IDE: merged options open last project and last packages

git-svn-id: trunk@49805 -
This commit is contained in:
mattias 2015-09-10 10:58:18 +00:00
parent 6637d69e9a
commit aebdc634cf
5 changed files with 35 additions and 70 deletions

View File

@ -475,7 +475,6 @@ type
FRecentPackageFiles: TStringList; FRecentPackageFiles: TStringList;
FMaxRecentPackageFiles: integer; FMaxRecentPackageFiles: integer;
FOpenLastProjectAtStart: boolean; FOpenLastProjectAtStart: boolean;
FOpenPackagesAtStart: boolean;
// Prevent repopulating Recent project files menu with example projects if it was already cleared up. // Prevent repopulating Recent project files menu with example projects if it was already cleared up.
FAlreadyPopulatedRecentFiles : Boolean; FAlreadyPopulatedRecentFiles : Boolean;
@ -729,8 +728,6 @@ type
property LastOpenPackages: TLastOpenPackagesList read FLastOpenPackages; property LastOpenPackages: TLastOpenPackagesList read FLastOpenPackages;
property OpenLastProjectAtStart: boolean read FOpenLastProjectAtStart property OpenLastProjectAtStart: boolean read FOpenLastProjectAtStart
write FOpenLastProjectAtStart; write FOpenLastProjectAtStart;
property OpenPackagesAtStart: boolean read FOpenPackagesAtStart
write FOpenPackagesAtStart;
property FileDialogFilter: string read FFileDialogFilter write FFileDialogFilter; property FileDialogFilter: string read FFileDialogFilter write FFileDialogFilter;
// backup // backup
@ -1311,7 +1308,6 @@ begin
FRecentPackageFiles:=TStringList.Create; FRecentPackageFiles:=TStringList.Create;
FMaxRecentPackageFiles:=DefaultMaxRecentPackageFiles; FMaxRecentPackageFiles:=DefaultMaxRecentPackageFiles;
FOpenLastProjectAtStart:=true; FOpenLastProjectAtStart:=true;
FOpenPackagesAtStart:=true;
// backup // backup
with FBackupInfoProjectFiles do begin with FBackupInfoProjectFiles do begin
@ -1616,12 +1612,11 @@ begin
FAutoSaveIntervalInSecs:=FXMLCfg.GetValue(Path+'AutoSave/IntervalInSecs',600); FAutoSaveIntervalInSecs:=FXMLCfg.GetValue(Path+'AutoSave/IntervalInSecs',600);
FLastSavedProjectFile:=FXMLCfg.GetValue(Path+'AutoSave/LastSavedProjectFile',''); FLastSavedProjectFile:=FXMLCfg.GetValue(Path+'AutoSave/LastSavedProjectFile','');
FOpenLastProjectAtStart:=FXMLCfg.GetValue(Path+'AutoSave/OpenLastProjectAtStart',true); FOpenLastProjectAtStart:=FXMLCfg.GetValue(Path+'AutoSave/OpenLastProjectAtStart',true);
FOpenPackagesAtStart:=FXMLCfg.GetValue(Path+'AutoSave/OpenPackagesAtStart',true);
FShowCompileDialog:=FXMLCfg.GetValue(Path+'ShowCompileDialog/Value',false); FShowCompileDialog:=FXMLCfg.GetValue(Path+'ShowCompileDialog/Value',false);
FAutoCloseCompileDialog:=FXMLCfg.GetValue(Path+'AutoCloseCompileDialog/Value',false); FAutoCloseCompileDialog:=FXMLCfg.GetValue(Path+'AutoCloseCompileDialog/Value',false);
FAutoSaveActiveDesktop:=FXMLCfg.GetValue(Path+'AutoSave/ActiveDesktop',True); FAutoSaveActiveDesktop:=FXMLCfg.GetValue(Path+'AutoSave/ActiveDesktop',True);
FLastOpenPackages.Clear; FLastOpenPackages.Clear;
if FOpenPackagesAtStart then if FOpenLastProjectAtStart then
begin begin
i := 1; i := 1;
repeat repeat
@ -1946,9 +1941,8 @@ begin
FXMLCfg.SetDeleteValue(Path+'AutoSave/IntervalInSecs',FAutoSaveIntervalInSecs,600); FXMLCfg.SetDeleteValue(Path+'AutoSave/IntervalInSecs',FAutoSaveIntervalInSecs,600);
FXMLCfg.SetDeleteValue(Path+'AutoSave/LastSavedProjectFile',FLastSavedProjectFile,''); FXMLCfg.SetDeleteValue(Path+'AutoSave/LastSavedProjectFile',FLastSavedProjectFile,'');
FXMLCfg.SetDeleteValue(Path+'AutoSave/OpenLastProjectAtStart',FOpenLastProjectAtStart,true); FXMLCfg.SetDeleteValue(Path+'AutoSave/OpenLastProjectAtStart',FOpenLastProjectAtStart,true);
FXMLCfg.SetDeleteValue(Path+'AutoSave/OpenPackagesAtStart',FOpenPackagesAtStart,true);
FXMLCfg.SetDeleteValue(Path+'AutoSave/ActiveDesktop', FAutoSaveActiveDesktop, True); FXMLCfg.SetDeleteValue(Path+'AutoSave/ActiveDesktop', FAutoSaveActiveDesktop, True);
if FOpenPackagesAtStart and (FLastOpenPackages.Count > 0) then if FOpenLastProjectAtStart and (FLastOpenPackages.Count > 0) then
begin begin
for i := 0 to FLastOpenPackages.Count-1 do for i := 0 to FLastOpenPackages.Count-1 do
FXMLCfg.SetValue(Path+'AutoSave/LastOpenPackages/Package'+IntToStr(i+1), FLastOpenPackages[i]); FXMLCfg.SetValue(Path+'AutoSave/LastOpenPackages/Package'+IntToStr(i+1), FLastOpenPackages[i]);

