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> </Linking>
<Other> <Other>
<CustomOptions Value="-dBUFDATASET"/> <CustomOptions Value="-dBUFDATASET"/>
<OtherDefines Count="1">
<Define0 Value="BUFDATASET"/>
</OtherDefines>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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