mirror of https://gitlab.com/basile.b/dexed.git
added interface for application-wide shortcuts management
This commit is contained in:
parent
101a9f16b8
commit
45c9e3f219
|
@ -21,7 +21,6 @@ type
|
||||||
// persistent things have just been reloaded.
|
// persistent things have just been reloaded.
|
||||||
procedure sesoptAfterLoad;
|
procedure sesoptAfterLoad;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer gets and gives back some things
|
* An implementer gets and gives back some things
|
||||||
*)
|
*)
|
||||||
|
@ -30,6 +29,8 @@ type
|
||||||
function acceptObserver(aObject: TObject): boolean; override;
|
function acceptObserver(aObject: TObject): boolean; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer declares some actions on demand.
|
* An implementer declares some actions on demand.
|
||||||
*)
|
*)
|
||||||
|
@ -43,6 +44,8 @@ type
|
||||||
function contextAction(index: integer): TAction;
|
function contextAction(index: integer): TAction;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer is informed about the current file(s).
|
* An implementer is informed about the current file(s).
|
||||||
*)
|
*)
|
||||||
|
@ -57,7 +60,6 @@ type
|
||||||
// aDoc is about to be closed.
|
// aDoc is about to be closed.
|
||||||
procedure docClosing(const aDoc: TCESynMemo);
|
procedure docClosing(const aDoc: TCESynMemo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer informs some ICEMultiDocObserver about the current file(s)
|
* An implementer informs some ICEMultiDocObserver about the current file(s)
|
||||||
*)
|
*)
|
||||||
|
@ -66,6 +68,8 @@ type
|
||||||
function acceptObserver(aObject: TObject): boolean; override;
|
function acceptObserver(aObject: TObject): boolean; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer is informed about the current project(s).
|
* An implementer is informed about the current project(s).
|
||||||
*)
|
*)
|
||||||
|
@ -80,7 +84,6 @@ type
|
||||||
// not used yet: the active project is now aProject
|
// not used yet: the active project is now aProject
|
||||||
procedure projFocused(const aProject: TCEProject);
|
procedure projFocused(const aProject: TCEProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer informs some ICEProjectObserver about the current project(s)
|
* An implementer informs some ICEProjectObserver about the current project(s)
|
||||||
*)
|
*)
|
||||||
|
@ -89,6 +92,8 @@ type
|
||||||
function acceptObserver(aObject: TObject): boolean; override;
|
function acceptObserver(aObject: TObject): boolean; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer can add a mainmenu entry.
|
* An implementer can add a mainmenu entry.
|
||||||
*)
|
*)
|
||||||
|
@ -99,6 +104,37 @@ type
|
||||||
// the implementer can update the actions used in the menu declared previously.
|
// the implementer can update the actions used in the menu declared previously.
|
||||||
procedure menuActionsUpdate;
|
procedure menuActionsUpdate;
|
||||||
end;
|
end;
|
||||||
|
(**
|
||||||
|
* An implementer agregates its observers menus.
|
||||||
|
*)
|
||||||
|
TCEMainMenuSubject = class(TCECustomSubject)
|
||||||
|
protected
|
||||||
|
function acceptObserver(aObject: TObject): boolean; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(**
|
||||||
|
* An implementer can expose some customizable shortcuts
|
||||||
|
*)
|
||||||
|
ICEEditableShortCut = interface
|
||||||
|
['ICEEditableShortCut']
|
||||||
|
// a TCEEditableShortCutSubject queries the editable shortcuts count.
|
||||||
|
procedure scGetCount(out aValue: Integer);
|
||||||
|
// a TCEEditableShortCutSubject queries the shortcut category name.
|
||||||
|
procedure scGetCategory(out aValue: string);
|
||||||
|
// a TCEEditableShortCutSubject queries the state of the index-th shortcut.
|
||||||
|
procedure scGetItem(index: Integer; out aName: string; out aShortcut: Word);
|
||||||
|
// a TCEEditableShortCutSubject sends the possibly modified assignation of the index-th shortcut.
|
||||||
|
procedure scSetItem(index: Integer; const aCategory, aName: string; aShortcut: Word);
|
||||||
|
end;
|
||||||
|
(**
|
||||||
|
* An implementer manages its observers shortcuts.
|
||||||
|
*)
|
||||||
|
TCEEditableShortCutSubject = class(TCECustomSubject)
|
||||||
|
protected
|
||||||
|
function acceptObserver(aObject: TObject): boolean; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -132,6 +168,7 @@ type
|
||||||
procedure subjSesOptsDeclareProperties(aSubject: TCESessionOptionsSubject; aFiler: TFiler);{$IFDEF RELEASE}inline;{$ENDIF}
|
procedure subjSesOptsDeclareProperties(aSubject: TCESessionOptionsSubject; aFiler: TFiler);{$IFDEF RELEASE}inline;{$ENDIF}
|
||||||
procedure subjSesOptsAfterLoad(aSubject: TCESessionOptionsSubject); {$IFDEF RELEASE}inline;{$ENDIF}
|
procedure subjSesOptsAfterLoad(aSubject: TCESessionOptionsSubject); {$IFDEF RELEASE}inline;{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$REGION TCEMultiDocSubject-----------------------------------------------------}
|
{$REGION TCEMultiDocSubject-----------------------------------------------------}
|
||||||
|
@ -212,7 +249,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TCESessionOptionsSubject------------------------------------------------------}
|
{$REGION TCESessionOptionsSubject-----------------------------------------------}
|
||||||
function TCESessionOptionsSubject.acceptObserver(aObject: TObject): boolean;
|
function TCESessionOptionsSubject.acceptObserver(aObject: TObject): boolean;
|
||||||
begin
|
begin
|
||||||
exit(aObject is ICESessionOptionsObserver);
|
exit(aObject is ICESessionOptionsObserver);
|
||||||
|
@ -242,4 +279,18 @@ begin
|
||||||
(fObservers.Items[i] as ICESessionOptionsObserver).sesoptAfterLoad;
|
(fObservers.Items[i] as ICESessionOptionsObserver).sesoptAfterLoad;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION TCEEditableShortCutSubject}
|
||||||
|
function TCEMainMenuSubject.acceptObserver(aObject: TObject): boolean;
|
||||||
|
begin
|
||||||
|
exit(aObject is ICEMainMenuProvider);
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION TCEEditableShortCutSubject}
|
||||||
|
function TCEEditableShortCutSubject.acceptObserver(aObject: TObject): boolean;
|
||||||
|
begin
|
||||||
|
exit(aObject is ICEEditableShortCut);
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue