IDE: fixed run parameters, also included kde's konsole. fixes #15847

git-svn-id: trunk@26200 -
This commit is contained in:
zeljko 2010-06-20 10:28:31 +00:00
parent fd33466244
commit a846b8b3cb
2 changed files with 114 additions and 65 deletions

View File

@ -9,7 +9,7 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
ClientHeight = 501 ClientHeight = 501
ClientWidth = 500 ClientWidth = 500
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '0.9.27' LCLVersion = '0.9.29'
object Notebook: TNotebook object Notebook: TNotebook
Left = 0 Left = 0
Height = 463 Height = 463
@ -21,8 +21,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
TabOrder = 0 TabOrder = 0
object GeneralPage: TPage object GeneralPage: TPage
Caption = 'GeneralPage' Caption = 'GeneralPage'
ClientWidth = 492 ClientWidth = 498
ClientHeight = 421 ClientHeight = 432
object DisplayGroupBox: TGroupBox object DisplayGroupBox: TGroupBox
Left = 6 Left = 6
Height = 82 Height = 82
@ -32,8 +32,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'DisplayGroupBox' Caption = 'DisplayGroupBox'
ClientHeight = 64 ClientHeight = 82
ClientWidth = 476 ClientWidth = 480
TabOrder = 3 TabOrder = 3
object DisplayEdit: TEdit object DisplayEdit: TEdit
Left = 6 Left = 6
@ -68,8 +68,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'CmdLineParametersGroupBox' Caption = 'CmdLineParametersGroupBox'
ClientHeight = 42 ClientHeight = 60
ClientWidth = 476 ClientWidth = 480
TabOrder = 0 TabOrder = 0
object CmdLineParametersComboBox: TComboBox object CmdLineParametersComboBox: TComboBox
Left = 6 Left = 6
@ -77,10 +77,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
Top = 6 Top = 6
Width = 464 Width = 464
Align = alTop Align = alTop
AutoComplete = False
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ItemHeight = 13 ItemHeight = 0
ItemWidth = 0
TabOrder = 0 TabOrder = 0
Text = 'CmdLineParametersComboBox' Text = 'CmdLineParametersComboBox'
end end
@ -94,8 +92,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'UseLaunchingApplicationGroupBox' Caption = 'UseLaunchingApplicationGroupBox'
ClientHeight = 70 ClientHeight = 88
ClientWidth = 476 ClientWidth = 480
TabOrder = 1 TabOrder = 1
object UseLaunchingApplicationCheckBox: TCheckBox object UseLaunchingApplicationCheckBox: TCheckBox
Left = 6 Left = 6
@ -116,10 +114,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
Top = 34 Top = 34
Width = 464 Width = 464
Align = alTop Align = alTop
AutoComplete = False
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ItemHeight = 13 ItemHeight = 0
ItemWidth = 0
TabOrder = 1 TabOrder = 1
Text = 'UseLaunchingApplicationComboBox' Text = 'UseLaunchingApplicationComboBox'
end end
@ -133,8 +129,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'HostApplicationGroupBox' Caption = 'HostApplicationGroupBox'
ClientHeight = 42 ClientHeight = 60
ClientWidth = 476 ClientWidth = 480
TabOrder = 2 TabOrder = 2
object HostApplicationBrowseBtn: TButton object HostApplicationBrowseBtn: TButton
AnchorSideTop.Control = HostApplicationGroupBox AnchorSideTop.Control = HostApplicationGroupBox
@ -164,7 +160,6 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
Top = 6 Top = 6
Width = 278 Width = 278
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
TabOrder = 1 TabOrder = 1
Text = 'HostApplicationEdit' Text = 'HostApplicationEdit'
@ -179,8 +174,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'WorkingDirectoryGroupBox' Caption = 'WorkingDirectoryGroupBox'
ClientHeight = 42 ClientHeight = 60
ClientWidth = 476 ClientWidth = 480
TabOrder = 4 TabOrder = 4
object WorkingDirectoryBtn: TButton object WorkingDirectoryBtn: TButton
AnchorSideTop.Control = WorkingDirectoryGroupBox AnchorSideTop.Control = WorkingDirectoryGroupBox
@ -209,10 +204,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
Top = 6 Top = 6
Width = 317 Width = 317
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoComplete = False
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ItemHeight = 13 ItemHeight = 0
ItemWidth = 0
TabOrder = 1 TabOrder = 1
Text = 'WorkingDirectoryComboBox' Text = 'WorkingDirectoryComboBox'
end end
@ -220,17 +213,17 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
end end
object EnvVarsPage: TPage object EnvVarsPage: TPage
Caption = 'EnvVarsPage' Caption = 'EnvVarsPage'
ClientWidth = 492 ClientWidth = 496
ClientHeight = 437 ClientHeight = 438
OnResize = EnvVarsPageResize OnResize = EnvVarsPageResize
object IncludeSystemVariablesCheckBox: TCheckBox object IncludeSystemVariablesCheckBox: TCheckBox
AnchorSideLeft.Control = EnvVarsPage AnchorSideLeft.Control = EnvVarsPage
AnchorSideBottom.Control = EnvVarsPage AnchorSideBottom.Control = EnvVarsPage
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 20
Top = 414 Top = 412
Width = 480 Width = 484
Align = alBottom Align = alBottom
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'IncludeSystemVariablesCheckBox' Caption = 'IncludeSystemVariablesCheckBox'
@ -244,14 +237,14 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = IncludeSystemVariablesCheckBox AnchorSideBottom.Control = IncludeSystemVariablesCheckBox
Left = 6 Left = 6
Height = 179 Height = 177
Top = 229 Top = 229
Width = 480 Width = 484
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'UserOverridesGroupBox' Caption = 'UserOverridesGroupBox'
ClientHeight = 161 ClientHeight = 158
ClientWidth = 476 ClientWidth = 480
TabOrder = 1 TabOrder = 1
object UserOverridesListView: TListView object UserOverridesListView: TListView
AnchorSideLeft.Control = UserOverridesGroupBox AnchorSideLeft.Control = UserOverridesGroupBox
@ -260,9 +253,9 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UserOverridesAddButton AnchorSideBottom.Control = UserOverridesAddButton
Left = 6 Left = 6
Height = 120 Height = 115
Top = 6 Top = 6
Width = 464 Width = 468
Align = alTop Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -270,13 +263,14 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
item item
AutoSize = True AutoSize = True
Caption = 'Caption' Caption = 'Caption'
Width = 59 Width = 60
end end
item item
AutoSize = True AutoSize = True
Caption = 'Caption' Caption = 'Caption'
Width = 391 Width = 390
end> end>
ItemIndex = -1
RowSelect = True RowSelect = True
SortType = stText SortType = stText
TabOrder = 0 TabOrder = 0
@ -287,9 +281,9 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideBottom.Control = UserOverridesGroupBox AnchorSideBottom.Control = UserOverridesGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 23 Height = 25
Top = 132 Top = 127
Width = 146 Width = 159
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -303,10 +297,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = UserOverridesGroupBox AnchorSideBottom.Control = UserOverridesGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 322 Left = 350
Height = 23 Height = 25
Top = 132 Top = 127
Width = 145 Width = 159
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -320,10 +314,10 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = UserOverridesGroupBox AnchorSideBottom.Control = UserOverridesGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 158 Left = 171
Height = 23 Height = 25
Top = 132 Top = 127
Width = 158 Width = 173
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -338,13 +332,13 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
Left = 6 Left = 6
Height = 217 Height = 217
Top = 6 Top = 6
Width = 480 Width = 484
Align = alTop Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'SystemVariablesGroupBox' Caption = 'SystemVariablesGroupBox'
ClientHeight = 199 ClientHeight = 198
ClientWidth = 476 ClientWidth = 480
TabOrder = 2 TabOrder = 2
object SystemVariablesListView: TListView object SystemVariablesListView: TListView
AnchorSideLeft.Control = SystemVariablesGroupBox AnchorSideLeft.Control = SystemVariablesGroupBox
@ -354,22 +348,23 @@ object RunParamsOptsDlg: TRunParamsOptsDlg
AnchorSideBottom.Control = SystemVariablesGroupBox AnchorSideBottom.Control = SystemVariablesGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 187 Height = 186
Top = 6 Top = 6
Width = 464 Width = 468
Align = alClient Align = alClient
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Columns = < Columns = <
item item
AutoSize = True AutoSize = True
Caption = 'Caption' Caption = 'Caption'
Width = 59 Width = 60
end end
item item
AutoSize = True AutoSize = True
Caption = 'Caption' Caption = 'Caption'
Width = 391 Width = 390
end> end>
ItemIndex = -1
RowSelect = True RowSelect = True
SortType = stText SortType = stText
TabOrder = 0 TabOrder = 0

