IDE: in Run Parameters dialog use TMemo instead of TComboBox. Issue #24345, patch from Cyrax.

git-svn-id: trunk@41936 -
This commit is contained in:
juha 2013-06-29 10:24:12 +00:00
parent fc6e116e5c
commit ab277e68c5
4 changed files with 456 additions and 138 deletions

View File

@ -532,27 +532,52 @@ var
Result := ExtractFileNameWithoutExt(Result) + '.app';
end;
end;
begin
Result := '';
if Project1=nil then exit;
if Project1.RunParameterOptions.UseLaunchingApplication then
Result := Project1.RunParameterOptions.LaunchingApplicationPathPlusParams;
if Result=''
then begin
Result:=Project1.RunParameterOptions.CmdLineParams;
if GlobalMacroList.SubstituteStr(Result) then begin
TargetFileName:='"'+GetTargetFilename+'"';
if Result='' then
Result:=TargetFileName
else
Result:=TargetFilename+' '+Result;
end else
Result:='';
end else begin
if not GlobalMacroList.SubstituteStr(Result) then Result:='';
function ListToString(AList : TStringList) : String;
Var
I : Integer;
Begin
Result := '';
For I := 0 To AList.Count - 1 Do
If I < AList.Count - 1 Then
Result := Result + AList[I] + ' '
Else
Result := Result + AList[I];
end;
Var
AStrList : TStringList;
AStr : String;
begin
AStrList := TStringList.Create;
AStr := '';
if Project1=nil then exit;
if Project1.RunParameterOptions.UseLaunchingApplication then Begin
AStrList.Text := Project1.RunParameterOptions.LaunchingApplicationPathPlusParams;
AStr := ListToString(AStrList);
end;
if AStr=''
then begin
AStrList.Text := Project1.RunParameterOptions.CmdLineParams;
AStr:= ListToString(AStrList);
if GlobalMacroList.SubstituteStr(AStr) then begin
TargetFileName:='"'+GetTargetFilename+'"';
if AStr='' then
AStr:=TargetFileName
else
AStr:=TargetFilename+' '+AStr;
end else
AStr:='';
end else begin
if not GlobalMacroList.SubstituteStr(AStr) then AStr:='';
end;
Result := AStr;
FreeAndNil(AStrList);
end;
function TBuildManager.GetProjectPublishDir: string;

View File

