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

View File

@ -190,12 +190,14 @@ type
*) *)
ICEEditableShortCut = interface(ISubjectType) ICEEditableShortCut = interface(ISubjectType)
['ICEEditableShortCut'] ['ICEEditableShortCut']
// a TCEEditableShortCutSubject will start to collect shortcuts if result // a TCEEditableShortCutSubject will start to collect shortcuts if result.
function scedWantFirst: boolean; 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; 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); procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
// a TCEEditableShortCutSubject has finished to send the shortcuts.
procedure scedSendDone;
end; end;
(** (**
* An implementer manages its observers shortcuts. * An implementer manages its observers shortcuts.

View File

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

View File

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

View File

@ -73,6 +73,7 @@ type
function scedWantFirst: boolean; function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean; function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut); procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
procedure scedSendDone;
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;
@ -337,6 +338,10 @@ begin
fOptions.shortcut := aShortcut; fOptions.shortcut := aShortcut;
end; end;
end; end;
procedure TCEStaticEditorMacro.scedSendDone;
begin
end;
{$ENDREGION} {$ENDREGION}
{$REGION Macros things ---------------------------------------------------------} {$REGION Macros things ---------------------------------------------------------}

View File

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