mirror of https://gitlab.com/basile.b/dexed.git
tools shortcuts are exposed as option
This commit is contained in:
parent
ca84243cfa
commit
570c8aae4a
|
@ -10,8 +10,6 @@ uses
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
//TODO-cfeature: declare tools shortcuts, set TCETools ICEEditableShortcut
|
|
||||||
|
|
||||||
TCEToolItem = class(TCollectionItem)
|
TCEToolItem = class(TCollectionItem)
|
||||||
private
|
private
|
||||||
fProcess: TCheckedAsyncProcess;
|
fProcess: TCheckedAsyncProcess;
|
||||||
|
@ -24,7 +22,7 @@ type
|
||||||
fQueryParams: boolean;
|
fQueryParams: boolean;
|
||||||
fChainBefore: TStringList;
|
fChainBefore: TStringList;
|
||||||
fChainAfter: TStringList;
|
fChainAfter: TStringList;
|
||||||
//fShortcut: TShortcut;
|
fShortcut: TShortcut;
|
||||||
fMsgs: ICEMessagesDisplay;
|
fMsgs: ICEMessagesDisplay;
|
||||||
procedure setParameters(aValue: TStringList);
|
procedure setParameters(aValue: TStringList);
|
||||||
procedure setChainBefore(aValue: TStringList);
|
procedure setChainBefore(aValue: TStringList);
|
||||||
|
@ -41,21 +39,26 @@ type
|
||||||
property queryParameters: boolean read fQueryParams write fQueryParams;
|
property queryParameters: boolean read fQueryParams write fQueryParams;
|
||||||
property chainBefore: TStringList read fChainBefore write setchainBefore;
|
property chainBefore: TStringList read fChainBefore write setchainBefore;
|
||||||
property chainAfter: TStringList read fChainAfter write setChainAfter;
|
property chainAfter: TStringList read fChainAfter write setChainAfter;
|
||||||
//property shortcut: TShortcut read fShortcut write fShortcut;
|
property shortcut: TShortcut read fShortcut write fShortcut;
|
||||||
public
|
public
|
||||||
constructor create(ACollection: TCollection); override;
|
constructor create(ACollection: TCollection); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCETools = class(TWritableLfmTextComponent, ICEMainMenuProvider)
|
TCETools = class(TWritableLfmTextComponent, ICEMainMenuProvider, ICEEditableShortcut)
|
||||||
private
|
private
|
||||||
fTools: TCollection;
|
fTools: TCollection;
|
||||||
|
fShctCount: Integer;
|
||||||
function getTool(index: Integer): TCEToolItem;
|
function getTool(index: Integer): TCEToolItem;
|
||||||
procedure setTools(const aValue: TCollection);
|
procedure setTools(const aValue: TCollection);
|
||||||
//
|
//
|
||||||
procedure menuDeclare(item: TMenuItem);
|
procedure menuDeclare(item: TMenuItem);
|
||||||
procedure menuUpdate(item: TMenuItem);
|
procedure menuUpdate(item: TMenuItem);
|
||||||
procedure executeToolFromMenu(sender: TObject);
|
procedure executeToolFromMenu(sender: TObject);
|
||||||
|
//
|
||||||
|
function scedWantFirst: boolean;
|
||||||
|
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
|
||||||
|
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
|
||||||
published
|
published
|
||||||
property tools: TCollection read fTools write setTools;
|
property tools: TCollection read fTools write setTools;
|
||||||
public
|
public
|
||||||
|
@ -81,6 +84,7 @@ uses
|
||||||
const
|
const
|
||||||
toolsFname = 'tools.txt';
|
toolsFname = 'tools.txt';
|
||||||
|
|
||||||
|
{$REGION TCEToolItem -----------------------------------------------------------}
|
||||||
constructor TCEToolItem.create(ACollection: TCollection);
|
constructor TCEToolItem.create(ACollection: TCollection);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -164,7 +168,9 @@ begin
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
|
||||||
|
{$REGION Standard Comp/Obj -----------------------------------------------------}
|
||||||
constructor TCETools.create(aOwner: TComponent);
|
constructor TCETools.create(aOwner: TComponent);
|
||||||
var
|
var
|
||||||
fname: string;
|
fname: string;
|
||||||
|
@ -186,7 +192,9 @@ begin
|
||||||
fTools.Free;
|
fTools.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEMainMenuProvider ---------------------------------------------------}
|
||||||
procedure TCETools.executeToolFromMenu(sender: TObject);
|
procedure TCETools.executeToolFromMenu(sender: TObject);
|
||||||
begin
|
begin
|
||||||
executeTool(TCEToolItem(TMenuItem(sender).tag));
|
executeTool(TCEToolItem(TMenuItem(sender).tag));
|
||||||
|
@ -225,7 +233,32 @@ begin
|
||||||
item.Items[i].Caption := tool[i].toolAlias;
|
item.Items[i].Caption := tool[i].toolAlias;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEEditableShortcut ---------------------------------------------------}
|
||||||
|
function TCETools.scedWantFirst: boolean;
|
||||||
|
begin
|
||||||
|
result := fTools.Count > 0;
|
||||||
|
fShctCount := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCETools.scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
|
||||||
|
begin
|
||||||
|
category := 'Tools';
|
||||||
|
identifier:= tool[fShctCount].toolAlias;
|
||||||
|
aShortcut := tool[fShctCount].shortcut;
|
||||||
|
//
|
||||||
|
fShctCount += 1;
|
||||||
|
result := fShctCount < fTools.Count;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCETools.scedSendItem(const category, identifier: string; aShortcut: TShortcut);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION Tools things ----------------------------------------------------------}
|
||||||
procedure TCETools.setTools(const aValue: TCollection);
|
procedure TCETools.setTools(const aValue: TCollection);
|
||||||
begin
|
begin
|
||||||
fTools.Assign(aValue);
|
fTools.Assign(aValue);
|
||||||
|
@ -271,6 +304,7 @@ begin
|
||||||
//
|
//
|
||||||
executeTool(tool[aToolIndex]);
|
executeTool(tool[aToolIndex]);
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterClasses([TCEToolItem, TCETools]);
|
RegisterClasses([TCEToolItem, TCETools]);
|
||||||
|
|
Loading…
Reference in New Issue