IDE: moved InsertFilename to source editor so that focussing works like other source commands

git-svn-id: trunk@37802 -
This commit is contained in:
mattias 2012-06-27 16:06:45 +00:00
parent c625dd1c05
commit 0200ab2e5b
2 changed files with 21 additions and 19 deletions

View File

@ -1061,7 +1061,6 @@ type
function DoMakeResourceString: TModalResult;
function DoDiff: TModalResult;
function DoFindInFiles: TModalResult;
procedure DoInsertFilename;
// conversion
function DoConvertDFMtoLFM: TModalResult;
@ -19004,7 +19003,7 @@ end;
procedure TMainIDE.mnuSourceInsertFilename(Sender: TObject);
begin
DoInsertFilename;
DoSourceEditorCommand(ecInsertFilename);
end;
procedure TMainIDE.mnuSearchFindInFiles(Sender: TObject);
@ -19163,23 +19162,6 @@ begin
MainIDEBar.mnuMainMenu.ShortcutHandled := false;
end;
procedure TMainIDE.DoInsertFilename;
var
ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
begin
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then exit;
if ActiveSrcEdit = nil then Exit;
with TOpenDialog.Create(nil) do
try
Title:=lisSelectFile;
if not Execute then exit;
ActiveSrcEdit.Selection := FileName;
finally
Free;
end;
end;
function TMainIDE.DoReplaceUnitUse(OldFilename, OldUnitName, NewFilename,
NewUnitName: string; IgnoreErrors, Quiet, Confirm: boolean): TModalResult;
{ Replaces all references to a unit

View File

@ -414,6 +414,7 @@ type
procedure InsertChangeLogEntry;
procedure InsertCVSKeyword(const AKeyWord: string);
procedure InsertGUID;
procedure InsertFilename;
function GetSelEnd: Integer; override;
function GetSelStart: Integer; override;
procedure SetSelEnd(const AValue: Integer); override;
@ -3245,6 +3246,9 @@ Begin
ecInsertGUID:
InsertGUID;
ecInsertFilename:
InsertFilename;
ecLockEditor:
IsLocked := not IsLocked;
@ -3703,6 +3707,22 @@ begin
FEditor.InsertTextAtCaret(Format(cGUID, [GUIDToString(lGUID)]));
end;
procedure TSourceEditor.InsertFilename;
var
Dlg: TOpenDialog;
begin
if ReadOnly then Exit;
Dlg:=TOpenDialog.Create(nil);
try
InitIDEFileDialog(Dlg);
Dlg.Title:=lisSelectFile;
if not Dlg.Execute then exit;
FEditor.InsertTextAtCaret(Dlg.FileName);
finally
Dlg.Free;
end;
end;
function TSourceEditor.GetSelEnd: Integer;
begin
Result:=FEditor.SelEnd;