From 4e1548d574101d484ce48748f0e4289f0fa3b363 Mon Sep 17 00:00:00 2001 From: PragmaticLinux Date: Thu, 28 Apr 2022 21:08:47 +0200 Subject: [PATCH] IDE: Make OI visible on first start even when configuration directory is missing, but still Initial Setup Dialog has no reason to be shown (all its checks are passing correct). Fixes issue #39328. --- ide/main.pp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ide/main.pp b/ide/main.pp index aa08697108..503e3bc3e4 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -649,6 +649,7 @@ type FFixingGlobalComponentLock: integer; OldCompilerFilename, OldLanguage: String; OIChangedTimer: TIdleTimer; + FEnvOptsCfgExisted: boolean; // tracks if a local or user specific environment options configuration file existed FIdentifierWordCompletion: TSourceEditorWordCompletion; FIdentifierWordCompletionWordList: TStringList; @@ -1206,7 +1207,6 @@ procedure TMainIDE.LoadGlobalOptions; end; var - EnvOptsCfgExisted: boolean; s, LastCalled: String; OldVer: String; NowVer: String; @@ -1219,7 +1219,6 @@ begin with EnvironmentOptions do begin - EnvOptsCfgExisted := FileExistsCached(GetDefaultConfigFilename); OnBeforeRead := @EnvironmentOptionsBeforeRead; OnBeforeWrite := @EnvironmentOptionsBeforeWrite; OnAfterWrite := @EnvironmentOptionsAfterWrite; @@ -1308,8 +1307,8 @@ begin OldVer:=EnvironmentOptions.OldLazarusVersion; NowVer:=GetLazarusVersionString; - //debugln(['TMainIDE.LoadGlobalOptions ',EnvOptsCfgExisted,' diff=',OldVer<>NowVer,' Now=',NowVer,' Old=',OldVer,' Comp=',CompareLazarusVersion(NowVer,OldVer)]); - if EnvOptsCfgExisted and (OldVer<>NowVer) then + //debugln(['TMainIDE.LoadGlobalOptions ',FEnvOptsCfgExisted,' diff=',OldVer<>NowVer,' Now=',NowVer,' Old=',OldVer,' Comp=',CompareLazarusVersion(NowVer,OldVer)]); + if FEnvOptsCfgExisted and (OldVer<>NowVer) then begin IsUpgrade:=CompareLazarusVersion(NowVer,OldVer)>0; if OldVer='' then @@ -1395,7 +1394,6 @@ var CfgCache: TPCTargetConfigCache; OldLazDir: String; Note: string; - OI: TSimpleWindowLayout; ConfigFile: string; SkipAllTests: Boolean; begin @@ -1491,10 +1489,6 @@ begin Application.Terminate; exit; end; - // show OI with empty configuration - OI := IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(DefaultObjectInspectorName); - if OI<>nil then - OI.Visible := True; EnvironmentOptions.Save(true); if OldLazDir<>EnvironmentOptions.LazarusDirectory then begin // fetch new translations @@ -1535,6 +1529,9 @@ begin // setup macros before loading options MainBuildBoss.SetupTransferMacros; + // set flag to track if a local or user specific environment options configuration file existed + FEnvOptsCfgExisted := FileExistsCached(EnvironmentOptions.GetDefaultConfigFilename); + // load options CreatePrimaryConfigPath; StartProtocol; @@ -2152,6 +2149,8 @@ begin end; procedure TMainIDE.SetupObjectInspector; +var + OIWindowLayout: TSimpleWindowLayout; begin IDECmdScopeObjectInspectorOnly.AddWindowClass(TObjectInspectorDlg); @@ -2160,6 +2159,15 @@ begin ShowAnchorDesigner:=@mnuViewAnchorEditorClicked; ShowTabOrderEditor:=@mnuViewTabOrderClicked; + + // always show the object inspector in case no local or user specific environment + // options configuration file existed + if not FEnvOptsCfgExisted then + begin + OIWindowLayout := IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(DefaultObjectInspectorName); + if OIWindowLayout <> nil then + OIWindowLayout.Visible := True; + end; end; procedure TMainIDE.SetupFormEditor;