Skip to content

Commit a2c5f68

Browse files
committed
Reverse order of compiler list in find compilers dlg
1 parent 4edaefe commit a2c5f68

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Src/FmFindCompilerDlg.pas

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ TFindCompilerDlg = class(TGenericOKDlg, INoPublicConstruct)
5555
fSearchParams: TCompilerSearchParams; // Persistent compiler search options
5656
fSearch: ISearch; // Search entered by user
5757
fRefinePreviousSearch: Boolean; // Whether to refine previous search
58+
fMapIdxToComp: TArray<TCompilerID>; // Maps list idx to comp ID of entry
5859

5960
procedure UpdateOKBtn;
6061
{Updates state of OK button according to whether valid entries made in
@@ -363,13 +364,25 @@ procedure TFindCompilerDlg.InitForm;
363364
Option: TCompilerSearchOption; // loops thru possible compiler search options
364365
SelOption: Integer; // selected search option
365366
Compiler: ICompiler; // references each compiler
367+
CompID: TCompilerID;
366368
begin
367369
inherited;
370+
// Set up index map that reverses order of compilers
371+
SetLength(fMapIdxToComp, fCompilers.Count);
372+
Idx := High(fMapIdxToComp);
373+
for CompID := Low(TCompilerID) to High(TCompilerID) do
374+
begin
375+
fMapIdxToComp[Idx] := CompID;
376+
Dec(Idx);
377+
end;
378+
368379
// Set up list of compilers and check appropriate ones
369380
// we store compiler ID in listbox's Objects[] property
370-
for Compiler in fCompilers do
381+
// Use mapping to reverse order of compilers in list
382+
for Idx := Low(fMapIdxToComp) to High(fMapIdxToComp) do
371383
begin
372-
Idx := lbCompilerVers.Items.AddObject(
384+
Compiler := fCompilers[fMapIdxToComp[Idx]];
385+
lbCompilerVers.Items.AddObject(
373386
Compiler.GetName, TObject(Compiler.GetID)
374387
);
375388
lbCompilerVers.Checked[Idx] := Compiler.GetID in fSearchParams.Compilers;

0 commit comments

Comments
 (0)