View File

@ -43,17 +43,16 @@ object FilesOptionsFrame: TFilesOptionsFrame
Width = 195 Width = 195
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'OpenLastProjectAtStartCheckBox' Caption = 'OpenLastProjectAtStartCheckBox'
OnChange = OpenLastProjectAtStartCheckBoxChange
TabOrder = 0 TabOrder = 0
end end
object ShowCompileDialogCheckBox: TCheckBox object ShowCompileDialogCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = OpenPackagesAtStartCheckBox AnchorSideTop.Control = OpenLastProjectAtStartCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 2 Left = 2
Height = 19 Height = 19
Top = 88 Top = 69
Width = 180 Width = 180
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Caption = 'ShowCompileDialogCheckBox' Caption = 'ShowCompileDialogCheckBox'
@ -66,7 +65,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 2 Left = 2
Height = 15 Height = 15
Top = 136 Top = 117
Width = 82 Width = 82
BorderSpacing.Top = 10 BorderSpacing.Top = 10
Caption = 'LazarusDirLabel' Caption = 'LazarusDirLabel'
@ -81,7 +80,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 542 Left = 542
Height = 23 Height = 23
Top = 151 Top = 132
Width = 25 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
Caption = '...' Caption = '...'
@ -95,7 +94,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = LazarusDirButton AnchorSideRight.Control = LazarusDirButton
Left = 2 Left = 2
Height = 23 Height = 23
Top = 151 Top = 132
Width = 540 Width = 540
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 15 ItemHeight = 15
@ -109,7 +108,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = CompilerPathButton AnchorSideRight.Control = CompilerPathButton
Left = 2 Left = 2
Height = 23 Height = 23
Top = 195 Top = 176
Width = 540 Width = 540
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 15 ItemHeight = 15
@ -124,7 +123,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 542 Left = 542
Height = 23 Height = 23
Top = 195 Top = 176
Width = 25 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
Caption = '...' Caption = '...'
@ -137,7 +136,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 2 Left = 2
Height = 15 Height = 15
Top = 180 Top = 161
Width = 101 Width = 101
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'CompilerPathLabel' Caption = 'CompilerPathLabel'
@ -150,7 +149,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = FPCSourceDirButton AnchorSideRight.Control = FPCSourceDirButton
Left = 2 Left = 2
Height = 23 Height = 23
Top = 239 Top = 220
Width = 540 Width = 540
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 15 ItemHeight = 15
@ -165,7 +164,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 542 Left = 542
Height = 23 Height = 23
Top = 239 Top = 220
Width = 25 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
Caption = '...' Caption = '...'
@ -178,7 +177,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 2 Left = 2
Height = 15 Height = 15
Top = 224 Top = 205
Width = 100 Width = 100
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'FPCSourceDirLabel' Caption = 'FPCSourceDirLabel'
@ -190,7 +189,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 2 Left = 2
Height = 15 Height = 15
Top = 268 Top = 249
Width = 81 Width = 81
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'MakePathLabel' Caption = 'MakePathLabel'
@ -202,7 +201,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 2 Left = 2
Height = 15 Height = 15
Top = 312 Top = 293
Width = 91 Width = 91
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'TestBuildDirLabel' Caption = 'TestBuildDirLabel'
@ -215,7 +214,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = MakePathButton AnchorSideRight.Control = MakePathButton
Left = 2 Left = 2
Height = 23 Height = 23
Top = 283 Top = 264
Width = 540 Width = 540
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 15 ItemHeight = 15
@ -230,7 +229,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 542 Left = 542
Height = 23 Height = 23
Top = 283 Top = 264
Width = 25 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
Caption = '...' Caption = '...'
@ -244,7 +243,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = TestBuildDirButton AnchorSideRight.Control = TestBuildDirButton
Left = 2 Left = 2
Height = 23 Height = 23
Top = 327 Top = 308
Width = 540 Width = 540
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 15 ItemHeight = 15
@ -259,7 +258,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 542 Left = 542
Height = 23 Height = 23
Top = 327 Top = 308
Width = 25 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
Caption = '...' Caption = '...'
@ -273,7 +272,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 32 Left = 32
Height = 19 Height = 19
Top = 107 Top = 88
Width = 206 Width = 206
BorderSpacing.Left = 30 BorderSpacing.Left = 30
Caption = 'AutoCloseCompileDialogCheckBox' Caption = 'AutoCloseCompileDialogCheckBox'
@ -285,7 +284,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 2 Left = 2
Height = 15 Height = 15
Top = 356 Top = 337
Width = 153 Width = 153
Alignment = taRightJustify Alignment = taRightJustify
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -302,7 +301,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 542 Left = 542
Height = 23 Height = 23
Top = 371 Top = 352
Width = 25 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
Caption = '...' Caption = '...'
@ -318,7 +317,7 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = CompilerTranslationFileButton AnchorSideRight.Control = CompilerTranslationFileButton
Left = 2 Left = 2
Height = 23 Height = 23
Top = 371 Top = 352
Width = 540 Width = 540
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 15 ItemHeight = 15
@ -366,17 +365,4 @@ object FilesOptionsFrame: TFilesOptionsFrame
BorderSpacing.Around = 2 BorderSpacing.Around = 2
TabOrder = 16 TabOrder = 16
end 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 end

