diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas index 95bb4e6f54..9029da0c7b 100644 --- a/ide/buildmanager.pas +++ b/ide/buildmanager.pas @@ -533,52 +533,27 @@ var Result := ExtractFileNameWithoutExt(Result) + '.app'; end; end; - - 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 := ''; - + Result := ''; if Project1=nil then exit; + if Project1.RunParameterOptions.UseLaunchingApplication then + Result := Project1.RunParameterOptions.LaunchingApplicationPathPlusParams; - if Project1.RunParameterOptions.UseLaunchingApplication then Begin - AStrList.Text := Project1.RunParameterOptions.LaunchingApplicationPathPlusParams; - AStr := ListToString(AStrList); - end; - - if AStr='' + if Result='' then begin - AStrList.Text := Project1.RunParameterOptions.CmdLineParams; - AStr:= ListToString(AStrList); - if GlobalMacroList.SubstituteStr(AStr) then begin + Result:=Project1.RunParameterOptions.CmdLineParams; + if GlobalMacroList.SubstituteStr(Result) then begin TargetFileName:='"'+GetTargetFilename+'"'; - if AStr='' then - AStr:=TargetFileName + if Result='' then + Result:=TargetFileName else - AStr:=TargetFilename+' '+AStr; + Result:=TargetFilename+' '+Result; end else - AStr:=''; + Result:=''; end else begin - if not GlobalMacroList.SubstituteStr(AStr) then AStr:=''; + if not GlobalMacroList.SubstituteStr(Result) then Result:=''; end; - - Result := AStr; - - FreeAndNil(AStrList); end; function TBuildManager.GetProjectPublishDir: string; diff --git a/ide/inputhistory.pas b/ide/inputhistory.pas index cdf5253618..70159081e4 100644 --- a/ide/inputhistory.pas +++ b/ide/inputhistory.pas @@ -69,32 +69,29 @@ 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);virtual; + constructor Create(TheListType: TRecentListType); destructor Destroy; override; function Push(const Entry: string): integer; - procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);virtual; - procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);virtual; + procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); + procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); 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 @@ -113,8 +110,6 @@ 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; @@ -775,16 +770,6 @@ 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; @@ -808,25 +793,6 @@ 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); @@ -870,26 +836,6 @@ 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]); @@ -968,16 +914,13 @@ 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 - AClass := Self.GetHistoryListClass(Name); - If AClass = NIL Then - AClass := THistoryList; - Result:= AClass.CreateMe(ListType, Name); + Result:=THistoryList.Create(ListType); + Result.Name:=Name; FItems.Add(Result); end else Result:=nil; @@ -1283,10 +1226,6 @@ end; initialization InputHistories:= nil; - AHistoryListClasses := TStringToPointerTree.Create(True); - -finalization - FreeAndNil(AHistoryListClasses); end. diff --git a/ide/runparamsopts.lfm b/ide/runparamsopts.lfm index 689e5977e4..8ea6d1257c 100644 --- a/ide/runparamsopts.lfm +++ b/ide/runparamsopts.lfm @@ -1,18 +1,18 @@ object RunParamsOptsDlg: TRunParamsOptsDlg - Left = 411 - Height = 597 - Top = 122 - Width = 496 + Left = 443 + Height = 501 + Top = 176 + Width = 500 Caption = 'RunParamsOptsDlg' - ClientHeight = 597 - ClientWidth = 496 + ClientHeight = 501 + ClientWidth = 500 Position = poScreenCenter LCLVersion = '1.1' object Notebook: TPageControl Left = 0 - Height = 552 + Height = 456 Top = 0 - Width = 496 + Width = 500 ActivePage = GeneralPage Align = alClient BorderSpacing.Bottom = 6 @@ -20,152 +20,110 @@ object RunParamsOptsDlg: TRunParamsOptsDlg TabOrder = 0 object GeneralPage: TTabSheet Caption = 'GeneralPage' - ClientHeight = 527 - ClientWidth = 492 + ClientHeight = 423 + ClientWidth = 496 object DisplayGroupBox: TGroupBox - AnchorSideRight.Side = asrBottom Left = 6 - Height = 71 - Top = 374 - Width = 480 + Height = 86 + Top = 234 + Width = 484 Align = alTop AutoSize = True BorderSpacing.Around = 6 Caption = 'DisplayGroupBox' - ClientHeight = 52 + ClientHeight = 65 ClientWidth = 476 TabOrder = 3 object DisplayEdit: TEdit Left = 6 Height = 25 - Top = 27 + Top = 34 Width = 464 Align = alTop - BorderSpacing.Left = 6 - BorderSpacing.Top = 3 - BorderSpacing.Right = 6 + BorderSpacing.Around = 6 TabOrder = 1 Text = 'DisplayEdit' end object UseDisplayCheckBox: TCheckBox Left = 6 - Height = 21 - Top = 3 + Height = 22 + Top = 6 Width = 464 Align = alTop BorderSpacing.Left = 6 - BorderSpacing.Top = 3 + BorderSpacing.Top = 6 BorderSpacing.Right = 6 + BorderSpacing.Bottom = 6 Caption = 'UseDisplayCheckBox' TabOrder = 0 end end object CmdLineParametersGroupBox: TGroupBox - AnchorSideRight.Side = asrBottom Left = 6 - Height = 135 - Top = 68 - Width = 480 + Height = 62 + Top = 70 + Width = 484 Align = alTop AutoSize = True BorderSpacing.Around = 6 Caption = 'CmdLineParametersGroupBox' - ClientHeight = 116 + ClientHeight = 41 ClientWidth = 476 TabOrder = 1 object CmdLineParametersComboBox: TComboBox Left = 6 - Height = 25 - Top = 3 + Height = 29 + Top = 6 Width = 464 Align = alTop - BorderSpacing.Left = 6 - BorderSpacing.Top = 3 - BorderSpacing.Right = 6 + BorderSpacing.Around = 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 = 159 - Top = 209 - Width = 480 + Height = 90 + Top = 138 + Width = 484 Align = alTop AutoSize = True BorderSpacing.Around = 6 Caption = 'UseLaunchingApplicationGroupBox' - ClientHeight = 140 + ClientHeight = 69 ClientWidth = 476 TabOrder = 2 object UseLaunchingApplicationCheckBox: TCheckBox Left = 6 - Height = 21 - Top = 3 + Height = 22 + Top = 6 Width = 464 Align = alTop BorderSpacing.Left = 6 - BorderSpacing.Top = 3 + BorderSpacing.Top = 6 BorderSpacing.Right = 6 + BorderSpacing.Bottom = 6 Caption = 'UseLaunchingApplicationCheckBox' TabOrder = 0 end object UseLaunchingApplicationComboBox: TComboBox - AnchorSideTop.Control = UseLaunchingApplicationCheckBox - AnchorSideTop.Side = asrBottom Left = 6 - Height = 25 - Top = 27 + Height = 29 + Top = 34 Width = 464 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 6 - BorderSpacing.Top = 3 - BorderSpacing.Right = 6 + Align = alTop + BorderSpacing.Around = 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 = 56 + Height = 58 Top = 6 - Width = 480 + Width = 484 Align = alTop AutoSize = True BorderSpacing.Around = 6 @@ -179,10 +137,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = HostApplicationEdit AnchorSideBottom.Side = asrBottom - Left = 292 + Left = 288 Height = 25 Top = 6 - Width = 178 + Width = 182 Anchors = [akTop, akRight, akBottom] AutoSize = True BorderSpacing.Left = 6 @@ -199,7 +157,7 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Left = 6 Height = 25 Top = 6 - Width = 280 + Width = 276 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 TabOrder = 0 @@ -207,16 +165,15 @@ object RunParamsOptsDlg: TRunParamsOptsDlg end end object WorkingDirectoryGroupBox: TGroupBox - AnchorSideRight.Side = asrBottom Left = 6 - Height = 50 - Top = 451 - Width = 480 + Height = 62 + Top = 326 + Width = 484 Align = alTop AutoSize = True BorderSpacing.Around = 6 Caption = 'WorkingDirectoryGroupBox' - ClientHeight = 31 + ClientHeight = 41 ClientWidth = 476 TabOrder = 4 object WorkingDirectoryBtn: TButton @@ -225,10 +182,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = WorkingDirectoryComboBox AnchorSideBottom.Side = asrBottom - Left = 330 - Height = 22 + Left = 327 + Height = 29 Top = 6 - Width = 140 + Width = 143 Anchors = [akTop, akRight, akBottom] AutoSize = True BorderSpacing.Top = 6 @@ -242,14 +199,11 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideTop.Control = WorkingDirectoryGroupBox AnchorSideRight.Control = WorkingDirectoryBtn Left = 6 - Height = 25 - Top = 3 - Width = 318 + Height = 29 + Top = 6 + Width = 315 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 6 - BorderSpacing.Top = 3 - BorderSpacing.Right = 6 - BorderSpacing.Bottom = 3 + BorderSpacing.Around = 6 ItemHeight = 0 TabOrder = 0 Text = 'WorkingDirectoryComboBox' @@ -258,16 +212,16 @@ object RunParamsOptsDlg: TRunParamsOptsDlg end object EnvVarsPage: TTabSheet Caption = 'EnvVarsPage' - ClientHeight = 527 - ClientWidth = 489 + ClientHeight = 423 + ClientWidth = 496 OnResize = EnvVarsPageResize object IncludeSystemVariablesCheckBox: TCheckBox AnchorSideLeft.Control = EnvVarsPage AnchorSideBottom.Control = EnvVarsPage Left = 6 - Height = 21 - Top = 500 - Width = 477 + Height = 22 + Top = 395 + Width = 484 Align = alBottom BorderSpacing.Around = 6 Caption = 'IncludeSystemVariablesCheckBox' @@ -281,14 +235,14 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = IncludeSystemVariablesCheckBox Left = 6 - Height = 265 + Height = 160 Top = 229 - Width = 477 + Width = 484 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 Caption = 'UserOverridesGroupBox' - ClientHeight = 246 - ClientWidth = 473 + ClientHeight = 139 + ClientWidth = 476 TabOrder = 1 object UserOverridesListView: TListView AnchorSideLeft.Control = UserOverridesGroupBox @@ -296,14 +250,12 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideRight.Control = UserOverridesGroupBox AnchorSideBottom.Control = UserOverridesAddButton Left = 6 - Height = 205 - Top = 3 - Width = 461 + Height = 93 + Top = 6 + Width = 464 Align = alTop Anchors = [akTop, akLeft, akRight, akBottom] - BorderSpacing.Left = 6 - BorderSpacing.Top = 3 - BorderSpacing.Right = 6 + BorderSpacing.Around = 6 Columns = < item AutoSize = True @@ -325,9 +277,9 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideBottom.Control = UserOverridesGroupBox AnchorSideBottom.Side = asrBottom Left = 6 - Height = 26 - Top = 214 - Width = 168 + Height = 28 + Top = 105 + Width = 173 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Around = 6 @@ -340,10 +292,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideLeft.Side = asrBottom AnchorSideBottom.Control = UserOverridesGroupBox AnchorSideBottom.Side = asrBottom - Left = 371 - Height = 26 - Top = 214 - Width = 168 + Left = 381 + Height = 28 + Top = 105 + Width = 172 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Around = 6 @@ -356,10 +308,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideLeft.Side = asrBottom AnchorSideBottom.Control = UserOverridesGroupBox AnchorSideBottom.Side = asrBottom - Left = 180 - Height = 26 - Top = 214 - Width = 185 + Left = 185 + Height = 28 + Top = 105 + Width = 190 Anchors = [akLeft, akBottom] AutoSize = True BorderSpacing.Around = 6 @@ -373,13 +325,13 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Left = 6 Height = 217 Top = 6 - Width = 477 + Width = 484 Align = alTop Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 Caption = 'SystemVariablesGroupBox' - ClientHeight = 198 - ClientWidth = 473 + ClientHeight = 196 + ClientWidth = 476 TabOrder = 0 object SystemVariablesListView: TListView AnchorSideLeft.Control = SystemVariablesGroupBox @@ -387,13 +339,11 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AnchorSideRight.Control = SystemVariablesGroupBox AnchorSideBottom.Control = SystemVariablesGroupBox Left = 6 - Height = 195 - Top = 3 - Width = 461 + Height = 184 + Top = 6 + Width = 464 Align = alClient - BorderSpacing.Left = 6 - BorderSpacing.Top = 3 - BorderSpacing.Right = 6 + BorderSpacing.Around = 6 Columns = < item AutoSize = True @@ -416,8 +366,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg object ButtonPanel: TButtonPanel Left = 6 Height = 33 - Top = 558 - Width = 484 + Top = 462 + Width = 488 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True OKButton.OnClick = OkButtonClick diff --git a/ide/runparamsopts.pas b/ide/runparamsopts.pas index 2c453fd08d..0f9bbabdad 100644 --- a/ide/runparamsopts.pas +++ b/ide/runparamsopts.pas @@ -50,17 +50,16 @@ uses Classes, SysUtils, LCLProc, Controls, Forms, Buttons, StdCtrls, ComCtrls, Dialogs, ExtCtrls, BaseIDEIntf, IDEHelpIntf, ProjectIntf, IDEDialogs, IDEProcs, SysVarUserOverrideDlg, InputHistory, LazarusIDEStrConsts, FileUtil, - Laz2_XMLCfg, ButtonPanel, AdvHistoryList; + Laz2_XMLCfg, ButtonPanel; { 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 = 2; + RunParamsOptionsVersion = '1'; type - { the storage object for run parameters } @@ -68,9 +67,6 @@ type { TRunParamsOptions } TRunParamsOptions = class(TAbstractRunParamsOptions) - private - FCmdLineParamsHistoryList, - FLaunchingApplicationHistoryList : TAdvHistoryList; public constructor Create; destructor Destroy; override; @@ -80,8 +76,6 @@ 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; { @@ -93,8 +87,6 @@ type TRunParamsOptsDlg = class(TForm) ButtonPanel: TButtonPanel; CmdLineParametersComboBox: TComboBox; - CmdLineParametersMemo: TMemo; - UseLaunchingApplicationMemo: TMemo; UseDisplayCheckBox: TCheckBox; DisplayEdit: TEdit; DisplayGroupBox: TGroupBox; @@ -119,14 +111,10 @@ 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); @@ -142,7 +130,7 @@ type procedure FillUserOverridesListView; procedure SaveToOptions; procedure SaveUserOverrides; - procedure SetComboBoxText(AComboBox: TComboBox; AText: string); + procedure SetComboBoxText(AComboBox: TComboBox; AText: ansistring); public constructor Create(AnOwner: TComponent); override; property Options: TRunParamsOptions Read fOptions Write SetOptions; @@ -227,24 +215,16 @@ 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 @@ -260,9 +240,6 @@ begin // environment options fUserOverrides.Clear; fIncludeSystemVariables := False; - - FCmdLineParamsHistoryList.Clear; - FLaunchingApplicationHistoryList.Clear; end; function TRunParamsOptions.Load(XMLConfig: TXMLConfig; const Path: string; @@ -286,52 +263,20 @@ 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); - - 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; - - + fLaunchingApplicationPathPlusParams := + f(XMLConfig.GetValue(Path + 'RunParams/local/LaunchingApplication/PathPlusParams', + f(GetDefaultLaunchingApplicationPathPlusParams))); 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); @@ -367,8 +312,6 @@ 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', @@ -377,26 +320,12 @@ 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), ''); - - fLaunchingApplicationPathPlusParams := APrevValue; - + f(fLaunchingApplicationPathPlusParams), f(GetDefaultLaunchingApplicationPathPlusParams)); XMLConfig.SetDeleteValue(Path + 'RunParams/local/WorkingDirectory/Value', f(fWorkingDirectory), ''); XMLConfig.SetDeleteValue(Path + 'RunParams/local/Display/Use', @@ -409,9 +338,6 @@ 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; @@ -473,9 +399,6 @@ begin DisplayGroupBox.Caption := dlgRunODisplay; UseDisplayCheckBox.Caption := dlgRunOUsedisplay; DisplayEdit.Parent := DisplayGroupBox; - - CmdLineParametersComboBox.Text := ''; - UseLaunchingApplicationComboBox.Text := ''; end; procedure TRunParamsOptsDlg.SetupEnvironmentPage; @@ -527,29 +450,6 @@ 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); @@ -581,29 +481,6 @@ 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; @@ -683,36 +560,14 @@ 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(CmdLineParametersMemo.Lines.Text); - + fOptions.CmdLineParams := Trim(CmdLineParametersComboBox.Text); fOptions.UseLaunchingApplication := UseLaunchingApplicationCheckBox.Checked; fOptions.LaunchingApplicationPathPlusParams := - Trim(UseLaunchingApplicationMemo.Lines.Text); - + Trim(UseLaunchingApplicationComboBox.Text); fOptions.WorkingDirectory := Trim(WorkingDirectoryComboBox.Text); - fOptions.UseDisplay := UseDisplayCheckBox.Checked; fOptions.Display := Trim(DisplayEdit.Text); @@ -720,16 +575,10 @@ begin SaveComboHistory(WorkingDirectoryComboBox,hlWorkingDirectory,rltFile); // history list: UseLaunchingApplicationComboBox - //SaveComboHistory(UseLaunchingApplicationComboBox,hlLaunchingApplication,rltFile); - - SaveAdvHistoryList(CmdLineParametersComboBox, fOptions.CmdLineParamsHistoryList, CmdLineParametersMemo); - SaveAdvHistoryList(UseLaunchingApplicationComboBox, fOptions.LaunchingApplicationHistoryList, UseLaunchingApplicationMemo); - - SaveHistoryList(fOptions.CmdLineParamsHistoryList, hlCmdLineParamsHistoryList, rltCaseSensitive); - SaveHistoryList(fOptions.LaunchingApplicationHistoryList, hlLaunchingApplicationHistoryList, rltCaseSensitive); + SaveComboHistory(UseLaunchingApplicationComboBox,hlLaunchingApplication,rltFile); // history list: CmdLineParametersComboBox - //SaveComboHistory(CmdLineParametersComboBox,hlCmdLineParameters,rltCaseSensitive); + SaveComboHistory(CmdLineParametersComboBox,hlCmdLineParameters,rltCaseSensitive); // environment SaveUserOverrides; @@ -749,7 +598,7 @@ begin end; end; -procedure TRunParamsOptsDlg.SetComboBoxText(AComboBox: TComboBox; AText: string); +procedure TRunParamsOptsDlg.SetComboBoxText(AComboBox: TComboBox; AText: ansistring); var a: integer; begin @@ -758,10 +607,8 @@ begin AComboBox.ItemIndex := a else begin - If AText <> '' Then Begin - AComboBox.Items.Add(AText); - AComboBox.ItemIndex := AComboBox.Items.IndexOf(AText); - end; + AComboBox.Items.Add(AText); + AComboBox.ItemIndex := AComboBox.Items.IndexOf(AText); end; end; @@ -769,9 +616,6 @@ procedure TRunParamsOptsDlg.SetOptions(NewOptions: TRunParamsOptions); var List: THistoryList; S: String; - I : Integer; - AValue : String; - AAdvHistoryList : TAdvHistoryList; begin fOptions := NewOptions; @@ -786,9 +630,8 @@ 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); @@ -800,39 +643,14 @@ begin if S <> '' then List.AppendEntry(S); {$ENDIF} - 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]; + UseLaunchingApplicationComboBox.Items.Assign(List); + UseLaunchingApplicationComboBox.Text:=fOptions.LaunchingApplicationPathPlusParams; // CmdLineParametersComboBox List:=InputHistories.HistoryLists.GetList(hlCmdLineParameters,true,rltCaseSensitive); - - 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]; + List.AppendEntry(fOptions.CmdLineParams); + CmdLineParametersComboBox.Items.Assign(List); + CmdLineParametersComboBox.Text := fOptions.CmdLineParams; UseDisplayCheckBox.Checked := fOptions.UseDisplay; DisplayEdit.Text := fOptions.Display;