IDE: Options page to specify type of project created on startup + other startup options. Issue #38105.

git-svn-id: trunk@64781 -
This commit is contained in:
juha 2021-03-10 19:53:06 +00:00
parent 207dee8890
commit 63fc1a91aa
11 changed files with 421 additions and 176 deletions

2
.gitattributes vendored
View File

@ -7480,6 +7480,8 @@ ide/frames/help_general_options.lfm svneol=native#text/plain
ide/frames/help_general_options.pas svneol=native#text/plain
ide/frames/idecoolbar_options.lfm svneol=native#text/plain
ide/frames/idecoolbar_options.pas svneol=native#text/pascal
ide/frames/idestartup_options.lfm svneol=native#text/plain
ide/frames/idestartup_options.pas svneol=native#text/pascal
ide/frames/modematrixctrl.pas svneol=native#text/plain
ide/frames/msgwnd_options.lfm svneol=native#text/plain
ide/frames/msgwnd_options.pas svneol=native#text/plain

View File

@ -161,6 +161,7 @@ const
EnvOptionsOI = 500;
EnvOptionsMessages = 550;
EnvOptionsFpDoc = 600;
EnvOptionsIdeStartup = 650;
EnvOptionsBackup = 700;
EnvOptionsNaming = 800;
EnvOptionsFileFilters = 900;

View File

@ -681,6 +681,7 @@ type
FRecentPackageFiles: TStringList;
FMaxRecentPackageFiles: integer;
FOpenLastProjectAtStart: boolean;
FNewProjectTemplateAtStart: string;
FMultipleInstances: TIDEMultipleInstancesOption;
// Prevent repopulating Recent project files menu with example projects if it was already cleared up.
FAlreadyPopulatedRecentFiles : Boolean;
@ -979,6 +980,8 @@ type
property LastOpenPackages: TLastOpenPackagesList read FLastOpenPackages;
property OpenLastProjectAtStart: boolean read FOpenLastProjectAtStart
write FOpenLastProjectAtStart;
property NewProjectTemplateAtStart: string read FNewProjectTemplateAtStart
write FNewProjectTemplateAtStart;
property MultipleInstances: TIDEMultipleInstancesOption read FMultipleInstances
write FMultipleInstances;
property FileDialogFilter: string read FFileDialogFilter write FFileDialogFilter;
@ -2576,6 +2579,7 @@ begin
FAutoSaveIntervalInSecs:=FXMLCfg.GetValue(Path+'AutoSave/IntervalInSecs',DefaultAutoSaveIntervalInSecs);
FLastSavedProjectFile:=FXMLCfg.GetValue(Path+'AutoSave/LastSavedProjectFile','');
FOpenLastProjectAtStart:=FXMLCfg.GetValue(Path+'AutoSave/OpenLastProjectAtStart',true);
FNewProjectTemplateAtStart:=FXMLCfg.GetValue(Path+'NewProjectTemplateAtStart/Value','Application');
FShowCompileDialog:=FXMLCfg.GetValue(Path+'ShowCompileDialog/Value',false);
FAutoCloseCompileDialog:=FXMLCfg.GetValue(Path+'AutoCloseCompileDialog/Value',false);
FAutoSaveActiveDesktop:=FXMLCfg.GetValue(Path+'AutoSave/ActiveDesktop',True);
@ -2951,6 +2955,8 @@ begin
FXMLCfg.SetDeleteValue(Path+'AutoSave/IntervalInSecs',FAutoSaveIntervalInSecs,DefaultAutoSaveIntervalInSecs);
FXMLCfg.SetDeleteValue(Path+'AutoSave/LastSavedProjectFile',FLastSavedProjectFile,'');
FXMLCfg.SetDeleteValue(Path+'AutoSave/OpenLastProjectAtStart',FOpenLastProjectAtStart,true);
FXMLCfg.SetDeleteValue(Path+'NewProjectTemplateAtStart/Value',FNewProjectTemplateAtStart,'Application');
FXMLCfg.SetDeleteValue(Path+'AutoSave/ActiveDesktop', FAutoSaveActiveDesktop, True);
FXMLCfg.DeletePath(Path+'AutoSave/LastOpenPackages/');
if FOpenLastProjectAtStart then

View File

