IDE: Save the size of Run / "Compile many modes" dialog. Issue #35245, patch by n7800.

This commit is contained in:
Juha 2023-11-24 12:44:58 +02:00
parent 486ffc5d9a
commit ca7c0d686b
2 changed files with 23 additions and 26 deletions

View File

@ -38,6 +38,7 @@ uses
LazFileUtils, LazLoggerBase, LazFileUtils, LazLoggerBase,
// IdeIntf // IdeIntf
IDEDialogs, CompOptsIntf, IDEOptionsIntf, LazIDEIntf, IDEImagesIntf, IDEDialogs, CompOptsIntf, IDEOptionsIntf, LazIDEIntf, IDEImagesIntf,
IDEWindowIntf,
// IdeConfig // IdeConfig
EnvironmentOpts, TransferMacros, SearchPathProcs, EnvironmentOpts, TransferMacros, SearchPathProcs,
// IDE // IDE
@ -108,14 +109,12 @@ type
{ TBuildModesCheckList } { TBuildModesCheckList }
TBuildModesCheckList = class TBuildModesCheckList = class(TGenericCheckListForm)
private private
FListForm: TGenericCheckListForm;
function IsSelected(AIndex: Integer): Boolean; function IsSelected(AIndex: Integer): Boolean;
procedure SaveManyModesSelection; procedure SaveManyModesSelection;
procedure SelectAll; procedure SelectAll;
procedure SelectFirst; procedure SelectFirst;
function Show: Boolean;
public public
constructor Create(InfoCaption: String); constructor Create(InfoCaption: String);
destructor Destroy; override; destructor Destroy; override;
@ -238,7 +237,7 @@ begin
if Project1.BuildModes.Count > 1 then if Project1.BuildModes.Count > 1 then
begin begin
BMList.SelectAll; BMList.SelectAll;
Ok:=BMList.Show; Ok:=BMList.ShowModal = mrOK;
end end
else begin else begin
Ok:=IDEMessageDialog(DlgCapt, Format(DlgMsg,[LineEnding,aDir]), Ok:=IDEMessageDialog(DlgCapt, Format(DlgMsg,[LineEnding,aDir]),
@ -345,7 +344,7 @@ begin
BMList := TBuildModesCheckList.Create(lisCompileFollowingModes); BMList := TBuildModesCheckList.Create(lisCompileFollowingModes);
ModeList := TList.Create; ModeList := TList.Create;
try try
if not BMList.Show then Exit; if BMList.ShowModal <> mrOK then Exit;
BMList.SaveManyModesSelection; // Remember the selection for next time. BMList.SaveManyModesSelection; // Remember the selection for next time.
ActiveMode := Project1.ActiveBuildMode; ActiveMode := Project1.ActiveBuildMode;
BuildActiveMode := False; BuildActiveMode := False;
@ -864,10 +863,11 @@ var
BM: String; BM: String;
ManyBMs: TStringList; ManyBMs: TStringList;
begin begin
FListForm:=TGenericCheckListForm.Create(Nil); inherited Create(nil);
//lisApplyForBuildModes = 'Apply for build modes:';
FListForm.Caption:=lisAvailableProjectBuildModes; Caption:=lisAvailableProjectBuildModes;
FListForm.InfoLabel.Caption:=InfoCaption; InfoLabel.Caption:=InfoCaption;
ManyBMs:=Project1.BuildModes.ManyBuildModes; ManyBMs:=Project1.BuildModes.ManyBuildModes;
// Backwards compatibility. Many BuildModes value used to be in EnvironmentOptions. // Backwards compatibility. Many BuildModes value used to be in EnvironmentOptions.
if ManyBMs.Count=0 then if ManyBMs.Count=0 then
@ -875,23 +875,25 @@ begin
// Add project build modes to a CheckListBox. // Add project build modes to a CheckListBox.
for i:=0 to Project1.BuildModes.Count-1 do begin for i:=0 to Project1.BuildModes.Count-1 do begin
BM:=Project1.BuildModes[i].Identifier; BM:=Project1.BuildModes[i].Identifier;
FListForm.CheckListBox1.Items.Add(BM); CheckListBox1.Items.Add(BM);
if ManyBMs.IndexOf(BM) >= 0 then if ManyBMs.IndexOf(BM) >= 0 then
FListForm.CheckListBox1.Checked[i]:=True; CheckListBox1.Checked[i]:=True;
end; end;
if ManyBMs.Count=0 then // No persistent selections -> select all by default. if ManyBMs.Count=0 then // No persistent selections -> select all by default.
SelectAll; SelectAll;
IDEDialogLayoutList.ApplyLayout(Self, 350, 300);
end; end;
destructor TBuildModesCheckList.Destroy; destructor TBuildModesCheckList.Destroy;
begin begin
FListForm.Free; IDEDialogLayoutList.SaveLayout(Self);
inherited Destroy; inherited Destroy;
end; end;
function TBuildModesCheckList.IsSelected(AIndex: Integer): Boolean; function TBuildModesCheckList.IsSelected(AIndex: Integer): Boolean;
begin begin
Result := FListForm.CheckListBox1.Checked[AIndex]; Result := CheckListBox1.Checked[AIndex];
end; end;
procedure TBuildModesCheckList.SaveManyModesSelection; procedure TBuildModesCheckList.SaveManyModesSelection;
@ -900,9 +902,9 @@ var
begin begin
// Remember selected items. // Remember selected items.
Project1.BuildModes.ManyBuildModes.Clear; Project1.BuildModes.ManyBuildModes.Clear;
for i:=0 to FListForm.CheckListBox1.Items.Count-1 do for i:=0 to CheckListBox1.Items.Count-1 do
if FListForm.CheckListBox1.Checked[i] then if CheckListBox1.Checked[i] then
Project1.BuildModes.ManyBuildModes.Add(FListForm.CheckListBox1.Items[i]); Project1.BuildModes.ManyBuildModes.Add(CheckListBox1.Items[i]);
Project1.Modified:=True; Project1.Modified:=True;
end; end;
@ -910,19 +912,14 @@ procedure TBuildModesCheckList.SelectAll;
var var
i: Integer; i: Integer;
begin begin
for i := 0 to FListForm.CheckListBox1.Count-1 do for i := 0 to CheckListBox1.Count-1 do
FListForm.CheckListBox1.Checked[i] := True; CheckListBox1.Checked[i] := True;
end; end;
procedure TBuildModesCheckList.SelectFirst; procedure TBuildModesCheckList.SelectFirst;
begin begin
Assert(FListForm.CheckListBox1.Items.Count>0, 'TBuildModesCheckList.SelectFirst: Build modes count < 1'); Assert(CheckListBox1.Items.Count>0, 'TBuildModesCheckList.SelectFirst: Build modes count < 1');
FListForm.CheckListBox1.Checked[0] := True; CheckListBox1.Checked[0] := True;
end;
function TBuildModesCheckList.Show: Boolean;
begin
Result := FListForm.ShowModal=mrOK;
end; end;
end. end.

View File

@ -4519,7 +4519,7 @@ resourcestring
+'is marked for installation but cannot be found.' +'is marked for installation but cannot be found.'
+'%sRemove dependency from the installation list of packages?'; +'%sRemove dependency from the installation list of packages?';
lisERRORInvalidBuildMode = 'Error: (lazarus) invalid build mode "%s"'; lisERRORInvalidBuildMode = 'Error: (lazarus) invalid build mode "%s"';
lisAvailableProjectBuildModes = 'Available project build modes:'; lisAvailableProjectBuildModes = 'Available project build modes';
lisThisProjectHasOnlyTheDefaultBuildMode = 'This project has only the default build mode.'; lisThisProjectHasOnlyTheDefaultBuildMode = 'This project has only the default build mode.';
lisPkgMangstaticPackagesConfigFile = 'static packages config file'; lisPkgMangstaticPackagesConfigFile = 'static packages config file';
lisPkgMangUnableToCreateTargetDirectoryForLazarus = 'Unable to create ' lisPkgMangUnableToCreateTargetDirectoryForLazarus = 'Unable to create '