mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 21:20:30 +02:00
IDE: moved InsertFilename to source editor so that focussing works like other source commands
git-svn-id: trunk@37802 -
This commit is contained in:
parent
c625dd1c05
commit
0200ab2e5b
20
ide/main.pp
20
ide/main.pp
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user