DockedFormEditor: Preparing IDE for AnchorDesigner UnDo/ReDo

git-svn-id: trunk@65107 -
This commit is contained in:
michl 2021-05-12 16:07:12 +00:00
parent 5f52e17206
commit 30e1eb1591
2 changed files with 24 additions and 11 deletions

View File

@ -578,16 +578,15 @@ type
function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; virtual; abstract;
public
function AutoSizeInShowDesigner(AControl: TControl): Boolean; virtual; abstract;
function GetDesigner(ASourceEditor: TSourceEditorInterface; ATabDisplayState: TTabDisplayState): TIDesigner; virtual;
procedure ToggleFormUnit; virtual; abstract;
procedure JumpToCompilerMessage(ASourceEditor: TSourceEditorInterface); virtual; abstract;
property TabDisplayState: TTabDisplayState read GetTabDisplayState;
property TabDisplayStateEditor[Index: TSourceEditorInterface]: TTabDisplayState read GetTabDisplayStateEditor;
procedure ShowCode(ASourceEditor: TSourceEditorInterface); virtual; abstract;
procedure ShowDesigner(ASourceEditor: TSourceEditorInterface; AIndex: Integer = 0); virtual; abstract;
procedure ShowForm(AForm: TCustomForm); virtual; abstract;
public
property TabDisplayState: TTabDisplayState read GetTabDisplayState;
property TabDisplayStateEditor[Index: TSourceEditorInterface]: TTabDisplayState read GetTabDisplayStateEditor;
end;
var
@ -626,6 +625,19 @@ begin
BootHandlers[ht][i]();
end;
{ TIDETabMaster }
function TIDETabMaster.GetDesigner(ASourceEditor: TSourceEditorInterface;
ATabDisplayState: TTabDisplayState): TIDesigner;
begin
case ATabDisplayState of
tdsDesign:
Result := ASourceEditor.GetDesigner(True);
else
Result := nil;
end;
end;
{ TLazIDEInterface }
procedure TLazIDEInterface.AddHandler(HandlerType: TLazarusIDEHandlerType;

View File

@ -2533,14 +2533,13 @@ var
function TryGetDesignerFromForm(AForm: TCustomForm;
out ADesigner: TComponentEditorDesigner): Boolean;
begin
if Assigned(IDETabMaster) and (AForm is TSourceEditorWindowInterface)
and (IDETabMaster.TabDisplayState=tdsDesign)
then
ADesigner := TComponentEditorDesigner(TSourceEditorWindowInterface(AForm).
ActiveEditor.GetDesigner(True))
if Assigned(IDETabMaster) and (AForm is TSourceEditorWindowInterface) then
ADesigner := TComponentEditorDesigner(
IDETabMaster.GetDesigner(
TSourceEditorWindowInterface(AForm).ActiveEditor,
IDETabMaster.TabDisplayState))
else
ADesigner := nil;
Result := ADesigner <> nil;
end;
@ -3964,6 +3963,8 @@ var
begin
GetCurrentUnit(ASrcEdit, AnUnitInfo);
ActiveDesigner := GetActiveDesignerSkipMainBar;
if not (ActiveDesigner is TDesigner) then
Exit;
if not UpdateEditorCommandsStamp.Changed(ASrcEdit, ActiveDesigner as TDesigner, DisplayState) then
Exit;