From d0ca1fbffa1675da9d47fd002f1513c1ba0c83c1 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 9 Dec 2014 11:33:48 +0100 Subject: [PATCH] fix, changed ancestor, previous one didn't have a Shortcut. removed default attrib, property is always written to setting file --- src/ce_staticmacro.pas | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ce_staticmacro.pas b/src/ce_staticmacro.pas index 46eb10b3..57841196 100644 --- a/src/ce_staticmacro.pas +++ b/src/ce_staticmacro.pas @@ -5,7 +5,7 @@ unit ce_staticmacro; interface uses - Classes, Sysutils, SynEdit, SynEditAutoComplete, + Classes, Sysutils, SynEdit, SynEditAutoComplete, SynCompletion, ce_interfaces, ce_writableComponent, ce_synmemo; type @@ -24,7 +24,7 @@ type *) TCEStaticEditorMacro = class(TWritableComponent, ICEMultiDocObserver) private - fCompletor: TSynEditAutoComplete; + fCompletor: TSynAutoComplete; fMacros: TStringList; fDoc: TCESynMemo; fAutomatic: boolean; @@ -40,7 +40,7 @@ type published // list of string with the format $<..>alnum=<..> property macros: TStringList read fMacros write setMacros; - property automatic: boolean read fAutomatic write fAutomatic default true; + property automatic: boolean read fAutomatic write fAutomatic; public constructor create(aOwner: TComponent); override; destructor destroy; override; @@ -77,9 +77,10 @@ var begin inherited; fAutomatic := true; - fCompletor := TSynEditAutoComplete.Create(self); + fCompletor := TSynAutoComplete.Create(self); fMacros := TStringList.Create; fMacros.Delimiter := '='; + assert(fCompletor.ShortCut <> 0); // fname := getDocPath + macFname; if fileExists(fname) then loadFromFile(fname); @@ -113,11 +114,13 @@ end; procedure TCEStaticEditorMacro.docNew(aDoc: TCESynMemo); begin fDoc := aDoc; + fCompletor.Editor := fDoc; end; procedure TCEStaticEditorMacro.docFocused(aDoc: TCESynMemo); begin fDoc := aDoc; + fCompletor.Editor := fDoc; end; procedure TCEStaticEditorMacro.docChanged(aDoc: TCESynMemo); @@ -183,13 +186,13 @@ end; procedure TCEStaticEditorMacro.Execute; begin if fDoc <> nil then - fCompletor.ExecuteCompletion(fDoc.Identifier, fDoc); + fCompletor.Execute(fDoc.Identifier, fDoc); end; procedure TCEStaticEditorMacro.Execute(aEditor: TCustomSynEdit; const aToken: string); begin if aEditor <> nil then - fCompletor.ExecuteCompletion(aToken, aEditor); + fCompletor.Execute(aToken, aEditor); end; {$ENDREGION}