IDE: Store history from "RunParameters" dialog in LPS and not in global Lazarus IDE config, issue #35285, patch from Ondrej

git-svn-id: trunk@60782 -
This commit is contained in:
mattias 2019-03-26 19:59:44 +00:00
parent 19e7d42dad
commit 6bd2d193e1
4 changed files with 26 additions and 11 deletions

View File

@ -62,9 +62,6 @@ const
hlMakeResourceStringLengths = 'MakeResourceStringLengths';
hlCodeToolsDirectories = 'CodeToolsDirectories';
hlCompilerOptsImExport = 'CompilerOptsImExport';
hlLaunchingApplication = 'LaunchingApplication';
hlCmdLineParameters = 'CommandLineParameters';
hlWorkingDirectory = 'WorkingDirectory';
hlCleanBuildFileMask = 'CleanBuildFileMask';
type

View File

@ -4408,7 +4408,7 @@ end;
procedure TMainIDE.mnuRunParametersClicked(Sender: TObject);
begin
if Project1=nil then exit;
if ShowRunParamsOptsDlg(Project1.RunParameterOptions)=mrOK then
if ShowRunParamsOptsDlg(Project1.RunParameterOptions, Project1.HistoryLists)=mrOK then
begin
Project1.Modified:=true;
Project1.SessionModified:=true;

View File

