shortcut editor, ICEEditableShortCut, inform the observers when item sent

This commit is contained in:
Basile Burg 2016-01-23 23:48:13 +01:00
parent 30a0b1a9e8
commit 1bf9097758
6 changed files with 28 additions and 8 deletions

View File

@ -130,6 +130,7 @@ type
function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
procedure scedSendDone;
//
procedure applyChangesFromSelf;
procedure applyChangeToEditor(anEditor: TCESynMemo);
@ -508,12 +509,13 @@ begin
end;
// note: shortcut modifications are not reversible,
// they are sent from another option editor.
fShortcutCount -= 1;
// TODO: modifies interface so that the target knows when the last
// item has been sent.
if fShortcutCount = 0 then
applyChangesFromSelf;
end;
procedure TCEEditorOptions.scedSendDone;
begin
applyChangesFromSelf;
end;
{$ENDREGION}
{$REGION ICEEditableOptions ----------------------------------------------------}

View File

@ -190,12 +190,14 @@ type
*)
ICEEditableShortCut = interface(ISubjectType)
['ICEEditableShortCut']
// a TCEEditableShortCutSubject will start to collect shortcuts if result
// a TCEEditableShortCutSubject will start to collect shortcuts if result.
function scedWantFirst: boolean;
// a TCEEditableShortCutSubject collects the information on the shortcuts while result
// a TCEEditableShortCutSubject collects the information on the shortcuts while result.
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
// a TCEEditableShortCutSubject sends the possibly modified shortcut
// a TCEEditableShortCutSubject sends the possibly modified shortcut.
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
// a TCEEditableShortCutSubject has finished to send the shortcuts.
procedure scedSendDone;
end;
(**
* An implementer manages its observers shortcuts.

View File

@ -260,6 +260,7 @@ type
function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
procedure scedSendDone;
//Init - Fina
procedure getCMdParams;
@ -1409,6 +1410,10 @@ begin
act.ShortCut := aShortcut;
end;
end;
procedure TCEMainForm.scedSendDone;
begin
end;
{$ENDREGION}
{$REGION TCEActionProviderHandler ----------------------------------------------}

View File

@ -419,6 +419,7 @@ begin
continue;
shc.declarator.scedSendItem(cat, shc.identifier, shc.data);
end;
shc.declarator.scedSendDone;
end;
{$ENDREGION}

View File

@ -73,6 +73,7 @@ type
function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
procedure scedSendDone;
published
// list of string with the format $<..>alnum=<..>
property macros: TStringList read fMacros write setMacros;
@ -337,6 +338,10 @@ begin
fOptions.shortcut := aShortcut;
end;
end;
procedure TCEStaticEditorMacro.scedSendDone;
begin
end;
{$ENDREGION}
{$REGION Macros things ---------------------------------------------------------}

View File

@ -86,6 +86,7 @@ type
function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
procedure scedSendDone;
published
property tools: TCEToolItems read fTools write setTools;
public
@ -360,6 +361,10 @@ begin
break;
end;
end;
procedure TCETools.scedSendDone;
begin
end;
{$ENDREGION}
{$REGION ICEMultidocObserver ---------------------------------------------------}