@ -18,7 +18,7 @@
* *
***************************************************************************
}
unit desktop_options;
unit Desktop_Options;
{$mode objfpc}{$H+}

View File

@ -15,9 +15,9 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 2
Height = 15
Height = 18
Top = 2
Width = 139
Width = 161
Caption = 'MaxRecentOpenFilesLabel'
ParentColor = False
end
@ -25,48 +25,35 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideLeft.Control = lblCenter
AnchorSideTop.Control = Owner
Left = 314
Height = 15
Height = 18
Top = 2
Width = 147
Width = 170
BorderSpacing.Left = 3
Caption = 'MaxRecentProjectFilesLabel'
ParentColor = False
end
object OpenLastProjectAtStartCheckBox: TCheckBox
object ShowCompileDialogCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = MaxRecentOpenFilesSpin
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 2
Height = 19
Top = 48
Width = 196
BorderSpacing.Top = 6
Caption = 'OpenLastProjectAtStartCheckBox'
TabOrder = 2
end
object ShowCompileDialogCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = MultipleInstancesComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 2
Height = 19
Top = 94
Width = 181
BorderSpacing.Top = 2
Height = 22
Top = 65
Width = 211
BorderSpacing.Top = 11
Caption = 'ShowCompileDialogCheckBox'
OnChange = ShowCompileDialogCheckBoxChange
TabOrder = 4
TabOrder = 2
end
object LazarusDirLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = AutoCloseCompileDialogCheckBox
AnchorSideTop.Side = asrBottom
Left = 2
Height = 15
Top = 142
Width = 82
Height = 18
Top = 119
Width = 98
BorderSpacing.Top = 10
Caption = 'LazarusDirLabel'
ParentColor = False
@ -79,13 +66,13 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Control = LazarusDirComboBox
AnchorSideBottom.Side = asrBottom
Left = 597
Height = 23
Top = 157
Height = 32
Top = 137
Width = 23
Anchors = [akTop, akRight, akBottom]
Caption = '...'
OnClick = DirectoriesButtonClick
TabOrder = 7
TabOrder = 5
end
object LazarusDirComboBox: TComboBox
AnchorSideLeft.Control = Owner
@ -93,12 +80,12 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = LazarusDirButton
Left = 2
Height = 23
Top = 157
Height = 32
Top = 137
Width = 595
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
TabOrder = 6
ItemHeight = 24
TabOrder = 4
Text = 'LazarusDirComboBox'
end
object CompilerPathComboBox: TComboBox
@ -107,12 +94,12 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CompilerPathButton
Left = 2
Height = 23
Top = 201
Height = 32
Top = 193
Width = 595
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
TabOrder = 8
ItemHeight = 24
TabOrder = 6
Text = 'CompilerPathComboBox'
end
object CompilerPathButton: TButton
@ -122,22 +109,22 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Control = CompilerPathComboBox
AnchorSideBottom.Side = asrBottom
Left = 597
Height = 23
Top = 201
Height = 32
Top = 193
Width = 23
Anchors = [akTop, akRight, akBottom]
Caption = '...'
OnClick = FilesButtonClick
TabOrder = 9
TabOrder = 7
end
object CompilerPathLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = LazarusDirComboBox
AnchorSideTop.Side = asrBottom
Left = 2
Height = 15
Top = 186
Width = 101
Height = 18
Top = 175
Width = 117
BorderSpacing.Top = 6
Caption = 'CompilerPathLabel'
ParentColor = False
@ -148,12 +135,12 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = FPCSourceDirButton
Left = 2
Height = 23
Top = 245
Height = 32
Top = 249
Width = 595
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
TabOrder = 10
ItemHeight = 24
TabOrder = 8
Text = 'FPCSourceDirComboBox'
end
object FPCSourceDirButton: TButton
@ -163,22 +150,22 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Control = FPCSourceDirComboBox
AnchorSideBottom.Side = asrBottom
Left = 597
Height = 23
Top = 245
Height = 32
Top = 249
Width = 23
Anchors = [akTop, akRight, akBottom]
Caption = '...'
OnClick = DirectoriesButtonClick
TabOrder = 11
TabOrder = 9
end
object FPCSourceDirLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CompilerPathComboBox
AnchorSideTop.Side = asrBottom
Left = 2
Height = 15
Top = 230
Width = 100
Height = 18
Top = 231
Width = 116
BorderSpacing.Top = 6
Caption = 'FPCSourceDirLabel'
ParentColor = False
@ -188,9 +175,9 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Control = FPCSourceDirComboBox
AnchorSideTop.Side = asrBottom
Left = 2
Height = 15
Top = 274
Width = 81
Height = 18
Top = 287
Width = 94
BorderSpacing.Top = 6
Caption = 'MakePathLabel'
ParentColor = False
@ -200,9 +187,9 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Control = MakePathComboBox
AnchorSideTop.Side = asrBottom
Left = 2
Height = 15
Top = 318
Width = 90
Height = 18
Top = 343
Width = 107
BorderSpacing.Top = 6
Caption = 'TestBuildDirLabel'
ParentColor = False
@ -213,12 +200,12 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = MakePathButton
Left = 2
Height = 23
Top = 289
Height = 32
Top = 305
Width = 595
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
TabOrder = 12
ItemHeight = 24
TabOrder = 10
Text = 'MakePathComboBox'
end
object MakePathButton: TButton
@ -228,13 +215,13 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Control = MakePathComboBox
AnchorSideBottom.Side = asrBottom
Left = 597
Height = 23
Top = 289
Height = 32
Top = 305
Width = 23
Anchors = [akTop, akRight, akBottom]
Caption = '...'
OnClick = FilesButtonClick
TabOrder = 13
TabOrder = 11
end
object TestBuildDirComboBox: TComboBox
AnchorSideLeft.Control = Owner
@ -242,12 +229,12 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TestBuildDirButton
Left = 2
Height = 23
Top = 333
Height = 32
Top = 361
Width = 595
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
TabOrder = 14
ItemHeight = 24
TabOrder = 12
Text = 'TestBuildDirComboBox'
end
object TestBuildDirButton: TButton
@ -257,13 +244,13 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Control = TestBuildDirComboBox
AnchorSideBottom.Side = asrBottom
Left = 597
Height = 23
Top = 333
Height = 32
Top = 361
Width = 23
Anchors = [akTop, akRight, akBottom]
Caption = '...'
OnClick = DirectoriesButtonClick
TabOrder = 15
TabOrder = 13
end
object AutoCloseCompileDialogCheckBox: TCheckBox
AnchorSideLeft.Control = ShowCompileDialogCheckBox
@ -271,21 +258,21 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 32
Height = 19
Top = 113
Width = 207
Height = 22
Top = 87
Width = 239
BorderSpacing.Left = 30
Caption = 'AutoCloseCompileDialogCheckBox'
TabOrder = 5
TabOrder = 3
end
object CompilerTranslationFileLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = TestBuildDirComboBox
AnchorSideTop.Side = asrBottom
Left = 2
Height = 15
Top = 362
Width = 152
Height = 18
Top = 399
Width = 177
Alignment = taRightJustify
BorderSpacing.Top = 6
Caption = 'CompilerTranslationFileLabel'
@ -300,15 +287,15 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Control = CompilerTranslationFileComboBox
AnchorSideBottom.Side = asrBottom
Left = 597
Height = 23
Top = 377
Height = 32
Top = 417
Width = 23
Anchors = [akTop, akRight, akBottom]
Caption = '...'
OnClick = CompilerTranslationFileButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 17
TabOrder = 15
end
object CompilerTranslationFileComboBox: TComboBox
AnchorSideLeft.Control = Owner
@ -316,14 +303,14 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CompilerTranslationFileButton
Left = 2
Height = 23
Top = 377
Height = 32
Top = 417
Width = 595
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
ItemHeight = 24
ParentShowHint = False
ShowHint = True
TabOrder = 16
TabOrder = 14
Text = 'CompilerTranslationFileComboBox'
end
object lblCenter: TLabel
@ -342,9 +329,9 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = lblCenter
AnchorSideRight.Side = asrBottom
Left = 2
Height = 23
Height = 32
Hint = 'Value 0 means unlimited.'
Top = 19
Top = 22
Width = 305
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 3
@ -360,9 +347,9 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 316
Height = 23
Height = 32
Hint = 'Value 0 means unlimited.'
Top = 19
Top = 22
Width = 304
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 3
@ -371,43 +358,14 @@ object FilesOptionsFrame: TFilesOptionsFrame
ShowHint = True
TabOrder = 1
end
object MultipleInstancesLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = MultipleInstancesComboBox
AnchorSideTop.Side = asrCenter
Left = 2
Height = 15
Top = 73
Width = 121
Caption = 'MultipleInstancesLabel'
ParentColor = False
end
object MultipleInstancesComboBox: TComboBox
AnchorSideLeft.Control = MultipleInstancesLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = OpenLastProjectAtStartCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 131
Height = 23
Top = 69
Width = 489
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
ItemHeight = 15
Style = csDropDownList
TabOrder = 3
end
object FppkgConfigurationFileLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CompilerTranslationFileComboBox
AnchorSideTop.Side = asrBottom
Left = 2
Height = 15
Top = 406
Width = 153
Height = 18
Top = 455
Width = 176
Alignment = taRightJustify
BorderSpacing.Top = 6
Caption = 'FppkgConfigurationFileLabel'
@ -421,14 +379,14 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = FppkgConfigurationFileButton
Left = 2
Height = 23
Top = 421
Height = 32
Top = 473
Width = 595
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
ItemHeight = 24
ParentShowHint = False
ShowHint = True
TabOrder = 18
TabOrder = 16
Text = 'FppkgConfigurationFileComboBox'
end
object FppkgConfigurationFileButton: TButton
@ -438,14 +396,14 @@ object FilesOptionsFrame: TFilesOptionsFrame
AnchorSideBottom.Control = FppkgConfigurationFileComboBox
AnchorSideBottom.Side = asrBottom
Left = 597
Height = 23
Top = 421
Height = 32
Top = 473
Width = 23
Anchors = [akTop, akRight, akBottom]
Caption = '...'
OnClick = FilesButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 19
TabOrder = 17
end
end

