mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:29:29 +02:00
IDE: added flag to disable autosizing on create
git-svn-id: trunk@26002 -
This commit is contained in:
parent
44cf8aac3a
commit
9b2dc8742c
@ -40,8 +40,6 @@ uses
|
||||
Classes, Forms, Controls, IDEProcs, Debugger, EnvironmentOpts, IDEOptionDefs;
|
||||
|
||||
type
|
||||
TDebuggerDlgClass = class of TDebuggerDlg;
|
||||
|
||||
TDebuggerDlg = class(TForm)
|
||||
private
|
||||
FUpdateCount: integer;
|
||||
@ -54,6 +52,7 @@ type
|
||||
procedure EndUpdate;
|
||||
function UpdateCount: integer;
|
||||
end;
|
||||
TDebuggerDlgClass = class of TDebuggerDlg;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -55,10 +55,10 @@
|
||||
- header auto, left, top, right, bottom
|
||||
- undock (needed if no place to undock on screen)
|
||||
- merge (for example after moving a dock page into a layout)
|
||||
- enlarge side to left, top, right, bottom
|
||||
|
||||
ToDo:
|
||||
- popup menu
|
||||
- enlarge side to left, top, right, bottom
|
||||
- shrink side left, top, right, bottom
|
||||
- options
|
||||
- close (for pages)
|
||||
@ -353,6 +353,7 @@ type
|
||||
AddDockHeader: boolean = true);
|
||||
function ShowControl(ControlName: string; BringToFront: boolean = false
|
||||
): TControl;
|
||||
procedure CloseAll;
|
||||
|
||||
// save/restore layouts
|
||||
procedure SaveMainLayoutToTree(LayoutTree: TAnchorDockLayoutTree);
|
||||
@ -1033,6 +1034,29 @@ begin
|
||||
MakeDockable(Result,true,BringToFront);
|
||||
end;
|
||||
|
||||
procedure TAnchorDockMaster.CloseAll;
|
||||
var
|
||||
AForm: TCustomForm;
|
||||
i: Integer;
|
||||
begin
|
||||
// first hide all to reduce flicker
|
||||
i:=Screen.CustomFormCount-1;
|
||||
while i>=0 do begin
|
||||
AForm:=GetParentForm(Screen.CustomForms[i]);
|
||||
if AForm<>nil then
|
||||
AForm.Hide;
|
||||
i:=Min(i,Screen.CustomFormCount);
|
||||
end;
|
||||
// then close all, but the MainForm
|
||||
i:=Screen.CustomFormCount-1;
|
||||
while i>=0 do begin
|
||||
AForm:=Screen.CustomForms[i];
|
||||
if AForm<>Application.MainForm then
|
||||
AForm.Close;
|
||||
i:=Min(i,Screen.CustomFormCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockMaster.SaveMainLayoutToTree(LayoutTree: TAnchorDockLayoutTree
|
||||
);
|
||||
var
|
||||
@ -2345,7 +2369,7 @@ begin
|
||||
OnlyCheckIfPossible) then exit(true);
|
||||
if EnlargeSideResizeTwoSplitters(Side,OppositeAnchor[ClockwiseAnchor[Side]],
|
||||
OnlyCheckIfPossible) then exit(true);
|
||||
// ToDo:
|
||||
// ToDo: EnlargeBetween
|
||||
end;
|
||||
|
||||
function TAnchorDockHostSite.EnlargeSideResizeTwoSplitters(ShrinkSplitterSide,
|
||||
|
@ -46,10 +46,10 @@ type
|
||||
{ TIDEEasyDockMaster }
|
||||
|
||||
TIDEEasyDockMaster = class(TIDEDockMaster)
|
||||
private
|
||||
function DockMasterRestore(const CtrlName: string; ASite: TWinControl
|
||||
): TControl;
|
||||
function DockMasterSave(ACtrl: TControl): string;
|
||||
private
|
||||
procedure GetDefaultBounds(AForm: TCustomForm; out Creator: TIDEWindowCreator;
|
||||
out NewBounds: TRect; out DockSiblingName: string; out DockAlign: TAlign);
|
||||
public
|
||||
@ -283,7 +283,7 @@ begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
// create the dockmaster in the initialization section, so that is ready
|
||||
// create the dockmaster in the initialization section, so that it is ready
|
||||
// when the Register procedures of the packages are called.
|
||||
TDockMaster.Create(nil);
|
||||
IDEDockMaster:=TIDEEasyDockMaster.Create;
|
||||
|
@ -146,7 +146,8 @@ type
|
||||
function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; virtual; abstract;
|
||||
|
||||
procedure ViewDebugDialog(const ADialogType: TDebugDialogType;
|
||||
BringToFront: Boolean = True; Show: Boolean = true); virtual; abstract;
|
||||
BringToFront: Boolean = True; Show: Boolean = true;
|
||||
DoDisableAutoSizing: boolean = false); virtual; abstract;
|
||||
public
|
||||
property Commands: TDBGCommands read GetCommands; // All current available commands of the debugger
|
||||
property Debuggers[const AIndex: Integer]: TDebuggerClass read GetDebuggerClass;
|
||||
|
@ -116,7 +116,7 @@ type
|
||||
|
||||
// Dialog routines
|
||||
procedure CreateDebugDialog(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
procedure DestroyDebugDialog(const ADialogType: TDebugDialogType);
|
||||
procedure InitDebugOutputDlg;
|
||||
procedure InitDebugEventsDlg;
|
||||
@ -187,7 +187,7 @@ type
|
||||
function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; override;
|
||||
function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; override;
|
||||
|
||||
procedure ViewDebugDialog(const ADialogType: TDebugDialogType; BringToFront: Boolean = true; Show: Boolean = true); override;
|
||||
procedure ViewDebugDialog(const ADialogType: TDebugDialogType; BringToFront: Boolean = true; Show: Boolean = true; DoDisableAutoSizing: boolean = false); override;
|
||||
end;
|
||||
|
||||
|
||||
@ -1741,7 +1741,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TDebugManager.ViewDebugDialog(const ADialogType: TDebugDialogType;
|
||||
BringToFront: Boolean; Show: Boolean);
|
||||
BringToFront: Boolean; Show: Boolean; DoDisableAutoSizing: boolean);
|
||||
const
|
||||
DEBUGDIALOGCLASS: array[TDebugDialogType] of TDebuggerDlgClass = (
|
||||
TDbgOutputForm, TDbgEventsForm, TBreakPointsDlg, TWatchesDlg, TLocalsDlg,
|
||||
@ -1753,8 +1753,10 @@ begin
|
||||
if Destroying then exit;
|
||||
if FDialogs[ADialogType] = nil
|
||||
then begin
|
||||
FDialogs[ADialogType] := DEBUGDIALOGCLASS[ADialogType].Create(Self);
|
||||
CurDialog:=FDialogs[ADialogType];
|
||||
CurDialog := TDebuggerDlg(DEBUGDIALOGCLASS[ADialogType].NewInstance);
|
||||
CurDialog.DisableAutoSizing;
|
||||
CurDialog.Create(Self);
|
||||
FDialogs[ADialogType]:=CurDialog;
|
||||
CurDialog.Name:=NonModalIDEWindowNames[DebugDlgIDEWindow[ADialogType]];
|
||||
CurDialog.Tag := Integer(ADialogType);
|
||||
CurDialog.OnDestroy := @DebugDialogDestroy;
|
||||
@ -1773,12 +1775,16 @@ begin
|
||||
end
|
||||
else begin
|
||||
CurDialog:=FDialogs[ADialogType];
|
||||
if DoDisableAutoSizing then
|
||||
CurDialog.DisableAutoSizing;
|
||||
if (CurDialog is TBreakPointsDlg)
|
||||
then begin
|
||||
if (Project1<>nil) then
|
||||
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
|
||||
end;
|
||||
end;
|
||||
if not DoDisableAutoSizing then
|
||||
CurDialog.EnableAutoSizing;
|
||||
if Show then
|
||||
begin
|
||||
IDEWindowCreators.ShowForm(CurDialog,BringToFront);
|
||||
@ -2195,7 +2201,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TDebugManager.CreateDebugDialog(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
|
||||
function ItIs(Prefix: string): boolean;
|
||||
begin
|
||||
@ -2208,7 +2214,7 @@ begin
|
||||
for DlgType:=Low(TDebugDialogType) to High(TDebugDialogType) do
|
||||
if ItIs(NonModalIDEWindowNames[DebugDlgIDEWindow[DlgType]]) then
|
||||
begin
|
||||
ViewDebugDialog(DlgType,false,false);
|
||||
ViewDebugDialog(DlgType,false,false,DoDisableAutoSizing);
|
||||
AForm:=FDialogs[DlgType];
|
||||
exit;
|
||||
end;
|
||||
|
10
ide/main.pp
10
ide/main.pp
@ -807,7 +807,7 @@ type
|
||||
procedure DoShowRestrictionBrowser(Show: boolean; const RestrictedName: String = '');
|
||||
procedure DoShowComponentList(Show: boolean);
|
||||
procedure CreateIDEWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
function CreateNewUniqueFilename(const Prefix, Ext: string;
|
||||
NewOwner: TObject; Flags: TSearchIDEFileFlags; TryWithoutNumber: boolean
|
||||
): string; override;
|
||||
@ -9013,7 +9013,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainIDE.CreateIDEWindow(Sender: TObject; aFormName: string; var
|
||||
AForm: TCustomForm);
|
||||
AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
|
||||
function ItIs(Prefix: string): boolean;
|
||||
begin
|
||||
@ -9073,9 +9073,9 @@ begin
|
||||
begin
|
||||
DoShowComponentList(false);
|
||||
AForm:=ComponentListForm;
|
||||
end
|
||||
else
|
||||
raise Exception.Create('TMainIDE.CreateIDEWindow invalid formname: '+aFormName);
|
||||
end;
|
||||
if (AForm<>nil) and DoDisableAutoSizing then
|
||||
AForm.DisableAutoSizing;
|
||||
end;
|
||||
|
||||
function TMainIDE.CreateNewUniqueFilename(const Prefix, Ext: string;
|
||||
|
@ -951,7 +951,7 @@ type
|
||||
function ActiveOrNewSourceWindow: TSourceNotebook;
|
||||
function NewSourceWindow: TSourceNotebook;
|
||||
procedure CreateSourceWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
procedure GetDefaultLayout(Sender: TObject; aFormName: string;
|
||||
out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign);
|
||||
function SourceWindowWithPage(const APage: TPage): TSourceNotebook;
|
||||
@ -1045,7 +1045,8 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function CreateNewWindow(Activate: Boolean= False): TSourceNotebook;
|
||||
function CreateNewWindow(Activate: Boolean= False;
|
||||
DoDisableAutoSizing: boolean = False): TSourceNotebook;
|
||||
private
|
||||
FOnAddJumpPoint: TOnAddJumpPoint;
|
||||
FOnClearBookmark: TPlaceBookMarkEvent;
|
||||
@ -8406,12 +8407,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.CreateSourceWindow(Sender: TObject;
|
||||
aFormName: string; var AForm: TCustomForm);
|
||||
aFormName: string; var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
begin
|
||||
{$IFDEF VerboseIDEDocking}
|
||||
debugln(['TSourceEditorManager.CreateSourceWindow Sender=',DbgSName(Sender),' FormName="',aFormName,'"']);
|
||||
{$ENDIF}
|
||||
AForm := CreateNewWindow(false);
|
||||
AForm := CreateNewWindow(false,DoDisableAutoSizing);
|
||||
AForm.Name:=aFormName;
|
||||
end;
|
||||
|
||||
@ -9107,12 +9108,14 @@ begin
|
||||
Result := AnsiStrComp(PChar(SrcWin1.Caption), PChar(SrcWin2.Caption));
|
||||
end;
|
||||
|
||||
function TSourceEditorManager.CreateNewWindow(Activate: Boolean= False): TSourceNotebook;
|
||||
function TSourceEditorManager.CreateNewWindow(Activate: Boolean= False;
|
||||
DoDisableAutoSizing: boolean = false): TSourceNotebook;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := TSourceNotebook.Create(Self);
|
||||
Result.FreeNotification(self);
|
||||
Result := TSourceNotebook(TSourceNotebook.NewInstance);
|
||||
Result.DisableAutoSizing;
|
||||
Result.Create(Self);
|
||||
Result.OnDropFiles := @OnFilesDroping;
|
||||
|
||||
for i := 1 to FUpdateLock do
|
||||
@ -9125,6 +9128,8 @@ begin
|
||||
ShowActiveWindowOnTop(False);
|
||||
end;
|
||||
FChangeNotifyLists[semWindowCreate].CallNotifyEvents(Result);
|
||||
if not DoDisableAutoSizing then
|
||||
Result.EnableAutoSizing;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.RemoveWindow(AWindow: TSourceNotebook);
|
||||
|
@ -113,7 +113,7 @@ type
|
||||
);
|
||||
|
||||
TCreateIDEWindowEvent = procedure(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm) of object;
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean) of object;
|
||||
TGetDefaultIDEWindowLayoutEvent = procedure(Sender: TObject; aFormName: string;
|
||||
out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign) of object;
|
||||
TShowIDEWindowEvent = procedure(Sender: TObject; AForm: TCustomForm;
|
||||
@ -190,7 +190,8 @@ type
|
||||
procedure Delete(Index: integer);
|
||||
function IndexOfName(FormName: string): integer;
|
||||
function FindWithName(FormName: string): TIDEWindowCreator;
|
||||
function GetForm(aFormName: string; AutoCreate: boolean): TCustomForm;
|
||||
function GetForm(aFormName: string; AutoCreate: boolean;
|
||||
DisableAutoSizing: boolean = false): TCustomForm;
|
||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean);
|
||||
property OnShowForm: TShowIDEWindowEvent read FOnShowForm write FOnShowForm;
|
||||
end;
|
||||
@ -675,13 +676,17 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TIDEWindowCreatorList.GetForm(aFormName: string; AutoCreate: boolean
|
||||
): TCustomForm;
|
||||
function TIDEWindowCreatorList.GetForm(aFormName: string; AutoCreate: boolean;
|
||||
DisableAutoSizing: boolean): TCustomForm;
|
||||
var
|
||||
Item: TIDEWindowCreator;
|
||||
begin
|
||||
Result:=Screen.FindForm(aFormName);
|
||||
if Result<>nil then exit;
|
||||
if Result<>nil then begin
|
||||
if DisableAutoSizing then
|
||||
Result.DisableAutoSizing;
|
||||
exit;
|
||||
end;
|
||||
if AutoCreate then begin
|
||||
Item:=FindWithName(aFormName);
|
||||
if Item=nil then begin
|
||||
@ -692,7 +697,7 @@ begin
|
||||
debugln(['TIDEWindowCreatorList.GetForm no OnCreateForm for ',aFormName]);
|
||||
exit;
|
||||
end;
|
||||
Item.OnCreateForm(Self,aFormName,Result);
|
||||
Item.OnCreateForm(Self,aFormName,Result,DisableAutoSizing);
|
||||
if Result=nil then begin
|
||||
debugln(['TIDEWindowCreatorList.GetForm create failed for ',aFormName]);
|
||||
exit;
|
||||
|
@ -159,7 +159,7 @@ type
|
||||
function LoadDependencyList(FirstDependency: TPkgDependency): TModalResult;
|
||||
procedure OnOpenPackageForCurrentSrcEditFile(Sender: TObject);
|
||||
procedure CreateIDEWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
private
|
||||
// helper functions
|
||||
FLastLazarusSrcDir: string;
|
||||
@ -717,12 +717,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPkgManager.CreateIDEWindow(Sender: TObject; aFormName: string; var
|
||||
AForm: TCustomForm);
|
||||
AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
begin
|
||||
if SysUtils.CompareText(aFormName,NonModalIDEWindowNames[nmiwPkgGraphExplorer])=0
|
||||
then begin
|
||||
DoShowPackageGraph(false);
|
||||
AForm:=PackageGraphExplorer;
|
||||
if DoDisableAutoSizing then
|
||||
AForm.DisableAutoSizing;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user