tvplanit: Fix crash (with heaptrace on) due to incomplete Notification. Cosmetic changes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5149 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-10 20:26:10 +00:00
parent 1f82493afa
commit 54087cb1f1
9 changed files with 194 additions and 160 deletions

View File

@ -95,9 +95,6 @@
</Linking>
<Other>
<CustomOptions Value="-dBUFDATASET"/>
<OtherDefines Count="1">
<Define0 Value="BUFDATASET"/>
</OtherDefines>
</Other>
</CompilerOptions>
<Debugging>

View File

@ -675,6 +675,10 @@ msgstr "keine"
msgid "(None)"
msgstr "(Nichts)"
#: vpsr.rsnooverlayedevents
msgid "none"
msgstr "keine"
#: vpsr.rsnoprintformats
msgid "No print formats have been defined"
msgstr "Es sind keine Druckformate definiert."

View File

@ -681,6 +681,10 @@ msgstr "Aucun"
msgid "(None)"
msgstr "(Aucun)"
#: vpsr.rsnooverlayedevents
msgid "none"
msgstr ""
#: vpsr.rsnoprintformats
msgid "No print formats have been defined"
msgstr "Formats d'impression non-défini"
@ -1496,3 +1500,4 @@ msgstr "Spécificateur d'axe inconnu"
#: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element"
msgstr "La déclaration XML doit apparaître avant le premier élément"

View File

@ -675,6 +675,10 @@ msgstr "Geen"
msgid "(None)"
msgstr "(Geen)"
#: vpsr.rsnooverlayedevents
msgid "none"
msgstr ""
#: vpsr.rsnoprintformats
msgid "No print formats have been defined"
msgstr "Er zijn geen afdrukformaten gedefinieerd."
@ -1490,3 +1494,4 @@ msgstr "Onbekende as specificatie: %s"
#: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element"
msgstr "De XML declaratie moet voor het eerste element staan"

View File

@ -665,6 +665,10 @@ msgstr ""
msgid "(None)"
msgstr ""
#: vpsr.rsnooverlayedevents
msgid "none"
msgstr ""
#: vpsr.rsnoprintformats
msgid "No print formats have been defined"
msgstr ""

View File

@ -675,6 +675,10 @@ msgstr "Нет"
msgid "(None)"
msgstr "(Нет)"
#: vpsr.rsnooverlayedevents
msgid "none"
msgstr ""
#: vpsr.rsnoprintformats
msgid "No print formats have been defined"
msgstr "Не определён формат печати"
@ -1490,3 +1494,4 @@ msgstr ""
#: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element"
msgstr ""

View File

