mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 19:40:09 +02:00
IDE: when doing a source editor command from via menu then focus editor
git-svn-id: trunk@37800 -
This commit is contained in:
parent
1cef9d4fcd
commit
1953444e63
15
ide/main.pp
15
ide/main.pp
@ -918,7 +918,8 @@ type
|
|||||||
|
|
||||||
// edit menu
|
// edit menu
|
||||||
procedure DoCommand(ACommand: integer); override;
|
procedure DoCommand(ACommand: integer); override;
|
||||||
procedure DoSourceEditorCommand(EditorCommand: integer; CheckFocus: boolean = true);
|
procedure DoSourceEditorCommand(EditorCommand: integer;
|
||||||
|
CheckFocus: boolean = true; FocusEditor: boolean = true);
|
||||||
procedure UpdateCustomToolsInMenu;
|
procedure UpdateCustomToolsInMenu;
|
||||||
|
|
||||||
// external tools
|
// external tools
|
||||||
@ -19132,7 +19133,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoSourceEditorCommand(EditorCommand: integer; CheckFocus: boolean);
|
procedure TMainIDE.DoSourceEditorCommand(EditorCommand: integer;
|
||||||
|
CheckFocus: boolean; FocusEditor: boolean);
|
||||||
var
|
var
|
||||||
CurFocusControl: TWinControl;
|
CurFocusControl: TWinControl;
|
||||||
ActiveSourceEditor: TSourceEditor;
|
ActiveSourceEditor: TSourceEditor;
|
||||||
@ -19151,8 +19153,11 @@ begin
|
|||||||
if Assigned(CurFocusControl) then
|
if Assigned(CurFocusControl) then
|
||||||
begin // MainIDEBar or SourceNotebook has focus -> find active source editor
|
begin // MainIDEBar or SourceNotebook has focus -> find active source editor
|
||||||
GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
|
GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
|
||||||
if Assigned(ActiveSourceEditor) then
|
if Assigned(ActiveSourceEditor) then begin
|
||||||
ActiveSourceEditor.DoEditorExecuteCommand(EditorCommand); // pass the command
|
ActiveSourceEditor.DoEditorExecuteCommand(EditorCommand); // pass the command
|
||||||
|
if FocusEditor then
|
||||||
|
ActiveSourceEditor.EditorControl.SetFocus;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
// Some other window has focus -> continue processing shortcut, not handled yet
|
// Some other window has focus -> continue processing shortcut, not handled yet
|
||||||
if (CurFocusControl=Nil) or (ActiveSourceEditor=Nil) then
|
if (CurFocusControl=Nil) or (ActiveSourceEditor=Nil) then
|
||||||
@ -19185,8 +19190,8 @@ begin
|
|||||||
with TOpenDialog.Create(nil) do
|
with TOpenDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
Title:=lisSelectFile;
|
Title:=lisSelectFile;
|
||||||
if Execute then
|
if not Execute then exit;
|
||||||
ActiveSrcEdit.Selection := FileName;
|
ActiveSrcEdit.Selection := FileName;
|
||||||
finally
|
finally
|
||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user