IDE: Improve "Manage desktops" dialog. Issue #35786, patch from FTurtle.

git-svn-id: trunk@61528 -
This commit is contained in:
juha 2019-07-04 21:59:53 +00:00
parent 77eab57ea8
commit 12bd4546ad
3 changed files with 256 additions and 182 deletions

View File

@ -1,21 +1,28 @@
object DesktopForm: TDesktopForm
Left = 334
Height = 292
Height = 310
Top = 319
Width = 377
Width = 450
BorderIcons = [biSystemMenu]
Caption = 'DesktopForm'
ClientHeight = 292
ClientWidth = 377
ClientHeight = 310
ClientWidth = 450
Constraints.MinHeight = 310
Constraints.MinWidth = 350
OnClose = FormClose
OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.9.0.0'
LCLVersion = '2.1.0.0'
object ButtonPanel1: TButtonPanel
Left = 6
Height = 34
Top = 252
Width = 365
Top = 270
Width = 438
BorderSpacing.Left = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
BorderSpacing.Around = 0
OKButton.Name = 'OKButton'
OKButton.Caption = 'OK'
OKButton.DefaultCaption = False
@ -30,10 +37,10 @@ object DesktopForm: TDesktopForm
TabOrder = 4
ShowButtons = [pbClose, pbHelp]
object ExportBitBtn: TBitBtn
Left = 93
Left = 179
Height = 26
Top = 8
Width = 91
Width = 0
Align = alCustom
AutoSize = True
Caption = 'ExportBitBtn'
@ -42,10 +49,10 @@ object DesktopForm: TDesktopForm
TabOrder = 4
end
object ImportBitBtn: TBitBtn
Left = 190
Left = 271
Height = 26
Top = 8
Width = 94
Width = 0
Align = alCustom
AutoSize = True
Caption = 'ImportBitBtn'
@ -55,16 +62,19 @@ object DesktopForm: TDesktopForm
end
end
object DesktopListBox: TListBox
AnchorSideLeft.Control = LblGrayedInfo
AnchorSideRight.Control = LblGrayedInfo
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = AssociatedDebugDesktopComboBox
Left = 11
Height = 163
Top = 8
Width = 320
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Panel1
AnchorSideBottom.Control = AssociatedDebugDesktopLabel
Left = 6
Height = 178
Top = 6
Width = 290
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 6
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 4
ItemHeight = 18
OnDblClick = SetActiveDesktopActionClick
OnDrawItem = DesktopListBoxDrawItem
@ -74,157 +84,186 @@ object DesktopForm: TDesktopForm
TabOrder = 0
end
object AutoSaveActiveDesktopCheckBox: TCheckBox
AnchorSideLeft.Control = LblGrayedInfo
AnchorSideLeft.Control = DesktopListBox
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = LblGrayedInfo
Left = 11
Height = 19
Top = 204
Width = 151
Left = 6
Height = 17
Top = 230
Width = 140
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
Caption = 'Auto save active desktop'
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object ToolBar1: TToolBar
Left = 340
Height = 241
Top = 8
Width = 30
Align = alNone
Anchors = [akTop, akRight, akBottom]
Caption = 'ToolBar1'
EdgeBorders = []
TabOrder = 3
object SaveTB: TToolButton
Left = 1
Top = 0
Action = SaveAction
OnClick = SaveActionClick
ParentShowHint = False
ShowHint = True
end
object ToolButton1: TToolButton
Left = 1
Top = 22
Width = 23
Caption = 'ToolButton1'
Style = tbsDivider
end
object SetActiveDesktopTB: TToolButton
Left = 1
Top = 27
Action = SetActiveDesktopAction
OnClick = SetActiveDesktopActionClick
ParentShowHint = False
ShowHint = True
end
object SetDebugDesktopTB: TToolButton
Left = 1
Top = 54
Action = SetDebugDesktopAction
OnClick = SetDebugDesktopActionClick
ParentShowHint = False
ShowHint = True
end
object RenameTB: TToolButton
Left = 1
Top = 76
Action = RenameAction
OnClick = RenameActionClick
ParentShowHint = False
ShowHint = True
end
object DeleteTB: TToolButton
Left = 1
Top = 98
Action = DeleteAction
OnClick = DeleteActionClick
ParentShowHint = False
ShowHint = True
end
object MoveUpTB: TToolButton
Tag = -1
Left = 1
Top = 125
Action = MoveUpAction
OnClick = MoveUpDownActionClick
ParentShowHint = False
ShowHint = True
end
object MoveDownTB: TToolButton
Tag = 1
Left = 1
Top = 147
Action = MoveDownAction
OnClick = MoveUpDownActionClick
ParentShowHint = False
ShowHint = True
end
object ToolButton2: TToolButton
Left = 1
Top = 120
Width = 23
Caption = 'ToolButton2'
Style = tbsDivider
end
object ToolButton3: TToolButton
Left = 1
Top = 49
Width = 23
Caption = 'ToolButton3'
Style = tbsDivider
end
end
object LblGrayedInfo: TLabel
AnchorSideLeft.Control = DesktopListBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
Left = 11
Height = 15
Top = 229
Width = 320
AnchorSideBottom.Control = ButtonPanel1
Left = 6
Height = 13
Top = 253
Width = 438
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Top = 3
BorderSpacing.Bottom = 4
Caption = 'Grayed desktops are for undocked environment.'
ParentColor = False
WordWrap = True
end
object AssociatedDebugDesktopComboBox: TComboBox
AnchorSideLeft.Control = AssociatedDebugDesktopLabel
AnchorSideLeft.Side = asrBottom
AnchorSideLeft.Control = DesktopListBox
AnchorSideRight.Control = DesktopListBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = AutoSaveActiveDesktopCheckBox
Left = 184
Left = 6
Height = 21
Top = 177
Width = 147
Top = 203
Width = 290
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 10
ItemHeight = 15
BorderSpacing.Bottom = 6
ItemHeight = 13
OnChange = AssociatedDebugDesktopComboBoxChange
Style = csDropDownList
TabOrder = 1
end
object AssociatedDebugDesktopLabel: TLabel
AnchorSideLeft.Control = AutoSaveActiveDesktopCheckBox
AnchorSideTop.Control = AssociatedDebugDesktopComboBox
AnchorSideLeft.Control = DesktopListBox
AnchorSideTop.Side = asrCenter
Left = 11
Height = 15
Top = 180
Width = 163
AnchorSideRight.Control = DesktopListBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = AssociatedDebugDesktopComboBox
Left = 6
Height = 13
Top = 188
Width = 290
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 2
Caption = 'AssociatedDebugDesktopLabel'
ParentColor = False
ParentShowHint = False
ShowHint = True
WordWrap = True
end
object Panel1: TPanel
AnchorSideTop.Control = DesktopListBox
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = LblGrayedInfo
Left = 302
Height = 247
Top = 6
Width = 142
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
BevelOuter = bvNone
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 247
ClientWidth = 142
TabOrder = 3
object SaveAsButton: TBitBtn
Left = 0
Height = 24
Top = 0
Width = 142
Action = SaveAsAction
AutoSize = True
Constraints.MinHeight = 24
Constraints.MinWidth = 24
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object SetActiveDesktopButton: TBitBtn
Left = 0
Height = 24
Top = 26
Width = 142
Action = SetActiveDesktopAction
AutoSize = True
Constraints.MinHeight = 24
Constraints.MinWidth = 24
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object SetDebugDesktopButton: TBitBtn
Left = 0
Height = 24
Top = 52
Width = 142
Action = SetDebugDesktopAction
AutoSize = True
Constraints.MinHeight = 24
Constraints.MinWidth = 24
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object RenameButton: TBitBtn
Left = 0
Height = 24
Top = 78
Width = 142
Action = RenameAction
AutoSize = True
Constraints.MinHeight = 24
Constraints.MinWidth = 24
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
object DeleteButton: TBitBtn
Left = 0
Height = 24
Top = 104
Width = 142
Action = DeleteAction
AutoSize = True
Constraints.MinHeight = 24
Constraints.MinWidth = 24
ParentShowHint = False
ShowHint = True
TabOrder = 4
end
object MoveUpButton: TBitBtn
Tag = -1
Left = 0
Height = 24
Top = 130
Width = 142
Action = MoveUpAction
AutoSize = True
Constraints.MinHeight = 24
Constraints.MinWidth = 24
ParentShowHint = False
ShowHint = True
TabOrder = 5
end
object MoveDownButton: TBitBtn
Tag = 1
Left = 0
Height = 24
Top = 156
Width = 142
Action = MoveDownAction
AutoSize = True
Constraints.MinHeight = 24
Constraints.MinWidth = 24
ParentShowHint = False
ShowHint = True
TabOrder = 6
end
end
object ExportMenu: TPopupMenu
Left = 48
Top = 24
left = 28
top = 24
object ExportItem: TMenuItem
Action = ExportAction
OnClick = ExportActionClick
@ -235,11 +274,11 @@ object DesktopForm: TDesktopForm
end
end
object ActionList1: TActionList
Left = 128
Top = 32
object SaveAction: TAction
Caption = 'SaveAction'
OnExecute = SaveActionClick
left = 89
top = 24
object SaveAsAction: TAction
Caption = 'SaveAsAction'
OnExecute = SaveAsActionClick
ShortCut = 16467
end
object SetActiveDesktopAction: TAction