@ -69,29 +69,32 @@ type
{ THistoryList - a TStringList to store a history list }
THistoryListClass = class of THistoryList;
THistoryList = class(TStringList)
private
FListType: TRecentListType;
FMaxCount: integer;
FName: string;
procedure SetMaxCount(const AValue: integer);
procedure SetName(const AValue: string);
protected
FListType: TRecentListType;
procedure AssignValues(Source : TPersistent);virtual;
public
constructor Create(TheListType: TRecentListType);
constructor Create(TheListType: TRecentListType);virtual;
destructor Destroy; override;
function Push(const Entry: string): integer;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);virtual;
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);virtual;
procedure AppendEntry(const Entry: string);
function IndexOf(const S: string): Integer; override;
class function CreateMe(ATheListType : TRecentListType; AName : String) : THistoryList;virtual;
procedure Assign(Source: TPersistent); override;
public
property Name: string read FName write SetName;
property MaxCount: integer read FMaxCount write SetMaxCount;
property ListType: TRecentListType read FListType;
end;
{ THistoryLists - list of THistoryList }
THistoryLists = class
@ -110,6 +113,8 @@ type
function GetList(const Name: string;
CreateIfNotExists: boolean; ListType: TRecentListType): THistoryList;
procedure Add(const ListName, Entry: string; ListType: TRecentListType);
class procedure RegisterHistoryListClass(AHistoryListClass : THistoryListClass; AHistoryListName : String);
class function GetHistoryListClass(AHistoryListName : String) : THistoryListClass;
property Items[Index: integer]: THistoryList read GetItems;
end;
@ -770,6 +775,16 @@ end;
{ THistoryList }
class function THistoryList.CreateMe(ATheListType : TRecentListType; AName : String) : THistoryList;
Var
AHistoryList : THistoryList;
begin
AHistoryList := THistoryList.Create(ATheListType);
AHistoryList.Name:= AName;
Result := AHistoryList;
end;
procedure THistoryList.SetMaxCount(const AValue: integer);
begin
if FMaxCount=AValue then exit;
@ -793,6 +808,25 @@ begin
inherited Destroy;
end;
procedure THistoryList.Assign(Source: TPersistent);
begin
inherited;
If Source is THistoryList Then Begin
Self.FMaxCount := THistoryList(Source).FMaxCount;
Self.FName := THistoryList(Source).FName;
Self.FListType := THistoryList(Source).FListType;
end;
end;
procedure THistoryList.AssignValues(Source : TPersistent);
Begin
If Source is THistoryList Then Begin
Self.FMaxCount := THistoryList(Source).FMaxCount;
Self.FName := THistoryList(Source).FName;
Self.FListType := THistoryList(Source).FListType;
end;
end;
function THistoryList.Push(const Entry: string): integer;
begin
AddToRecentList(Entry,Self,MaxCount,ListType);
@ -836,6 +870,26 @@ end;
{ THistoryLists }
Var
AHistoryListClasses : TStringToPointerTree = NIL;
class procedure THistoryLists.RegisterHistoryListClass(AHistoryListClass : THistoryListClass; AHistoryListName : String);
Var
BHistoryListClass : Pointer;
Begin
If Not AHistoryListClasses.GetData(AHistoryListName, BHistoryListClass) Then
AHistoryListClasses.Values[AHistoryListName] := AHistoryListClass;
end;
class function THistoryLists.GetHistoryListClass(AHistoryListName : String) : THistoryListClass;
Var
BHistoryListClass : Pointer;
Begin
Result := NIL;
If AHistoryListClasses.GetData(AHistoryListName, BHistoryListClass) Then
Result := THistoryListClass(BHistoryListClass);
end;
function THistoryLists.GetItems(Index: integer): THistoryList;
begin
Result:=THistoryList(FItems[Index]);
@ -914,13 +968,16 @@ function THistoryLists.GetList(const Name: string; CreateIfNotExists: boolean;
ListType: TRecentListType): THistoryList;
var
i: integer;
AClass : THistoryListClass;
begin
i:=IndexOfName(Name);
if i>=0 then
Result:=Items[i]
else if CreateIfNotExists then begin
Result:=THistoryList.Create(ListType);
Result.Name:=Name;
AClass := Self.GetHistoryListClass(Name);
If AClass = NIL Then
AClass := THistoryList;
Result:= AClass.CreateMe(ListType, Name);
FItems.Add(Result);
end else
Result:=nil;
@ -1226,6 +1283,10 @@ end;
initialization
InputHistories:= nil;
AHistoryListClasses := TStringToPointerTree.Create(True);
finalization
FreeAndNil(AHistoryListClasses);
end.

View File