View File

@ -22,7 +22,7 @@
Frame for environment options for main paths, like
Lazarus directory, compiler path.
}
unit files_options;
unit Files_Options;
{$mode objfpc}{$H+}
@ -49,7 +49,6 @@ type
TFilesOptionsFrame = class(TAbstractIDEOptionsEditor)
AutoCloseCompileDialogCheckBox: TCheckBox;
MultipleInstancesComboBox: TComboBox;
CompilerTranslationFileButton:TButton;
CompilerTranslationFileComboBox:TComboBox;
CompilerTranslationFileLabel:TLabel;
@ -59,7 +58,6 @@ type
FPCSourceDirButton:TButton;
FPCSourceDirComboBox:TComboBox;
FPCSourceDirLabel:TLabel;
MultipleInstancesLabel: TLabel;
lblCenter: TLabel;
LazarusDirButton:TButton;
LazarusDirComboBox:TComboBox;
@ -71,7 +69,6 @@ type
MaxRecentOpenFilesLabel: TLabel;
MaxRecentProjectFilesSpin: TSpinEdit;
MaxRecentProjectFilesLabel: TLabel;
OpenLastProjectAtStartCheckBox: TCheckBox;
ShowCompileDialogCheckBox: TCheckBox;
TestBuildDirButton:TButton;
TestBuildDirComboBox:TComboBox;
@ -99,7 +96,6 @@ type
fOldFppkcConfigurationFilename: string;
FOldMaxRecentOpenFiles: integer;
FOldMaxRecentProjectFiles: integer;
FOldOpenLastProjectAtStart: boolean;
fOldShowCompileDialog: boolean;
fOldAutoCloseCompileDialog: boolean;
function CheckLazarusDir(Buttons: TMsgDlgButtons): boolean;
@ -109,7 +105,6 @@ type
function CheckMake: boolean;
function CheckFPCMsgFile: boolean;
public
constructor Create(AOwner: TComponent); override;
function Check: Boolean; override;
function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
@ -280,7 +275,6 @@ begin
MaxRecentOpenFilesLabel.Hint:=dlgMaxRecentHint;
MaxRecentProjectFilesLabel.Caption:=dlgMaxRecentProjs;
MaxRecentProjectFilesLabel.Hint:=dlgMaxRecentHint;
OpenLastProjectAtStartCheckBox.Caption:=dlgQOpenLastPrj;
ShowCompileDialogCheckBox.Visible:=false;
AutoCloseCompileDialogCheckBox.Visible:=false;
LazarusDirLabel.Caption:=dlgLazarusDir;
@ -290,16 +284,6 @@ begin
Add(ProgramDirectoryWithBundle);
EndUpdate;
end;
MultipleInstancesLabel.Caption := dlgMultipleInstances;
with MultipleInstancesComboBox.Items do
begin
BeginUpdate;
Add(dlgMultipleInstances_AlwaysStartNew);
Add(dlgMultipleInstances_OpenFilesInRunning);
Add(dlgMultipleInstances_ForceSingleInstance);
EndUpdate;
end;
Assert(MultipleInstancesComboBox.Items.Count = Ord(High(TIDEMultipleInstancesOption))+1);
CompilerPathLabel.Caption:=Format(dlgFpcExecutable,[GetDefaultCompilerFilename]);
FPCSourceDirLabel.Caption:=dlgFpcSrcPath;
@ -436,12 +420,6 @@ begin
MaxRecentOpenFilesSpin.Value := MaxRecentOpenFiles;
FOldMaxRecentProjectFiles := MaxRecentProjectFiles;
MaxRecentProjectFilesSpin.Value := MaxRecentProjectFiles;
FOldOpenLastProjectAtStart := OpenLastProjectAtStart;
// open last project at start
OpenLastProjectAtStartCheckBox.Checked:=OpenLastProjectAtStart;
MultipleInstancesComboBox.ItemIndex := Ord(MultipleInstances);
// compile dialog
fOldShowCompileDialog:=ShowCompileDialog;
@ -474,8 +452,6 @@ begin
// recent files and directories
MaxRecentOpenFiles := MaxRecentOpenFilesSpin.Value;
MaxRecentProjectFiles := MaxRecentProjectFilesSpin.Value;
OpenLastProjectAtStart:=OpenLastProjectAtStartCheckBox.Checked;
MultipleInstances := TIDEMultipleInstancesOption(MultipleInstancesComboBox.ItemIndex);
ShowCompileDialog := ShowCompileDialogCheckBox.Checked;
AutoCloseCompileDialog := AutoCloseCompileDialogCheckBox.Checked;
end;
@ -497,7 +473,6 @@ begin
// recent files and directories
MaxRecentOpenFiles := FOldMaxRecentOpenFiles;
MaxRecentProjectFiles := FOldMaxRecentProjectFiles;
OpenLastProjectAtStart := FOldOpenLastProjectAtStart;
ShowCompileDialog := fOldShowCompileDialog;
AutoCloseCompileDialog := fOldAutoCloseCompileDialog;
end;
@ -620,11 +595,6 @@ begin
Result:=true;
end;
constructor TFilesOptionsFrame.Create(AOwner: TComponent); // ~bk to be removed
begin
inherited Create(AOwner);
end;
class function TFilesOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result := TEnvironmentOptions;

