From c933dc21315be50293b12583daccb251bd51a75b Mon Sep 17 00:00:00 2001 From: ACTom Date: Thu, 26 May 2022 12:53:52 +0800 Subject: [PATCH] Project Inspector: Add an option to hide the properties pane. --- ide/environmentopts.pp | 11 +++++++++++ ide/frames/window_options.lfm | 13 +++++++++++++ ide/frames/window_options.pas | 5 +++++ ide/lazarusidestrconsts.pas | 2 ++ ide/projectinspector.pas | 29 +++++++++++++++++++++-------- 5 files changed, 52 insertions(+), 8 deletions(-) diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index 797df6fee8..587d022a2e 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -480,6 +480,7 @@ type FHideIDEOnRun: boolean; FAutoAdjustIDEHeight: boolean; FAutoAdjustIDEHeightFullCompPal: boolean; + FProjectInspectorShowProps: boolean; // window menu FIDENameForDesignedFormList: boolean; // CompletionWindow @@ -535,6 +536,8 @@ type property EditorToolBarOptions: TEditorToolBarOptions read FEditorToolBarOptions; property ComponentPaletteOptions: TCompPaletteOptions read FComponentPaletteOptions; property ObjectInspectorOptions: TDesktopOIOptions read FObjectInspectorOptions; + property ProjectInspectorShowProps: boolean read FProjectInspectorShowProps + write FProjectInspectorShowProps; end; { TUnsupportedDesktopOpt } @@ -2044,6 +2047,8 @@ begin FComponentPaletteOptions:=TCompPaletteOptions.Create; // object inspector FObjectInspectorOptions:=TDesktopOIOptions.Create; + // project inspector + FProjectInspectorShowProps := true; // Windows layout InitLayoutList; @@ -2109,6 +2114,8 @@ begin FComponentPaletteOptions.Assign(Source.FComponentPaletteOptions); // object inspector FObjectInspectorOptions.Assign(Source.FObjectInspectorOptions); + // project inspector + FProjectInspectorShowProps := Source.FProjectInspectorShowProps; if IsCompatible and Assigned(FDockedOpt) then FDockedOpt.Assign(Source.FDockedOpt); @@ -2135,6 +2142,8 @@ begin // CompletionWindow FCompletionWindowWidth:=FXMLCfg.GetValue(Path+'CompletionWindowOptions/Width/Value', FCompletionWindowWidth); FCompletionWindowHeight:=FXMLCfg.GetValue(Path+'CompletionWindowOptions/Height/Value', 6); + // Project Inspector + FProjectInspectorShowProps := FXMLCfg.GetValue(Path+'ProjectInspectorShowProps/Value', true); if not FXMLCfg.HasPath(Path+'IDECoolBarOptions/', True) then Path := ''; // Toolbars and palette were at the top level in XML. @@ -2197,6 +2206,8 @@ begin // CompletionWindow FXMLCfg.SetValue(Path+'CompletionWindowOptions/Width/Value',FCompletionWindowWidth); FXMLCfg.SetDeleteValue(Path+'CompletionWindowOptions/Height/Value',FCompletionWindowHeight, 6); + // Project Inspector + FXMLCfg.SetDeleteValue(Path+'ProjectInspectorShowProps/Value', FProjectInspectorShowProps, true); // IDE Coolbar FIDECoolBarOptions.Save(FXMLCfg, Path); // Editor Toolbar diff --git a/ide/frames/window_options.lfm b/ide/frames/window_options.lfm index b6e3d8d5df..162d46d8a9 100644 --- a/ide/frames/window_options.lfm +++ b/ide/frames/window_options.lfm @@ -129,4 +129,17 @@ object WindowOptionsFrame: TWindowOptionsFrame ShowHint = True TabOrder = 7 end + object ProjectInspectorShowPropsCheckBox: TCheckBox + AnchorSideLeft.Control = AutoAdjustIDEHeightFullCompPalCheckBox + AnchorSideTop.Control = AutoAdjustIDEHeightFullCompPalCheckBox + AnchorSideTop.Side = asrBottom + Left = 0 + Height = 24 + Top = 211 + Width = 295 + Caption = 'ProjectInspectorShowPropsCheckBox' + ParentShowHint = False + ShowHint = True + TabOrder = 8 + end end diff --git a/ide/frames/window_options.pas b/ide/frames/window_options.pas index ac69f24d62..d63c93886d 100644 --- a/ide/frames/window_options.pas +++ b/ide/frames/window_options.pas @@ -40,6 +40,7 @@ type TWindowOptionsFrame = class(TAbstractIDEOptionsEditor) AutoAdjustIDEHeightFullCompPalCheckBox: TCheckBox; + ProjectInspectorShowPropsCheckBox: TCheckBox; lblShowingWindows: TDividerBevel; NameForDesignedFormList: TCheckBox; AutoAdjustIDEHeightCheckBox: TCheckBox; @@ -89,6 +90,8 @@ begin AutoAdjustIDEHeightFullCompPalCheckBox.Hint:=lisAutoAdjustIDEHeightFullComponentPaletteHint; ProjectDirInIdeTitleCheckBox.Caption:=lisIDETitleShowsProjectDir; ProjectDirInIdeTitleCheckBox.Hint:=lisProjectDirectoryIsShowedInIdeTitleBar; + ProjectInspectorShowPropsCheckBox.Caption:=lisProjectInspectorShowProps; + ProjectInspectorShowPropsCheckBox.Hint:=lisProjectInspectorShowPropsHint; end; procedure TWindowOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); @@ -104,6 +107,7 @@ begin AutoAdjustIDEHeightCheckBox.Checked:=AutoAdjustIDEHeight; AutoAdjustIDEHeightFullCompPalCheckBox.Checked:=AutoAdjustIDEHeightFullCompPal; ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle; + ProjectInspectorShowPropsCheckBox.Checked:=ProjectInspectorShowProps; end; end; @@ -120,6 +124,7 @@ begin AutoAdjustIDEHeight := AutoAdjustIDEHeightCheckBox.Checked; AutoAdjustIDEHeightFullCompPal := AutoAdjustIDEHeightFullCompPalCheckBox.Checked; IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked; + ProjectInspectorShowProps:=ProjectInspectorShowPropsCheckBox.Checked; end; end; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 13a87cf8f9..ff8bdb82c2 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1426,6 +1426,8 @@ resourcestring lisAutoAdjustIDEHeightFullComponentPalette = 'Show complete component palette'; lisAutoAdjustIDEHeightFullComponentPaletteHint = 'If component palette spans over more lines, show them all and not only one.'; + lisProjectInspectorShowProps = 'Show properties in Project Inspector'; + lisProjectInspectorShowPropsHint = 'Properties are in the lower pane'; lisWindowMenuWithNameForDesignedForm = 'Window menu shows designed form''s name instead of caption'; lisWindowMenuWithNameForDesignedFormHint = 'Useful especially if the caption is left empty.'; lisTitleInTaskbarShowsForExampleProject1LpiLazarus = 'Title in taskbar ' diff --git a/ide/projectinspector.pas b/ide/projectinspector.pas index f1a38ab590..74032563ed 100644 --- a/ide/projectinspector.pas +++ b/ide/projectinspector.pas @@ -208,6 +208,7 @@ type function CreateToolButton(AName, ACaption, AHint, AImageName: String; AOnClick: TNotifyEvent): TToolButton; function CreateDivider: TToolButton; + procedure OptionsChanged(Sender: TObject; {%H-}Restore: boolean); procedure SetDependencyDefaultFilename(AsPreferred: boolean); procedure SetIdleConnected(AValue: boolean); procedure SetLazProject(const AValue: TProject); @@ -1297,6 +1298,12 @@ begin Result.Parent := ToolBar; end; +procedure TProjectInspectorForm.OptionsChanged(Sender: TObject; Restore: boolean); +begin + PropsGroupBox.Visible := EnvironmentOptions.Desktop.ProjectInspectorShowProps; + Splitter1.Visible := PropsGroupBox.Visible; +end; + procedure TProjectInspectorForm.SetupComponents; begin ImageIndexFiles := IDEImages.LoadImage('pkg_files'); @@ -1341,6 +1348,9 @@ begin FDependenciesNode.ImageIndex:=FPropGui.ImageIndexRequired; FDependenciesNode.SelectedIndex:=FDependenciesNode.ImageIndex; end; + + EnvironmentOptions.AddHandlerAfterWrite(@OptionsChanged); + OptionsChanged(Nil, False); end; function TProjectInspectorForm.TreeViewGetImageIndex(Str: String; Data: TObject; @@ -1704,16 +1714,16 @@ end; procedure TProjectInspectorForm.UpdateProperties(Immediately: boolean); var CurDependency, SingleSelectedDep: TPkgDependency; - TVNode, SingleSelectedDirectory: TTreeNode; + TVNode, DepHeaderNode, SingleSelectedDirectory: TTreeNode; NodeData: TPENodeData; Item: TObject; i, SelFileCount, SelDepCount, SelUnitCount, SelDirCount: Integer; SingleSelectedRemoved: Boolean; begin if not CanUpdate(pefNeedUpdateProperties,Immediately) then exit; - //GuiToFileOptions(False); // check selection + DepHeaderNode:=nil; SingleSelectedDep:=nil; SingleSelectedDirectory:=nil; SingleSelectedRemoved:=false; @@ -1735,11 +1745,11 @@ begin SingleSelectedDep:=CurDependency; SingleSelectedRemoved:=NodeData.Removed; end; - end else if IsDirectoryNode(TVNode) or (TVNode=FFilesNode) then begin + end else if IsDirectoryNode(TVNode) then begin inc(SelDirCount); SingleSelectedDirectory:=TVNode; - end //else if TVNode=FRequiredPackagesNode then - // DebugLn('UpdatePEProperties: Required packages selected'); + end else if TVNode=FDependenciesNode then + DepHeaderNode:=TVNode; end; if (SelFileCount+SelDepCount+SelDirCount>1) then begin @@ -1768,12 +1778,15 @@ begin FPropGui.UpdateApplyDependencyButton; end else if SingleSelectedDirectory<>nil then begin - //PropsGroupBox.Enabled:=true; - //PropsGroupBox.Caption:=lisPckEditFileProperties; + PropsGroupBox.Enabled:=true; + PropsGroupBox.Caption:=lisPckEditFileProperties; end else begin PropsGroupBox.Enabled:=false; - PropsGroupBox.Caption:=lisPckEditDependencyProperties; + if Assigned(DepHeaderNode) then + PropsGroupBox.Caption:=lisPckEditDependencyProperties + else + PropsGroupBox.Caption:=lisPckEditFileProperties; end; finally EnableAlign;