@ -1,18 +1,18 @@
object RunParamsOptsDlg: TRunParamsOptsDlg
Left = 443
Height = 501
Top = 176
Width = 500
Left = 411
Height = 597
Top = 122
Width = 496
Caption = 'RunParamsOptsDlg'
ClientHeight = 501
ClientWidth = 500
ClientHeight = 597
ClientWidth = 496
Position = poScreenCenter
LCLVersion = '1.1'
object Notebook: TPageControl
Left = 0
Height = 456
Height = 552
Top = 0
Width = 500
Width = 496
ActivePage = GeneralPage
Align = alClient
BorderSpacing.Bottom = 6
@ -20,110 +20,152 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
TabOrder = 0
object GeneralPage: TTabSheet
Caption = 'GeneralPage'
ClientHeight = 423
ClientWidth = 496
ClientHeight = 527
ClientWidth = 492
object DisplayGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 86
Top = 234
Width = 484
Height = 71
Top = 374
Width = 480
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'DisplayGroupBox'
ClientHeight = 65
ClientHeight = 52
ClientWidth = 476
TabOrder = 3
object DisplayEdit: TEdit
Left = 6
Height = 25
Top = 34
Top = 27
Width = 464
Align = alTop
BorderSpacing.Around = 6
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
TabOrder = 1
Text = 'DisplayEdit'
end
object UseDisplayCheckBox: TCheckBox
Left = 6
Height = 22
Top = 6
Height = 21
Top = 3
Width = 464
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'UseDisplayCheckBox'
TabOrder = 0
end
end
object CmdLineParametersGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 62
Top = 70
Width = 484
Height = 135
Top = 68
Width = 480
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'CmdLineParametersGroupBox'
ClientHeight = 41
ClientHeight = 116
ClientWidth = 476
TabOrder = 1
object CmdLineParametersComboBox: TComboBox
Left = 6
Height = 29
Top = 6
Height = 25
Top = 3
Width = 464
Align = alTop
BorderSpacing.Around = 6
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
ItemHeight = 0
OnSelect = CmdLineParametersComboBoxSelect
TabOrder = 0
Text = 'CmdLineParametersComboBox'
end
object CmdLineParametersMemo: TMemo
AnchorSideTop.Control = CmdLineParametersComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 82
Top = 31
Width = 464
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
BorderSpacing.Bottom = 3
OnChange = CmdLineParametersMemoChange
ScrollBars = ssAutoBoth
TabOrder = 1
WordWrap = False
end
end
object UseLaunchingApplicationGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 90
Top = 138
Width = 484
Height = 159
Top = 209
Width = 480
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'UseLaunchingApplicationGroupBox'
ClientHeight = 69
ClientHeight = 140
ClientWidth = 476
TabOrder = 2
object UseLaunchingApplicationCheckBox: TCheckBox
Left = 6
Height = 22
Top = 6
Height = 21
Top = 3
Width = 464
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'UseLaunchingApplicationCheckBox'
TabOrder = 0
end
object UseLaunchingApplicationComboBox: TComboBox
AnchorSideTop.Control = UseLaunchingApplicationCheckBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 34
Height = 25
Top = 27
Width = 464
Align = alTop
BorderSpacing.Around = 6
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
ItemHeight = 0
OnSelect = UseLaunchingApplicationComboBoxSelect
TabOrder = 1
Text = 'UseLaunchingApplicationComboBox'
end
object UseLaunchingApplicationMemo: TMemo
AnchorSideTop.Control = UseLaunchingApplicationComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 82
Top = 55
Width = 464
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
BorderSpacing.Bottom = 3
OnChange = UseLaunchingApplicationMemoChange
ScrollBars = ssAutoBoth
TabOrder = 2
WordWrap = False
end
end
object HostApplicationGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 58
Height = 56
Top = 6
Width = 484
Width = 480
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
@ -137,10 +179,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = HostApplicationEdit
AnchorSideBottom.Side = asrBottom
Left = 288
Left = 292
Height = 25
Top = 6
Width = 182
Width = 178
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 6
@ -157,7 +199,7 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
Left = 6
Height = 25
Top = 6
Width = 276
Width = 280
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 0
@ -165,15 +207,16 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
end
end
object WorkingDirectoryGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 62
Top = 326
Width = 484
Height = 50
Top = 451
Width = 480
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'WorkingDirectoryGroupBox'
ClientHeight = 41
ClientHeight = 31
ClientWidth = 476
TabOrder = 4
object WorkingDirectoryBtn: TButton
@ -182,10 +225,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = WorkingDirectoryComboBox
AnchorSideBottom.Side = asrBottom
Left = 327
Height = 29
Left = 330
Height = 22
Top = 6
Width = 143
Width = 140
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 6
@ -199,11 +242,14 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideTop.Control = WorkingDirectoryGroupBox
AnchorSideRight.Control = WorkingDirectoryBtn
Left = 6
Height = 29
Top = 6
Width = 315
Height = 25
Top = 3
Width = 318
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
BorderSpacing.Bottom = 3
ItemHeight = 0
TabOrder = 0
Text = 'WorkingDirectoryComboBox'
@ -212,16 +258,16 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
end
object EnvVarsPage: TTabSheet
Caption = 'EnvVarsPage'
ClientHeight = 423
ClientWidth = 496
ClientHeight = 527
ClientWidth = 489
OnResize = EnvVarsPageResize
object IncludeSystemVariablesCheckBox: TCheckBox
AnchorSideLeft.Control = EnvVarsPage
AnchorSideBottom.Control = EnvVarsPage
Left = 6
Height = 22
Top = 395
Width = 484
Height = 21
Top = 500
Width = 477
Align = alBottom
BorderSpacing.Around = 6
Caption = 'IncludeSystemVariablesCheckBox'
@ -235,14 +281,14 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = IncludeSystemVariablesCheckBox
Left = 6
Height = 160
Height = 265
Top = 229
Width = 484
Width = 477
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'UserOverridesGroupBox'
ClientHeight = 139
ClientWidth = 476
ClientHeight = 246
ClientWidth = 473
TabOrder = 1
object UserOverridesListView: TListView
AnchorSideLeft.Control = UserOverridesGroupBox
@ -250,12 +296,14 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideRight.Control = UserOverridesGroupBox
AnchorSideBottom.Control = UserOverridesAddButton
Left = 6
Height = 93
Top = 6
Width = 464
Height = 205
Top = 3
Width = 461
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
Columns = <
item
AutoSize = True
@ -277,9 +325,9 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideBottom.Control = UserOverridesGroupBox
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 28
Top = 105
Width = 173
Height = 26
Top = 214
Width = 168
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Around = 6
@ -292,10 +340,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = UserOverridesGroupBox
AnchorSideBottom.Side = asrBottom
Left = 381
Height = 28
Top = 105
Width = 172
Left = 371
Height = 26
Top = 214
Width = 168
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Around = 6
@ -308,10 +356,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = UserOverridesGroupBox
AnchorSideBottom.Side = asrBottom
Left = 185
Height = 28
Top = 105
Width = 190
Left = 180
Height = 26
Top = 214
Width = 185
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Around = 6
@ -325,13 +373,13 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
Left = 6
Height = 217
Top = 6
Width = 484
Width = 477
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'SystemVariablesGroupBox'
ClientHeight = 196
ClientWidth = 476
ClientHeight = 198
ClientWidth = 473
TabOrder = 0
object SystemVariablesListView: TListView
AnchorSideLeft.Control = SystemVariablesGroupBox
@ -339,11 +387,13 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideRight.Control = SystemVariablesGroupBox
AnchorSideBottom.Control = SystemVariablesGroupBox
Left = 6
Height = 184
Top = 6
Width = 464
Height = 195
Top = 3
Width = 461
Align = alClient
BorderSpacing.Around = 6
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
Columns = <
item
AutoSize = True
@ -366,8 +416,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
object ButtonPanel: TButtonPanel
Left = 6
Height = 33
Top = 462
Width = 488
Top = 558
Width = 484
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
OKButton.OnClick = OkButtonClick

