mirror of https://gitlab.com/basile.b/dexed.git
tools pass their shortcut when declared in main menu
This commit is contained in:
parent
2f2808005d
commit
d600486198
|
|
@ -204,15 +204,20 @@ procedure TCETools.menuDeclare(item: TMenuItem);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
itm: TMenuItem;
|
itm: TMenuItem;
|
||||||
|
colitm: TCEToolItem;
|
||||||
begin
|
begin
|
||||||
if tools.Count = 0 then exit;
|
if tools.Count = 0 then exit;
|
||||||
//
|
//
|
||||||
item.Caption := 'Custom tools';
|
item.Caption := 'Custom tools';
|
||||||
item.Clear;
|
item.Clear;
|
||||||
for i := 0 to tools.Count-1 do begin
|
for i := 0 to tools.Count-1 do
|
||||||
|
begin
|
||||||
|
colitm := tool[i];
|
||||||
|
//
|
||||||
itm := TMenuItem.Create(item);
|
itm := TMenuItem.Create(item);
|
||||||
itm.Caption := tool[i].toolAlias;
|
itm.ShortCut:= colitm.shortcut;
|
||||||
itm.tag := ptrInt(tool[i]);
|
itm.Caption := colitm.toolAlias;
|
||||||
|
itm.tag := ptrInt(colitm);
|
||||||
itm.onClick := @executeToolFromMenu;
|
itm.onClick := @executeToolFromMenu;
|
||||||
item.add(itm);
|
item.add(itm);
|
||||||
end;
|
end;
|
||||||
|
|
@ -221,16 +226,23 @@ end;
|
||||||
procedure TCETools.menuUpdate(item: TMenuItem);
|
procedure TCETools.menuUpdate(item: TMenuItem);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
colitm: TCEToolItem;
|
||||||
|
mnuitm: TMenuItem;
|
||||||
begin
|
begin
|
||||||
if item = nil then exit;
|
if item = nil then exit;
|
||||||
if item.Count <> tools.Count then
|
if item.Count <> tools.Count then
|
||||||
menuDeclare(item)
|
menuDeclare(item)
|
||||||
else for i:= 0 to tools.Count-1 do
|
else for i:= 0 to tools.Count-1 do
|
||||||
begin
|
begin
|
||||||
if ptrInt(tool[i]) <> item.Items[i].Tag then
|
colitm := tool[i];
|
||||||
item.Items[i].Tag := ptrInt(tool[i]);
|
mnuitm := item.Items[i];
|
||||||
if item.Items[i].Caption <> tool[i].toolAlias then
|
//
|
||||||
item.Items[i].Caption := tool[i].toolAlias;
|
if mnuitm.Tag <> ptrInt(colitm) then
|
||||||
|
mnuitm.Tag := ptrInt(colitm);
|
||||||
|
if mnuitm.Caption <> colitm.toolAlias then
|
||||||
|
mnuitm.Caption := colitm.toolAlias;
|
||||||
|
if mnuitm.shortcut <> colitm.shortcut then
|
||||||
|
mnuitm.shortcut := colitm.shortcut;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
@ -253,8 +265,16 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCETools.scedSendItem(const category, identifier: string; aShortcut: TShortcut);
|
procedure TCETools.scedSendItem(const category, identifier: string; aShortcut: TShortcut);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
if category <> 'Tools' then exit;
|
||||||
|
//
|
||||||
|
for i := 0 to tools.Count-1 do if tool[i].toolAlias = identifier then
|
||||||
|
begin
|
||||||
|
tool[i].shortcut := aShortcut;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue