mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 20:09:10 +02:00
Do not move source editor, on tab changes, codetool completion or similar actions. Issue #0026051
git-svn-id: trunk@44801 -
This commit is contained in:
parent
57d4b03505
commit
a37ff8d09e
@ -17,7 +17,7 @@ unit IDEWindowIntf;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, Classes, SysUtils, LCLProc, LazConfigStorage, Forms, Controls;
|
Math, Classes, SysUtils, LCLProc, LazConfigStorage, Forms, Controls, LCLIntf;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// layout settings of modal forms (dialogs) in the IDE
|
// layout settings of modal forms (dialogs) in the IDE
|
||||||
@ -248,6 +248,11 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSimpleWindowLayoutList }
|
{ TSimpleWindowLayoutList }
|
||||||
|
TLayoutMoveToVisbleMode = (
|
||||||
|
vmAlwaysMoveToVisible,
|
||||||
|
vmNeverMoveToVisible,
|
||||||
|
vmOnlyMoveOffScreenToVisible // Only make visible, if fully offscreen (no part of the windov is on screen)
|
||||||
|
);
|
||||||
|
|
||||||
TSimpleWindowLayoutList = class
|
TSimpleWindowLayoutList = class
|
||||||
private
|
private
|
||||||
@ -260,7 +265,8 @@ type
|
|||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure Delete(Index: Integer);
|
procedure Delete(Index: Integer);
|
||||||
procedure ApplyAndShow(Sender: TObject; AForm: TCustomForm;
|
procedure ApplyAndShow(Sender: TObject; AForm: TCustomForm;
|
||||||
BringToFront: boolean);
|
BringToFront: boolean;
|
||||||
|
AMoveToVisbleMode: TLayoutMoveToVisbleMode = vmAlwaysMoveToVisible);
|
||||||
procedure StoreWindowPositions;
|
procedure StoreWindowPositions;
|
||||||
procedure Assign(SrcList: TSimpleWindowLayoutList);
|
procedure Assign(SrcList: TSimpleWindowLayoutList);
|
||||||
function Add(ALayout: TSimpleWindowLayout): integer;
|
function Add(ALayout: TSimpleWindowLayout): integer;
|
||||||
@ -407,7 +413,8 @@ type
|
|||||||
function FindWithName(FormName: string): TIDEWindowCreator;
|
function FindWithName(FormName: string): TIDEWindowCreator;
|
||||||
function GetForm(aFormName: string; AutoCreate: boolean;
|
function GetForm(aFormName: string; AutoCreate: boolean;
|
||||||
DisableAutoSizing: boolean = false): TCustomForm;
|
DisableAutoSizing: boolean = false): TCustomForm;
|
||||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); overload;
|
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean;
|
||||||
|
AMoveToVisbleMode: TLayoutMoveToVisbleMode = vmAlwaysMoveToVisible); overload;
|
||||||
function ShowForm(AFormName: string; BringToFront: boolean): TCustomForm; overload;
|
function ShowForm(AFormName: string; BringToFront: boolean): TCustomForm; overload;
|
||||||
procedure CreateForm(var AForm; AFormClass: TCustomFormClass;
|
procedure CreateForm(var AForm; AFormClass: TCustomFormClass;
|
||||||
DoDisableAutoSizing: boolean; TheOwner: TComponent); // utility function to create a form with delayed autosizing
|
DoDisableAutoSizing: boolean; TheOwner: TComponent); // utility function to create a form with delayed autosizing
|
||||||
@ -1523,8 +1530,18 @@ begin
|
|||||||
ALayout.CloseForm;
|
ALayout.CloseForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSimpleWindowLayoutList.ApplyAndShow(Sender: TObject;
|
procedure TSimpleWindowLayoutList.ApplyAndShow(Sender: TObject; AForm: TCustomForm;
|
||||||
AForm: TCustomForm; BringToFront: boolean);
|
BringToFront: boolean; AMoveToVisbleMode: TLayoutMoveToVisbleMode);
|
||||||
|
|
||||||
|
function IsAnyCornerVisible(AForm: TCustomForm): Boolean;
|
||||||
|
var
|
||||||
|
Overlap: TRect;
|
||||||
|
begin
|
||||||
|
IntersectRect(Overlap, AForm.BoundsRect, AForm.Monitor.WorkareaRect);
|
||||||
|
Result := (Overlap.Bottom > Overlap.Top + 1) and
|
||||||
|
(Overlap.Right > Overlap.Left + 1);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
ALayout: TSimpleWindowLayout;
|
ALayout: TSimpleWindowLayout;
|
||||||
NewBounds: TRect;
|
NewBounds: TRect;
|
||||||
@ -1617,6 +1634,7 @@ begin
|
|||||||
NewBounds.Right:=Max(NewBounds.Left+100,NewBounds.Right);
|
NewBounds.Right:=Max(NewBounds.Left+100,NewBounds.Right);
|
||||||
NewBounds.Bottom:=Max(NewBounds.Top+100,NewBounds.Bottom);
|
NewBounds.Bottom:=Max(NewBounds.Top+100,NewBounds.Bottom);
|
||||||
AForm.BoundsRect:=NewBounds;
|
AForm.BoundsRect:=NewBounds;
|
||||||
|
AMoveToVisbleMode := vmAlwaysMoveToVisible;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
if (AForm.WindowState in [wsNormal,wsMaximized]) and BringToFront then
|
if (AForm.WindowState in [wsNormal,wsMaximized]) and BringToFront then
|
||||||
@ -1626,7 +1644,11 @@ begin
|
|||||||
if (csDesigning in AForm.ComponentState) and (AForm.Designer <> nil) then
|
if (csDesigning in AForm.ComponentState) and (AForm.Designer <> nil) then
|
||||||
ARestoreVisible := AForm.Visible;
|
ARestoreVisible := AForm.Visible;
|
||||||
|
|
||||||
AForm.EnsureVisible(true);
|
if (AMoveToVisbleMode = vmAlwaysMoveToVisible) or
|
||||||
|
( (AMoveToVisbleMode = vmOnlyMoveOffScreenToVisible) and
|
||||||
|
(not IsAnyCornerVisible(AForm)) )
|
||||||
|
then
|
||||||
|
AForm.EnsureVisible(true);
|
||||||
|
|
||||||
if (csDesigning in AForm.ComponentState) and (AForm.Designer <> nil) then
|
if (csDesigning in AForm.ComponentState) and (AForm.Designer <> nil) then
|
||||||
AForm.Visible := ARestoreVisible;
|
AForm.Visible := ARestoreVisible;
|
||||||
@ -1643,7 +1665,11 @@ begin
|
|||||||
// issue #19769
|
// issue #19769
|
||||||
if AForm.Visible and not (fsModal in AForm.FormState) then
|
if AForm.Visible and not (fsModal in AForm.FormState) then
|
||||||
AForm.Visible := False;
|
AForm.Visible := False;
|
||||||
AForm.EnsureVisible(true);
|
if (AMoveToVisbleMode = vmAlwaysMoveToVisible) or
|
||||||
|
( (AMoveToVisbleMode = vmOnlyMoveOffScreenToVisible) and
|
||||||
|
(not IsAnyCornerVisible(AForm)) )
|
||||||
|
then
|
||||||
|
AForm.EnsureVisible(true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2000,7 +2026,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEWindowCreatorList.ShowForm(AForm: TCustomForm; BringToFront: boolean);
|
procedure TIDEWindowCreatorList.ShowForm(AForm: TCustomForm; BringToFront: boolean;
|
||||||
|
AMoveToVisbleMode: TLayoutMoveToVisbleMode);
|
||||||
var
|
var
|
||||||
Layout: TSimpleWindowLayout;
|
Layout: TSimpleWindowLayout;
|
||||||
begin
|
begin
|
||||||
@ -2021,7 +2048,7 @@ begin
|
|||||||
// show dockable if it has a creator and is not a designer form
|
// show dockable if it has a creator and is not a designer form
|
||||||
IDEDockMaster.ShowForm(AForm,BringToFront)
|
IDEDockMaster.ShowForm(AForm,BringToFront)
|
||||||
else
|
else
|
||||||
SimpleLayoutStorage.ApplyAndShow(Self,AForm,BringToFront);
|
SimpleLayoutStorage.ApplyAndShow(Self,AForm,BringToFront,AMoveToVisbleMode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEWindowCreatorList.ShowForm(AFormName: string; BringToFront: boolean
|
function TIDEWindowCreatorList.ShowForm(AFormName: string; BringToFront: boolean
|
||||||
|
@ -3149,7 +3149,7 @@ end;
|
|||||||
procedure TSourceEditor.FocusEditor;
|
procedure TSourceEditor.FocusEditor;
|
||||||
Begin
|
Begin
|
||||||
DebugLnEnter(SRCED_PAGES, ['>> TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name]);
|
DebugLnEnter(SRCED_PAGES, ['>> TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name]);
|
||||||
IDEWindowCreators.ShowForm(SourceNotebook,true);
|
IDEWindowCreators.ShowForm(SourceNotebook, true, vmOnlyMoveOffScreenToVisible);
|
||||||
if FEditor.IsVisible then begin
|
if FEditor.IsVisible then begin
|
||||||
FEditor.SetFocus; // TODO: will cal EditorEnter, which does self.Activate => maybe lock, and do here?
|
FEditor.SetFocus; // TODO: will cal EditorEnter, which does self.Activate => maybe lock, and do here?
|
||||||
FSharedValues.SetActiveSharedEditor(Self);
|
FSharedValues.SetActiveSharedEditor(Self);
|
||||||
|
Loading…
Reference in New Issue
Block a user