From 3f57047f77859e4e66aa0b0dd302824020cd64e8 Mon Sep 17 00:00:00 2001 From: n7800 <14154601-n7800@users.noreply.gitlab.com> Date: Fri, 1 Nov 2024 14:32:43 +0500 Subject: [PATCH] IDE/ProjectInspector: Add a button to the toolbar to show/hide the properties panel --- ide/lazarusidestrconsts.pas | 1 + ide/projectinspector.lfm | 25 ++++++++++++++++++++++--- ide/projectinspector.pas | 12 ++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index c25ba1418c..4254c4e53c 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -2770,6 +2770,7 @@ resourcestring lisPLDOnlinePackagesCannotBeDeleted = 'Online packages cannot be deleted'; lisPESortFilesAlphabetically = 'Sort files alphabetically'; lisPEShowDirectoryHierarchy = 'Show directory hierarchy'; + lisPEShowPropsPanel = 'Show properties panel'; lisClearFilter = 'Clear filter'; dlgCaseSensitive = '&Case sensitive'; lisDistinguishBigAndSmallLettersEGAAndA = 'Distinguish big and small letters e.g. A and a'; diff --git a/ide/projectinspector.lfm b/ide/projectinspector.lfm index 1c618021bc..863ebca311 100644 --- a/ide/projectinspector.lfm +++ b/ide/projectinspector.lfm @@ -105,14 +105,14 @@ object ProjectInspectorForm: TProjectInspectorForm OnClick = SortAlphabeticallyButtonClick end object FilterEdit: TTreeFilterEdit - AnchorSideLeft.Control = SortAlphabeticallyButton + AnchorSideLeft.Control = ShowPropsPanelButton AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = SortAlphabeticallyButton AnchorSideTop.Side = asrCenter - Left = 95 + Left = 122 Height = 23 Top = 3 - Width = 365 + Width = 338 OnAfterFilter = FilterEditAfterFilter ButtonWidth = 23 Anchors = [akTop, akLeft, akRight] @@ -124,6 +124,25 @@ object ProjectInspectorForm: TProjectInspectorForm OnKeyDown = FilterEditKeyDown FilteredTreeview = ItemsTreeView end + object ShowPropsPanelButton: TSpeedButton + AnchorSideLeft.Control = SortAlphabeticallyButton + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = OpenButton + AnchorSideTop.Side = asrCenter + Left = 94 + Height = 25 + Top = 2 + Width = 25 + AllowAllUp = True + AutoSize = True + BorderSpacing.Around = 2 + Constraints.MinHeight = 25 + Constraints.MinWidth = 25 + GroupIndex = 2 + ShowHint = True + ParentShowHint = False + OnClick = ShowPropsPanelButtonClick + end end object ToolBar: TToolBar Left = 0 diff --git a/ide/projectinspector.pas b/ide/projectinspector.pas index 2205b27309..bc6e5b7a2c 100644 --- a/ide/projectinspector.pas +++ b/ide/projectinspector.pas @@ -129,6 +129,7 @@ type ItemsTreeView: TTreeView; ItemsPopupMenu: TPopupMenu; SortAlphabeticallyButton: TSpeedButton; + ShowPropsPanelButton: TSpeedButton; Splitter1: TSplitter; // toolbar ToolBar: TToolBar; @@ -174,6 +175,7 @@ type procedure ReAddMenuItemClick(Sender: TObject); procedure RemoveBitBtnClick(Sender: TObject); procedure RemoveNonExistingFilesMenuItemClick(Sender: TObject); + procedure ShowPropsPanelButtonClick(Sender: TObject); procedure SortAlphabeticallyButtonClick(Sender: TObject); procedure EnableI18NForLFMMenuItemClick(Sender: TObject); procedure DisableI18NForLFMMenuItemClick(Sender: TObject); @@ -1207,6 +1209,13 @@ begin end; end; +procedure TProjectInspectorForm.ShowPropsPanelButtonClick(Sender: TObject); +begin + with EnvironmentGuiOpts.Desktop do + ProjectInspectorShowProps := not ProjectInspectorShowProps; + OptionsChanged(Sender, false); +end; + procedure TProjectInspectorForm.SelectFileNode(const AFileName: string); function _FindInChildren(_Parent: TTreeNode): TTreeNode; var @@ -1392,6 +1401,7 @@ end; procedure TProjectInspectorForm.OptionsChanged(Sender: TObject; Restore: boolean); begin PropsGroupBox.Visible := EnvironmentGuiOpts.Desktop.ProjectInspectorShowProps; + ShowPropsPanelButton.Down := PropsGroupBox.Visible; PropsGroupBox.Height := EnvironmentGuiOpts.Desktop.ProjectInspectorPropsPanelHeight; Splitter1.Visible := PropsGroupBox.Visible; end; @@ -1428,6 +1438,8 @@ begin IDEImages.AssignImage(SortAlphabeticallyButton, 'pkg_sortalphabetically'); DirectoryHierarchyButton.Hint:=lisPEShowDirectoryHierarchy; IDEImages.AssignImage(DirectoryHierarchyButton, 'pkg_hierarchical'); + ShowPropsPanelButton.Hint:=lisPEShowPropsPanel; + IDEImages.AssignImage(ShowPropsPanelButton, 'item_todo'); FPropGui.OnGetPkgDep := @GetDependencyToUpdate; FPropGui.ApplyDependencyButton.OnClick := @ApplyDependencyButtonClick;