mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 18:38:25 +02:00
DockedFormEditor: Fixed AV on designer default method creation (mouse double click)
git-svn-id: trunk@64573 -
This commit is contained in:
parent
26c6ac0ef4
commit
e1df656379
@ -229,7 +229,7 @@ var
|
||||
LPageIndex: Integer;
|
||||
begin
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(LastActiveSourceEditor);
|
||||
LRefreshDesigner := Assigned(LPageCtrl) and (LPageCtrl.PageIndex in [1, 2]);
|
||||
LRefreshDesigner := Assigned(LPageCtrl) and LPageCtrl.DesignerFocused;
|
||||
LPageIndex := LPageCtrl.PageIndex;
|
||||
LPageCtrl.CreateTabSheetAnchors;
|
||||
|
||||
@ -465,14 +465,14 @@ begin
|
||||
// Prevent unexpected events (when is deactivated some control outside designed form)
|
||||
if (LDesignForm.LastActiveSourceWindow = LSourceEditorWindowInterface)
|
||||
// important!!! for many error - switching between editors...
|
||||
and (LPageCtrl.PageIndex in [1, 2]) then
|
||||
and LPageCtrl.DesignerFocused then
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].ActiveDesignForm := LDesignForm
|
||||
else
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].ActiveDesignForm := nil;
|
||||
end;
|
||||
|
||||
LPageCtrl.InitPage;
|
||||
if (LPageCtrl.PageIndex in [1, 2]) then
|
||||
if LPageCtrl.DesignerFocused then
|
||||
begin
|
||||
if not LDesignForm.Hiding then
|
||||
begin
|
||||
@ -578,7 +578,7 @@ begin
|
||||
LSourceEditorWindow := SourceEditorWindows.SourceEditorWindow[LActiveSourceWindowInterface];
|
||||
if LSourceEditorWindow = nil then Exit;
|
||||
|
||||
if not (LPageCtrl.PageIndex in [1, 2]) then
|
||||
if not LPageCtrl.DesignerFocused then
|
||||
begin
|
||||
LSourceEditorWindow.ActiveDesignForm := nil;
|
||||
LPageCtrl.InitPage;
|
||||
|
@ -51,6 +51,7 @@ type
|
||||
procedure CreateTabSheetAnchors;
|
||||
procedure CreateTabSheetDesigner;
|
||||
procedure DesignerSetFocus;
|
||||
function DesignerFocused: Boolean;
|
||||
procedure HideDesignPages;
|
||||
procedure InitPage;
|
||||
procedure RefreshResizer;
|
||||
@ -82,7 +83,6 @@ begin
|
||||
FDesignForm := AValue;
|
||||
if AValue = nil then
|
||||
begin
|
||||
//find
|
||||
if Assigned(FResizer) then
|
||||
FResizer.DesignForm := nil;
|
||||
end else begin
|
||||
@ -153,6 +153,12 @@ begin
|
||||
Resizer.DesignerSetFocus;
|
||||
end;
|
||||
|
||||
function TModulePageControl.DesignerFocused: Boolean;
|
||||
begin
|
||||
Result := (ActivePage = FTabSheetDesigner) or
|
||||
(ActivePage = FTabSheetAnchors);
|
||||
end;
|
||||
|
||||
procedure TModulePageControl.HideDesignPages;
|
||||
begin
|
||||
FreeAndNil(FTabSheetAnchors);
|
||||
|
@ -447,8 +447,13 @@ end;
|
||||
procedure TResizeFrame.SetDesignForm(const AValue: TDesignForm);
|
||||
begin
|
||||
FDesignForm := AValue;
|
||||
// special for QT (at start "design form" has wrong position)
|
||||
TryBoundDesignForm;
|
||||
if Assigned(AValue) then
|
||||
begin
|
||||
// special for QT (at start "design form" has wrong position)
|
||||
TryBoundDesignForm;
|
||||
Application.AddOnIdleHandler(@AppOnIdle);
|
||||
end else
|
||||
Application.RemoveOnIdleHandler(@AppOnIdle);
|
||||
end;
|
||||
|
||||
procedure TResizeFrame.TryBoundDesignForm;
|
||||
@ -481,14 +486,11 @@ begin
|
||||
PanelFormClient.OnChangeBounds := @ClientChangeBounds;
|
||||
PanelAnchorContainer.OnChangeBounds := @ClientChangeBounds;
|
||||
AdjustPanelResizer;
|
||||
|
||||
Application.AddOnIdleHandler(@AppOnIdle);
|
||||
end;
|
||||
|
||||
destructor TResizeFrame.Destroy;
|
||||
begin
|
||||
Pointer(FDesignForm) := nil;
|
||||
Application.RemoveOnIdleHandler(@AppOnIdle);
|
||||
DesignForm := nil;
|
||||
FBitmapBarInactive.Free;
|
||||
FBitmapBarActive.Free;
|
||||
inherited Destroy;
|
||||
|
@ -107,6 +107,10 @@ end;
|
||||
|
||||
procedure TResizer.SetDesignForm(AValue: TDesignForm);
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR}
|
||||
if Assigned(AValue) then DebugLn('TResizer.SetDesignForm: New Designform: ', DbgSName(AValue.Form))
|
||||
else DebugLn('TResizer.SetDesignForm: New Designform: nil');
|
||||
{$ENDIF}
|
||||
if FDesignForm <> nil then
|
||||
FDesignForm.OnChangeHackedBounds := nil;
|
||||
FDesignForm := AValue;
|
||||
|
Loading…
Reference in New Issue
Block a user