View File

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, Types,
LCLIntf, LCLType, LCLProc, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ButtonPanel, Menus, ComCtrls, ActnList,
Buttons, ButtonPanel, Menus, ComCtrls, ActnList, ExtCtrls,
// LazUtils
Laz2_XMLCfg,
// IdeIntf
@ -21,19 +21,25 @@ type
TDesktopForm = class(TForm)
AssociatedDebugDesktopComboBox: TComboBox;
DeleteButton: TBitBtn;
ExportBitBtn: TBitBtn;
ImportBitBtn: TBitBtn;
ImportAction: TAction;
ExportAction: TAction;
ExportAllAction: TAction;
AssociatedDebugDesktopLabel: TLabel;
MoveDownButton: TBitBtn;
MoveUpAction: TAction;
MoveDownAction: TAction;
DeleteAction: TAction;
MoveUpButton: TBitBtn;
RenameAction: TAction;
RenameButton: TBitBtn;
SaveAsButton: TBitBtn;
SetActiveDesktopButton: TBitBtn;
SetDebugDesktopAction: TAction;
SetActiveDesktopAction: TAction;
SaveAction: TAction;
SaveAsAction: TAction;
ActionList1: TActionList;
AutoSaveActiveDesktopCheckBox: TCheckBox;
ButtonPanel1: TButtonPanel;
@ -42,17 +48,8 @@ type
ExportItem: TMenuItem;
ExportAllItem: TMenuItem;
DesktopListBox: TListBox;
ToolBar1: TToolBar;
SaveTB: TToolButton;
ToolButton1: TToolButton;
SetActiveDesktopTB: TToolButton;
SetDebugDesktopTB: TToolButton;
RenameTB: TToolButton;
DeleteTB: TToolButton;
MoveUpTB: TToolButton;
MoveDownTB: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
Panel1: TPanel;
SetDebugDesktopButton: TBitBtn;
procedure AssociatedDebugDesktopComboBoxChange(Sender: TObject);
procedure DeleteActionClick(Sender: TObject);
procedure DesktopListBoxDrawItem(Control: TWinControl; Index: Integer;
@ -62,13 +59,14 @@ type
procedure ExportAllActionClick(Sender: TObject);
procedure ExportActionClick(Sender: TObject);
procedure ExportBitBtnClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
procedure ImportActionClick(Sender: TObject);
procedure MoveUpDownActionClick(Sender: TObject);
procedure RenameActionClick(Sender: TObject);
procedure SaveActionClick(Sender: TObject);
procedure SaveAsActionClick(Sender: TObject);
procedure SetActiveDesktopActionClick(Sender: TObject);
procedure SetDebugDesktopActionClick(Sender: TObject);
private
@ -286,7 +284,7 @@ begin
xMISaveAs.ImageIndex := IDEImages.LoadImage('menu_saveas');
xMIToggleDebug := TMenuItem.Create(xPM);
xMIToggleDebug.Caption := dlgToggleDebugDesktop;
xMIToggleDebug.Caption := dlgToggleDebugDesktopBtnCaption;
xMIToggleDebug.ImageIndex := IDEImages.LoadImage('debugger');
// Saved desktops
@ -348,29 +346,48 @@ end;
procedure TDesktopForm.FormCreate(Sender: TObject);
begin
IDEDialogLayoutList.ApplyLayout(Self, 470, 326);
// buttons captions & text
ToolBar1.Images := IDEImages.Images_16;
ActionList1.Images := IDEImages.Images_16; // for TDesktopForm.DesktopListBoxDrawItem only
Caption := dlgManageDesktops;
SaveAction.Hint := dlgSaveCurrentDesktopAs;
SaveAction.ImageIndex := IDEImages.LoadImage('laz_save');
DeleteAction.Hint := lisDelete;
DeleteAction.ImageIndex := IDEImages.LoadImage('laz_cancel');
RenameAction.Hint := lisRename;
RenameAction.ImageIndex := IDEImages.LoadImage('laz_edit');
MoveUpAction.Hint := lisMenuEditorMoveUp;
MoveUpAction.ImageIndex := IDEImages.LoadImage('arrow_up');
MoveDownAction.Hint := lisMenuEditorMoveDown;
MoveDownAction.ImageIndex := IDEImages.LoadImage('arrow_down');
SetActiveDesktopAction.Hint := dlgSetActiveDesktop;
SetActiveDesktopAction.ImageIndex := IDEImages.LoadImage('laz_tick');
SetDebugDesktopAction.Hint := dlgToggleDebugDesktop;
SetDebugDesktopAction.ImageIndex := IDEImages.LoadImage('debugger');
SaveAsAction.Caption := dlgSaveCurrentDesktopAsBtnCaption;
SaveAsAction.Hint := dlgSaveCurrentDesktopAsBtnHint;
IDEImages.AssignImage(SaveAsButton, 'menu_saveas');
DeleteAction.Caption := dlgDeleteSelectedDesktopBtnCaption;
DeleteAction.Hint := dlgDeleteSelectedDesktopBtnHint;
IDEImages.AssignImage(DeleteButton, 'laz_cancel');
RenameAction.Caption := dlgRenameSelectedDesktopBtnCaption;
RenameAction.Hint := dlgRenameSelectedDesktopBtnHint;
IDEImages.AssignImage(RenameButton, 'laz_edit');
MoveUpAction.Caption := lisMoveUp;
MoveUpAction.Hint := lisMoveUp;
IDEImages.AssignImage(MoveUpButton, 'arrow_up');
MoveDownAction.Caption := lisMoveDown;
MoveDownAction.Hint := lisMoveDown;
IDEImages.AssignImage(MoveDownButton, 'arrow_down');
SetActiveDesktopAction.Caption := dlgSetActiveDesktopBtnCaption;
SetActiveDesktopAction.Hint := dlgSetActiveDesktopBtnHint;
IDEImages.AssignImage(SetActiveDesktopButton, 'laz_tick');
SetDebugDesktopAction.Caption := dlgToggleDebugDesktopBtnCaption;
SetDebugDesktopAction.Hint := dlgToggleDebugDesktopBtnHint;
IDEImages.AssignImage(SetDebugDesktopButton, 'debugger');
AutoSaveActiveDesktopCheckBox.Caption := dlgAutoSaveActiveDesktop;
AutoSaveActiveDesktopCheckBox.Hint := dlgAutoSaveActiveDesktopHint;
LblGrayedInfo.Caption := '';
AssociatedDebugDesktopLabel.Caption := dlgAssociatedDebugDesktop;
//AssociatedDebugDesktopLabel.Caption := dlgAssociatedDebugDesktop; // moved to TDesktopForm.DesktopListBoxSelectionChange
AssociatedDebugDesktopLabel.Hint := dlgAssociatedDebugDesktopHint;
LblGrayedInfo.Font.Color := clGrayText;
LblGrayedInfo.Font.Color := clGrayText; // perhaps better clInactiveCaption
ExportAction.Hint := lisExport;
ExportAction.Caption := lisExportSelected;
@ -546,6 +563,11 @@ begin
ExportMenu.PopUp(p.x,p.y);
end;
procedure TDesktopForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
IDEDialogLayoutList.SaveLayout(Self);
end;
procedure TDesktopForm.ExportDesktops(
const aDesktops: array of TCustomDesktopOpt);
var
@ -785,7 +807,7 @@ begin
raise Exception.Create('Desktop manager internal error: the desktop list doesn''t match the listbox content.');
end;
xInfo := '';
xTextLeft := ARect.Left+ToolBar1.Images.Width + 4;
xTextLeft := ARect.Left+ActionList1.Images.Width + 4;
xIconLeft := ARect.Left+2;
if (xDesktopName <> '') and (EnvironmentOptions.ActiveDesktopName = xDesktopName) then
begin
@ -793,7 +815,7 @@ begin
xInfo := xInfo + ', ';
xInfo := xInfo + dlgActiveDesktop;
xLB.Canvas.Font.Style := xLB.Canvas.Font.Style + [fsBold];
ToolBar1.Images.Draw(xLB.Canvas, xIconLeft, (ARect.Top+ARect.Bottom-ToolBar1.Images.Height) div 2, SetActiveDesktopTB.ImageIndex, xDesktop.Compatible);//I don't see a problem painting the tick over the "run" icon...
ActionList1.Images.Draw(xLB.Canvas, xIconLeft, (ARect.Top+ARect.Bottom-ActionList1.Images.Height) div 2, SetActiveDesktopButton.ImageIndex, xDesktop.Compatible);//I don't see a problem painting the tick over the "run" icon...
end;
if (xDesktopName <> '') and (EnvironmentOptions.DebugDesktopName = xDesktopName) then
begin
@ -802,10 +824,10 @@ begin
xInfo := xInfo + dlgDebugDesktop;
if (EnvironmentOptions.ActiveDesktopName = xDesktopName) then
begin
xTextLeft := xTextLeft + ToolBar1.Images.Width;
xIconLeft := xIconLeft + ToolBar1.Images.Width;
xTextLeft := xTextLeft + ActionList1.Images.Width;
xIconLeft := xIconLeft + ActionList1.Images.Width;
end;
ToolBar1.Images.Draw(xLB.Canvas, xIconLeft, (ARect.Top+ARect.Bottom-ToolBar1.Images.Height) div 2, SetDebugDesktopTB.ImageIndex, xDesktop.Compatible);
ActionList1.Images.Draw(xLB.Canvas, xIconLeft, (ARect.Top+ARect.Bottom-ActionList1.Images.Height) div 2, SetDebugDesktopButton.ImageIndex, xDesktop.Compatible);
end;
ARect.Left := xTextLeft;
xText := xDesktopName;
@ -864,6 +886,9 @@ begin
ExportAction.Enabled := HasSel;
ExportAllAction.Enabled := DesktopListBox.Items.Count>0;
ExportBitBtn.Enabled := ExportItem.Enabled or ExportAllItem.Enabled;
if DesktopListBox.Items.Count>0 then
AssociatedDebugDesktopLabel.Caption:=Format(dlgAssociatedDebugDesktop,
[DesktopListBox.Items[DesktopListBox.ItemIndex]]);
end;
procedure TDesktopForm.ExportAllActionClick(Sender: TObject);
@ -877,7 +902,7 @@ begin
ExportDesktops(xDesktops);
end;
procedure TDesktopForm.SaveActionClick(Sender: TObject);
procedure TDesktopForm.SaveAsActionClick(Sender: TObject);
var
xDesktopName, xOldDesktopName: string;
begin

View File

@ -149,6 +149,8 @@ resourcestring
lisMoveFiles = 'Move Files';
lisMoveFiles2 = 'Move files?';
lrsPLDDeleteSelected = 'Delete selected';
lisMoveUp = 'Move Up';
lisMoveDown = 'Move Down';
dlgMultipleInstances = 'Multiple Lazarus instances';
dlgMultipleInstances_AlwaysStartNew = 'always start a new instance';
@ -1380,12 +1382,20 @@ resourcestring
dlgManageDesktops = 'Manage desktops';
dlgSaveCurrentDesktop = 'Save current desktop';
dlgSaveCurrentDesktopAs = 'Save current desktop as';
dlgSaveCurrentDesktopAsBtnCaption = 'Save active desktop as ...';
dlgSaveCurrentDesktopAsBtnHint = 'Save active desktop as';
dlgDeleteSelectedDesktopBtnCaption = 'Delete';
dlgDeleteSelectedDesktopBtnHint = 'Delete selected desktop';
dlgRenameSelectedDesktopBtnCaption = 'Rename';
dlgRenameSelectedDesktopBtnHint = 'Rename selected desktop';
dlgReallyDeleteDesktop = 'Really delete desktop "%s"?';
dlgCannotUseDockedUndockedDesktop = 'You cannot use docked desktop in undocked environment and vice versa.';
dlgRenameDesktop = 'Rename desktop';
dlgNewDesktop = 'New desktop ...';
dlgSetActiveDesktop = 'Set active';
dlgToggleDebugDesktop = 'Toggle as debug desktop';
dlgSetActiveDesktopBtnCaption = 'Set active';
dlgSetActiveDesktopBtnHint = 'Set active';
dlgToggleDebugDesktopBtnCaption = 'Toggle as debug desktop';
dlgToggleDebugDesktopBtnHint = 'Toggle as debug desktop';
dlgDesktopName = 'Desktop name';
dlgOverwriteDesktop = 'Desktop with the name "%s" was found.'+sLineBreak+'Should the old desktop be overwritten?';
dlgDebugDesktop = 'debug';
@ -1399,7 +1409,7 @@ resourcestring
dlgGrayedDesktopsUndocked = 'Grayed desktops are for undocked environment.';
dlgAutoSaveActiveDesktop = 'Auto save active desktop';
dlgAutoSaveActiveDesktopHint = 'Save active desktop on IDE close'+sLineBreak+'Save debug desktop on IDE close and debug end';
dlgAssociatedDebugDesktop = 'Associated debug desktop';
dlgAssociatedDebugDesktop = 'Associated debug desktop for "%s"';
dlgAssociatedDebugDesktopHint = 'If you select the desktop, the associated debug desktop will be selected as well.';
// Window options