View File

@ -176,9 +176,46 @@ implementation
{$R *.lfm} {$R *.lfm}
const const
DefaultLauncherApplication = DefaultLauncherTitle = '''Lazarus Run Output''';
'/usr/X11R6/bin/xterm -T ''Lazarus Run Output''' + DefaultLauncherApplication = '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)';
' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)';
function FindTerminalInPath(const ATerm: String = ''): String;
var
List: TStrings;
i: Integer;
s: String;
Term: String;
begin
Result := '';
List := TStringList.Create;
{$IFDEF MSWINDOWS}
List.Delimiter := ';';
{$ELSE}
List.Delimiter := ':';
{$ENDIF}
Term := ATerm;
if Term = '' then
Term := GetEnvironmentVariable('TERM');
if Term = '' then
Term := 'xterm';
List.DelimitedText := GetEnvironmentVariable('PATH');
for i := 0 to List.Count - 1 do
begin
S := List.Strings[i] + PathDelim + Term;
if FileExistsUTF8(S) and FileIsExecutable(S) then
begin
// gnome-terminal is not compatibile to xterm params.
if Term = 'gnome-terminal' then
Result := S + ' -t ' + DefaultLauncherTitle + ' -e ' +
'''' + DefaultLauncherApplication + ''''
else
Result := S + ' -T ' + DefaultLauncherTitle + ' -e ' +
DefaultLauncherApplication;
break;
end;
end;
List.Free;
end;
function ShowRunParamsOptsDlg(RunParamsOptions: TRunParamsOptions): TModalResult; function ShowRunParamsOptsDlg(RunParamsOptions: TRunParamsOptions): TModalResult;
var var
@ -210,12 +247,17 @@ begin
end; end;
procedure TRunParamsOptions.Clear; procedure TRunParamsOptions.Clear;
var
s: String;
begin begin
// local options // local options
fHostApplicationFilename := ''; fHostApplicationFilename := '';
fCmdLineParams := ''; fCmdLineParams := '';
fUseLaunchingApplication := False; fUseLaunchingApplication := False;
fLaunchingApplicationPathPlusParams := DefaultLauncherApplication; S := FindTerminalInPath;
if S <> '' then
fLaunchingApplicationPathPlusParams := S;
// TODO: guess are we under gnome or kde so query for gnome-terminal or konsole.
fWorkingDirectory := ''; fWorkingDirectory := '';
fUseDisplay := False; fUseDisplay := False;
fDisplay := ':0'; fDisplay := ':0';
@ -227,7 +269,8 @@ end;
function TRunParamsOptions.Load(XMLConfig: TXMLConfig; const Path: string; function TRunParamsOptions.Load(XMLConfig: TXMLConfig; const Path: string;
AdjustPathDelims: boolean): TModalResult; AdjustPathDelims: boolean): TModalResult;
var
S: String;
function f(const Filename: string): string; function f(const Filename: string): string;
begin begin
@ -260,7 +303,11 @@ begin
f(XMLConfig.GetValue(Path + 'RunParams/local/LaunchingApplication/PathPlusParams', f(XMLConfig.GetValue(Path + 'RunParams/local/LaunchingApplication/PathPlusParams',
fLaunchingApplicationPathPlusParams)); fLaunchingApplicationPathPlusParams));
if (fLaunchingApplicationPathPlusParams = '') then if (fLaunchingApplicationPathPlusParams = '') then
fLaunchingApplicationPathPlusParams := DefaultLauncherApplication; begin
S := FindTerminalInPath;
if S <> '' then
fLaunchingApplicationPathPlusParams := S;
end;
fWorkingDirectory := f(XMLConfig.GetValue( fWorkingDirectory := f(XMLConfig.GetValue(
Path + 'RunParams/local/WorkingDirectory/Value', fWorkingDirectory)); Path + 'RunParams/local/WorkingDirectory/Value', fWorkingDirectory));
fUseDisplay := XMLConfig.GetValue(Path + 'RunParams/local/Display/Use', fUseDisplay := XMLConfig.GetValue(Path + 'RunParams/local/Display/Use',
@ -376,6 +423,7 @@ end;
procedure TRunParamsOptsDlg.SetupLocalPage; procedure TRunParamsOptsDlg.SetupLocalPage;
var var
List: THistoryList; List: THistoryList;
S: String;
begin begin
HostApplicationGroupBox.Caption := dlgHostApplication; HostApplicationGroupBox.Caption := dlgHostApplication;
HostApplicationBrowseBtn.Caption := '...'; HostApplicationBrowseBtn.Caption := '...';
@ -394,11 +442,17 @@ begin
WorkingDirectoryComboBox.Items.Assign(List); WorkingDirectoryComboBox.Items.Assign(List);
// history list: UseLaunchingApplicationComboBox // history list: UseLaunchingApplicationComboBox
List:=InputHistories.HistoryLists.GetList(hlLaunchingApplication,true); List := InputHistories.HistoryLists.GetList(hlLaunchingApplication,true);
List.AppendEntry(DefaultLauncherApplication); S := FindTerminalInPath;
{$IFNdef MSWindows} if S <> '' then
List.AppendEntry('/usr/bin/gnome-terminal -t ''Lazarus Run Output''' List.AppendEntry(S);
+ ' -e ''$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)'''); {$IFNDEF MSWINDOWS}
S := FindTerminalInPath('gnome-terminal');
if S <> '' then
List.AppendEntry(S);
S := FindTerminalInPath('konsole');
if S <> '' then
List.AppendEntry(S);
{$ENDIF} {$ENDIF}
UseLaunchingApplicationComboBox.Items.Assign(List); UseLaunchingApplicationComboBox.Items.Assign(List);