IDE: compiler options: execute before/after: fixed adding text to history lists

git-svn-id: trunk@56854 -
This commit is contained in:
mattias 2017-12-27 12:38:41 +00:00
parent 6f0194962a
commit 265412f333
5 changed files with 45 additions and 29 deletions

View File

@ -50,16 +50,18 @@ procedure SetComboBoxText(AComboBox:TComboBox; const AText: String;
var
a: integer;
begin
a := IndexInStringList(AComboBox.Items,Cmp,AText);
if a >= 0 then
AComboBox.ItemIndex := a
else
begin
AComboBox.Items.Insert(0,AText);
AComboBox.ItemIndex:=IndexInStringList(AComboBox.Items,Cmp,AText);
if MaxCount<2 then MaxCount:=2;
while AComboBox.Items.Count>MaxCount do
AComboBox.Items.Delete(AComboBox.Items.Count-1);
if AText<>'' then begin
a := IndexInStringList(AComboBox.Items,Cmp,AText);
if a >= 0 then
AComboBox.ItemIndex := a
else
begin
AComboBox.Items.Insert(0,AText);
AComboBox.ItemIndex:=IndexInStringList(AComboBox.Items,Cmp,AText);
if MaxCount<2 then MaxCount:=2;
while AComboBox.Items.Count>MaxCount do
AComboBox.Items.Delete(AComboBox.Items.Count-1);
end;
end;
AComboBox.Text := AText;
end;

View File

@ -318,8 +318,13 @@ var
begin
chkCreateMakefile.Checked := Options.CreateMakefileOnBuild;
ExecuteBeforeCommandComboBox.Text := Options.ExecuteBefore.Command;
// execute before
with ExecuteBeforeCommandComboBox do begin
Items.BeginUpdate;
Items.Assign(InputHistories.HistoryLists.GetList('BuildExecBefore',true,rltFile));
SetComboBoxText(ExecuteBeforeCommandComboBox,Options.ExecuteBefore.Command,cstCaseSensitive);
Items.EndUpdate;
end;
if Options.ExecuteBefore is TProjectCompilationToolOptions then
with TProjectCompilationToolOptions(Options.ExecuteBefore) do
begin
@ -338,7 +343,10 @@ begin
chkExecBeforeBuild.Visible := False;
chkExecBeforeRun.Visible := False;
end;
ReadSettingsParsers(Options.ExecuteBefore,ExecBeforeParsersCheckComboBox,
ExecBeforeParsersSumLabel);
// compiler path
with cobCompiler do begin
Items.BeginUpdate;
Items.Assign(EnvironmentOptions.CompilerFileHistory);
@ -346,14 +354,6 @@ begin
SetComboBoxText(cobCompiler,Options.CompilerPath,cstFilename);
Items.EndUpdate;
end;
ReadSettingsParsers(Options.ExecuteBefore,ExecBeforeParsersCheckComboBox,
ExecBeforeParsersSumLabel);
ExecuteBeforeCommandComboBox.Items.Assign(
InputHistories.HistoryLists.GetList('BuildExecBefore',true,rltFile));
ExecuteAfterCommandComboBox.Items.Assign(
InputHistories.HistoryLists.GetList('BuildExecAfter',true,rltFile));
if Options is TProjectCompilerOptions then
with TProjectCompilerOptions(Options) do
begin
@ -391,7 +391,13 @@ begin
cobCompiler.AnchorParallel(akTop, 0, lblCompiler.Parent);
end;
ExecuteAfterCommandComboBox.Text := Options.ExecuteAfter.Command;
// execute after
with ExecuteAfterCommandComboBox do begin
Items.BeginUpdate;
Items.Assign(InputHistories.HistoryLists.GetList('BuildExecAfter',true,rltFile));
SetComboBoxText(ExecuteAfterCommandComboBox,Options.ExecuteAfter.Command,cstCaseSensitive);
Items.EndUpdate;
end;
if Options.ExecuteAfter is TProjectCompilationToolOptions then
with TProjectCompilationToolOptions(Options.ExecuteAfter) do
begin
@ -429,7 +435,12 @@ var
begin
Options.CreateMakefileOnBuild := chkCreateMakefile.Checked;
// execute before
Options.ExecuteBefore.Command := ExecuteBeforeCommandComboBox.Text;
with InputHistories.HistoryLists.GetList('BuildExecBefore',true,rltCaseSensitive) do begin
Assign(ExecuteBeforeCommandComboBox.Items);
Push(Options.ExecuteBefore.Command);
end;
WriteSettingsParsers(Options.ExecuteBefore,ExecBeforeParsersCheckComboBox);
@ -439,13 +450,10 @@ begin
MakeCompileReasons(chkExecBeforeCompile, chkExecBeforeBuild, chkExecBeforeRun);
end;
// compiler path
Options.CompilerPath := cobCompiler.Text;
EnvironmentOptions.CompilerFileHistory.Assign(cobCompiler.Items);
InputHistories.HistoryLists.GetList('BuildExecBefore',true,rltFile).Assign(
ExecuteBeforeCommandComboBox.Items);
InputHistories.HistoryLists.GetList('BuildExecAfter',true,rltFile).Assign(
ExecuteAfterCommandComboBox.Items);
AddToRecentList(Options.CompilerPath,EnvironmentOptions.CompilerFileHistory,30,rltFile);
if Options is TProjectCompilerOptions then
begin
@ -455,7 +463,12 @@ begin
else if Options is TPkgCompilerOptions then
TPkgCompilerOptions(Options).SkipCompiler := chkCompilerCompile.Checked;
// execute after
Options.ExecuteAfter.Command := ExecuteAfterCommandComboBox.Text;
with InputHistories.HistoryLists.GetList('BuildExecAfter',true,rltCaseSensitive) do begin
Assign(ExecuteAfterCommandComboBox.Items);
Push(Options.ExecuteAfter.Command);
end;
WriteSettingsParsers(Options.ExecuteAfter,ExecAfterParsersCheckComboBox);
if Options.ExecuteAfter is TProjectCompilationToolOptions then
begin

View File

@ -1117,7 +1117,7 @@ var
i: Integer;
begin
for i:=List.Count-1 downto 1 do
if CompareRecentListItem(List[i],List[i-1],ListType) then
if (List[i]='') or CompareRecentListItem(List[i],List[i-1],ListType) then
List.Delete(i);
end;

View File

@ -688,7 +688,8 @@ end;
function THistoryList.Push(const Entry: string): integer;
begin
AddToRecentList(Entry,Self,MaxCount,ListType);
if Entry<>'' then
AddToRecentList(Entry,Self,MaxCount,ListType);
Result:=-1;
end;

View File

@ -4284,7 +4284,7 @@ begin
if (not (sfDoNotSaveVirtualFiles in Flags)) then
begin
// check that all new units are saved first to get valid filenames
// (this can alter the mainunit: e.g. used unit names)
// Note: this can alter the mainunit: e.g. used unit names
for i:=0 to Project1.UnitCount-1 do begin
AnUnitInfo:=Project1.Units[i];
if (AnUnitInfo.Loaded) and AnUnitInfo.IsVirtual