[Lazarus] Desktops and multiple source editors

Ondrej Pokorny lazarus at kluug.net
Thu Sep 10 12:47:13 CEST 2015


On 10.09.2015 11:03, Mattias Gaertner wrote:
> The "most users" argument is seldom good. There are basically two 
> groups of users. Those who want a fresh IDE when starting and those 
> who want to continue where they stopped working. I don't think we need 
> another option. Keep it simple and stupid and change "Open last 
> project on start" to "Open last project and packages at start". When 
> project groups arrive this option will probably become "Open last 
> project, groups and packages at start."

I removed the extra settings as you suggested. I decided not to rename 
the variable/check box. I only changed the caption. See patch.
If you think the OpenLastProjectAtStart variable should be renamed as 
well, I am sure you can do it easily.

Ondrej
-------------- next part --------------
Index: ide/environmentopts.pp
===================================================================
--- ide/environmentopts.pp	(revision 49804)
+++ ide/environmentopts.pp	(working copy)
@@ -475,7 +475,6 @@
     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 @@
     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 @@
   FRecentPackageFiles:=TStringList.Create;
   FMaxRecentPackageFiles:=DefaultMaxRecentPackageFiles;
   FOpenLastProjectAtStart:=true;
-  FOpenPackagesAtStart:=true;
 
   // backup
   with FBackupInfoProjectFiles do begin
@@ -1616,12 +1612,11 @@
     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 @@
     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]);
Index: ide/frames/files_options.lfm
===================================================================
--- ide/frames/files_options.lfm	(revision 49804)
+++ ide/frames/files_options.lfm	(working copy)
@@ -43,17 +43,16 @@
     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 @@
     AnchorSideTop.Side = asrBottom
     Left = 2
     Height = 15
-    Top = 136
+    Top = 117
     Width = 82
     BorderSpacing.Top = 10
     Caption = 'LazarusDirLabel'
@@ -81,7 +80,7 @@
     AnchorSideBottom.Side = asrBottom
     Left = 542
     Height = 23
-    Top = 151
+    Top = 132
     Width = 25
     Anchors = [akTop, akRight, akBottom]
     Caption = '...'
@@ -95,7 +94,7 @@
     AnchorSideRight.Control = LazarusDirButton
     Left = 2
     Height = 23
-    Top = 151
+    Top = 132
     Width = 540
     Anchors = [akTop, akLeft, akRight]
     ItemHeight = 15
@@ -109,7 +108,7 @@
     AnchorSideRight.Control = CompilerPathButton
     Left = 2
     Height = 23
-    Top = 195
+    Top = 176
     Width = 540
     Anchors = [akTop, akLeft, akRight]
     ItemHeight = 15
@@ -124,7 +123,7 @@
     AnchorSideBottom.Side = asrBottom
     Left = 542
     Height = 23
-    Top = 195
+    Top = 176
     Width = 25
     Anchors = [akTop, akRight, akBottom]
     Caption = '...'
@@ -137,7 +136,7 @@
     AnchorSideTop.Side = asrBottom
     Left = 2
     Height = 15
-    Top = 180
+    Top = 161
     Width = 101
     BorderSpacing.Top = 6
     Caption = 'CompilerPathLabel'
@@ -150,7 +149,7 @@
     AnchorSideRight.Control = FPCSourceDirButton
     Left = 2
     Height = 23
-    Top = 239
+    Top = 220
     Width = 540
     Anchors = [akTop, akLeft, akRight]
     ItemHeight = 15
@@ -165,7 +164,7 @@
     AnchorSideBottom.Side = asrBottom
     Left = 542
     Height = 23
-    Top = 239
+    Top = 220
     Width = 25
     Anchors = [akTop, akRight, akBottom]
     Caption = '...'
@@ -178,7 +177,7 @@
     AnchorSideTop.Side = asrBottom
     Left = 2
     Height = 15
-    Top = 224
+    Top = 205
     Width = 100
     BorderSpacing.Top = 6
     Caption = 'FPCSourceDirLabel'
@@ -190,7 +189,7 @@
     AnchorSideTop.Side = asrBottom
     Left = 2
     Height = 15
-    Top = 268
+    Top = 249
     Width = 81
     BorderSpacing.Top = 6
     Caption = 'MakePathLabel'
@@ -202,7 +201,7 @@
     AnchorSideTop.Side = asrBottom
     Left = 2
     Height = 15
-    Top = 312
+    Top = 293
     Width = 91
     BorderSpacing.Top = 6
     Caption = 'TestBuildDirLabel'
@@ -215,7 +214,7 @@
     AnchorSideRight.Control = MakePathButton
     Left = 2
     Height = 23
