mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 23:29:16 +02:00
ide: use unit dialog: start with selected text or word at cursor.
git-svn-id: trunk@51919 -
This commit is contained in:
parent
712eae76cd
commit
5149a4f43b
19
ide/main.pp
19
ide/main.pp
@ -72,7 +72,7 @@ uses
|
||||
FileUtil, LazFileUtils, LazFileCache, LazUTF8, LazUTF8Classes, UTF8Process,
|
||||
LConvEncoding, Laz2_XMLCfg, LazLogger,
|
||||
// SynEdit
|
||||
AllSynEdit, SynEditKeyCmds, SynEditMarks, SynEditHighlighter,
|
||||
SynEdit, AllSynEdit, SynEditKeyCmds, SynEditMarks, SynEditHighlighter,
|
||||
// IDE interface
|
||||
IDEIntf, ObjectInspector, PropEdits, PropEditUtils,
|
||||
MacroIntf, IDECommands, IDEWindowIntf, ComponentReg,
|
||||
@ -9974,8 +9974,23 @@ begin
|
||||
end;
|
||||
|
||||
function TMainIDE.DoUseUnit: TModalResult;
|
||||
var
|
||||
TempEditor: TSourceEditorInterface;
|
||||
DefText: String;
|
||||
begin
|
||||
Result:=ShowUseUnitDialog;
|
||||
DefText:='';
|
||||
TempEditor := SourceEditorManagerIntf.ActiveEditor;
|
||||
if TempEditor <> nil then
|
||||
begin
|
||||
if EditorOpts.FindTextAtCursor then
|
||||
begin
|
||||
if TempEditor.SelectionAvailable and (TempEditor.BlockBegin.Y = TempEditor.BlockEnd.Y)
|
||||
then DefText := TempEditor.Selection
|
||||
else DefText := TSynEdit(TempEditor.EditorControl).GetWordAtRowCol(TempEditor.CursorTextXY);
|
||||
end;
|
||||
end;
|
||||
|
||||
Result:=ShowUseUnitDialog(DefText);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoFindOverloads: TModalResult;
|
||||
|
@ -73,13 +73,13 @@ type
|
||||
|
||||
end;
|
||||
|
||||
function ShowUseUnitDialog: TModalResult;
|
||||
function ShowUseUnitDialog(const DefText: string): TModalResult;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
function ShowUseUnitDialog: TModalResult;
|
||||
function ShowUseUnitDialog(const DefText: string): TModalResult;
|
||||
var
|
||||
UseUnitDlg: TUseUnitDialog;
|
||||
SrcEdit: TSourceEditor;
|
||||
@ -125,6 +125,8 @@ begin
|
||||
Exit(mrCancel);
|
||||
end;
|
||||
|
||||
UseUnitDlg.FilterEdit.Text := DefText;
|
||||
|
||||
// Show the dialog.
|
||||
if UseUnitDlg.ShowModal=mrOk then begin
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user