@ -64,7 +64,7 @@ uses
CompOptsModes, ProjectResources, LazConf, ProjectIcon,
IDECmdLine, IDEProcs, CompilerOptions, RunParamsOpts, ModeMatrixOpts,
TransferMacros, ProjectDefs, FileReferenceList, EditDefineTree,
LazarusIDEStrConsts, ProjPackCommon, PackageDefs, PackageSystem;
LazarusIDEStrConsts, InputHistory, ProjPackCommon, PackageDefs, PackageSystem;
type
TUnitInfo = class;
@ -709,6 +709,7 @@ type
FAutoCreateForms: boolean;
FChangeStampSaved: integer;
FEnableI18NForLFM: boolean;
FHistoryLists: THistoryLists;
FLastCompileComplete: boolean;
FMacroEngine: TTransferMacroList;
FTmpAutoCreatedForms: TStrings; // temporary, used to apply auto create forms changes
@ -1102,6 +1103,7 @@ type
property ProjResources: TProjectResources read GetProjResources;
property RunParameterOptions: TRunParamsOptions read GetRunParameterOptions;
property HistoryLists: THistoryLists read FHistoryLists;
property SourceDirectories: TFileReferenceList read GetSourceDirectories;
property StateFileDate: longint read FStateFileDate write FStateFileDate;
property StateFlags: TLazProjectStateFlags read FStateFlags write FStateFlags;
@ -2717,6 +2719,8 @@ begin
FResources := TProjectResources.Create(Self);
ProjResources.OnModified := @EmbeddedObjectModified;
FHistoryLists := THistoryLists.Create;
end;
{------------------------------------------------------------------------------
@ -2745,6 +2749,7 @@ begin
FreeThenNil(FPublishOptions);
FreeThenNil(FRunParameters);
FreeThenNil(FDefineTemplates);
FreeThenNil(FHistoryLists);
inherited Destroy;
end;
@ -2976,6 +2981,9 @@ begin
if FFileVersion>=11 then
RunParameterOptions.Load(FXMLConfig,Path+'RunParams/',fPathDelimChanged,rpsLPS);
HistoryLists.Clear;
if FFileVersion>=12 then
HistoryLists.LoadFromXMLConfig(FXMLConfig,Path+'HistoryLists/');
// call hooks to read their info (e.g. DebugBoss)
if Assigned(OnLoadProjectInfo) then
@ -3324,6 +3332,8 @@ begin
SaveSessionInfo(Path);
// save the Run and Build parameter options
RunParameterOptions.Save(FXMLConfig,Path+'RunParams/',fCurStorePathDelim,rpsLPS);
// save history lists
HistoryLists.SaveToXMLConfig(FXMLConfig,Path+'HistoryLists/');
// Notifiy hooks
if Assigned(OnSaveProjectInfo) then

View File

@ -175,6 +175,7 @@ type
procedure UserOverridesEditButtonClick(Sender: TObject);
procedure UserOverridesDeleteButtonClick(Sender: TObject);
private
fHistoryLists: THistoryLists;
fOptions: TRunParamsOptions;
fSaveToOptions: TRunParamsOptions;
fLastSelectedMode: TRunParamsOptionsMode;
@ -199,9 +200,10 @@ type
constructor Create(AnOwner: TComponent); override;
destructor Destroy; override;
property Options: TRunParamsOptions Write SetOptions;
property HistoryLists: THistoryLists read fHistoryLists write fHistoryLists;
end;
function ShowRunParamsOptsDlg(RunParamsOptions: TRunParamsOptions): TModalResult;
function ShowRunParamsOptsDlg(RunParamsOptions: TRunParamsOptions; HistoryLists: THistoryLists): TModalResult;
implementation
@ -211,6 +213,10 @@ const
DefaultLauncherTitle = '''Lazarus Run Output''';
DefaultLauncherApplication = '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)';
hlLaunchingApplication = 'LaunchingApplication';
hlCmdLineParameters = 'CommandLineParameters';
hlWorkingDirectory = 'WorkingDirectory';
function FindTerminalInPath(const ATerm: String = ''): String;
var
List: TStrings;
@ -260,13 +266,15 @@ begin
DefaultLaunchingApplicationPathPlusParams:=Result;
end;
function ShowRunParamsOptsDlg(RunParamsOptions: TRunParamsOptions): TModalResult;
function ShowRunParamsOptsDlg(RunParamsOptions: TRunParamsOptions;
HistoryLists: THistoryLists): TModalResult;
var
RunParamsOptsForm: TRunParamsOptsDlg;
begin
Result := mrCancel;
RunParamsOptsForm := TRunParamsOptsDlg.Create(nil);
try
RunParamsOptsForm.HistoryLists := HistoryLists;
RunParamsOptsForm.Options := RunParamsOptions;
Result := RunParamsOptsForm.ShowModal;
finally
@ -968,7 +976,7 @@ begin
HostApplicationEdit.Text := AMode.HostApplicationFilename;
// WorkingDirectoryComboBox
List:=InputHistories.HistoryLists.GetList(hlWorkingDirectory,true,rltFile);
List:=HistoryLists.GetList(hlWorkingDirectory,true,rltFile);
List.AppendEntry(AMode.WorkingDirectory);
WorkingDirectoryComboBox.Items.Assign(List);
WorkingDirectoryComboBox.Text := AMode.WorkingDirectory;
@ -979,7 +987,7 @@ begin
// UseLaunchingApplicationComboBox
UseLaunchingApplicationCheckBox.Checked := AMode.UseLaunchingApplication;
List := InputHistories.HistoryLists.GetList(hlLaunchingApplication,true,rltFile);
List := HistoryLists.GetList(hlLaunchingApplication,true,rltFile);
List.AppendEntry(AMode.LaunchingApplicationPathPlusParams);
S := FindTerminalInPath;
if S <> '' then
@ -997,7 +1005,7 @@ begin
UseLaunchingApplicationComboBox.Enabled := UseLaunchingApplicationCheckBox.Checked;
// CmdLineParametersComboBox
List:=InputHistories.HistoryLists.GetList(hlCmdLineParameters,true,rltCaseSensitive);
List:=HistoryLists.GetList(hlCmdLineParameters,true,rltCaseSensitive);
List.AppendEntry(AMode.CmdLineParams);
CmdLineParametersComboBox.Items.Assign(List);
CmdLineParametersComboBox.Text := AMode.CmdLineParams;
@ -1108,7 +1116,7 @@ procedure TRunParamsOptsDlg.SaveToOptionsMode(const AMode: TRunParamsOptionsMode
ListType: TRecentListType);
begin
AComboBox.AddHistoryItem(AComboBox.Text,20,true,false);
InputHistories.HistoryLists.GetList(History,true,ListType).Assign(AComboBox.Items);
HistoryLists.GetList(History,true,ListType).Assign(AComboBox.Items);
end;
begin