mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-21 22:39:30 +02:00
IDE: Improve the Startup options page. Use ComboBox for project types. Issue #38105.
git-svn-id: trunk@64795 -
This commit is contained in:
parent
4e2c94c4c9
commit
23c4243b52
@ -15,13 +15,13 @@ object IdeStartupFrame: TIdeStartupFrame
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 22
|
||||
Top = 91
|
||||
Top = 97
|
||||
Width = 231
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'OpenLastProjectAtStartCheckBox'
|
||||
OnChange = OpenLastProjectAtStartCheckBoxChange
|
||||
TabOrder = 0
|
||||
TabOrder = 1
|
||||
end
|
||||
object lblFileAssociation: TDividerBevel
|
||||
AnchorSideTop.Control = Owner
|
||||
@ -29,80 +29,83 @@ object IdeStartupFrame: TIdeStartupFrame
|
||||
Height = 18
|
||||
Top = 0
|
||||
Width = 597
|
||||
Caption = 'Using File Association in OS'
|
||||
Caption = 'Opening Files from OS'
|
||||
Anchors = [akLeft, akRight]
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object lblProjectToOpen: TDividerBevel
|
||||
AnchorSideTop.Control = MultipleInstancesComboBox
|
||||
AnchorSideTop.Control = LazarusInstancesCB
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 18
|
||||
Top = 67
|
||||
Top = 73
|
||||
Width = 597
|
||||
Caption = 'Project to Open or Create'
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 11
|
||||
BorderSpacing.Top = 15
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object LazarusInstancesLabel: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = MultipleInstancesComboBox
|
||||
AnchorSideTop.Control = LazarusInstancesCB
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 1
|
||||
Left = 3
|
||||
Height = 18
|
||||
Top = 31
|
||||
Top = 33
|
||||
Width = 139
|
||||
BorderSpacing.Left = 1
|
||||
BorderSpacing.Left = 3
|
||||
Caption = 'LazarusInstancesLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object MultipleInstancesComboBox: TComboBox
|
||||
object LazarusInstancesCB: TComboBox
|
||||
AnchorSideLeft.Control = LazarusInstancesLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = lblFileAssociation
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 148
|
||||
Left = 150
|
||||
Height = 32
|
||||
Top = 24
|
||||
Width = 441
|
||||
Top = 26
|
||||
Width = 439
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Top = 8
|
||||
ItemHeight = 18
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
TabOrder = 0
|
||||
end
|
||||
object ProjectTypeRG: TRadioGroup
|
||||
AnchorSideLeft.Control = Owner
|
||||
object ProjectTypeCB: TComboBox
|
||||
AnchorSideLeft.Control = ProjectTypeLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
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
|
||||
Left = 117
|
||||
Height = 32
|
||||
Top = 130
|
||||
Width = 459
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 11
|
||||
ItemHeight = 18
|
||||
Style = csDropDownList
|
||||
TabOrder = 2
|
||||
end
|
||||
object ProjectTypeLabel: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = ProjectTypeCB
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 3
|
||||
Height = 18
|
||||
Top = 137
|
||||
Width = 106
|
||||
BorderSpacing.Left = 3
|
||||
Caption = 'New Project Type'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
|
@ -28,33 +28,33 @@ unit IdeStartup_Options;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
// LCL
|
||||
StdCtrls, Dialogs, Controls, Spin, CheckLst, ExtCtrls,
|
||||
StdCtrls, Controls, Dialogs,
|
||||
// LazControls
|
||||
DividerBevel,
|
||||
// LazUtils
|
||||
FileUtil, LazFileUtils, LazLoggerBase,
|
||||
// IDE
|
||||
EnvironmentOpts,
|
||||
LazFileUtils, LazLoggerBase,
|
||||
// CodeTools
|
||||
CodeToolManager, DefineTemplates,
|
||||
// BuildIntf
|
||||
ProjectIntf,
|
||||
ProjectIntf, IDEOptionsIntf,
|
||||
// IdeIntf
|
||||
IDEOptionsIntf, IDEOptEditorIntf, IDEDialogs, IDEUtils, DividerBevel,
|
||||
IDEOptEditorIntf,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, InputHistory, LazConf, DialogProcs, InitialSetupProc, Classes;
|
||||
EnvironmentOpts, LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
|
||||
{ TIdeStartupFrame }
|
||||
|
||||
TIdeStartupFrame = class(TAbstractIDEOptionsEditor)
|
||||
ProjectTypeLabel: TLabel;
|
||||
ProjectTypeCB: TComboBox;
|
||||
lblFileAssociation: TDividerBevel;
|
||||
lblProjectToOpen: TDividerBevel;
|
||||
MultipleInstancesComboBox: TComboBox;
|
||||
LazarusInstancesCB: TComboBox;
|
||||
LazarusInstancesLabel: TLabel;
|
||||
OpenLastProjectAtStartCheckBox: TCheckBox;
|
||||
ProjectTypeRG: TRadioGroup;
|
||||
procedure OpenLastProjectAtStartCheckBoxChange(Sender: TObject);
|
||||
private
|
||||
FOldOpenLastProjectAtStart: boolean;
|
||||
@ -77,7 +77,7 @@ implementation
|
||||
|
||||
procedure TIdeStartupFrame.OpenLastProjectAtStartCheckBoxChange(Sender: TObject);
|
||||
begin
|
||||
ProjectTypeRG.Enabled := not (Sender as TCheckBox).Checked;
|
||||
ProjectTypeCB.Enabled := not (Sender as TCheckBox).Checked;
|
||||
end;
|
||||
{
|
||||
function TIdeStartupFrame.Check: Boolean;
|
||||
@ -93,11 +93,12 @@ end;
|
||||
procedure TIdeStartupFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
var
|
||||
i: Integer;
|
||||
pd: TProjectDescriptor;
|
||||
begin
|
||||
// Using File Association in OS
|
||||
lblFileAssociation.Caption := dlgFileAssociationInOS;
|
||||
LazarusInstancesLabel.Caption := dlgLazarusInstances;
|
||||
with MultipleInstancesComboBox.Items do
|
||||
with LazarusInstancesCB.Items do
|
||||
begin
|
||||
BeginUpdate;
|
||||
Add(dlgMultipleInstances_AlwaysStartNew);
|
||||
@ -105,46 +106,57 @@ begin
|
||||
Add(dlgMultipleInstances_ForceSingleInstance);
|
||||
EndUpdate;
|
||||
end;
|
||||
Assert(MultipleInstancesComboBox.Items.Count = Ord(High(TIDEMultipleInstancesOption))+1);
|
||||
Assert(LazarusInstancesCB.Items.Count = Ord(High(TIDEMultipleInstancesOption))+1);
|
||||
// Project to Open or Create
|
||||
lblProjectToOpen.Caption := dlgProjectToOpenOrCreate;
|
||||
OpenLastProjectAtStartCheckBox.Caption := dlgQOpenLastPrj;
|
||||
ProjectTypeRG.Caption := dlgNewProjectType;
|
||||
ProjectTypeLabel.Caption := dlgNewProjectType;
|
||||
for i:=0 to ProjectDescriptors.Count-1 do
|
||||
if ProjectDescriptors[i].VisibleInNewDialog then
|
||||
ProjectTypeRG.Items.Add(ProjectDescriptors[i].Name); // GetLocalizedName
|
||||
begin
|
||||
pd := ProjectDescriptors[i];
|
||||
if pd.VisibleInNewDialog then
|
||||
ProjectTypeCB.Items.AddObject(pd.GetLocalizedName, pd);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIdeStartupFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
i: Integer;
|
||||
pd: TProjectDescriptor;
|
||||
begin
|
||||
with AOptions as TEnvironmentOptions do
|
||||
begin
|
||||
MultipleInstancesComboBox.ItemIndex := Ord(MultipleInstances);
|
||||
LazarusInstancesCB.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
|
||||
for i := 0 to ProjectTypeCB.Items.Count-1 do
|
||||
begin
|
||||
pd := TProjectDescriptor(ProjectTypeCB.Items.Objects[i]);
|
||||
if pd.Name = FOldProjectTemplateAtStart then
|
||||
begin
|
||||
ProjectTypeRG.ItemIndex := i;
|
||||
ProjectTypeCB.ItemIndex := i;
|
||||
Exit;
|
||||
end;
|
||||
ProjectTypeRG.ItemIndex := 0;
|
||||
end;
|
||||
ProjectTypeCB.ItemIndex := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIdeStartupFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
pd: TProjectDescriptor;
|
||||
begin
|
||||
with AOptions as TEnvironmentOptions do
|
||||
begin
|
||||
MultipleInstances := TIDEMultipleInstancesOption(MultipleInstancesComboBox.ItemIndex);
|
||||
MultipleInstances := TIDEMultipleInstancesOption(LazarusInstancesCB.ItemIndex);
|
||||
|
||||
OpenLastProjectAtStart := OpenLastProjectAtStartCheckBox.Checked;
|
||||
NewProjectTemplateAtStart := ProjectTypeRG.Items[ProjectTypeRG.ItemIndex];
|
||||
// Don't use the localized name from ProjectTypeCB.Text.
|
||||
pd := TProjectDescriptor(ProjectTypeCB.Items.Objects[ProjectTypeCB.ItemIndex]);
|
||||
NewProjectTemplateAtStart := pd.Name;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1611,7 +1611,7 @@ resourcestring
|
||||
lisEnvOptDlgTestDirNotFoundMsg = 'Test directory "%s" not found.';
|
||||
|
||||
// Ide Startup options
|
||||
dlgFileAssociationInOS = 'Opening files from OS';
|
||||
dlgFileAssociationInOS = 'Opening Files from OS';
|
||||
dlgLazarusInstances = 'Lazarus instances';
|
||||
dlgMultipleInstances_AlwaysStartNew = 'always start a new instance';
|
||||
dlgMultipleInstances_OpenFilesInRunning = 'open files in a running instance';
|
||||
|
Loading…
Reference in New Issue
Block a user