-    Top = 283
+    Top = 264
     Width = 540
     Anchors = [akTop, akLeft, akRight]
     ItemHeight = 15
@@ -230,7 +229,7 @@
     AnchorSideBottom.Side = asrBottom
     Left = 542
     Height = 23
-    Top = 283
+    Top = 264
     Width = 25
     Anchors = [akTop, akRight, akBottom]
     Caption = '...'
@@ -244,7 +243,7 @@
     AnchorSideRight.Control = TestBuildDirButton
     Left = 2
     Height = 23
-    Top = 327
+    Top = 308
     Width = 540
     Anchors = [akTop, akLeft, akRight]
     ItemHeight = 15
@@ -259,7 +258,7 @@
     AnchorSideBottom.Side = asrBottom
     Left = 542
     Height = 23
-    Top = 327
+    Top = 308
     Width = 25
     Anchors = [akTop, akRight, akBottom]
     Caption = '...'
@@ -273,7 +272,7 @@
     AnchorSideRight.Side = asrBottom
     Left = 32
     Height = 19
-    Top = 107
+    Top = 88
     Width = 206
     BorderSpacing.Left = 30
     Caption = 'AutoCloseCompileDialogCheckBox'
@@ -285,7 +284,7 @@
     AnchorSideTop.Side = asrBottom
     Left = 2
     Height = 15
-    Top = 356
+    Top = 337
     Width = 153
     Alignment = taRightJustify
     BorderSpacing.Top = 6
@@ -302,7 +301,7 @@
     AnchorSideBottom.Side = asrBottom
     Left = 542
     Height = 23
-    Top = 371
+    Top = 352
     Width = 25
     Anchors = [akTop, akRight, akBottom]
     Caption = '...'
@@ -318,7 +317,7 @@
     AnchorSideRight.Control = CompilerTranslationFileButton
     Left = 2
     Height = 23
-    Top = 371
+    Top = 352
     Width = 540
     Anchors = [akTop, akLeft, akRight]
     ItemHeight = 15
@@ -366,17 +365,4 @@
     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
Index: ide/frames/files_options.pas
===================================================================
--- ide/frames/files_options.pas	(revision 49804)
+++ ide/frames/files_options.pas	(working copy)
@@ -61,7 +61,6 @@
     MaxRecentProjectFilesSpin: TSpinEdit;
     MaxRecentProjectFilesLabel: TLabel;
     OpenLastProjectAtStartCheckBox: TCheckBox;
-    OpenPackagesAtStartCheckBox: TCheckBox;
     ShowCompileDialogCheckBox: TCheckBox;
     TestBuildDirButton:TButton;
     TestBuildDirComboBox:TComboBox;
@@ -69,7 +68,6 @@
     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 @@
   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 @@
   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 @@
 
     // open last project at start
     OpenLastProjectAtStartCheckBox.Checked:=OpenLastProjectAtStart;
-    OpenPackagesAtStartCheckBox.Checked:=OpenPackagesAtStart;
 
     // compile dialog
     fOldShowCompileDialog:=ShowCompileDialog;
@@ -401,7 +391,6 @@
     MaxRecentOpenFiles := MaxRecentOpenFilesSpin.Value;
     MaxRecentProjectFiles := MaxRecentProjectFilesSpin.Value;
     OpenLastProjectAtStart:=OpenLastProjectAtStartCheckBox.Checked;
-    OpenPackagesAtStart:=OpenPackagesAtStartCheckBox.Checked;
     ShowCompileDialog := ShowCompileDialogCheckBox.Checked;
     AutoCloseCompileDialog := AutoCloseCompileDialogCheckBox.Checked;
   end;
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 49804)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -1338,8 +1338,7 @@
   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';
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 49804)
+++ ide/main.pp	(working copy)
@@ -2221,21 +2221,18 @@
         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<EnvironmentOptions.LastOpenPackages.Count-1 then
-                Include(PkgOpenFlags,pofMultiOpen)
-              else
-                Exclude(PkgOpenFlags,pofMultiOpen);
-              if PkgBoss.DoOpenPackageFile(AFilename,PkgOpenFlags,true)=mrAbort then begin
-                break;
-              end;
+            AFilename:=EnvironmentOptions.LastOpenPackages[I];
+            if AFilename='' then
+              continue;
+            if i<EnvironmentOptions.LastOpenPackages.Count-1 then
+              Include(PkgOpenFlags,pofMultiOpen)
+            else
+              Exclude(PkgOpenFlags,pofMultiOpen);
+            if PkgBoss.DoOpenPackageFile(AFilename,PkgOpenFlags,true)=mrAbort then begin
+              break;
             end;
           end;
         end else


More information about the Lazarus mailing list