mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 09:40:49 +02:00
New Fixed removing of incorrect component properties in LFM with installed DockedFormEditor. Issue #40377.
(cherry picked from commit 4179f1b4b1
)
This commit is contained in:
parent
ffd2d084e4
commit
4ae41c0283
@ -22,7 +22,7 @@
|
||||
|
||||
unit DockedMainIDE;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$mode delphi}{$H+}
|
||||
{ $define DEBUGDOCKEDFORMEDITOR}
|
||||
|
||||
interface
|
||||
@ -48,12 +48,16 @@ type
|
||||
// enable autosizing for docked form editor forms, see issue #32207 - disabled
|
||||
// in SourceFileManager per PreventAutoSize
|
||||
FAutoSizeControlList: TObjectList;
|
||||
FActivateEditorList: TObjectList;
|
||||
protected
|
||||
function GetTabDisplayState: TTabDisplayState; override;
|
||||
function GetTabDisplayStateEditor(ASourceEditor: TSourceEditorInterface): TTabDisplayState; override;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure BeginUpdate; override;
|
||||
procedure EndUpdate; override;
|
||||
procedure ActivateEditorPostponed(ASourceEditor: TSourceEditorInterface);
|
||||
function AutoSizeInShowDesigner(AControl: TControl): Boolean; override;
|
||||
procedure EnableAutoSizing(AControl: TControl);
|
||||
function GetDesigner(ASourceEditor: TSourceEditorInterface; ATabDisplayState: TTabDisplayState): TIDesigner; override;
|
||||
@ -80,6 +84,7 @@ type
|
||||
class procedure WindowShow(Sender: TObject);
|
||||
|
||||
class procedure EditorActivated(Sender: TObject);
|
||||
class procedure EditorActivatedPostponed(Sender: TObject);
|
||||
class procedure EditorCreate(Sender: TObject);
|
||||
class procedure EditorDestroyed(Sender: TObject);
|
||||
|
||||
@ -124,15 +129,39 @@ end;
|
||||
|
||||
constructor TDockedTabMaster.Create;
|
||||
begin
|
||||
FActivateEditorList := TObjectList.Create(False);
|
||||
FAutoSizeControlList := TObjectList.Create(False);
|
||||
end;
|
||||
|
||||
destructor TDockedTabMaster.Destroy;
|
||||
begin
|
||||
FAutoSizeControlList.Free;
|
||||
FActivateEditorList.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TDockedTabMaster.BeginUpdate;
|
||||
begin
|
||||
SourceEditorManagerIntf.UnRegisterChangeEvent(semEditorActivate, TDockedMainIDE.EditorActivated);
|
||||
SourceEditorManagerIntf.RegisterChangeEvent(semEditorActivate, TDockedMainIDE.EditorActivatedPostponed);
|
||||
end;
|
||||
|
||||
procedure TDockedTabMaster.EndUpdate;
|
||||
var
|
||||
ASourceEditor: TSourceEditorInterface;
|
||||
begin
|
||||
SourceEditorManagerIntf.UnRegisterChangeEvent(semEditorActivate, TDockedMainIDE.EditorActivatedPostponed);
|
||||
SourceEditorManagerIntf.RegisterChangeEvent(semEditorActivate, TDockedMainIDE.EditorActivated);
|
||||
for ASourceEditor in FActivateEditorList do
|
||||
TDockedMainIDE.EditorActivated(ASourceEditor);
|
||||
FActivateEditorList.Clear;
|
||||
end;
|
||||
|
||||
procedure TDockedTabMaster.ActivateEditorPostponed(ASourceEditor: TSourceEditorInterface);
|
||||
begin
|
||||
FActivateEditorList.Add(ASourceEditor);
|
||||
end;
|
||||
|
||||
function TDockedTabMaster.AutoSizeInShowDesigner(AControl: TControl): Boolean;
|
||||
begin
|
||||
// enable autosizing for docked form editor forms, see issue #32207 - disabled
|
||||
@ -297,7 +326,7 @@ begin
|
||||
SetTimer(AForm.Handle, WM_SETNOFRAME, 10, nil);
|
||||
end else begin
|
||||
if AForm is TSourceEditorWindowInterface then
|
||||
AForm.AddHandlerOnChangeBounds(@GlobalSNOnChangeBounds);
|
||||
AForm.AddHandlerOnChangeBounds(GlobalSNOnChangeBounds);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -330,7 +359,7 @@ begin
|
||||
end
|
||||
else
|
||||
if AForm is TSourceEditorWindowInterface then
|
||||
AForm.RemoveHandlerOnChangeBounds(@GlobalSNOnChangeBounds);
|
||||
AForm.RemoveHandlerOnChangeBounds(GlobalSNOnChangeBounds);
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.WindowCreate(Sender: TObject);
|
||||
@ -468,6 +497,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.EditorActivatedPostponed(Sender: TObject);
|
||||
begin
|
||||
if Sender is TSourceEditorInterface then
|
||||
DockedTabMaster.ActivateEditorPostponed(TSourceEditorInterface(Sender));
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.EditorCreate(Sender: TObject);
|
||||
var
|
||||
LSourceEditor: TSourceEditorInterface;
|
||||
@ -478,7 +513,7 @@ begin
|
||||
LSourceEditor := Sender as TSourceEditorInterface;
|
||||
if LSourceEditor.EditorControl.Parent.Parent is TSourcePageControl then Exit;
|
||||
LPageCtrl := TSourcePageControl.Create(LSourceEditor);
|
||||
LPageCtrl.OnChange := @TabChange;
|
||||
LPageCtrl.OnChange := TabChange;
|
||||
LSourceWindowIntf := SourceWindowGet(LSourceEditor);
|
||||
SourceWindows.SourceWindow[LSourceWindowIntf].AddPageCtrl(LPageCtrl);
|
||||
end;
|
||||
|
@ -603,6 +603,8 @@ type
|
||||
function GetTabDisplayState: TTabDisplayState; virtual; abstract;
|
||||
function GetTabDisplayStateEditor(Index: TSourceEditorInterface): TTabDisplayState; virtual; abstract;
|
||||
public
|
||||
procedure BeginUpdate; virtual; abstract;
|
||||
procedure EndUpdate; virtual; abstract;
|
||||
function AutoSizeInShowDesigner(AControl: TControl): Boolean; virtual; abstract;
|
||||
function GetDesigner(ASourceEditor: TSourceEditorInterface; ATabDisplayState: TTabDisplayState): TIDesigner; virtual;
|
||||
procedure ToggleFormUnit; virtual; abstract;
|
||||
|
@ -3752,6 +3752,8 @@ begin
|
||||
EditorInfoIndex := 0;
|
||||
SourceEditorManager.IncUpdateLock;
|
||||
Project1.BeginUpdate(true);
|
||||
if IDETabMaster <> nil then
|
||||
IDETabMaster.BeginUpdate;
|
||||
try
|
||||
// call ProjectOpening handlers
|
||||
HandlerResult:=MainIDE.DoCallProjectChangedHandler(lihtProjectOpening, Project1);
|
||||
@ -3895,6 +3897,9 @@ begin
|
||||
HandlerResult:=mrCancel;
|
||||
if (Result=mrOk) then
|
||||
Result:=HandlerResult;
|
||||
|
||||
if IDETabMaster <> nil then
|
||||
IDETabMaster.EndUpdate;
|
||||
end;
|
||||
if Result=mrAbort then exit;
|
||||
//debugln('InitOpenedProjectFile end CodeToolBoss.ConsistencyCheck=',IntToStr(CodeToolBoss.ConsistencyCheck));
|
||||
|
Loading…
Reference in New Issue
Block a user