mirror of https://gitlab.com/basile.b/dexed.git
custom tools, add btn to set prop editor visibility + persist setting
This commit is contained in:
parent
e50a89f671
commit
7aee6a38f6
|
@ -22,6 +22,7 @@ A few examples:
|
|||
|
||||
Toolbar:
|
||||
|
||||
- <img src="{%include icurl%}window/application_edit.png" class="tlbric"/>: Enables or disables edition.
|
||||
- <img src="{%include icurl%}window/application_add.png" class="tlbric"/>: Adds a new tool.
|
||||
- <img src="{%include icurl%}window/application_delete.png" class="tlbric"/>: Removes selected tool.
|
||||
- <img src="{%include icurl%}arrow/arrow_up.png" class="tlbric"/> **/** <img src="{%include icurl%}arrow/arrow_down.png" class="tlbric"/>: Changes the position of the selected tool.
|
||||
|
|
|
@ -69,6 +69,7 @@ type
|
|||
fShctCount: Integer;
|
||||
fDoc: TCESynMemo;
|
||||
fMenu: TMenuItem;
|
||||
fReadOnly: boolean;
|
||||
function getTool(index: Integer): TCEToolItem;
|
||||
procedure setTools(value: TCEToolItems);
|
||||
//
|
||||
|
@ -85,6 +86,7 @@ type
|
|||
procedure scedSendDone;
|
||||
published
|
||||
property tools: TCEToolItems read fTools write setTools;
|
||||
property readOnly: boolean read fReadOnly write fReadOnly;
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
|
|
|
@ -68,7 +68,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
inherited toolbar: TCEToolBar
|
||||
Width = 433
|
||||
object btnRun: TCEToolButton[0]
|
||||
Left = 157
|
||||
Left = 185
|
||||
Hint = 'execute selected tool'
|
||||
Top = 0
|
||||
Caption = 'btnRun'
|
||||
|
@ -77,7 +77,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
scaledSeparator = False
|
||||
end
|
||||
object button1: TCEToolButton[1]
|
||||
Left = 141
|
||||
Left = 169
|
||||
Height = 28
|
||||
Top = 0
|
||||
Width = 16
|
||||
|
@ -86,7 +86,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
scaledSeparator = False
|
||||
end
|
||||
object btnClone: TCEToolButton[2]
|
||||
Left = 113
|
||||
Left = 141
|
||||
Hint = 'clone selected tool'
|
||||
Top = 0
|
||||
Caption = 'btnClone'
|
||||
|
@ -95,7 +95,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
scaledSeparator = False
|
||||
end
|
||||
object btnMoveUp: TCEToolButton[3]
|
||||
Left = 85
|
||||
Left = 113
|
||||
Hint = 'move selected tool up'
|
||||
Top = 0
|
||||
Caption = 'btnMoveUp'
|
||||
|
@ -104,7 +104,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
scaledSeparator = False
|
||||
end
|
||||
object btnMoveDown: TCEToolButton[4]
|
||||
Left = 57
|
||||
Left = 85
|
||||
Hint = 'move selected tool down'
|
||||
Top = 0
|
||||
Caption = 'btnMoveDown'
|
||||
|
@ -113,7 +113,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
scaledSeparator = False
|
||||
end
|
||||
object btnRemTool: TCEToolButton[5]
|
||||
Left = 29
|
||||
Left = 57
|
||||
Hint = 'remove selected tool'
|
||||
Top = 0
|
||||
Caption = 'btnRemTool'
|
||||
|
@ -122,7 +122,7 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
scaledSeparator = False
|
||||
end
|
||||
object btnAddTool: TCEToolButton[6]
|
||||
Left = 1
|
||||
Left = 29
|
||||
Hint = 'add a new empty tool'
|
||||
Top = 0
|
||||
Caption = 'btnAddTool'
|
||||
|
@ -130,6 +130,15 @@ inherited CEToolsEditorWidget: TCEToolsEditorWidget
|
|||
resourceName = 'APPLICATION_ADD'
|
||||
scaledSeparator = False
|
||||
end
|
||||
object btnEdit: TCEToolButton[7]
|
||||
Left = 1
|
||||
Hint = 'enable or disable edition'
|
||||
Top = 0
|
||||
Caption = 'btnEdit'
|
||||
OnClick = btnEditClick
|
||||
resourceName = 'APPLICATION_EDIT'
|
||||
scaledSeparator = False
|
||||
end
|
||||
end
|
||||
end
|
||||
inherited contextMenu: TPopupMenu
|
||||
|
|
|
@ -15,6 +15,7 @@ type
|
|||
TCEToolsEditorWidget = class(TCEWidget)
|
||||
btnAddTool: TCEToolButton;
|
||||
btnClone: TCEToolButton;
|
||||
btnEdit: TCEToolButton;
|
||||
btnMoveDown: TCEToolButton;
|
||||
btnMoveUp: TCEToolButton;
|
||||
btnRemTool: TCEToolButton;
|
||||
|
@ -25,6 +26,7 @@ type
|
|||
propsEd: TTIPropertyGrid;
|
||||
procedure BtnAddToolClick(Sender: TObject);
|
||||
procedure btnCloneClick(Sender: TObject);
|
||||
procedure btnEditClick(Sender: TObject);
|
||||
procedure btnRemToolClick(Sender: TObject);
|
||||
procedure btnMoveUpClick(Sender: TObject);
|
||||
procedure btnMoveDownClick(Sender: TObject);
|
||||
|
@ -33,6 +35,7 @@ type
|
|||
procedure lstToolsSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure propsEdModified(Sender: TObject);
|
||||
private
|
||||
procedure setReadOnly(value: boolean);
|
||||
procedure executeSelectedTool;
|
||||
procedure clearInspector;
|
||||
procedure rebuildToolList;
|
||||
|
@ -50,6 +53,7 @@ begin
|
|||
propsEd.CheckboxForBoolean := true;
|
||||
propsEd.PropertyEditorHook.AddHandlerModified(@propsEdModified);
|
||||
rebuildToolList;
|
||||
setReadOnly(CustomTools.readOnly);
|
||||
end;
|
||||
|
||||
procedure TCEToolsEditorWidget.clearInspector;
|
||||
|
@ -118,6 +122,29 @@ begin
|
|||
rebuildToolList;
|
||||
end;
|
||||
|
||||
procedure TCEToolsEditorWidget.setReadOnly(value: boolean);
|
||||
begin
|
||||
if value then
|
||||
begin
|
||||
CustomTools.readOnly:= true;
|
||||
lstTools.Align:= alClient;
|
||||
PropsEd.Visible := false;
|
||||
Splitter1.Visible := false;
|
||||
end
|
||||
else
|
||||
begin
|
||||
CustomTools.readOnly:= false;
|
||||
lstTools.Align:= alLeft;
|
||||
PropsEd.Visible := true;
|
||||
Splitter1.Visible := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEToolsEditorWidget.btnEditClick(Sender: TObject);
|
||||
begin
|
||||
setReadOnly(not CustomTools.readOnly);
|
||||
end;
|
||||
|
||||
procedure TCEToolsEditorWidget.btnRemToolClick(Sender: TObject);
|
||||
begin
|
||||
if lstTools.ItemIndex = -1 then
|
||||
|
|
Loading…
Reference in New Issue