From cb1bb1a10b49163a23e965a42ff1309f42d4e74a Mon Sep 17 00:00:00 2001 From: ondrej Date: Fri, 9 Jun 2017 11:15:00 +0000 Subject: [PATCH] ide: desktops: add "Associated debug desktop" property to a desktop. git-svn-id: trunk@55278 - --- ide/desktopmanager.lfm | 53 ++++++++++++++++++++++++++++--------- ide/desktopmanager.pas | 33 ++++++++++++++++++++++- ide/environmentopts.pp | 7 +++++ ide/lazarusidestrconsts.pas | 2 ++ 4 files changed, 81 insertions(+), 14 deletions(-) diff --git a/ide/desktopmanager.lfm b/ide/desktopmanager.lfm index f936edb639..69b41c752f 100644 --- a/ide/desktopmanager.lfm +++ b/ide/desktopmanager.lfm @@ -10,7 +10,7 @@ object DesktopForm: TDesktopForm OnCreate = FormCreate OnShow = FormShow Position = poScreenCenter - LCLVersion = '1.5' + LCLVersion = '1.9.0.0' object ButtonPanel1: TButtonPanel Left = 6 Height = 34 @@ -27,7 +27,7 @@ object DesktopForm: TDesktopForm CancelButton.Name = 'CancelButton' CancelButton.Caption = 'Close' CancelButton.DefaultCaption = False - TabOrder = 3 + TabOrder = 4 ShowButtons = [pbClose, pbHelp] object ExportBitBtn: TBitBtn Left = 93 @@ -58,9 +58,9 @@ object DesktopForm: TDesktopForm AnchorSideLeft.Control = LblGrayedInfo AnchorSideRight.Control = LblGrayedInfo AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = AutoSaveActiveDesktopCheckBox + AnchorSideBottom.Control = AssociatedDebugDesktopComboBox Left = 11 - Height = 190 + Height = 161 Top = 8 Width = 320 Anchors = [akTop, akLeft, akRight, akBottom] @@ -87,7 +87,7 @@ object DesktopForm: TDesktopForm Caption = 'Auto save active desktop' ParentShowHint = False ShowHint = True - TabOrder = 1 + TabOrder = 2 end object ToolBar1: TToolBar Left = 340 @@ -98,7 +98,7 @@ object DesktopForm: TDesktopForm Anchors = [akTop, akRight, akBottom] Caption = 'ToolBar1' EdgeBorders = [] - TabOrder = 2 + TabOrder = 3 object SaveTB: TToolButton Left = 1 Top = 0 @@ -109,7 +109,6 @@ object DesktopForm: TDesktopForm end object ToolButton1: TToolButton Left = 1 - Height = 5 Top = 22 Width = 23 Caption = 'ToolButton1' @@ -167,7 +166,6 @@ object DesktopForm: TDesktopForm end object ToolButton2: TToolButton Left = 1 - Height = 5 Top = 120 Width = 23 Caption = 'ToolButton2' @@ -175,7 +173,6 @@ object DesktopForm: TDesktopForm end object ToolButton3: TToolButton Left = 1 - Height = 5 Top = 49 Width = 23 Caption = 'ToolButton3' @@ -195,9 +192,39 @@ object DesktopForm: TDesktopForm ParentColor = False WordWrap = True end + object AssociatedDebugDesktopComboBox: TComboBox + AnchorSideLeft.Control = AssociatedDebugDesktopLabel + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = DesktopListBox + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = AutoSaveActiveDesktopCheckBox + Left = 184 + Height = 23 + Top = 175 + Width = 147 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 10 + ItemHeight = 15 + OnChange = AssociatedDebugDesktopComboBoxChange + Style = csDropDownList + TabOrder = 1 + end + object AssociatedDebugDesktopLabel: TLabel + AnchorSideLeft.Control = AutoSaveActiveDesktopCheckBox + AnchorSideTop.Control = AssociatedDebugDesktopComboBox + AnchorSideTop.Side = asrCenter + Left = 11 + Height = 15 + Top = 179 + Width = 163 + Caption = 'AssociatedDebugDesktopLabel' + ParentColor = False + ParentShowHint = False + ShowHint = True + end object ExportMenu: TPopupMenu - left = 48 - top = 24 + Left = 48 + Top = 24 object ExportItem: TMenuItem Action = ExportAction OnClick = ExportActionClick @@ -208,8 +235,8 @@ object DesktopForm: TDesktopForm end end object ActionList1: TActionList - left = 128 - top = 32 + Left = 128 + Top = 32 object SaveAction: TAction Caption = 'SaveAction' OnExecute = SaveActionClick diff --git a/ide/desktopmanager.pas b/ide/desktopmanager.pas index aea6ffee65..70117dee45 100644 --- a/ide/desktopmanager.pas +++ b/ide/desktopmanager.pas @@ -20,11 +20,13 @@ type { TDesktopForm } TDesktopForm = class(TForm) + AssociatedDebugDesktopComboBox: TComboBox; ExportBitBtn: TBitBtn; ImportBitBtn: TBitBtn; ImportAction: TAction; ExportAction: TAction; ExportAllAction: TAction; + AssociatedDebugDesktopLabel: TLabel; MoveUpAction: TAction; MoveDownAction: TAction; DeleteAction: TAction; @@ -51,6 +53,7 @@ type MoveDownTB: TToolButton; ToolButton2: TToolButton; ToolButton3: TToolButton; + procedure AssociatedDebugDesktopComboBoxChange(Sender: TObject); procedure DeleteActionClick(Sender: TObject); procedure DesktopListBoxDrawItem(Control: TWinControl; Index: Integer; ARect: TRect; {%H-}State: TOwnerDrawState); @@ -344,6 +347,8 @@ begin AutoSaveActiveDesktopCheckBox.Caption := dlgAutoSaveActiveDesktop; AutoSaveActiveDesktopCheckBox.Hint := dlgAutoSaveActiveDesktopHint; LblGrayedInfo.Caption := dlgGrayedDesktopsUndocked; + AssociatedDebugDesktopLabel.Caption := dlgAssociatedDebugDesktop; + AssociatedDebugDesktopLabel.Hint := dlgAssociatedDebugDesktopHint; LblGrayedInfo.Font.Color := clGrayText; ExportAction.Hint := lisExport; @@ -387,11 +392,14 @@ begin HasNonCompatible := False; DesktopListBox.Clear; + AssociatedDebugDesktopComboBox.Clear; + AssociatedDebugDesktopComboBox.Items.AddObject(dlgPOIconDescNone, nil); // Saved desktops for i:=0 to EnvironmentOptions.Desktops.Count-1 do begin DskTop := EnvironmentOptions.Desktops[i]; - DesktopListBox.Items.Add(DskTop.Name); + DesktopListBox.Items.AddObject(DskTop.Name, DskTop); + AssociatedDebugDesktopComboBox.Items.AddObject(DskTop.Name, DskTop); if not DskTop.Compatible then HasNonCompatible := True; end; @@ -446,6 +454,19 @@ begin end; end; +procedure TDesktopForm.AssociatedDebugDesktopComboBoxChange(Sender: TObject); +var + SelDesktop: TDesktopOpt; +begin + if DesktopListBox.ItemIndex = -1 then + Exit; + + SelDesktop := DesktopListBox.Items.Objects[DesktopListBox.ItemIndex] as TDesktopOpt; + SelDesktop.AssociatedDebugDesktopName := AssociatedDebugDesktopComboBox.Text; + if SelDesktop.Name = EnvironmentOptions.ActiveDesktopName then + EnvironmentOptions.Desktop.AssociatedDebugDesktopName := SelDesktop.AssociatedDebugDesktopName; +end; + procedure TDesktopForm.DeleteActionClick(Sender: TObject); var dskName: String; @@ -758,10 +779,20 @@ procedure TDesktopForm.DesktopListBoxSelectionChange(Sender: TObject; User: bool var HasSel, IsActive, IsDebug: Boolean; CurName: String; + SelDesktop: TDesktopOpt; begin HasSel := DesktopListBox.ItemIndex>=0; if HasSel then begin + SelDesktop := DesktopListBox.Items.Objects[DesktopListBox.ItemIndex] as TDesktopOpt; + if (SelDesktop.AssociatedDebugDesktopName<>'') then + begin + AssociatedDebugDesktopComboBox.ItemIndex := + AssociatedDebugDesktopComboBox.Items.IndexOfObject(EnvironmentOptions.Desktops.Find(SelDesktop.AssociatedDebugDesktopName)); + if AssociatedDebugDesktopComboBox.ItemIndex<0 then + AssociatedDebugDesktopComboBox.ItemIndex := 0; + end else + AssociatedDebugDesktopComboBox.ItemIndex := 0; CurName := DesktopListBox.Items[DesktopListBox.ItemIndex]; IsActive := CurName = EnvironmentOptions.ActiveDesktopName; IsDebug := CurName = EnvironmentOptions.DebugDesktopName; diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index 2fa8a89336..310defb9a4 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -298,6 +298,7 @@ type TDesktopOpt = class private FName: String; + FAssociatedDebugDesktopName: String; FIsDocked: Boolean; FXMLCfg: TRttiXMLConfig; FConfigStore: TXMLOptionsStorage; @@ -344,6 +345,7 @@ type procedure RestoreDesktop; property Name: String read FName write FName; + property AssociatedDebugDesktopName: String read FAssociatedDebugDesktopName write FAssociatedDebugDesktopName; property IDEWindowCreatorsLayoutList: TSimpleWindowLayoutList read FIDEWindowCreatorsLayoutList write FIDEWindowCreatorsLayoutList; property IDEDialogLayoutList: TIDEDialogLayoutList read FIDEDialogLayoutList; property SingleTaskBarButton: boolean read FSingleTaskBarButton write FSingleTaskBarButton; @@ -1168,6 +1170,7 @@ begin begin FIDEWindowCreatorsLayoutList.CopyItemsFrom(Source.FIDEWindowCreatorsLayoutList); FIDEDialogLayoutList.Assign(Source.FIDEDialogLayoutList); + FAssociatedDebugDesktopName := Source.FAssociatedDebugDesktopName; end; FSingleTaskBarButton := Source.FSingleTaskBarButton; FHideIDEOnRun := Source.FHideIDEOnRun; @@ -1199,6 +1202,7 @@ begin FIDEWindowCreatorsLayoutList.LoadFromConfig(FConfigStore, Path); FIDEDialogLayoutList.LoadFromConfig(FConfigStore, Path+'Dialogs/'); + FAssociatedDebugDesktopName:=FXMLCfg.GetValue(Path+'AssociatedDebugDesktopName/Value', ''); FSingleTaskBarButton:=FXMLCfg.GetValue(Path+'SingleTaskBarButton/Value', False); FHideIDEOnRun:=FXMLCfg.GetValue(Path+'HideIDEOnRun/Value',false); FAutoAdjustIDEHeight:=FXMLCfg.GetValue(Path+'AutoAdjustIDEHeight/Value',true); @@ -1255,6 +1259,7 @@ begin FIDEWindowCreatorsLayoutList.SaveToConfig(FConfigStore, Path); FIDEDialogLayoutList.SaveToConfig(FConfigStore,Path+'Dialogs/'); + FXMLCfg.SetDeleteValue(Path+'AssociatedDebugDesktopName/Value', FAssociatedDebugDesktopName, ''); FXMLCfg.SetDeleteValue(Path+'SingleTaskBarButton/Value',FSingleTaskBarButton, False); FXMLCfg.SetDeleteValue(Path+'HideIDEOnRun/Value',FHideIDEOnRun,false); FXMLCfg.SetDeleteValue(Path+'AutoAdjustIDEHeight/Value',FAutoAdjustIDEHeight,true); @@ -2750,6 +2755,8 @@ begin DoBeforeWrite(False); //this is needed to get the EditorToolBar refreshed!!! - needed only here in UseDesktop() Desktop.Assign(ADesktop); ActiveDesktopName := ADesktop.Name; + if ADesktop.AssociatedDebugDesktopName<>'' then + DebugDesktopName := ADesktop.AssociatedDebugDesktopName; DoAfterWrite(False); //this is needed to get the EditorToolBar refreshed!!! - needed only here in UseDesktop() Desktop.ExportSettingsToIDE; Desktop.RestoreDesktop; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 640e5d206e..54add39ca9 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1355,6 +1355,8 @@ 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'; + dlgAssociatedDebugDesktopHint = 'If you select the desktop, the associated debug desktop will be selected as well.'; // Window options dlgShowingWindows = 'Showing Windows';