@ -243,6 +243,7 @@ type
procedure SetDayBuffer(Value: Integer);
procedure SetRange(StartTime, EndTime: TDateTime);
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure NotifyLinked;
procedure LinkToControls(AOwner: TComponent);
procedure UnlinkFromControls(AOwner: TComponent);
@ -324,11 +325,12 @@ type
{TVpLinkableControl}
TVpLinkableControl = class(TVpCustomControl)
protected{private}
FDataStore : TVpCustomDataStore;
FReadOnly : Boolean;
FControlLink : TVpControlLink;
FLastPrintLine : Integer;
FDataStore: TVpCustomDataStore;
FReadOnly: Boolean;
FControlLink: TVpControlLink;
FLastPrintLine: Integer;
function CheckCreateResource : Boolean;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetDataStore (const Value : TVpCustomDataStore); virtual;
procedure SetControlLink (const Value : TVpControlLink);
procedure CMEnter(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF}); message CM_ENTER;
@ -600,16 +602,21 @@ begin
Result := FMediaFolder <> '';
end;
procedure TVpCustomDatastore.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (AComponent = FLinkedOwner) then
FLinkedOwner := nil;
end;
procedure TVpCustomDataStore.NotifyLinked;
var
i : Integer;
i: Integer;
begin
for i := 0 to FNotifiers.Count - 1 do
if Assigned (FNotifiers[i]) then
PostMessage (PVpWatcher (FNotifiers[i]).Handle, Vp_DataStoreChanged, 0, 0);
if Assigned(FNotifiers[i]) then
PostMessage(PVpWatcher(FNotifiers[i]).Handle, Vp_DataStoreChanged, 0, 0);
end;
{=====}
procedure TVpCustomDataStore.SetActiveDate(Value: TDateTime);
var
@ -775,7 +782,6 @@ begin
if not Loading then
NotifyDependents;
end;
{=====}
procedure TVpCustomDataStore.PurgeEvents(Res: TVpResource);
begin
@ -783,7 +789,6 @@ begin
if not Loading then
NotifyDependents;
end;
{=====}
procedure TVpCustomDataStore.PurgeContacts(Res: TVpResource);
begin
@ -791,7 +796,6 @@ begin
if not Loading then
NotifyDependents;
end;
{=====}
procedure TVpCustomDataStore.PurgeTasks(Res: TVpResource);
begin
@ -799,7 +803,6 @@ begin
if not Loading then
NotifyDependents;
end;
{=====}
procedure TVpCustomDatastore.UpdateGroupEvents;
var
@ -1034,11 +1037,8 @@ begin
inherited;
OnChange := ResourceChanged;
FResourceUpdateStyle := ruOnChange;
Style := csDropDownList;
DoubleBuffered := true;
{ If the ResourceCombo is being dropped onto a form for the first }
@ -1063,7 +1063,7 @@ procedure TVpResourceCombo.CNCommand (var Msg: TWMCommand);
begin
if Msg.NotifyCode = CBN_CLOSEUP then begin
if (FResourceUpdateStyle = ruOnDropDownClose) then
ResourceChanged (Self)
ResourceChanged(Self)
else
inherited;
end else
@ -1132,24 +1132,26 @@ begin
//Empty on purpose
end;
{=====}
procedure TVpResourceCombo.SetResourceUpdateStyle (
const v : TVpResourceUpdate);
procedure TVpResourceCombo.SetResourceUpdateStyle(const v: TVpResourceUpdate);
begin
if v <> FResourceUpdateStyle then begin
FResourceUpdateStyle := v;
case FResourceUpdateStyle of
ruOnChange : begin
OnChange := ResourceChanged;
OnExit := nil;
end;
ruOnExit : begin
OnChange := nil;
OnExit := ResourceChanged;
end;
ruOnDropDownClose : begin
OnChange := nil;
OnExit := nil;
end;
ruOnChange:
begin
OnChange := ResourceChanged;
OnExit := nil;
end;
ruOnExit:
begin
OnChange := nil;
OnExit := ResourceChanged;
end;
ruOnDropDownClose:
begin
OnChange := nil;
OnExit := nil;
end;
end;
end;
end;
@ -1181,8 +1183,8 @@ var
I: Integer;
begin
inherited;
{ If the control is being dropped onto a form for the first time then }
{ Auto connect to the first ControlLink component found }
{ If the control is being dropped onto a form for the first time then
auto-connect to the first ControlLink component found }
if (csDesigning in ComponentState) and not (csLoading in ComponentState) then
begin
I := 0;
@ -1206,19 +1208,18 @@ end;
function TVpLinkableControl.CheckCreateResource : Boolean;
var
ResEdit : TVpResourceEditDialog;
frmSelectResource : TfrmSelectResource;
ResEdit: TVpResourceEditDialog;
frmSelectResource: TfrmSelectResource;
begin
Result := False;
if not Assigned (DataStore) then
if not Assigned(DataStore) then
Exit;
if not Assigned (DataStore.Resource) then begin
if not Assigned(DataStore.Resource) then begin
if DataStore.Resources.Count > 0 then begin
{ No resource is selected, select one }
if MessageDlg (RSSelectResource, mtConfirmation,
[mbYes, mbNo], 0) = mrYes then begin
frmSelectResource := TfrmSelectResource.Create (Self);
if MessageDlg(RSSelectResource, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
frmSelectResource := TfrmSelectResource.Create(Self);
try
frmSelectResource.VpResourceCombo1.DataStore := DataStore;
frmSelectResource.VpResourceEditDialog1.DataStore := DataStore;
@ -1231,11 +1232,12 @@ begin
end;
end else
Exit;
end else begin
end else
begin
{ There are no resources at all, add one }
if MessageDlg (RSAddNewResource, mtConfirmation,
[mbYes, mbNo], 0) = mrYes then begin
ResEdit := TVpResourceEditDialog.Create (Self);
if MessageDlg(RSAddNewResource, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
ResEdit := TVpResourceEditDialog.Create(Self);
try
ResEdit.DataStore := DataStore;
Result := ResEdit.AddNewResource;
@ -1250,12 +1252,23 @@ begin
Result := True;
end;
{=====}
function TVpLinkableControl.GetLastPrintLine : Integer;
function TVpLinkableControl.GetLastPrintLine: Integer;
begin
Result := FLastPrintLine;
end;
{=====}
procedure TVpLinkableControl.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) then begin
if (AComponent = FDatastore) then
FDatastore := nil;
if (AComponent = FControlLink) then
FControlLink := nil;
end;
end;
procedure TVpLinkableControl.SetDataStore(const Value: TVpCustomDataStore);
begin
if Value = nil then begin

View File

@ -723,7 +723,7 @@ begin
AMenu.Add(newItem);
newSubItem := TMenuItem.Create(AMenu.Owner);
newSubItem.Caption := 'none';
newSubItem.Caption := RSNoOverlayedEvents;
newSubItem.OnClick := AEventHandler;
newSubItem.GroupIndex := 1;
newSubItem.AutoCheck := true;

View File

@ -154,6 +154,7 @@ resourcestring
RSStartEndTimeError = 'Incorrect order of start and end times. ' +
'Do you want to flip them?';
RSCannotEditOverlayedEvent= 'Cannot edit this overlayed event.';
RSNoOverlayedEvents = 'none';
{Task Specific}
RSConfirmDeleteTask = 'Delete this task from your list?';