View File

@ -50,16 +50,17 @@ uses
Classes, SysUtils, LCLProc, Controls, Forms, Buttons, StdCtrls, ComCtrls,
Dialogs, ExtCtrls, BaseIDEIntf, IDEHelpIntf, ProjectIntf, IDEDialogs,
IDEProcs, SysVarUserOverrideDlg, InputHistory, LazarusIDEStrConsts, FileUtil,
Laz2_XMLCfg, ButtonPanel;
Laz2_XMLCfg, ButtonPanel, AdvHistoryList;
{ The xml format version:
When the format changes (new values, changed formats) we can distinguish old
files and are able to convert them.
}
const
RunParamsOptionsVersion = '1';
RunParamsOptionsVersion = 2;
type
{
the storage object for run parameters
}
@ -67,6 +68,9 @@ type
{ TRunParamsOptions }
TRunParamsOptions = class(TAbstractRunParamsOptions)
private
FCmdLineParamsHistoryList,
FLaunchingApplicationHistoryList : TAdvHistoryList;
public
constructor Create;
destructor Destroy; override;
@ -76,6 +80,8 @@ type
function Save(XMLConfig: TXMLConfig; const Path: string;
UsePathDelim: TPathDelimSwitch): TModalResult;
procedure AssignEnvironmentTo(Strings: TStrings); override;
property CmdLineParamsHistoryList : TAdvHistoryList read FCmdLineParamsHistoryList;
property LaunchingApplicationHistoryList : TAdvHistoryList read FLaunchingApplicationHistoryList;
end;
{
@ -87,6 +93,8 @@ type
TRunParamsOptsDlg = class(TForm)
ButtonPanel: TButtonPanel;
CmdLineParametersComboBox: TComboBox;
CmdLineParametersMemo: TMemo;
UseLaunchingApplicationMemo: TMemo;
UseDisplayCheckBox: TCheckBox;
DisplayEdit: TEdit;
DisplayGroupBox: TGroupBox;
@ -111,10 +119,14 @@ type
Notebook: TPageControl;
GeneralPage: TTabSheet;
EnvVarsPage: TTabSheet;
procedure CmdLineParametersComboBoxSelect(Sender: TObject);
procedure CmdLineParametersMemoChange(Sender: TObject);
procedure EnvVarsPageResize(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure HostApplicationBrowseBtnClick(Sender: TObject);
procedure UseLaunchingApplicationComboBoxSelect(Sender: TObject);
procedure UseLaunchingApplicationMemoChange(Sender: TObject);
procedure WorkingDirectoryBtnClick(Sender: TObject);
procedure UserOverridesAddButtonClick(Sender: TObject);
procedure UserOverridesEditButtonClick(Sender: TObject);
@ -130,7 +142,7 @@ type
procedure FillUserOverridesListView;
procedure SaveToOptions;
procedure SaveUserOverrides;
procedure SetComboBoxText(AComboBox: TComboBox; AText: ansistring);
procedure SetComboBoxText(AComboBox: TComboBox; AText: string);
public
constructor Create(AnOwner: TComponent); override;
property Options: TRunParamsOptions Read fOptions Write SetOptions;
@ -215,16 +227,24 @@ end;
constructor TRunParamsOptions.Create;
begin
inherited Create;
fUserOverrides := TStringList.Create;
FCmdLineParamsHistoryList := TAdvHistoryList(TAdvHistoryList.CreateMe(rltCaseSensitive, hlCmdLineParamsHistoryList));
FLaunchingApplicationHistoryList := TAdvHistoryList(TAdvHistoryList.CreateMe(rltCaseSensitive, hlLaunchingApplicationHistoryList));
Clear;
end;
destructor TRunParamsOptions.Destroy;
begin
fUserOverrides.Free;
FreeAndNil(FCmdLineParamsHistoryList);
FreeAndNil(FLaunchingApplicationHistoryList);
inherited Destroy;
end;
procedure TRunParamsOptions.Clear;
begin
// local options
@ -240,6 +260,9 @@ begin
// environment options
fUserOverrides.Clear;
fIncludeSystemVariables := False;
FCmdLineParamsHistoryList.Clear;
FLaunchingApplicationHistoryList.Clear;
end;
function TRunParamsOptions.Load(XMLConfig: TXMLConfig; const Path: string;
@ -263,20 +286,52 @@ function TRunParamsOptions.Load(XMLConfig: TXMLConfig; const Path: string;
end;
end;
Var
ARunParamsOptionsVersion : Integer;
begin
// get format version to distinguish old formats
ARunParamsOptionsVersion := XMLConfig.GetValue(Path + 'RunParams/local/FormatVersion/Value',
RunParamsOptionsVersion);
// local options
fHostApplicationFilename := f(XMLConfig.GetValue(
Path + 'RunParams/local/HostApplicationFilename/Value',
fHostApplicationFilename));
fCmdLineParams := f(XMLConfig.GetValue(
Path + 'RunParams/local/CommandLineParams/Value', fCmdLineParams));
fUseLaunchingApplication := XMLConfig.GetValue(
Path + 'RunParams/local/LaunchingApplication/Use', fUseLaunchingApplication);
fLaunchingApplicationPathPlusParams :=
f(XMLConfig.GetValue(Path + 'RunParams/local/LaunchingApplication/PathPlusParams',
f(GetDefaultLaunchingApplicationPathPlusParams)));
Case ARunParamsOptionsVersion Of
1 : Begin
fCmdLineParams := f(XMLConfig.GetValue(
Path + 'RunParams/local/CommandLineParams/Value', fCmdLineParams));
CmdLineParamsHistoryList.Values['Old value'] := fCmdLineParams;
CmdLineParamsHistoryList.Selected := 'Old value';
fLaunchingApplicationPathPlusParams :=
f(XMLConfig.GetValue(Path + 'RunParams/local/LaunchingApplication/PathPlusParams',
f(GetDefaultLaunchingApplicationPathPlusParams)));
LaunchingApplicationHistoryList.Values['Old value'] := fLaunchingApplicationPathPlusParams;
LaunchingApplicationHistoryList.Selected := 'Old value';
End;
2 : begin
FCmdLineParamsHistoryList.AdvLoadFromXMLConfig(XMLConfig, Path + 'RunParams/local/CommandLineParamsList');
If FCmdLineParamsHistoryList.Selected <> '' Then
fCmdLineParams := f(FCmdLineParamsHistoryList.Values[FCmdLineParamsHistoryList.Selected]);
FLaunchingApplicationHistoryList.AdvLoadFromXMLConfig(XMLConfig, Path + 'RunParams/local/LaunchingApplication/PathPlusParams/List');
if FLaunchingApplicationHistoryList.Selected <> '' Then
fLaunchingApplicationPathPlusParams := f(FLaunchingApplicationHistoryList.Values[FLaunchingApplicationHistoryList.Selected])
else
fLaunchingApplicationPathPlusParams := f(GetDefaultLaunchingApplicationPathPlusParams);
end;
end;
fWorkingDirectory := f(XMLConfig.GetValue(
Path + 'RunParams/local/WorkingDirectory/Value', fWorkingDirectory));
fUseDisplay := XMLConfig.GetValue(Path + 'RunParams/local/Display/Use',
fUseDisplay);
fDisplay := XMLConfig.GetValue(Path + 'RunParams/local/Display/Value', fDisplay);
@ -312,6 +367,8 @@ function TRunParamsOptions.Save(XMLConfig: TXMLConfig; const Path: string;
end;
end;
Var
APrevValue : String;
begin
// save a format version to distinguish old formats
XMLConfig.SetValue(Path + 'RunParams/local/FormatVersion/Value',
@ -320,12 +377,26 @@ begin
// local options
XMLConfig.SetDeleteValue(Path + 'RunParams/local/HostApplicationFilename/Value',
f(fHostApplicationFilename), '');
APrevValue := fCmdLineParams;
fCmdLineParams := '';
XMLConfig.SetDeleteValue(Path + 'RunParams/local/CommandLineParams/Value',
f(fCmdLineParams), '');
fCmdLineParams := APrevValue;
XMLConfig.SetDeleteValue(Path + 'RunParams/local/LaunchingApplication/Use',
fUseLaunchingApplication, False);
APrevValue := fLaunchingApplicationPathPlusParams;
fLaunchingApplicationPathPlusParams := '';
XMLConfig.SetDeleteValue(Path + 'RunParams/local/LaunchingApplication/PathPlusParams',
f(fLaunchingApplicationPathPlusParams), f(GetDefaultLaunchingApplicationPathPlusParams));
f(fLaunchingApplicationPathPlusParams), '');
fLaunchingApplicationPathPlusParams := APrevValue;
XMLConfig.SetDeleteValue(Path + 'RunParams/local/WorkingDirectory/Value',
f(fWorkingDirectory), '');
XMLConfig.SetDeleteValue(Path + 'RunParams/local/Display/Use',
@ -338,6 +409,9 @@ begin
XMLConfig.SetDeleteValue(Path + 'RunParams/environment/IncludeSystemVariables/Value',
fIncludeSystemVariables, False);
CmdLineParamsHistoryList.AdvSaveToXMLConfig(XMLConfig, Path + 'RunParams/local/CommandLineParamsList');
LaunchingApplicationHistoryList.AdvSaveToXMLConfig(XMLConfig, Path + 'RunParams/local/LaunchingApplication/PathPlusParams/List');
Result := mrOk;
end;
@ -399,6 +473,9 @@ begin
DisplayGroupBox.Caption := dlgRunODisplay;
UseDisplayCheckBox.Caption := dlgRunOUsedisplay;
DisplayEdit.Parent := DisplayGroupBox;
CmdLineParametersComboBox.Text := '';
UseLaunchingApplicationComboBox.Text := '';
end;
procedure TRunParamsOptsDlg.SetupEnvironmentPage;
@ -450,6 +527,29 @@ begin
UserOverridesListView.Column[1].Width := UserOverridesListView.Column[0].Width;
end;
procedure TRunParamsOptsDlg.CmdLineParametersMemoChange(Sender: TObject);
Var
AValue : String;
begin
AValue := CmdLineParametersComboBox.Text;
If AValue = '' Then Begin
SetComboBoxText(CmdLineParametersComboBox, 'Default');
AValue := CmdLineParametersComboBox.Text;
end;
If AValue <> '' Then Begin
fOptions.CmdLineParamsHistoryList.Values[AValue] := CmdLineParametersMemo.Lines.Text;
end;
end;
procedure TRunParamsOptsDlg.CmdLineParametersComboBoxSelect(Sender: TObject);
Var
AValue : String;
begin
AValue := CmdLineParametersComboBox.Text;
If AValue <> '' Then
CmdLineParametersMemo.Lines.Text := Foptions.CmdLineParamsHistoryList.Values[AValue];
end;
procedure TRunParamsOptsDlg.HelpButtonClick(Sender: TObject);
begin
LazarusHelp.ShowHelpForIDEControl(Self);
@ -481,6 +581,29 @@ begin
end;
end;
procedure TRunParamsOptsDlg.UseLaunchingApplicationComboBoxSelect(
Sender: TObject);
Var
AValue : String;
begin
AValue := UseLaunchingApplicationComboBox.Text;
If AValue <> '' Then
UseLaunchingApplicationMemo.Text := Foptions.LaunchingApplicationHistoryList.Values[AValue];
end;
procedure TRunParamsOptsDlg.UseLaunchingApplicationMemoChange(Sender: TObject);
Var
AValue : String;
begin
AValue := UseLaunchingApplicationComboBox.Text;
If AValue = '' Then Begin
SetComboBoxText(UseLaunchingApplicationComboBox, 'Default');
AValue := UseLaunchingApplicationComboBox.Text;
end;
If AValue <> '' Then
fOptions.LaunchingApplicationHistoryList.Values[AValue] := UseLaunchingApplicationMemo.Lines.Text;
end;
procedure TRunParamsOptsDlg.WorkingDirectoryBtnClick(Sender: TObject);
var
NewDirectory: String;
@ -560,14 +683,36 @@ procedure TRunParamsOptsDlg.SaveToOptions;
InputHistories.HistoryLists.GetList(History,true,ListType).Assign(AComboBox.Items);
end;
procedure SaveHistoryList(AHistoryList : THistoryList; History : String; ListType : TRecentListType);
begin
InputHistories.HistoryLists.GetList(History,true,ListType).Assign(AHistoryList);
end;
procedure SaveAdvHistoryList(AComboBox : TComboBox; AHistoryList : TAdvHistoryList; AMemo : TMemo);
Var
AValue : String;
begin
AValue := AComboBox.Text;
If (AValue = '') And (AMemo.Lines.Text <> '') Then
AValue := 'Default';
If AValue <> '' Then Begin
AHistoryList.Values[AValue] := AMemo.Lines.Text;
AHistoryList.Selected := AValue;
end;
end;
begin
// local
fOptions.HostApplicationFilename := Trim(HostApplicationEdit.Text);
fOptions.CmdLineParams := Trim(CmdLineParametersComboBox.Text);
fOptions.CmdLineParams := Trim(CmdLineParametersMemo.Lines.Text);
fOptions.UseLaunchingApplication := UseLaunchingApplicationCheckBox.Checked;
fOptions.LaunchingApplicationPathPlusParams :=
Trim(UseLaunchingApplicationComboBox.Text);
Trim(UseLaunchingApplicationMemo.Lines.Text);
fOptions.WorkingDirectory := Trim(WorkingDirectoryComboBox.Text);
fOptions.UseDisplay := UseDisplayCheckBox.Checked;
fOptions.Display := Trim(DisplayEdit.Text);
@ -575,10 +720,16 @@ begin
SaveComboHistory(WorkingDirectoryComboBox,hlWorkingDirectory,rltFile);
// history list: UseLaunchingApplicationComboBox
SaveComboHistory(UseLaunchingApplicationComboBox,hlLaunchingApplication,rltFile);
//SaveComboHistory(UseLaunchingApplicationComboBox,hlLaunchingApplication,rltFile);
SaveAdvHistoryList(CmdLineParametersComboBox, fOptions.CmdLineParamsHistoryList, CmdLineParametersMemo);
SaveAdvHistoryList(UseLaunchingApplicationComboBox, fOptions.LaunchingApplicationHistoryList, UseLaunchingApplicationMemo);
SaveHistoryList(fOptions.CmdLineParamsHistoryList, hlCmdLineParamsHistoryList, rltCaseSensitive);
SaveHistoryList(fOptions.LaunchingApplicationHistoryList, hlLaunchingApplicationHistoryList, rltCaseSensitive);
// history list: CmdLineParametersComboBox
SaveComboHistory(CmdLineParametersComboBox,hlCmdLineParameters,rltCaseSensitive);
//SaveComboHistory(CmdLineParametersComboBox,hlCmdLineParameters,rltCaseSensitive);
// environment
SaveUserOverrides;
@ -598,7 +749,7 @@ begin
end;
end;
procedure TRunParamsOptsDlg.SetComboBoxText(AComboBox: TComboBox; AText: ansistring);
procedure TRunParamsOptsDlg.SetComboBoxText(AComboBox: TComboBox; AText: string);
var
a: integer;
begin
@ -607,8 +758,10 @@ begin
AComboBox.ItemIndex := a
else
begin
AComboBox.Items.Add(AText);
AComboBox.ItemIndex := AComboBox.Items.IndexOf(AText);
If AText <> '' Then Begin
AComboBox.Items.Add(AText);
AComboBox.ItemIndex := AComboBox.Items.IndexOf(AText);
end;
end;
end;
@ -616,6 +769,9 @@ procedure TRunParamsOptsDlg.SetOptions(NewOptions: TRunParamsOptions);
var
List: THistoryList;
S: String;
I : Integer;
AValue : String;
AAdvHistoryList : TAdvHistoryList;
begin
fOptions := NewOptions;
@ -630,8 +786,9 @@ begin
// UseLaunchingApplicationComboBox
UseLaunchingApplicationCheckBox.Checked := fOptions.UseLaunchingApplication;
List := InputHistories.HistoryLists.GetList(hlLaunchingApplication,true,rltFile);
List.AppendEntry(fOptions.LaunchingApplicationPathPlusParams);
S := FindTerminalInPath;
if S <> '' then
List.AppendEntry(S);
@ -643,14 +800,39 @@ begin
if S <> '' then
List.AppendEntry(S);
{$ENDIF}
UseLaunchingApplicationComboBox.Items.Assign(List);
UseLaunchingApplicationComboBox.Text:=fOptions.LaunchingApplicationPathPlusParams;
For I := 0 To List.Count - 1 Do Begin
AValue := Format('Old value #%d', [I + 1]);
fOptions.LaunchingApplicationHistoryList.Values[AValue] := List[I];
end;
AAdvHistoryList := TAdvHistoryList(InputHistories.HistoryLists.GetList(hlLaunchingApplicationHistoryList,true,rltCaseSensitive));
If AAdvHistoryList.Count > 0 Then
fOptions.LaunchingApplicationHistoryList.AssignKeyValue(AAdvHistoryList);
fOptions.LaunchingApplicationHistoryList.SetComboBox(UseLaunchingApplicationComboBox);
SetComboBoxText(UseLaunchingApplicationComboBox, fOptions.LaunchingApplicationHistoryList.Selected);
UseLaunchingApplicationMemo.Lines.Text:= fOptions.LaunchingApplicationHistoryList.Values[fOptions.FLaunchingApplicationHistoryList.Selected];
// CmdLineParametersComboBox
List:=InputHistories.HistoryLists.GetList(hlCmdLineParameters,true,rltCaseSensitive);
List.AppendEntry(fOptions.CmdLineParams);
CmdLineParametersComboBox.Items.Assign(List);
CmdLineParametersComboBox.Text := fOptions.CmdLineParams;
For I := 0 To List.Count - 1 Do Begin
AValue := Format('Old value #%d', [I + 1]);
fOptions.CmdLineParamsHistoryList.Values[AValue] := List[I];
end;
AAdvHistoryList := TAdvHistoryList(InputHistories.HistoryLists.GetList(hlCmdLineParamsHistoryList,true,rltCaseSensitive));
If AAdvHistoryList.Count > 0 Then
fOptions.CmdLineParamsHistoryList.AssignKeyValue(AAdvHistoryList);
fOptions.CmdLineParamsHistoryList.SetComboBox(CmdLineParametersComboBox);
AValue := fOptions.CmdLineParamsHistoryList.Selected;
SetComboBoxText(CmdLineParametersComboBox, AValue);
CmdLineParametersMemo.Lines.Text := fOptions.CmdLineParamsHistoryList.Values[fOptions.CmdLineParamsHistoryList.Selected];
UseDisplayCheckBox.Checked := fOptions.UseDisplay;
DisplayEdit.Text := fOptions.Display;