View File

@ -0,0 +1,108 @@
object IdeStartupFrame: TIdeStartupFrame
Left = 0
Height = 470
Top = 0
Width = 589
ClientHeight = 470
ClientWidth = 589
TabOrder = 0
DesignLeft = 317
DesignTop = 418
object OpenLastProjectAtStartCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = lblProjectToOpen
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 6
Height = 22
Top = 91
Width = 231
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'OpenLastProjectAtStartCheckBox'
OnChange = OpenLastProjectAtStartCheckBoxChange
TabOrder = 0
end
object lblFileAssociation: TDividerBevel
AnchorSideTop.Control = Owner
Left = 0
Height = 18
Top = 0
Width = 597
Caption = 'Using File Association in OS'
Anchors = [akLeft, akRight]
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object lblProjectToOpen: TDividerBevel
AnchorSideTop.Control = MultipleInstancesComboBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 18
Top = 67
Width = 597
Caption = 'Project to Open or Create'
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 11
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object LazarusInstancesLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = MultipleInstancesComboBox
AnchorSideTop.Side = asrCenter
Left = 1
Height = 18
Top = 31
Width = 139
BorderSpacing.Left = 1
Caption = 'LazarusInstancesLabel'
ParentColor = False
end
object MultipleInstancesComboBox: TComboBox
AnchorSideLeft.Control = LazarusInstancesLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblFileAssociation
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 148
Height = 32
Top = 24
Width = 441
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 6
ItemHeight = 18
Style = csDropDownList
TabOrder = 1
end
object ProjectTypeRG: TRadioGroup
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = OpenLastProjectAtStartCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 1
Height = 348
Top = 122
Width = 588
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
BorderSpacing.Left = 1
BorderSpacing.Top = 9
Caption = 'New Project Type'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
TabOrder = 2
end
end

