fix #15 - Add a way to kill a custom tool

This commit is contained in:
Basile Burg 2020-04-05 14:13:04 +02:00
parent acb5324d70
commit 5116b50705
4 changed files with 30 additions and 2 deletions

View File

@ -2,6 +2,8 @@
## Enhancements ## Enhancements
- Custom tools: A new property allows to set the background color of the item. (#16)
- Custom tools: A new Toolbar button has for effect to terminate the process associated to a tool. (#15)
- Messages, added an option, enabled by default, allowing to highlight the blocks enclosed by backticks. This works for the "find all" action, the compiler output, the custom tools output, etc. (#13) - Messages, added an option, enabled by default, allowing to highlight the blocks enclosed by backticks. This works for the "find all" action, the compiler output, the custom tools output, etc. (#13)
## Bugs fixed ## Bugs fixed

View File

@ -23,8 +23,10 @@ Toolbar:
- ![](icons/window/application_add.png): Adds a new tool. - ![](icons/window/application_add.png): Adds a new tool.
- ![](icons/window/application_delete.png): Removes selected tool. - ![](icons/window/application_delete.png): Removes selected tool.
- ![](icons/arrow/arrow_up.png) **/** ![](icons/arrow/arrow_down.png): Changes the position of the selected tool. - ![](icons/arrow/arrow_up.png) **/** ![](icons/arrow/arrow_down.png): Changes the position of the selected tool.
- ![](icons/window/application_flash.png): Executes the tool that's selected, according to the options it's associated to. This also works by double-clicking the tool aliases.
- ![](icons/window/application_double.png): Clones the tool that's selected. - ![](icons/window/application_double.png): Clones the tool that's selected.
- ![](icons/window/application_flash.png): Executes the tool that's selected, according to the options it's associated to. This also works by double-clicking the tool aliases.
- ![](icons/other/cancel.png): Terminates the process create for the tool.
A tool can be selected from the left side of the widget. If selected, a property inspector displays the options that can be edited: A tool can be selected from the left side of the widget. If selected, a property inspector displays the options that can be edited:

View File

@ -150,6 +150,16 @@ inherited ToolsEditorWidget: TToolsEditorWidget
resourceName = 'APPLICATION_EDIT' resourceName = 'APPLICATION_EDIT'
scaledSeparator = False scaledSeparator = False
end end
object btnKill: TDexedToolButton[8]
Left = 202
Hint = 'if running, kills the process matching to the selected tool'
Top = 0
AutoSize = True
Caption = 'btnKill'
OnClick = btnKillClick
resourceName = 'CANCEL'
scaledSeparator = False
end
end end
end end
inherited contextMenu: TPopupMenu inherited contextMenu: TPopupMenu

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, Dialogs,
ExtCtrls, Menus, Buttons, StdCtrls, Types, LCLType, ExtCtrls, Menus, Buttons, StdCtrls, Types, LCLType,
u_widget, u_tools, u_sharedres, u_dsgncontrols; u_widget, u_tools, u_sharedres, u_dsgncontrols, u_common, u_processes;
type type
@ -16,6 +16,7 @@ type
btnAddTool: TDexedToolButton; btnAddTool: TDexedToolButton;
btnClone: TDexedToolButton; btnClone: TDexedToolButton;
btnEdit: TDexedToolButton; btnEdit: TDexedToolButton;
btnKill: TDexedToolButton;
btnMoveDown: TDexedToolButton; btnMoveDown: TDexedToolButton;
btnMoveUp: TDexedToolButton; btnMoveUp: TDexedToolButton;
btnRemTool: TDexedToolButton; btnRemTool: TDexedToolButton;
@ -27,6 +28,7 @@ type
procedure BtnAddToolClick(Sender: TObject); procedure BtnAddToolClick(Sender: TObject);
procedure btnCloneClick(Sender: TObject); procedure btnCloneClick(Sender: TObject);
procedure btnEditClick(Sender: TObject); procedure btnEditClick(Sender: TObject);
procedure btnKillClick(Sender: TObject);
procedure btnRemToolClick(Sender: TObject); procedure btnRemToolClick(Sender: TObject);
procedure btnMoveUpClick(Sender: TObject); procedure btnMoveUpClick(Sender: TObject);
procedure btnMoveDownClick(Sender: TObject); procedure btnMoveDownClick(Sender: TObject);
@ -153,6 +155,18 @@ begin
setReadOnly(not CustomTools.readOnly); setReadOnly(not CustomTools.readOnly);
end; end;
procedure TToolsEditorWidget.btnKillClick(Sender: TObject);
var
p: TDexedProcess;
begin
if lstTools.ItemIndex = -1 then
exit;
p := CustomTools.tool[lstTools.ItemIndex].process;
if p.isNotNil and p.Running then
p.Terminate(1);
end;
procedure TToolsEditorWidget.btnRemToolClick(Sender: TObject); procedure TToolsEditorWidget.btnRemToolClick(Sender: TObject);
begin begin
if lstTools.ItemIndex = -1 then if lstTools.ItemIndex = -1 then