From aebdc634cf7b3a01f2960bf3c74170caaa42107c Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 10 Sep 2015 10:58:18 +0000 Subject: [PATCH] IDE: merged options open last project and last packages git-svn-id: trunk@49805 - --- ide/environmentopts.pp | 10 ++----- ide/frames/files_options.lfm | 56 ++++++++++++++---------------------- ide/frames/files_options.pas | 11 ------- ide/lazarusidestrconsts.pas | 3 +- ide/main.pp | 25 +++++++--------- 5 files changed, 35 insertions(+), 70 deletions(-) diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index 10604a4741..50d474b346 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -475,7 +475,6 @@ type FRecentPackageFiles: TStringList; FMaxRecentPackageFiles: integer; FOpenLastProjectAtStart: boolean; - FOpenPackagesAtStart: boolean; // Prevent repopulating Recent project files menu with example projects if it was already cleared up. FAlreadyPopulatedRecentFiles : Boolean; @@ -729,8 +728,6 @@ type property LastOpenPackages: TLastOpenPackagesList read FLastOpenPackages; property OpenLastProjectAtStart: boolean read FOpenLastProjectAtStart write FOpenLastProjectAtStart; - property OpenPackagesAtStart: boolean read FOpenPackagesAtStart - write FOpenPackagesAtStart; property FileDialogFilter: string read FFileDialogFilter write FFileDialogFilter; // backup @@ -1311,7 +1308,6 @@ begin FRecentPackageFiles:=TStringList.Create; FMaxRecentPackageFiles:=DefaultMaxRecentPackageFiles; FOpenLastProjectAtStart:=true; - FOpenPackagesAtStart:=true; // backup with FBackupInfoProjectFiles do begin @@ -1616,12 +1612,11 @@ begin FAutoSaveIntervalInSecs:=FXMLCfg.GetValue(Path+'AutoSave/IntervalInSecs',600); FLastSavedProjectFile:=FXMLCfg.GetValue(Path+'AutoSave/LastSavedProjectFile',''); FOpenLastProjectAtStart:=FXMLCfg.GetValue(Path+'AutoSave/OpenLastProjectAtStart',true); - FOpenPackagesAtStart:=FXMLCfg.GetValue(Path+'AutoSave/OpenPackagesAtStart',true); FShowCompileDialog:=FXMLCfg.GetValue(Path+'ShowCompileDialog/Value',false); FAutoCloseCompileDialog:=FXMLCfg.GetValue(Path+'AutoCloseCompileDialog/Value',false); FAutoSaveActiveDesktop:=FXMLCfg.GetValue(Path+'AutoSave/ActiveDesktop',True); FLastOpenPackages.Clear; - if FOpenPackagesAtStart then + if FOpenLastProjectAtStart then begin i := 1; repeat @@ -1946,9 +1941,8 @@ begin FXMLCfg.SetDeleteValue(Path+'AutoSave/IntervalInSecs',FAutoSaveIntervalInSecs,600); FXMLCfg.SetDeleteValue(Path+'AutoSave/LastSavedProjectFile',FLastSavedProjectFile,''); FXMLCfg.SetDeleteValue(Path+'AutoSave/OpenLastProjectAtStart',FOpenLastProjectAtStart,true); - FXMLCfg.SetDeleteValue(Path+'AutoSave/OpenPackagesAtStart',FOpenPackagesAtStart,true); FXMLCfg.SetDeleteValue(Path+'AutoSave/ActiveDesktop', FAutoSaveActiveDesktop, True); - if FOpenPackagesAtStart and (FLastOpenPackages.Count > 0) then + if FOpenLastProjectAtStart and (FLastOpenPackages.Count > 0) then begin for i := 0 to FLastOpenPackages.Count-1 do FXMLCfg.SetValue(Path+'AutoSave/LastOpenPackages/Package'+IntToStr(i+1), FLastOpenPackages[i]); diff --git a/ide/frames/files_options.lfm b/ide/frames/files_options.lfm index 19e20d8db8..18aa3db512 100644 --- a/ide/frames/files_options.lfm +++ b/ide/frames/files_options.lfm @@ -43,17 +43,16 @@ object FilesOptionsFrame: TFilesOptionsFrame Width = 195 BorderSpacing.Top = 6 Caption = 'OpenLastProjectAtStartCheckBox' - OnChange = OpenLastProjectAtStartCheckBoxChange TabOrder = 0 end object ShowCompileDialogCheckBox: TCheckBox AnchorSideLeft.Control = Owner - AnchorSideTop.Control = OpenPackagesAtStartCheckBox + AnchorSideTop.Control = OpenLastProjectAtStartCheckBox AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom Left = 2 Height = 19 - Top = 88 + Top = 69 Width = 180 BorderSpacing.Top = 2 Caption = 'ShowCompileDialogCheckBox' @@ -66,7 +65,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom Left = 2 Height = 15 - Top = 136 + Top = 117 Width = 82 BorderSpacing.Top = 10 Caption = 'LazarusDirLabel' @@ -81,7 +80,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Side = asrBottom Left = 542 Height = 23 - Top = 151 + Top = 132 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -95,7 +94,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = LazarusDirButton Left = 2 Height = 23 - Top = 151 + Top = 132 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 15 @@ -109,7 +108,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = CompilerPathButton Left = 2 Height = 23 - Top = 195 + Top = 176 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 15 @@ -124,7 +123,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Side = asrBottom Left = 542 Height = 23 - Top = 195 + Top = 176 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -137,7 +136,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom Left = 2 Height = 15 - Top = 180 + Top = 161 Width = 101 BorderSpacing.Top = 6 Caption = 'CompilerPathLabel' @@ -150,7 +149,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = FPCSourceDirButton Left = 2 Height = 23 - Top = 239 + Top = 220 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 15 @@ -165,7 +164,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Side = asrBottom Left = 542 Height = 23 - Top = 239 + Top = 220 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -178,7 +177,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom Left = 2 Height = 15 - Top = 224 + Top = 205 Width = 100 BorderSpacing.Top = 6 Caption = 'FPCSourceDirLabel' @@ -190,7 +189,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom Left = 2 Height = 15 - Top = 268 + Top = 249 Width = 81 BorderSpacing.Top = 6 Caption = 'MakePathLabel' @@ -202,7 +201,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom Left = 2 Height = 15 - Top = 312 + Top = 293 Width = 91 BorderSpacing.Top = 6 Caption = 'TestBuildDirLabel' @@ -215,7 +214,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = MakePathButton Left = 2 Height = 23 - Top = 283 + Top = 264 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 15 @@ -230,7 +229,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Side = asrBottom Left = 542 Height = 23 - Top = 283 + Top = 264 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -244,7 +243,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = TestBuildDirButton Left = 2 Height = 23 - Top = 327 + Top = 308 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 15 @@ -259,7 +258,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Side = asrBottom Left = 542 Height = 23 - Top = 327 + Top = 308 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -273,7 +272,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Side = asrBottom Left = 32 Height = 19 - Top = 107 + Top = 88 Width = 206 BorderSpacing.Left = 30 Caption = 'AutoCloseCompileDialogCheckBox' @@ -285,7 +284,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideTop.Side = asrBottom Left = 2 Height = 15 - Top = 356 + Top = 337 Width = 153 Alignment = taRightJustify BorderSpacing.Top = 6 @@ -302,7 +301,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideBottom.Side = asrBottom Left = 542 Height = 23 - Top = 371 + Top = 352 Width = 25 Anchors = [akTop, akRight, akBottom] Caption = '...' @@ -318,7 +317,7 @@ object FilesOptionsFrame: TFilesOptionsFrame AnchorSideRight.Control = CompilerTranslationFileButton Left = 2 Height = 23 - Top = 371 + Top = 352 Width = 540 Anchors = [akTop, akLeft, akRight] ItemHeight = 15 @@ -366,17 +365,4 @@ object FilesOptionsFrame: TFilesOptionsFrame BorderSpacing.Around = 2 TabOrder = 16 end - object OpenPackagesAtStartCheckBox: TCheckBox - AnchorSideLeft.Control = OpenLastProjectAtStartCheckBox - AnchorSideTop.Control = OpenLastProjectAtStartCheckBox - AnchorSideTop.Side = asrBottom - AnchorSideRight.Side = asrBottom - Left = 32 - Height = 19 - Top = 67 - Width = 186 - BorderSpacing.Left = 30 - Caption = 'OpenPackagesAtStartCheckBox' - TabOrder = 17 - end end diff --git a/ide/frames/files_options.pas b/ide/frames/files_options.pas index 5e57bca8b9..14485f722a 100644 --- a/ide/frames/files_options.pas +++ b/ide/frames/files_options.pas @@ -61,7 +61,6 @@ type MaxRecentProjectFilesSpin: TSpinEdit; MaxRecentProjectFilesLabel: TLabel; OpenLastProjectAtStartCheckBox: TCheckBox; - OpenPackagesAtStartCheckBox: TCheckBox; ShowCompileDialogCheckBox: TCheckBox; TestBuildDirButton:TButton; TestBuildDirComboBox:TComboBox; @@ -69,7 +68,6 @@ type procedure CompilerTranslationFileButtonClick(Sender:TObject); procedure FilesButtonClick(Sender: TObject); procedure DirectoriesButtonClick(Sender: TObject); - procedure OpenLastProjectAtStartCheckBoxChange(Sender: TObject); procedure ShowCompileDialogCheckBoxChange(Sender: TObject); private FOldLazarusDir: string; @@ -222,7 +220,6 @@ begin MaxRecentOpenFilesLabel.Caption:=dlgMaxRecentFiles; MaxRecentProjectFilesLabel.Caption:=dlgMaxRecentProjs; OpenLastProjectAtStartCheckBox.Caption:=dlgQOpenLastPrj; - OpenPackagesAtStartCheckBox.Caption:=dlgQOpenPackages; ShowCompileDialogCheckBox.Visible:=false; AutoCloseCompileDialogCheckBox.Visible:=false; LazarusDirLabel.Caption:=dlgLazarusDir; @@ -275,12 +272,6 @@ begin Result := dlgEnvFiles; end; -procedure TFilesOptionsFrame.OpenLastProjectAtStartCheckBoxChange( - Sender: TObject); -begin - OpenPackagesAtStartCheckBox.Enabled := OpenLastProjectAtStartCheckBox.Checked; -end; - function TFilesOptionsFrame.Check: Boolean; begin Result := False; @@ -369,7 +360,6 @@ begin // open last project at start OpenLastProjectAtStartCheckBox.Checked:=OpenLastProjectAtStart; - OpenPackagesAtStartCheckBox.Checked:=OpenPackagesAtStart; // compile dialog fOldShowCompileDialog:=ShowCompileDialog; @@ -401,7 +391,6 @@ begin MaxRecentOpenFiles := MaxRecentOpenFilesSpin.Value; MaxRecentProjectFiles := MaxRecentProjectFilesSpin.Value; OpenLastProjectAtStart:=OpenLastProjectAtStartCheckBox.Checked; - OpenPackagesAtStart:=OpenPackagesAtStartCheckBox.Checked; ShowCompileDialog := ShowCompileDialogCheckBox.Checked; AutoCloseCompileDialog := AutoCloseCompileDialogCheckBox.Checked; end; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 7e7b4dbc7c..6f0e7a27da 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1338,8 +1338,7 @@ resourcestring dlgEnvOtherFiles = 'Other Files'; dlgMaxRecentFiles = 'Max recent files'; dlgMaxRecentProjs = 'Max recent project files'; - dlgQOpenLastPrj = 'Open last project at start'; - dlgQOpenPackages = 'Open packages'; + dlgQOpenLastPrj = 'Open last project and packages at start'; dlgLazarusDir = 'Lazarus directory (default for all projects)'; dlgFpcExecutable = 'Compiler executable (e.g. %s)'; dlgFpcSrcPath = 'FPC source directory'; diff --git a/ide/main.pp b/ide/main.pp index 9bc15cf0f0..cf0be28a95 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -2221,21 +2221,18 @@ begin IDEProtocolOpts.Save; if ProjectLoaded then begin - if EnvironmentOptions.OpenPackagesAtStart then + PkgOpenFlags:=[pofAddToRecent]; + for I := 0 to EnvironmentOptions.LastOpenPackages.Count-1 do begin - PkgOpenFlags:=[pofAddToRecent]; - for I := 0 to EnvironmentOptions.LastOpenPackages.Count-1 do - begin - AFilename:=EnvironmentOptions.LastOpenPackages[I]; - if AFilename='' then - continue; - if i