SpartaDockedFormEditor: Prevent showing of undocked new created frames (short flicker) and more generally code for revision 58299 #a027232dda.

git-svn-id: trunk@58321 -
This commit is contained in:
michl 2018-06-19 07:53:06 +00:00
parent 6526cf39b0
commit ce6f326b14
3 changed files with 29 additions and 19 deletions

View File

@ -570,7 +570,7 @@ type
function GetTabDisplayState: TTabDisplayState; virtual; abstract; function GetTabDisplayState: TTabDisplayState; virtual; abstract;
function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; virtual; abstract; function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; virtual; abstract;
public public
function AutoSizeInShowDesigner(AForm: TCustomForm): Boolean; virtual; abstract; function AutoSizeInShowDesigner(AControl: TControl): Boolean; virtual; abstract;
procedure ToggleFormUnit; virtual; abstract; procedure ToggleFormUnit; virtual; abstract;
procedure JumpToCompilerMessage(ASourceEditor: TSourceEditorInterface); virtual; abstract; procedure JumpToCompilerMessage(ASourceEditor: TSourceEditorInterface); virtual; abstract;

View File

@ -122,15 +122,15 @@ type
TDTXTabMaster = class(TIDETabMaster) TDTXTabMaster = class(TIDETabMaster)
private private
FAutoSizeFormList: TObjectList; FAutoSizeControlList: TObjectList;
protected protected
function GetTabDisplayState: TTabDisplayState; override; function GetTabDisplayState: TTabDisplayState; override;
function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; override; function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; override;
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
function AutoSizeInShowDesigner(AForm: TCustomForm): Boolean; override; function AutoSizeInShowDesigner(AControl: TControl): Boolean; override;
procedure EnableAutoSizing(AForm: TCustomForm); procedure EnableAutoSizing(AControl: TControl);
procedure ToggleFormUnit; override; procedure ToggleFormUnit; override;
procedure JumpToCompilerMessage(ASourceEditor: TSourceEditorInterface); override; procedure JumpToCompilerMessage(ASourceEditor: TSourceEditorInterface); override;
@ -795,31 +795,42 @@ end;
constructor TDTXTabMaster.Create; constructor TDTXTabMaster.Create;
begin begin
FAutoSizeFormList := TObjectList.Create(False); FAutoSizeControlList := TObjectList.Create(False);
end; end;
destructor TDTXTabMaster.Destroy; destructor TDTXTabMaster.Destroy;
begin begin
FAutoSizeFormList.Free; FAutoSizeControlList.Free;
inherited Destroy; inherited Destroy;
end; end;
function TDTXTabMaster.AutoSizeInShowDesigner(AForm: TCustomForm): Boolean; function TDTXTabMaster.AutoSizeInShowDesigner(AControl: TControl): Boolean;
begin begin
FAutoSizeFormList.Add(AForm); FAutoSizeControlList.Add(AControl);
Result := True; Result := True;
end; end;
procedure TDTXTabMaster.EnableAutoSizing(AForm: TCustomForm); procedure TDTXTabMaster.EnableAutoSizing(AControl: TControl);
var var
AIndex: Integer; AIndex: Integer;
AutoSizeControl: TControl;
begin begin
AIndex := FAutoSizeFormList.IndexOf(AForm); if not Assigned(AControl) then Exit;
if Assigned(AForm) and (AIndex >= 0) and IsFormDesign(AForm) AutoSizeControl := nil;
and (not (AForm is TNonControlProxyDesignerForm)) and (not (AForm is TFrameProxyDesignerForm)) then
if AControl is TNonFormProxyDesignerForm then
begin begin
FAutoSizeFormList.Delete(AIndex); if (TNonFormProxyDesignerForm(AControl).LookupRoot is TControl) then
AForm.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF}; AutoSizeControl := TControl(TNonFormProxyDesignerForm(AControl).LookupRoot);
end
else
AutoSizeControl := AControl;
AIndex := FAutoSizeControlList.IndexOf(AutoSizeControl);
if (AIndex >= 0) then
begin
FAutoSizeControlList.Delete(AIndex);
AutoSizeControl.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF};
end; end;
end; end;
@ -880,8 +891,7 @@ end;
{ TDTXComponentsMaster } { TDTXComponentsMaster }
function TDTXComponentsMaster.DrawNonVisualComponents(ALookupRoot: TComponent function TDTXComponentsMaster.DrawNonVisualComponents(ALookupRoot: TComponent): Boolean;
): Boolean;
var var
LFormData: TDesignFormData; LFormData: TDesignFormData;
LPageCtrl: TModulePageControl; LPageCtrl: TModulePageControl;

View File

@ -2295,9 +2295,9 @@ begin
begin begin
// disable autosizing for docked form editor forms, see issue #32207 // disable autosizing for docked form editor forms, see issue #32207
PreventAutoSize := (IDETabMaster <> nil) PreventAutoSize := (IDETabMaster <> nil)
and (NewUnitInfo.Component is TCustomForm) and ((NewUnitInfo.Component is TCustomForm)
and (IsFormDesign(NewUnitInfo.Component as TCustomForm)) or (NewUnitInfo.Component is TCustomFrame))
and IDETabMaster.AutoSizeInShowDesigner(NewUnitInfo.Component as TCustomForm); and IDETabMaster.AutoSizeInShowDesigner(TControl(NewUnitInfo.Component));
if not PreventAutoSize then if not PreventAutoSize then
TControl(NewUnitInfo.Component).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF}; TControl(NewUnitInfo.Component).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF};
end; end;