View File

@ -0,0 +1,170 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
* *
***************************************************************************
Abtract:
Frame for environment options for new projects.
}
unit IdeStartup_Options;
{$mode ObjFPC}{$H+}
interface
uses
SysUtils,
// LCL
StdCtrls, Dialogs, Controls, Spin, CheckLst, ExtCtrls,
// LazUtils
FileUtil, LazFileUtils, LazLoggerBase,
// IDE
EnvironmentOpts,
// CodeTools
CodeToolManager, DefineTemplates,
// BuildIntf
ProjectIntf,
// IdeIntf
IDEOptionsIntf, IDEOptEditorIntf, IDEDialogs, IDEUtils, DividerBevel,
// IDE
LazarusIDEStrConsts, InputHistory, LazConf, DialogProcs, InitialSetupProc, Classes;
type
{ TIdeStartupFrame }
TIdeStartupFrame = class(TAbstractIDEOptionsEditor)
lblFileAssociation: TDividerBevel;
lblProjectToOpen: TDividerBevel;
MultipleInstancesComboBox: TComboBox;
LazarusInstancesLabel: TLabel;
OpenLastProjectAtStartCheckBox: TCheckBox;
ProjectTypeRG: TRadioGroup;
procedure OpenLastProjectAtStartCheckBoxChange(Sender: TObject);
private
FOldOpenLastProjectAtStart: boolean;
FOldProjectTemplateAtStart: string;
public
//function Check: Boolean; override;
function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
procedure RestoreSettings(AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
end;
implementation
{$R *.lfm}
{ TIdeStartupFrame }
procedure TIdeStartupFrame.OpenLastProjectAtStartCheckBoxChange(Sender: TObject);
begin
ProjectTypeRG.Enabled := not (Sender as TCheckBox).Checked;
end;
{
function TIdeStartupFrame.Check: Boolean;
begin
Result:=inherited Check;
end;
}
function TIdeStartupFrame.GetTitle: String;
begin
Result := dlgEnvIdeStartup;
end;
procedure TIdeStartupFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
var
i: Integer;
begin
// Using File Association in OS
lblFileAssociation.Caption := dlgFileAssociationInOS;
LazarusInstancesLabel.Caption := dlgLazarusInstances;
with MultipleInstancesComboBox.Items do
begin
BeginUpdate;
Add(dlgMultipleInstances_AlwaysStartNew);
Add(dlgMultipleInstances_OpenFilesInRunning);
Add(dlgMultipleInstances_ForceSingleInstance);
EndUpdate;
end;
Assert(MultipleInstancesComboBox.Items.Count = Ord(High(TIDEMultipleInstancesOption))+1);
// Project to Open or Create
lblProjectToOpen.Caption := dlgProjectToOpenOrCreate;
OpenLastProjectAtStartCheckBox.Caption := dlgQOpenLastPrj;
ProjectTypeRG.Caption := dlgNewProjectType;
for i:=0 to ProjectDescriptors.Count-1 do
if ProjectDescriptors[i].VisibleInNewDialog then
ProjectTypeRG.Items.Add(ProjectDescriptors[i].Name); // GetLocalizedName
end;
procedure TIdeStartupFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
i: Integer;
begin
with AOptions as TEnvironmentOptions do
begin
MultipleInstancesComboBox.ItemIndex := Ord(MultipleInstances);
FOldOpenLastProjectAtStart := OpenLastProjectAtStart;
OpenLastProjectAtStartCheckBox.Checked:=OpenLastProjectAtStart;
FOldProjectTemplateAtStart := NewProjectTemplateAtStart;
for i := 0 to ProjectTypeRG.Items.Count-1 do
if ProjectTypeRG.Items[i] = FOldProjectTemplateAtStart then
begin
ProjectTypeRG.ItemIndex := i;
Exit;
end;
ProjectTypeRG.ItemIndex := 0;
end;
end;
procedure TIdeStartupFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin
with AOptions as TEnvironmentOptions do
begin
MultipleInstances := TIDEMultipleInstancesOption(MultipleInstancesComboBox.ItemIndex);
OpenLastProjectAtStart := OpenLastProjectAtStartCheckBox.Checked;
NewProjectTemplateAtStart := ProjectTypeRG.Items[ProjectTypeRG.ItemIndex];
end;
end;
procedure TIdeStartupFrame.RestoreSettings(AOptions: TAbstractIDEOptions);
begin
inherited RestoreSettings(AOptions);
with AOptions as TEnvironmentOptions do
begin
OpenLastProjectAtStart := FOldOpenLastProjectAtStart;
NewProjectTemplateAtStart := FOldProjectTemplateAtStart;
end;
end;
class function TIdeStartupFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result := TEnvironmentOptions;
end;
initialization
RegisterIDEOptionsEditor(GroupEnvironment, TIdeStartupFrame, EnvOptionsIdeStartup);
end.

View File

@ -64,7 +64,7 @@
<PackageName Value="SynEdit"/>
</Item8>
</RequiredPackages>
<Units Count="242">
<Units Count="243">
<Unit0>
<Filename Value="lazarus.pp"/>
<IsPartOfProject Value="True"/>
@ -82,7 +82,9 @@
<Filename Value="frames/files_options.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="FilesOptionsFrame"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="Files_Options"/>
</Unit2>
<Unit3>
<Filename Value="frames/desktop_options.pas"/>
@ -90,6 +92,7 @@
<ComponentName Value="DesktopOptionsFrame"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="Desktop_Options"/>
</Unit3>
<Unit4>
<Filename Value="frames/window_options.pas"/>
@ -110,6 +113,7 @@
<IsPartOfProject Value="True"/>
<ComponentName Value="BackupOptionsFrame"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="Backup_Options"/>
</Unit6>
<Unit7>
<Filename Value="frames/naming_options.pas"/>
@ -136,6 +140,7 @@
<Filename Value="frames/editor_display_options.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="EditorDisplayOptionsFrame"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
</Unit10>
<Unit11>
@ -776,6 +781,7 @@
<Unit114>
<Filename Value="lfmunitresource.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="lfmUnitResource"/>
</Unit114>
<Unit115>
<Filename Value="sourcemarks.pas"/>
@ -786,6 +792,7 @@
<Filename Value="checklfmdlg.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
<UnitName Value="CheckLFMDlg"/>
</Unit116>
<Unit117>
<Filename Value="sortselectiondlg.pas"/>
@ -862,6 +869,7 @@
<Unit130>
<Filename Value="componentpalette.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ComponentPalette"/>
</Unit130>
<Unit131>
<Filename Value="codecontextform.pas"/>
@ -937,7 +945,10 @@
<Unit146>
<Filename Value="diskdiffsdialog.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="DiskDiffsDlg"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="DiskDiffsDialog"/>
</Unit146>
<Unit147>
<Filename Value="unusedunitsdlg.pas"/>
@ -982,6 +993,7 @@
<Filename Value="newprojectdlg.pp"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
<UnitName Value="NewProjectDlg"/>
</Unit155>
<Unit156>
<Filename Value="codetoolsoptions.pas"/>
@ -1011,6 +1023,7 @@
<Unit161>
<Filename Value="transfermacros.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TransferMacros"/>
</Unit161>
<Unit162>
<Filename Value="publishmodule.pas"/>
@ -1434,6 +1447,14 @@
<IsPartOfProject Value="True"/>
<UnitName Value="ExtToolsIDE"/>
</Unit241>
<Unit242>
<Filename Value="frames/idestartup_options.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="IdeStartupFrame"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="IdeStartup_Options"/>
</Unit242>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -152,14 +152,6 @@ resourcestring
lisMoveUp = 'Move Up';
lisMoveDown = 'Move Down';
dlgMultipleInstances = 'Multiple Lazarus instances';
dlgMultipleInstances_AlwaysStartNew = 'always start a new instance';
dlgMultipleInstances_OpenFilesInRunning = 'open files in a running instance';
dlgMultipleInstances_ForceSingleInstance = 'do not allow multiple instances';
dlgRunningInstanceModalError = 'The running Lazarus instance cannot accept any files.'+sLineBreak+'Do you want to open them in a new IDE instance?'+sLineBreak+sLineBreak+'%s';
dlgForceUniqueInstanceModalError = 'The running Lazarus instance cannot accept any files.';
dlgRunningInstanceNotRespondingError = 'Lazarus instance is running but not responding.';
// *** Rest of the resource strings ***
lisImportPackageListXml = 'Import package list (*.xml)';
@ -1315,8 +1307,7 @@ resourcestring
dlgFrmEditor = 'Form Editor';
dlgObjInsp = 'Object Inspector';
dlgEnvFiles = 'Files';
//
dlgEnvIdeStartup = 'IDE Startup';
dlgEnvBckup = 'Backup';
dlgNaming = 'Naming';
lisInformation = 'Information';
@ -1475,7 +1466,6 @@ resourcestring
dlgMaxRecentFiles = 'Max recent files';
dlgMaxRecentProjs = 'Max recent project files';
dlgMaxRecentHint = 'Value 0 means unlimited.';
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';
@ -1607,6 +1597,7 @@ resourcestring
lisShowsDescriptionForSelectedProperty = 'A box at the bottom shows '
+'description for the selected property.';
lisShowPropertyFilterInObjectInspector = 'Show property filter';
dlgEnvBackupHelpNote = 'Notes: Project files are all files in the project directory';
lisEnvOptDlgInvalidDebuggerFilename = 'Invalid debugger filename';
lisEnvOptDlgInvalidDebuggerFilenameMsg = 'The debugger file "%s" is not an executable.';
@ -1619,6 +1610,20 @@ resourcestring
+'failed to compile.%sRemove it from the installation list?';
lisEnvOptDlgTestDirNotFoundMsg = 'Test directory "%s" not found.';
// Ide Startup options
dlgFileAssociationInOS = 'Using File Association in OS';
dlgLazarusInstances = 'Lazarus instances';
dlgMultipleInstances_AlwaysStartNew = 'always start a new instance';
dlgMultipleInstances_OpenFilesInRunning = 'open files in a running instance';
dlgMultipleInstances_ForceSingleInstance = 'do not allow multiple instances';
dlgRunningInstanceModalError = 'The running Lazarus instance cannot accept any files.'
+sLineBreak+'Do you want to open them in a new IDE instance?'+sLineBreak+sLineBreak+'%s';
dlgForceUniqueInstanceModalError = 'The running Lazarus instance cannot accept any files.';
dlgRunningInstanceNotRespondingError = 'Lazarus instance is running but not responding.';
dlgProjectToOpenOrCreate = 'Project to Open or Create';
dlgQOpenLastPrj = 'Open last project and packages at start';
dlgNewProjectType = 'New Project Type';
// open-dialog filters
dlgFilterAll = 'All files';
dlgFilterXML = 'XML files';

View File

@ -114,7 +114,7 @@ uses
ChgEncodingDlg, ConvertDelphi, MissingPropertiesDlg, LazXMLForms,
// environment option frames
editor_general_options, componentpalette_options, formed_options, OI_options,
MsgWnd_Options, files_options, desktop_options, window_options,
MsgWnd_Options, Files_Options, Desktop_Options, window_options, IdeStartup_Options,
Backup_Options, naming_options, fpdoc_options, idecoolbar_options, editortoolbar_options,
editor_display_options, editor_keymapping_options, editor_mouseaction_options,
editor_mouseaction_options_advanced, editor_color_options, editor_markup_options,
@ -2298,6 +2298,7 @@ procedure TMainIDE.SetupStartProject;
var
ProjectLoaded: Boolean;
AProjectFilename: String;
PrjDesc: TProjectDescriptor;
CmdLineFiles: TStrings;
i: Integer;
OpenFlags: TOpenFlags;
@ -2386,7 +2387,10 @@ begin
// IDE was closed without a project => restore that state
end else begin
// create new project
DoNewProject(ProjectDescriptorApplication);
PrjDesc := ProjectDescriptors.FindByName(EnvironmentOptions.NewProjectTemplateAtStart);
if PrjDesc = nil then
PrjDesc := ProjectDescriptorApplication; // Fallback to Application
DoNewProject(PrjDesc);
end;
end;