This commit is contained in:
Basile Burg 2014-08-18 23:56:03 +02:00
parent 5987571333
commit 3ae7eae9b3
11 changed files with 59 additions and 42 deletions

View File

@ -106,6 +106,7 @@ end;
destructor TCEEditorWidget.destroy;
begin
EntitiesConnector.removeObserver(self);
tokLst.Free;
errLst.Free;
inherited;
@ -120,6 +121,7 @@ end;
procedure TCEEditorWidget.docClosing(const aDoc: TCESynMemo);
begin
if fDoc <> aDoc then exit;
fDoc := nil;
end;
@ -146,6 +148,7 @@ end;
procedure TCEEditorWidget.projClosing(const aProject: TCEProject);
begin
if fProj <> aProject then exit;
fProj := nil;
end;
@ -156,6 +159,7 @@ end;
procedure TCEEditorWidget.projChanged(const aProject: TCEProject);
begin
fProj := aProject;
end;
procedure TCEEditorWidget.projCompile(const aProject: TCEProject);
@ -238,14 +242,9 @@ begin
memo.OnKeyUp := @memoKeyDown;
memo.OnKeyPress := @memoKeyPress;
memo.OnMouseDown := @memoMouseDown;
//memo.OnChange := @memoChange;
memo.OnMouseMove := @memoMouseMove;
//
pageControl.ActivePage := sheet;
//http://bugs.freepascal.org/view.php?id=26320
//focusedEditorChanged;
end;
procedure TCEEditorWidget.removeEditor(const aIndex: NativeInt);

View File

@ -127,7 +127,8 @@ type
implementation
uses
ce_main;
function TCEMultiDocSubject.acceptObserver(aObject: TObject): boolean;
begin

View File

@ -3044,20 +3044,4 @@ object CEMainForm: TCEMainForm
OnShowHint = ApplicationProperties1ShowHint
left = 96
end
object LfmSyn: TSynLFMSyn
DefaultFilter = 'Fichiers fiches Lazarus (*.lfm)|*.lfm'
Enabled = False
CommentAttri.Foreground = clGreen
CommentAttri.FrameEdges = sfeAround
IdentifierAttri.Foreground = clBlack
IdentifierAttri.FrameEdges = sfeAround
KeyAttri.Foreground = clNavy
KeyAttri.FrameEdges = sfeAround
NumberAttri.Foreground = clPurple
NumberAttri.FrameEdges = sfeAround
SpaceAttri.FrameEdges = sfeAround
StringAttri.Foreground = clBlue
StringAttri.FrameEdges = sfeAround
left = 128
end
end

View File

@ -166,7 +166,6 @@ type
MenuItem7: TMenuItem;
MenuItem8: TMenuItem;
MenuItem9: TMenuItem;
LfmSyn: TSynLFMSyn;
procedure actEdFindExecute(Sender: TObject);
procedure actEdFindNextExecute(Sender: TObject);
procedure actFileAddToProjExecute(Sender: TObject);
@ -682,6 +681,7 @@ end;
destructor TCEMainForm.destroy;
begin
EntitiesConnector.removeObserver(self);
SaveSettings;
//
KillPlugs;
@ -900,6 +900,7 @@ end;
procedure TCEMainForm.docClosing(const aDoc: TCESynMemo);
begin
if aDoc <> fDoc then exit;
fDoc := nil;
end;
@ -910,6 +911,7 @@ end;
procedure TCEMainForm.docChanged(const aDoc: TCESynMemo);
begin
fDoc := aDoc;
end;
{$ENDREGION}
@ -1158,7 +1160,6 @@ end;
procedure TCEMainForm.actEdFindExecute(Sender: TObject);
var
win: TAnchorDockHostSite;
ed: TCESynMemo;
str: string;
begin
win := DockMaster.GetAnchorSite(fFindWidg);
@ -1214,13 +1215,8 @@ begin
dt^.project := fProject;
dt^.position := getLineFromDmdMessage(msg);
if openFileFromDmdMessage(msg) then
dt^.editor := fDoc
else
dt^.editor := nil;
if dt^.editor = nil then
dt^.editor := fDoc
else
dt^.ctxt := mcEditor;
dt^.editor := fDoc;
fEditWidg.endUpdatebyDelay; // messages would be cleared by the delayed module name detection.
fMesgWidg.addMessage(msg, dt);
application.ProcessMessages;

View File