View File

@ -61,7 +61,6 @@ type
MaxRecentProjectFilesSpin: TSpinEdit; MaxRecentProjectFilesSpin: TSpinEdit;
MaxRecentProjectFilesLabel: TLabel; MaxRecentProjectFilesLabel: TLabel;
OpenLastProjectAtStartCheckBox: TCheckBox; OpenLastProjectAtStartCheckBox: TCheckBox;
OpenPackagesAtStartCheckBox: TCheckBox;
ShowCompileDialogCheckBox: TCheckBox; ShowCompileDialogCheckBox: TCheckBox;
TestBuildDirButton:TButton; TestBuildDirButton:TButton;
TestBuildDirComboBox:TComboBox; TestBuildDirComboBox:TComboBox;
@ -69,7 +68,6 @@ type
procedure CompilerTranslationFileButtonClick(Sender:TObject); procedure CompilerTranslationFileButtonClick(Sender:TObject);
procedure FilesButtonClick(Sender: TObject); procedure FilesButtonClick(Sender: TObject);
procedure DirectoriesButtonClick(Sender: TObject); procedure DirectoriesButtonClick(Sender: TObject);
procedure OpenLastProjectAtStartCheckBoxChange(Sender: TObject);
procedure ShowCompileDialogCheckBoxChange(Sender: TObject); procedure ShowCompileDialogCheckBoxChange(Sender: TObject);
private private
FOldLazarusDir: string; FOldLazarusDir: string;
@ -222,7 +220,6 @@ begin
MaxRecentOpenFilesLabel.Caption:=dlgMaxRecentFiles; MaxRecentOpenFilesLabel.Caption:=dlgMaxRecentFiles;
MaxRecentProjectFilesLabel.Caption:=dlgMaxRecentProjs; MaxRecentProjectFilesLabel.Caption:=dlgMaxRecentProjs;
OpenLastProjectAtStartCheckBox.Caption:=dlgQOpenLastPrj; OpenLastProjectAtStartCheckBox.Caption:=dlgQOpenLastPrj;
OpenPackagesAtStartCheckBox.Caption:=dlgQOpenPackages;
ShowCompileDialogCheckBox.Visible:=false; ShowCompileDialogCheckBox.Visible:=false;
AutoCloseCompileDialogCheckBox.Visible:=false; AutoCloseCompileDialogCheckBox.Visible:=false;
LazarusDirLabel.Caption:=dlgLazarusDir; LazarusDirLabel.Caption:=dlgLazarusDir;
@ -275,12 +272,6 @@ begin
Result := dlgEnvFiles; Result := dlgEnvFiles;
end; end;
procedure TFilesOptionsFrame.OpenLastProjectAtStartCheckBoxChange(
Sender: TObject);
begin
OpenPackagesAtStartCheckBox.Enabled := OpenLastProjectAtStartCheckBox.Checked;
end;
function TFilesOptionsFrame.Check: Boolean; function TFilesOptionsFrame.Check: Boolean;
begin begin
Result := False; Result := False;
@ -369,7 +360,6 @@ begin
// open last project at start // open last project at start
OpenLastProjectAtStartCheckBox.Checked:=OpenLastProjectAtStart; OpenLastProjectAtStartCheckBox.Checked:=OpenLastProjectAtStart;
OpenPackagesAtStartCheckBox.Checked:=OpenPackagesAtStart;
// compile dialog // compile dialog
fOldShowCompileDialog:=ShowCompileDialog; fOldShowCompileDialog:=ShowCompileDialog;
@ -401,7 +391,6 @@ begin
MaxRecentOpenFiles := MaxRecentOpenFilesSpin.Value; MaxRecentOpenFiles := MaxRecentOpenFilesSpin.Value;
MaxRecentProjectFiles := MaxRecentProjectFilesSpin.Value; MaxRecentProjectFiles := MaxRecentProjectFilesSpin.Value;
OpenLastProjectAtStart:=OpenLastProjectAtStartCheckBox.Checked; OpenLastProjectAtStart:=OpenLastProjectAtStartCheckBox.Checked;
OpenPackagesAtStart:=OpenPackagesAtStartCheckBox.Checked;
ShowCompileDialog := ShowCompileDialogCheckBox.Checked; ShowCompileDialog := ShowCompileDialogCheckBox.Checked;
AutoCloseCompileDialog := AutoCloseCompileDialogCheckBox.Checked; AutoCloseCompileDialog := AutoCloseCompileDialogCheckBox.Checked;
end; end;

