mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 20:36:09 +02:00
SpartaDockedFormEditor: Prevent showing of undocked forms (short flicker) after creating new forms. Issue #32207. Patch by Balázs Székely
git-svn-id: trunk@58299 -
This commit is contained in:
parent
19f92d6a42
commit
a027232dda
@ -570,6 +570,7 @@ type
|
||||
function GetTabDisplayState: TTabDisplayState; virtual; abstract;
|
||||
function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; virtual; abstract;
|
||||
public
|
||||
function AutoSizeInShowDesigner(AForm: TCustomForm): Boolean; virtual; abstract;
|
||||
procedure ToggleFormUnit; virtual; abstract;
|
||||
procedure JumpToCompilerMessage(ASourceEditor: TSourceEditorInterface); virtual; abstract;
|
||||
|
||||
|
@ -21,7 +21,7 @@ uses
|
||||
{$IFDEF USE_GENERICS_COLLECTIONS}
|
||||
Generics.Collections, Generics.Defaults,
|
||||
{$ELSE}
|
||||
ghashmap, sparta_HashUtils, gvector,
|
||||
ghashmap, sparta_HashUtils, gvector, contnrs,
|
||||
{$ENDIF}
|
||||
// LCL
|
||||
LCLIntf, LCLType, LMessages, ComCtrls, Controls, Forms, ExtCtrls, Graphics,
|
||||
@ -121,10 +121,16 @@ type
|
||||
{ TDTXTabMaster }
|
||||
|
||||
TDTXTabMaster = class(TIDETabMaster)
|
||||
private
|
||||
FAutoSizeFormList: TObjectList;
|
||||
protected
|
||||
function GetTabDisplayState: TTabDisplayState; override;
|
||||
function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; override;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
function AutoSizeInShowDesigner(AForm: TCustomForm): Boolean; override;
|
||||
procedure EnableAutoSizing(AForm: TCustomForm);
|
||||
procedure ToggleFormUnit; override;
|
||||
procedure JumpToCompilerMessage(ASourceEditor: TSourceEditorInterface); override;
|
||||
|
||||
@ -787,6 +793,36 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TDTXTabMaster.Create;
|
||||
begin
|
||||
FAutoSizeFormList := TObjectList.Create(False);
|
||||
end;
|
||||
|
||||
destructor TDTXTabMaster.Destroy;
|
||||
begin
|
||||
FAutoSizeFormList.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TDTXTabMaster.AutoSizeInShowDesigner(AForm: TCustomForm): Boolean;
|
||||
begin
|
||||
FAutoSizeFormList.Add(AForm);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TDTXTabMaster.EnableAutoSizing(AForm: TCustomForm);
|
||||
var
|
||||
AIndex: Integer;
|
||||
begin
|
||||
AIndex := FAutoSizeFormList.IndexOf(AForm);
|
||||
if Assigned(AForm) and (AIndex >= 0) and IsFormDesign(AForm)
|
||||
and (not (AForm is TNonControlProxyDesignerForm)) and (not (AForm is TFrameProxyDesignerForm)) then
|
||||
begin
|
||||
FAutoSizeFormList.Delete(AIndex);
|
||||
AForm.EnableAutoSizing;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDTXTabMaster.ToggleFormUnit;
|
||||
begin
|
||||
case TabDisplayState of
|
||||
@ -816,6 +852,8 @@ end;
|
||||
procedure TDTXTabMaster.ShowDesigner(ASourceEditor: TSourceEditorInterface; AIndex: Integer);
|
||||
var
|
||||
LPageCtrl: TModulePageControl;
|
||||
Designer: TIDesigner;
|
||||
Form: TCustomForm;
|
||||
begin
|
||||
if ASourceEditor = nil then
|
||||
Exit;
|
||||
@ -1439,6 +1477,8 @@ begin
|
||||
end;
|
||||
|
||||
LSourceWndData.ActiveDesignFormData := LFormData;
|
||||
// enable autosizing after creating a new form, see issue #32207
|
||||
TDTXTabMaster(IDETabMaster).EnableAutoSizing(LFormData.Form.Form);
|
||||
// to handle windows with different size
|
||||
LPageCtrl.BoundToDesignTabSheet;
|
||||
end;
|
||||
|
@ -3551,9 +3551,12 @@ begin
|
||||
AForm.WindowState := wsMinimized;
|
||||
exit;
|
||||
end;
|
||||
// do not call 'AForm.Show', because it will set Visible to true
|
||||
AForm.BringToFront;
|
||||
LCLIntf.ShowWindow(AForm.Handle,SW_SHOWNORMAL);
|
||||
if IDETabMaster = nil then
|
||||
begin
|
||||
// do not call 'AForm.Show', because it will set Visible to true
|
||||
AForm.BringToFront;
|
||||
LCLIntf.ShowWindow(AForm.Handle,SW_SHOWNORMAL);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewAnchorEditor(State: TIWGetFormState);
|
||||
|
@ -2077,6 +2077,7 @@ var
|
||||
Src: String;
|
||||
i: Integer;
|
||||
LFindDesignerBaseClassByName: Boolean = True;
|
||||
PreventAutoSize: Boolean;
|
||||
begin
|
||||
//debugln('TLazSourceFileManager.NewFile A NewFilename=',NewFilename);
|
||||
// empty NewFilename is ok, it will be auto generated
|
||||
@ -2291,7 +2292,15 @@ begin
|
||||
DisableAutoSize);
|
||||
if DisableAutoSize and (NewUnitInfo.Component<>nil)
|
||||
and (NewUnitInfo.Component is TControl) then
|
||||
TControl(NewUnitInfo.Component).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF};
|
||||
begin
|
||||
// disable autosizing for docked form editor forms, see issue #32207
|
||||
PreventAutoSize := (IDETabMaster <> nil)
|
||||
and (NewUnitInfo.Component is TCustomForm)
|
||||
and (IsFormDesign(NewUnitInfo.Component as TCustomForm))
|
||||
and IDETabMaster.AutoSizeInShowDesigner(NewUnitInfo.Component as TCustomForm);
|
||||
if not PreventAutoSize then
|
||||
TControl(NewUnitInfo.Component).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF};
|
||||
end;
|
||||
end;
|
||||
if Result<>mrOk then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user