@ -33,8 +33,8 @@ type
fActSaveMsg: TAction;
fActCopyMsg: TAction;
fActSelAll: TAction;
fProj: TCEProject;
fMaxMessCnt: Integer;
fProj: TCEProject;
fDoc: TCESynMemo;
procedure filterMessages;
procedure clearOutOfRangeMessg;
@ -53,6 +53,7 @@ type
property maxMessageCount: Integer read fMaxMessCnt write setMaxMessageCount default 125;
public
constructor create(aOwner: TComponent); override;
destructor destroy; override;
//
procedure scrollToBack;
procedure addMessage(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
@ -123,6 +124,12 @@ begin
EntitiesConnector.addObserver(self);
end;
destructor TCEMessagesWidget.destroy;
begin
EntitiesConnector.removeObserver(self);
Inherited;
end;
procedure TCEMessagesWidget.listDeletion(Sender: TObject; Node: TTreeNode);
begin
if node.Data <> nil then
@ -299,6 +306,7 @@ end;
procedure TCEMessagesWidget.docChanged(const aDoc: TCESynMemo);
begin
fDoc := aDoc;
end;
{$ENDREGION}
@ -561,7 +569,7 @@ begin
ext := extractFileExt(ident);
if not (ext = '.d') or (ext = '.di') then exit;
CEMainForm.openFile(ident);
exit(true);
result := true;
end;
ident += aMessage[i];
end;

View File

@ -132,7 +132,8 @@ begin
fUpdating := true;
fObservers.Remove(anObserver);
for i := 0 to fSubjects.Count-1 do
(fSubjects[i] as ICESubject).removeObserver(anObserver);
if fSubjects[i] <> nil then
(fSubjects[i] as ICESubject).removeObserver(anObserver);
end;
procedure TCEEntitiesConnector.removeSubject(aSubject: TObject);

View File

@ -35,6 +35,7 @@ type
procedure UpdateByEvent; override;
public
constructor create(aOwner: TComponent); override;
destructor destroy; override;
//
procedure projNew(const aProject: TCEProject);
procedure projClosing(const aProject: TCEProject);
@ -54,6 +55,11 @@ begin
EntitiesConnector.addObserver(self);
end;
destructor TCEProjectConfigurationWidget.destroy;
begin
EntitiesConnector.removeObserver(self);
inherited;
end;
procedure TCEProjectConfigurationWidget.projNew(const aProject: TCEProject);
begin

View File

@ -38,6 +38,7 @@ type
procedure actOpenFileExecute(sender: TObject);
public
constructor create(aOwner: TComponent); override;
destructor destroy; override;
//
procedure projNew(const aProject: TCEProject);
procedure projClosing(const aProject: TCEProject);
@ -75,6 +76,13 @@ begin
//
EntitiesConnector.addObserver(self);
end;
destructor TCEProjectInspectWidget.destroy;
begin
EntitiesConnector.removeObserver(self);
inherited;
end;
{$ENDREGION}
{$REGION ICEContextualActions---------------------------------------------------}

View File

@ -97,6 +97,7 @@ end;
destructor TCESearchWidget.Destroy;
begin
EntitiesConnector.removeObserver(self);
fSearchMru.Free;
fReplaceMru.Free;
inherited;

View File

@ -59,6 +59,7 @@ type
property refreshOnFocus: boolean read fRefreshOnFocus write fRefreshOnFocus;
public
constructor create(aOwner: TComponent); override;
destructor destroy; override;
//
procedure docNew(const aDoc: TCESynMemo);
procedure docClosing(const aDoc: TCESynMemo);
@ -132,6 +133,13 @@ begin
//
EntitiesConnector.addObserver(self);
end;
destructor TCEStaticExplorerWidget.destroy;
begin
EntitiesConnector.removeObserver(self);
inherited;
end;
{$ENDREGION}
{$REGION ICEWidgetPersist ------------------------------------------------------}
@ -225,6 +233,8 @@ end;
{$REGION ICEMultiDocObserver ---------------------------------------------------}
procedure TCEStaticExplorerWidget.docNew(const aDoc: TCESynMemo);
begin
fDoc := aDoc;
beginUpdateByDelay;
end;
procedure TCEStaticExplorerWidget.docClosing(const aDoc: TCESynMemo);

View File

@ -8,7 +8,7 @@ interface
uses
Classes, SysUtils, SynEdit, SynMemo, ce_d2syn, SynEditHighlighter, controls,
lcltype, LazSynEditText, SynPluginSyncroEdit, SynEditKeyCmds, ce_project,
SynEditMouseCmds, ce_common, ce_observer;
SynHighlighterLFM, SynEditMouseCmds, ce_common, ce_observer;
type
TCESynMemo = class(TSynMemo)
@ -53,11 +53,12 @@ type
var
D2Syn: TSynD2Syn;
LfmSyn: TSynLfmSyn;
implementation
uses
graphics, ce_main, ce_interfaces;
graphics, ce_interfaces;
constructor TCESynMemo.Create(aOwner: TComponent);
begin
@ -83,14 +84,12 @@ begin
Highlighter := D2Syn;
D2Syn.FoldKinds := [fkBrackets, fkComments1, fkComments2, fkStrings];
//
fTempFileName := GetTempDir(false) + 'temp_' + uniqueObjStr(self) + '.d';
fFilename := '<new document>';
fModified := false;
ShowHint := true;
TextBuffer.AddNotifyHandler(senrUndoRedoAdded, @changeNotify);
// avoid many call to get envir.string
fTempFileName := GetTempDir(false) + 'temp_' + uniqueObjStr(self) + '.d';
//
fMultiDocSubject := TCEMultiDocSubject.create;
subjDocNew(TCEMultiDocSubject(fMultiDocSubject), self);
end;
@ -132,7 +131,7 @@ procedure TCESynMemo.SetHighlighter(const Value: TSynCustomHighlighter);
begin
inherited;
fIsDSource := Highlighter = D2Syn;
fIsConfig := Highlighter = CEMainForm.LfmSyn;
fIsConfig := Highlighter = LfmSyn;
end;
procedure TCESynMemo.identifierToD2Syn;
@ -168,7 +167,8 @@ begin
fFilename := aFilename;
FileAge(fFilename, fFileDate);
fModified := false;
subjDocChanged(TCEMultiDocSubject(fMultiDocSubject), self);
if fFilename <> fTempFileName then
subjDocChanged(TCEMultiDocSubject(fMultiDocSubject), self);
end;
procedure TCESynMemo.save;
@ -176,7 +176,8 @@ begin
Lines.SaveToFile(fFilename);
FileAge(fFilename, fFileDate);
fModified := false;
subjDocChanged(TCEMultiDocSubject(fMultiDocSubject), self);
if fFilename <> fTempFileName then
subjDocChanged(TCEMultiDocSubject(fMultiDocSubject), self);
end;
procedure TCESynMemo.checkFileDate;
@ -219,6 +220,8 @@ end;
initialization
D2Syn := TSynD2Syn.create(nil);
LfmSyn := TSynLFMSyn.Create(nil);
finalization
D2Syn.free;
LfmSyn.Free;
end.