static macros shortcut exposed as ICEEditableShortcut

This commit is contained in:
Basile Burg 2015-03-11 19:28:49 +01:00
parent ef3b055bcf
commit e4f73a68fe
1 changed files with 27 additions and 2 deletions

View File

@ -43,9 +43,8 @@ type
* Shift + SPACE works automatically on the right editor (ICEMultiDocObserver) * Shift + SPACE works automatically on the right editor (ICEMultiDocObserver)
* Automatic insertion is handled in TCESynMemo.KeyUp() * Automatic insertion is handled in TCESynMemo.KeyUp()
*) *)
TCEStaticEditorMacro = class(TWritableLfmTextComponent, ICEMultiDocObserver, ICEEditableOptions) TCEStaticEditorMacro = class(TWritableLfmTextComponent, ICEMultiDocObserver, ICEEditableOptions, ICEEditableShortCut)
private private
//TODO-cfeature: exposes fCompletor shortcut with ICEEDItableShortcut
fCompletor: TSynAutoComplete; fCompletor: TSynAutoComplete;
fMacros: TStringList; fMacros: TStringList;
fDoc: TCESynMemo; fDoc: TCESynMemo;
@ -66,6 +65,10 @@ type
function optionedWantEditorKind: TOptionEditorKind; function optionedWantEditorKind: TOptionEditorKind;
function optionedWantContainer: TPersistent; function optionedWantContainer: TPersistent;
procedure optionedEvent(anEvent: TOptionEditorEvent); procedure optionedEvent(anEvent: TOptionEditorEvent);
// ICEEditableShortcut
function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
published published
// list of string with the format $<..>alnum=<..> // list of string with the format $<..>alnum=<..>
property macros: TStringList read fMacros write setMacros; property macros: TStringList read fMacros write setMacros;
@ -295,6 +298,28 @@ begin
end; end;
{$ENDREGION} {$ENDREGION}
{$REGION Macros things ---------------------------------------------------------}
function TCEStaticEditorMacro.scedWantFirst: boolean;
begin
exit(true);
end;
function TCEStaticEditorMacro.scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
begin
category := 'Static macros';
identifier := 'invoke';
aShortcut := fCompletor.ShortCut;
exit(false);
end;
procedure TCEStaticEditorMacro.scedSendItem(const category, identifier: string; aShortcut: TShortcut);
begin
if category = 'Static macros' then
if identifier = 'invoke' then
fCompletor.ShortCut := aShortcut;
end;
{$ENDREGION}
{$REGION Macros things ---------------------------------------------------------} {$REGION Macros things ---------------------------------------------------------}
procedure TCEStaticEditorMacro.sanitize; procedure TCEStaticEditorMacro.sanitize;
var var