mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-08 17:47:41 +01:00
MG: fixed sourcechanger wrong src bug
git-svn-id: trunk@1512 -
This commit is contained in:
parent
160029222a
commit
7d44c1a838
@ -927,6 +927,7 @@ writeln('TCodeCompletionCodeTool.CreateMissingProcBodies Gather existing method
|
|||||||
// search for missing proc bodies
|
// search for missing proc bodies
|
||||||
if (ProcBodyNodes.Count=0) then begin
|
if (ProcBodyNodes.Count=0) then begin
|
||||||
// there were no old proc bodies of the class -> start class
|
// there were no old proc bodies of the class -> start class
|
||||||
|
|
||||||
if NodeHasParentOfType(ClassNode,ctnInterface) then begin
|
if NodeHasParentOfType(ClassNode,ctnInterface) then begin
|
||||||
// class is in interface section
|
// class is in interface section
|
||||||
// -> insert at the end of the implementation section
|
// -> insert at the end of the implementation section
|
||||||
|
|||||||
@ -134,7 +134,8 @@ type
|
|||||||
FOnBeforeApplyChanges: TOnBeforeApplyChanges;
|
FOnBeforeApplyChanges: TOnBeforeApplyChanges;
|
||||||
FOnAfterApplyChanges: TOnAfterApplyChanges;
|
FOnAfterApplyChanges: TOnAfterApplyChanges;
|
||||||
FUpdateLock: integer;
|
FUpdateLock: integer;
|
||||||
Src: string;
|
Src: string; // current cleaned source
|
||||||
|
SrcLen: integer; // same as length(Src)
|
||||||
procedure DeleteOldText(CleanFromPos,CleanToPos: integer);
|
procedure DeleteOldText(CleanFromPos,CleanToPos: integer);
|
||||||
procedure InsertNewText(ACode: TCodeBuffer; DirectPos: integer;
|
procedure InsertNewText(ACode: TCodeBuffer; DirectPos: integer;
|
||||||
const InsertText: string);
|
const InsertText: string);
|
||||||
@ -439,6 +440,7 @@ writeln('TSourceChangeCache.Apply EntryCount=',FEntries.Count);
|
|||||||
end;
|
end;
|
||||||
try
|
try
|
||||||
Src:=MainScanner.CleanedSrc;
|
Src:=MainScanner.CleanedSrc;
|
||||||
|
SrcLen:=length(Src);
|
||||||
// apply the changes beginning with the last
|
// apply the changes beginning with the last
|
||||||
CurNode:=FEntries.FindHighest;
|
CurNode:=FEntries.FindHighest;
|
||||||
while CurNode<>nil do begin
|
while CurNode<>nil do begin
|
||||||
@ -452,8 +454,8 @@ writeln('TSourceChangeCache.Apply Pos=',FirstEntry.FromPos,'-',FirstEntry.ToPos,
|
|||||||
case FirstEntry.AfterGap of
|
case FirstEntry.AfterGap of
|
||||||
gtSpace:
|
gtSpace:
|
||||||
begin
|
begin
|
||||||
if ((FirstEntry.ToPos>MainScanner.CleanedLen)
|
if ((FirstEntry.ToPos>SrcLen)
|
||||||
or (not IsSpaceChar[MainScanner.Src[FirstEntry.ToPos]])) then
|
or (not IsSpaceChar[Src[FirstEntry.ToPos]])) then
|
||||||
InsertText:=InsertText+' ';
|
InsertText:=InsertText+' ';
|
||||||
end;
|
end;
|
||||||
gtNewLine:
|
gtNewLine:
|
||||||
@ -472,9 +474,9 @@ writeln('TSourceChangeCache.Apply Pos=',FirstEntry.FromPos,'-',FirstEntry.ToPos,
|
|||||||
if FirstEntry.AfterGap in [gtNewLine,gtEmptyLine] then begin
|
if FirstEntry.AfterGap in [gtNewLine,gtEmptyLine] then begin
|
||||||
// move the rest of the line behind the insert position to the next line
|
// move the rest of the line behind the insert position to the next line
|
||||||
// with auto indent
|
// with auto indent
|
||||||
NeededIndent:=GetLineIndent(MainScanner.Src,FirstEntry.ToPos);
|
NeededIndent:=GetLineIndent(Src,FirstEntry.ToPos);
|
||||||
j:=FirstEntry.ToPos;
|
j:=FirstEntry.ToPos;
|
||||||
while (j<=MainScanner.SrcLen) and (IsSpaceChar[MainScanner.Src[j]]) do
|
while (j<=SrcLen) and (IsSpaceChar[Src[j]]) do
|
||||||
inc(j);
|
inc(j);
|
||||||
dec(NeededIndent,j-FirstEntry.ToPos);
|
dec(NeededIndent,j-FirstEntry.ToPos);
|
||||||
if NeededIndent>0 then
|
if NeededIndent>0 then
|
||||||
@ -511,7 +513,7 @@ writeln('TSourceChangeCache.Apply Pos=',FirstEntry.FromPos,'-',FirstEntry.ToPos,
|
|||||||
gtSpace:
|
gtSpace:
|
||||||
begin
|
begin
|
||||||
if (CurEntry.FromPos=1)
|
if (CurEntry.FromPos=1)
|
||||||
or (not IsSpaceChar[MainScanner.Src[CurEntry.FromPos-1]]) then
|
or (not IsSpaceChar[Src[CurEntry.FromPos-1]]) then
|
||||||
InsertText:=' '+InsertText;
|
InsertText:=' '+InsertText;
|
||||||
end;
|
end;
|
||||||
gtNewLine:
|
gtNewLine:
|
||||||
@ -535,7 +537,7 @@ writeln('TSourceChangeCache.Apply Pos=',FirstEntry.FromPos,'-',FirstEntry.ToPos,
|
|||||||
// no line end was inserted in front
|
// no line end was inserted in front
|
||||||
// -> adjust the FromPos to replace the space in the existing line
|
// -> adjust the FromPos to replace the space in the existing line
|
||||||
while (FirstEntry.FromPos+FromPosAdjustment>1)
|
while (FirstEntry.FromPos+FromPosAdjustment>1)
|
||||||
and (not (MainScanner.Src[FirstEntry.FromPos+FromPosAdjustment-1]
|
and (not (Src[FirstEntry.FromPos+FromPosAdjustment-1]
|
||||||
in [#10,#13]))
|
in [#10,#13]))
|
||||||
do dec(FromPosAdjustment);
|
do dec(FromPosAdjustment);
|
||||||
end;
|
end;
|
||||||
@ -559,12 +561,12 @@ var c:char;
|
|||||||
begin
|
begin
|
||||||
Result:=MinLineEnds;
|
Result:=MinLineEnds;
|
||||||
if CleanPos<1 then exit;
|
if CleanPos<1 then exit;
|
||||||
while (CleanPos<=length(Src)) do begin
|
while (CleanPos<=SrcLen) do begin
|
||||||
c:=Src[CleanPos];
|
c:=Src[CleanPos];
|
||||||
if IsLineEndChar[c] then begin
|
if IsLineEndChar[c] then begin
|
||||||
dec(Result);
|
dec(Result);
|
||||||
inc(CleanPos);
|
inc(CleanPos);
|
||||||
if (CleanPos<=length(Src))
|
if (CleanPos<=SrcLen)
|
||||||
and (IsLineEndChar[Src[CleanPos]])
|
and (IsLineEndChar[Src[CleanPos]])
|
||||||
and (Src[CleanPos]<>c) then
|
and (Src[CleanPos]<>c) then
|
||||||
inc(CleanPos);
|
inc(CleanPos);
|
||||||
@ -580,7 +582,7 @@ function TSourceChangeCache.CountNeededLineEndsToAddBackward(
|
|||||||
var c:char;
|
var c:char;
|
||||||
begin
|
begin
|
||||||
Result:=MinLineEnds;
|
Result:=MinLineEnds;
|
||||||
if (CleanPos>length(Src)) then exit;
|
if (CleanPos>SrcLen) then exit;
|
||||||
while (CleanPos>=1) do begin
|
while (CleanPos>=1) do begin
|
||||||
c:=Src[CleanPos];
|
c:=Src[CleanPos];
|
||||||
if IsLineEndChar[c] then begin
|
if IsLineEndChar[c] then begin
|
||||||
|
|||||||
@ -38,7 +38,7 @@ uses
|
|||||||
MemCheck,
|
MemCheck,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils, Controls, Forms, Buttons, StdCtrls, ComCtrls, Dialogs,
|
Classes, SysUtils, Controls, Forms, Buttons, StdCtrls, ComCtrls, Dialogs,
|
||||||
ExtCtrls, LResources, XMLCfg;
|
ExtCtrls, LResources, XMLCfg, DOS, IDEProcs;
|
||||||
|
|
||||||
{ The xml format version:
|
{ The xml format version:
|
||||||
When the format changes (new values, changed formats) we can distinguish old
|
When the format changes (new values, changed formats) we can distinguish old
|
||||||
@ -108,18 +108,29 @@ type
|
|||||||
DisplayGroupBox: TGroupBox;
|
DisplayGroupBox: TGroupBox;
|
||||||
DisplayEdit: TEdit;
|
DisplayEdit: TEdit;
|
||||||
SystemVariablesGroupBox: TGroupBox;
|
SystemVariablesGroupBox: TGroupBox;
|
||||||
|
SystemVariablesListView: TListView;
|
||||||
UserOverridesGroupBox: TGroupBox;
|
UserOverridesGroupBox: TGroupBox;
|
||||||
|
UserOverridesListView: TListView;
|
||||||
|
UserOverridesAddButton: TButton;
|
||||||
|
UserOverridesEditButton: TButton;
|
||||||
|
UserOverridesDeleteButton: TButton;
|
||||||
IncludeSystemVariablesCheckBox: TCheckBox;
|
IncludeSystemVariablesCheckBox: TCheckBox;
|
||||||
OkButton: TButton;
|
OkButton: TButton;
|
||||||
CancelButton: TButton;
|
CancelButton: TButton;
|
||||||
procedure OkButtonClick(Sender: TObject);
|
procedure OkButtonClick(Sender: TObject);
|
||||||
procedure CancelButtonClick(Sender: TObject);
|
procedure CancelButtonClick(Sender: TObject);
|
||||||
|
procedure HostApplicationEditClick(Sender: TObject);
|
||||||
|
procedure WorkingDirectoryBtnClick(Sender: TObject);
|
||||||
|
procedure UserOverridesAddButtonClick(Sender: TObject);
|
||||||
|
procedure UserOverridesEditButtonClick(Sender: TObject);
|
||||||
|
procedure UserOverridesDeleteButtonClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
fOptions: TRunParamsOptions;
|
fOptions: TRunParamsOptions;
|
||||||
procedure SetupNotebook;
|
procedure SetupNotebook;
|
||||||
procedure SetupLocalPage;
|
procedure SetupLocalPage;
|
||||||
procedure SetupEnvironmentPage;
|
procedure SetupEnvironmentPage;
|
||||||
procedure SetOptions(NewOptions: TRunParamsOptions);
|
procedure SetOptions(NewOptions: TRunParamsOptions);
|
||||||
|
procedure FillSystemVariablesListView;
|
||||||
procedure SaveToOptions;
|
procedure SaveToOptions;
|
||||||
public
|
public
|
||||||
constructor Create(AnOwner: TComponent); override;
|
constructor Create(AnOwner: TComponent); override;
|
||||||
@ -189,8 +200,8 @@ function TRunParamsOptions.Load(XMLConfig: TXMLConfig;
|
|||||||
Cnt:=XMLConfig.GetValue(APath+'Count',0);
|
Cnt:=XMLConfig.GetValue(APath+'Count',0);
|
||||||
for i:=0 to Cnt-1 do begin
|
for i:=0 to Cnt-1 do begin
|
||||||
fUserOverrides.Values[XMLConfig.GetValue(
|
fUserOverrides.Values[XMLConfig.GetValue(
|
||||||
APath+'Variable'+IntToStr(i)+'/Name','')]:=
|
APath+'Variable'+IntToStr(i)+'/Name','')]
|
||||||
XMLConfig.GetValue(APath+'Variable'+IntToStr(i)+'/Value','');
|
:=XMLConfig.GetValue(APath+'Variable'+IntToStr(i)+'/Value','');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -329,7 +340,6 @@ begin
|
|||||||
Parent:=NoteBook.Page[0];
|
Parent:=NoteBook.Page[0];
|
||||||
SetBounds(5,5,w,60);
|
SetBounds(5,5,w,60);
|
||||||
Caption:='Host application';
|
Caption:='Host application';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -339,7 +349,6 @@ begin
|
|||||||
Parent:=HostApplicationGroupBox;
|
Parent:=HostApplicationGroupBox;
|
||||||
SetBounds(5,5,w-10-35,25);
|
SetBounds(5,5,w-10-35,25);
|
||||||
Caption:='';
|
Caption:='';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -349,7 +358,7 @@ begin
|
|||||||
Parent:=HostApplicationGroupBox;
|
Parent:=HostApplicationGroupBox;
|
||||||
SetBounds(HostApplicationEdit.Left+HostApplicationEdit.Width+2,5,25,25);
|
SetBounds(HostApplicationEdit.Left+HostApplicationEdit.Width+2,5,25,25);
|
||||||
Caption:='...';
|
Caption:='...';
|
||||||
Enabled:=false;
|
HostApplicationEdit.OnClick:=@HostApplicationEditClick;
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -360,7 +369,6 @@ begin
|
|||||||
SetBounds(5,HostApplicationGroupBox.Top+HostApplicationGroupBox.Height+5,
|
SetBounds(5,HostApplicationGroupBox.Top+HostApplicationGroupBox.Height+5,
|
||||||
w,60);
|
w,60);
|
||||||
Caption:='Command line parameters (without application name)';
|
Caption:='Command line parameters (without application name)';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -370,7 +378,6 @@ begin
|
|||||||
Parent:=CmdLineParametersGroupBox;
|
Parent:=CmdLineParametersGroupBox;
|
||||||
SetBounds(5,5,w-15,25);
|
SetBounds(5,5,w-15,25);
|
||||||
Caption:='';
|
Caption:='';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -380,7 +387,6 @@ begin
|
|||||||
Parent:=NoteBook.Page[0];
|
Parent:=NoteBook.Page[0];
|
||||||
SetBounds(
|
SetBounds(
|
||||||
5,CmdLineParametersGroupBox.Top+CmdLineParametersGroupBox.Height+10,w,60);
|
5,CmdLineParametersGroupBox.Top+CmdLineParametersGroupBox.Height+10,w,60);
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -389,10 +395,9 @@ begin
|
|||||||
Name:='UseLaunchingApplicationCheckBox';
|
Name:='UseLaunchingApplicationCheckBox';
|
||||||
Parent:=NoteBook.Page[0];
|
Parent:=NoteBook.Page[0];
|
||||||
SetBounds(UseLaunchingApplicationBevel.Left+10,
|
SetBounds(UseLaunchingApplicationBevel.Left+10,
|
||||||
UseLaunchingApplicationBevel.Top,100,25);
|
UseLaunchingApplicationBevel.Top,250,25);
|
||||||
Caption:='Use launching application';
|
Caption:='Use launching application';
|
||||||
Checked:=false;
|
Checked:=false;
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -403,7 +408,6 @@ begin
|
|||||||
SetBounds(UseLaunchingApplicationBevel.Left+5,
|
SetBounds(UseLaunchingApplicationBevel.Left+5,
|
||||||
UseLaunchingApplicationBevel.Top+25,w-15,25);
|
UseLaunchingApplicationBevel.Top+25,w-15,25);
|
||||||
Caption:='';
|
Caption:='';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -414,7 +418,6 @@ begin
|
|||||||
SetBounds(5,UseLaunchingApplicationBevel.Top
|
SetBounds(5,UseLaunchingApplicationBevel.Top
|
||||||
+UseLaunchingApplicationBevel.Height+10,w,60);
|
+UseLaunchingApplicationBevel.Height+10,w,60);
|
||||||
Caption:='Working directory';
|
Caption:='Working directory';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -424,7 +427,6 @@ begin
|
|||||||
Parent:=WorkingDirectoryGroupBox;
|
Parent:=WorkingDirectoryGroupBox;
|
||||||
SetBounds(5,5,w-10-35,25);
|
SetBounds(5,5,w-10-35,25);
|
||||||
Caption:='';
|
Caption:='';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -434,7 +436,7 @@ begin
|
|||||||
Parent:=WorkingDirectoryGroupBox;
|
Parent:=WorkingDirectoryGroupBox;
|
||||||
SetBounds(WorkingDirectoryEdit.Left+WorkingDirectoryEdit.Width+2,5,25,25);
|
SetBounds(WorkingDirectoryEdit.Left+WorkingDirectoryEdit.Width+2,5,25,25);
|
||||||
Caption:='...';
|
Caption:='...';
|
||||||
Enabled:=false;
|
WorkingDirectoryBtn.OnClick:=@WorkingDirectoryBtnClick;
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -445,7 +447,6 @@ begin
|
|||||||
SetBounds(5,WorkingDirectoryGroupBox.Top+WorkingDirectoryGroupBox.Height+10,
|
SetBounds(5,WorkingDirectoryGroupBox.Top+WorkingDirectoryGroupBox.Height+10,
|
||||||
w,60);
|
w,60);
|
||||||
Caption:='Display (not for win32)';
|
Caption:='Display (not for win32)';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -455,7 +456,6 @@ begin
|
|||||||
Parent:=DisplayGroupBox;
|
Parent:=DisplayGroupBox;
|
||||||
SetBounds(5,5,w-15,25);
|
SetBounds(5,5,w-15,25);
|
||||||
Caption:='';
|
Caption:='';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -471,7 +471,25 @@ begin
|
|||||||
Parent:=NoteBook.Page[1];
|
Parent:=NoteBook.Page[1];
|
||||||
SetBounds(5,5,w,150);
|
SetBounds(5,5,w,150);
|
||||||
Caption:='System variables';
|
Caption:='System variables';
|
||||||
Enabled:=false;
|
Visible:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
SystemVariablesListView:=TListView.Create(Self);
|
||||||
|
with SystemVariablesListView do begin
|
||||||
|
Name:='SystemVariablesListView';
|
||||||
|
Parent:=SystemVariablesGroupBox;
|
||||||
|
Left:=5;
|
||||||
|
Top:=5;
|
||||||
|
Width:=Parent.ClientWidth-17;
|
||||||
|
Height:=Parent.ClientHeight-28;
|
||||||
|
Columns.Clear;
|
||||||
|
Columns.Updating := true;
|
||||||
|
Columns.Add('Variable');
|
||||||
|
Columns.Add('Value');
|
||||||
|
Columns[0].Width:=130;
|
||||||
|
Columns.Updating := False;
|
||||||
|
ViewStyle := vsReport;
|
||||||
|
Sorted := true;
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -482,10 +500,64 @@ begin
|
|||||||
SetBounds(5,SystemVariablesGroupBox.Top+SystemVariablesGroupBox.Height+10,
|
SetBounds(5,SystemVariablesGroupBox.Top+SystemVariablesGroupBox.Height+10,
|
||||||
w,150);
|
w,150);
|
||||||
Caption:='User overrides';
|
Caption:='User overrides';
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
UserOverridesListView:=TListView.Create(Self);
|
||||||
|
with UserOverridesListView do begin
|
||||||
|
Name:='UserOverridesListView';
|
||||||
|
Parent:=UserOverridesGroupBox;
|
||||||
|
Left:=5;
|
||||||
|
Top:=5;
|
||||||
|
Width:=Parent.ClientWidth-17;
|
||||||
|
Height:=Parent.ClientHeight-68;
|
||||||
|
Columns.Clear;
|
||||||
|
Columns.Updating := true;
|
||||||
|
Columns.Add('Variable');
|
||||||
|
Columns.Add('Value');
|
||||||
|
Columns[0].Width:=130;
|
||||||
|
Columns.Updating := False;
|
||||||
|
ViewStyle := vsReport;
|
||||||
|
Sorted := true;
|
||||||
|
Visible:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
UserOverridesAddButton:=TButton.Create(Self);
|
||||||
|
with UserOverridesAddButton do begin
|
||||||
|
Name:='UserOverridesAddButton';
|
||||||
|
Parent:=UserOverridesGroupBox;
|
||||||
|
Left:=5;
|
||||||
|
Top:=Parent.ClientWidth-Height-28;
|
||||||
|
Width:=100;
|
||||||
|
Caption:='Add';
|
||||||
|
OnClick:=@UserOverridesAddButtonClick;
|
||||||
|
Visible:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
UserOverridesEditButton:=TButton.Create(Self);
|
||||||
|
with UserOverridesEditButton do begin
|
||||||
|
Name:='UserOverridesEditButton';
|
||||||
|
Parent:=UserOverridesGroupBox;
|
||||||
|
Left:=UserOverridesAddButton.Left+UserOverridesAddButton.Width+10;
|
||||||
|
Top:=UserOverridesAddButton.Top;
|
||||||
|
Width:=100;
|
||||||
|
Caption:='Edit';
|
||||||
|
OnClick:=@UserOverridesEditButtonClick;
|
||||||
|
Visible:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
UserOverridesDeleteButton:=TButton.Create(Self);
|
||||||
|
with UserOverridesDeleteButton do begin
|
||||||
|
Name:='UserOverridesDeleteButton';
|
||||||
|
Parent:=UserOverridesGroupBox;
|
||||||
|
Left:=UserOverridesEditButton.Left+UserOverridesEditButton.Width+10;
|
||||||
|
Top:=UserOverridesEditButton.Top;
|
||||||
|
Width:=100;
|
||||||
|
Caption:='Delete';
|
||||||
|
OnClick:=@UserOverridesDeleteButtonClick;
|
||||||
|
Visible:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
IncludeSystemVariablesCheckBox:=TCheckBox.Create(Self);
|
IncludeSystemVariablesCheckBox:=TCheckBox.Create(Self);
|
||||||
with IncludeSystemVariablesCheckBox do begin
|
with IncludeSystemVariablesCheckBox do begin
|
||||||
Name:='IncludeSystemVariablesCheckBox';
|
Name:='IncludeSystemVariablesCheckBox';
|
||||||
@ -493,7 +565,6 @@ begin
|
|||||||
SetBounds(5,UserOverridesGroupBox.Top+UserOverridesGroupBox.Height+10,w,25);
|
SetBounds(5,UserOverridesGroupBox.Top+UserOverridesGroupBox.Height+10,w,25);
|
||||||
Caption:='Include system variables';
|
Caption:='Include system variables';
|
||||||
Checked:=false;
|
Checked:=false;
|
||||||
Enabled:=false;
|
|
||||||
Visible:=true;
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -509,6 +580,61 @@ begin
|
|||||||
ModalResult:=mrCancel;
|
ModalResult:=mrCancel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRunParamsOptsDlg.HostApplicationEditClick(Sender: TObject);
|
||||||
|
var OpenDialog: TOpenDialog;
|
||||||
|
begin
|
||||||
|
OpenDialog:=TOpenDialog.Create(Self);
|
||||||
|
with OpenDialog do begin
|
||||||
|
if HostApplicationEdit.Text<>'' then
|
||||||
|
OpenDialog.InitialDir:=ExtractFilePath(HostApplicationEdit.Text);
|
||||||
|
OpenDialog.Filename:=HostApplicationEdit.Text;
|
||||||
|
if OpenDialog.Execute then begin
|
||||||
|
if (FileIsExecutable(OpenDialog.Filename))
|
||||||
|
or (MessageDlg('File not executable',
|
||||||
|
'The host application "'+OpenDialog.Filename+'" is not executable.',
|
||||||
|
mtWarning,[mbCancel,mbIgnore],0)=mrIgnore) then
|
||||||
|
begin
|
||||||
|
HostApplicationEdit.Text:=OpenDialog.Filename;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRunParamsOptsDlg.WorkingDirectoryBtnClick(Sender: TObject);
|
||||||
|
var OpenDialog: TOpenDialog;
|
||||||
|
begin
|
||||||
|
OpenDialog:=TOpenDialog.Create(Self);
|
||||||
|
with OpenDialog do begin
|
||||||
|
if WorkingDirectoryEdit.Text<>'' then
|
||||||
|
OpenDialog.InitialDir:=ExtractFilePath(WorkingDirectoryEdit.Text);
|
||||||
|
OpenDialog.Filename:=HostApplicationEdit.Text;
|
||||||
|
if OpenDialog.Execute then begin
|
||||||
|
if (DirectoryExists(OpenDialog.Filename))
|
||||||
|
or (MessageDlg('Directory does not exist',
|
||||||
|
'The directory "'+OpenDialog.Filename+'" does not exist.',
|
||||||
|
mtWarning,[mbIgnore,mbCancel],0)=mrIgnore) then
|
||||||
|
begin
|
||||||
|
WorkingDirectoryEdit.Text:=OpenDialog.Filename;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRunParamsOptsDlg.UserOverridesAddButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRunParamsOptsDlg.UserOverridesEditButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRunParamsOptsDlg.UserOverridesDeleteButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRunParamsOptsDlg.SaveToOptions;
|
procedure TRunParamsOptsDlg.SaveToOptions;
|
||||||
begin
|
begin
|
||||||
// local
|
// local
|
||||||
@ -520,6 +646,9 @@ begin
|
|||||||
fOptions.Display:=DisplayEdit.Text;
|
fOptions.Display:=DisplayEdit.Text;
|
||||||
|
|
||||||
// environment
|
// environment
|
||||||
|
|
||||||
|
// ToDo: User Overrides
|
||||||
|
|
||||||
fOptions.IncludeSystemVariables:=IncludeSystemVariablesCheckBox.Checked;
|
fOptions.IncludeSystemVariables:=IncludeSystemVariablesCheckBox.Checked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -536,8 +665,39 @@ begin
|
|||||||
DisplayEdit.Text:=fOptions.Display;
|
DisplayEdit.Text:=fOptions.Display;
|
||||||
|
|
||||||
// environment
|
// environment
|
||||||
|
FillSystemVariablesListView;
|
||||||
|
// ToDo: User Overrides
|
||||||
|
|
||||||
IncludeSystemVariablesCheckBox.Checked:=fOptions.IncludeSystemVariables;
|
IncludeSystemVariablesCheckBox.Checked:=fOptions.IncludeSystemVariables;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRunParamsOptsDlg.FillSystemVariablesListView;
|
||||||
|
var
|
||||||
|
i, SysVarCount, e: integer;
|
||||||
|
Variable, Value: string;
|
||||||
|
Begin
|
||||||
|
with SystemVariablesListView.Items do begin
|
||||||
|
//BeginUpdate;
|
||||||
|
SysVarCount:=EnvCount;
|
||||||
|
for i:=0 to SysVarCount-1 do begin
|
||||||
|
Variable:=EnvStr(i+1);
|
||||||
|
e:=1;
|
||||||
|
while (e<=length(Variable)) and (Variable[e]<>'=') do inc(e);
|
||||||
|
Value:=copy(Variable,e+1,length(Variable)-e);
|
||||||
|
Variable:=LeftStr(Variable,e-1);
|
||||||
|
if Count<=i then begin
|
||||||
|
// add line to listview
|
||||||
|
Add;
|
||||||
|
Item[i].SubItems.Add('');
|
||||||
|
end;
|
||||||
|
Item[i].Caption:=Variable;
|
||||||
|
Item[i].SubItems[0]:=Value;
|
||||||
|
end;
|
||||||
|
while Count>EnvCount do
|
||||||
|
Delete(Count-1);
|
||||||
|
//EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user