mirror of https://gitlab.com/basile.b/dexed.git
added btn to clone an existing tool
This commit is contained in:
parent
224a8836d1
commit
e7611457b6
|
@ -45,6 +45,7 @@ type
|
|||
public
|
||||
constructor create(ACollection: TCollection); override;
|
||||
destructor destroy; override;
|
||||
procedure assign(Source: TPersistent); override;
|
||||
end;
|
||||
|
||||
TCETools = class(TWritableLfmTextComponent, ICEMainMenuProvider, ICEEditableShortcut)
|
||||
|
@ -105,6 +106,27 @@ begin
|
|||
inherited;
|
||||
end;
|
||||
|
||||
procedure TCEToolItem.assign(Source: TPersistent);
|
||||
var
|
||||
tool: TCEToolItem;
|
||||
begin
|
||||
if Source is TCEToolItem then
|
||||
begin
|
||||
tool := TCEToolItem(Source);
|
||||
//
|
||||
toolAlias := tool.toolAlias;
|
||||
chainAfter.Assign(tool.chainAfter);
|
||||
chainBefore.Assign(tool.chainBefore);
|
||||
queryParameters := tool.queryParameters;
|
||||
clearMessages := tool.clearMessages;
|
||||
fOpts := tool.fOpts;
|
||||
parameters.Assign(tool.parameters);
|
||||
executable := tool.executable;
|
||||
workingDirectory := tool.workingDirectory;
|
||||
end
|
||||
else inherited;
|
||||
end;
|
||||
|
||||
procedure TCEToolItem.setParameters(aValue: TStringList);
|
||||
begin
|
||||
fParameters.Assign(aValue);
|
||||
|
|
|
@ -66,6 +66,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
object btnMoveDown: TBitBtn
|
||||
Left = 56
|
||||
Height = 24
|
||||
Hint = 'move selected tool down'
|
||||
Top = 0
|
||||
Width = 28
|
||||
Align = alLeft
|
||||
|
@ -77,6 +78,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
object btnMoveUp: TBitBtn
|
||||
Left = 84
|
||||
Height = 24
|
||||
Hint = 'move selected tool up'
|
||||
Top = 0
|
||||
Width = 28
|
||||
Align = alLeft
|
||||
|
@ -85,6 +87,18 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
Spacing = 0
|
||||
TabOrder = 4
|
||||
end
|
||||
object btnClone: TBitBtn
|
||||
Left = 112
|
||||
Height = 24
|
||||
Hint = 'clone selected tool'
|
||||
Top = 0
|
||||
Width = 28
|
||||
Align = alLeft
|
||||
Layout = blGlyphBottom
|
||||
OnClick = btnCloneClick
|
||||
Spacing = 0
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
||||
object Panel2: TPanel[1]
|
||||
Left = 4
|
||||
|
|
|
@ -9,10 +9,14 @@ uses
|
|||
ExtCtrls, Menus, Buttons, StdCtrls, ce_widget, ce_tools;
|
||||
|
||||
type
|
||||
|
||||
{ TCEToolsEditorWidget }
|
||||
|
||||
TCEToolsEditorWidget = class(TCEWidget)
|
||||
BtnAddTool: TBitBtn;
|
||||
btnMoveDown: TBitBtn;
|
||||
btnMoveUp: TBitBtn;
|
||||
btnClone: TBitBtn;
|
||||
btnRemTool: TBitBtn;
|
||||
btnRun: TBitBtn;
|
||||
lstTools: TListBox;
|
||||
|
@ -21,6 +25,7 @@ type
|
|||
Splitter1: TSplitter;
|
||||
propsEd: TTIPropertyGrid;
|
||||
procedure BtnAddToolClick(Sender: TObject);
|
||||
procedure btnCloneClick(Sender: TObject);
|
||||
procedure btnRemToolClick(Sender: TObject);
|
||||
procedure btnMoveUpClick(Sender: TObject);
|
||||
procedure btnMoveDownClick(Sender: TObject);
|
||||
|
@ -58,6 +63,8 @@ begin
|
|||
btnRemTool.Glyph.Assign(png);
|
||||
png.LoadFromLazarusResource('application_flash');
|
||||
btnRun.Glyph.Assign(png);
|
||||
png.LoadFromLazarusResource('application_double');
|
||||
btnClone.Glyph.Assign(png);
|
||||
finally
|
||||
png.free;
|
||||
end;
|
||||
|
@ -113,6 +120,18 @@ begin
|
|||
rebuildToolList;
|
||||
end;
|
||||
|
||||
procedure TCEToolsEditorWidget.btnCloneClick(Sender: TObject);
|
||||
var
|
||||
itm: TCEToolItem;
|
||||
begin
|
||||
if lstTools.ItemIndex = -1 then
|
||||
exit;
|
||||
itm := CustomTools.addTool;
|
||||
itm.Assign(CustomTools[lstTools.ItemIndex]);
|
||||
itm.toolAlias := itm.toolAlias + ' (copy)';
|
||||
rebuildToolList;
|
||||
end;
|
||||
|
||||
procedure TCEToolsEditorWidget.btnRemToolClick(Sender: TObject);
|
||||
begin
|
||||
if lstTools.ItemIndex = -1 then
|
||||
|
|
Loading…
Reference in New Issue