View File

@ -1338,8 +1338,7 @@ resourcestring
dlgEnvOtherFiles = 'Other Files'; dlgEnvOtherFiles = 'Other Files';
dlgMaxRecentFiles = 'Max recent files'; dlgMaxRecentFiles = 'Max recent files';
dlgMaxRecentProjs = 'Max recent project files'; dlgMaxRecentProjs = 'Max recent project files';
dlgQOpenLastPrj = 'Open last project at start'; dlgQOpenLastPrj = 'Open last project and packages at start';
dlgQOpenPackages = 'Open packages';
dlgLazarusDir = 'Lazarus directory (default for all projects)'; dlgLazarusDir = 'Lazarus directory (default for all projects)';
dlgFpcExecutable = 'Compiler executable (e.g. %s)'; dlgFpcExecutable = 'Compiler executable (e.g. %s)';
dlgFpcSrcPath = 'FPC source directory'; dlgFpcSrcPath = 'FPC source directory';

View File

@ -2221,21 +2221,18 @@ begin
IDEProtocolOpts.Save; IDEProtocolOpts.Save;
if ProjectLoaded then if ProjectLoaded then
begin begin
if EnvironmentOptions.OpenPackagesAtStart then PkgOpenFlags:=[pofAddToRecent];
for I := 0 to EnvironmentOptions.LastOpenPackages.Count-1 do
begin begin
PkgOpenFlags:=[pofAddToRecent]; AFilename:=EnvironmentOptions.LastOpenPackages[I];
for I := 0 to EnvironmentOptions.LastOpenPackages.Count-1 do if AFilename='' then
begin continue;
AFilename:=EnvironmentOptions.LastOpenPackages[I]; if i<EnvironmentOptions.LastOpenPackages.Count-1 then
if AFilename='' then Include(PkgOpenFlags,pofMultiOpen)
continue; else
if i<EnvironmentOptions.LastOpenPackages.Count-1 then Exclude(PkgOpenFlags,pofMultiOpen);
Include(PkgOpenFlags,pofMultiOpen) if PkgBoss.DoOpenPackageFile(AFilename,PkgOpenFlags,true)=mrAbort then begin
else break;
Exclude(PkgOpenFlags,pofMultiOpen);
if PkgBoss.DoOpenPackageFile(AFilename,PkgOpenFlags,true)=mrAbort then begin
break;
end;
end; end;
end; end;
end else end else