DockedFormEditor: Disable all designers of forms and show code in source editor window when a designer is shown in a other source editor window

git-svn-id: trunk@64596 -
This commit is contained in:
michl 2021-02-16 22:33:25 +00:00
parent 5cc908ff89
commit c681a65d52
2 changed files with 26 additions and 19 deletions

View File

@ -471,11 +471,11 @@ begin
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].ActiveDesignForm := nil;
end;
LPageCtrl.InitPage;
if LPageCtrl.DesignerPageActive then
begin
if not LDesignForm.Hiding then
begin
SourceEditorWindows.ShowCodeTabSkipCurrent(LPageCtrl, LDesignForm);
LPageCtrl.AdjustPage;
// don't focus designer here, focus can be on ObjectInspector, then
// <Del> in OI Events deletes component instead event handler
@ -483,6 +483,7 @@ begin
end else begin
if LDesignForm <> nil then
LDesignForm.HideWindow;
LPageCtrl.InitPage;
end;
end
else
@ -557,7 +558,6 @@ class procedure TDockedMainIDE.TabChange(Sender: TObject);
var
LActiveSourceWindowInterface: TSourceEditorWindowInterface;
LSourceEditorWindow: TSourceEditorWindow;
LSourceEditorPageControl: TSourceEditorPageControl;
LDesigner: TIDesigner;
LDesignForm: TDesignForm;
LPageCtrl: TModulePageControl;
@ -585,20 +585,10 @@ begin
LPageCtrl.InitPage;
LActiveSourceWindowInterface.ActiveEditor.EditorControl.SetFocus;
end else begin
// deactivate design tab in other source editor page control
for LSourceEditorWindow in SourceEditorWindows do
if LSourceEditorWindow.SourceEditorWindowInterface = LActiveSourceWindowInterface then
LPageCtrl.DesignForm := LDesignForm
else begin
for LSourceEditorPageControl in LSourceEditorWindow.PageControlList do
if (LSourceEditorPageControl.PageControl.DesignForm = LDesignForm) and (LSourceEditorPageControl.PageControl <> Sender) then
DockedTabMaster.ShowCode(LSourceEditorPageControl.SourceEditor);
end;
LSourceEditorWindow.ActiveDesignForm := LDesignForm;
// enable autosizing after creating a new form
DockedTabMaster.EnableAutoSizing(LDesignForm.Form);
LPageCtrl.InitPage;
SourceEditorWindows.ShowCodeTabSkipCurrent(LPageCtrl, LDesignForm);
LPageCtrl.DesignerSetFocus;
end;
end;

View File

@ -73,13 +73,14 @@ type
function GetSourceEditorWindow(AWindowInterface: TSourceEditorWindowInterface): TSourceEditorWindow;
public
destructor Destroy; override;
function Contains(AWindowInterface: TSourceEditorWindowInterface): Boolean;
function Contains(ASrcEditor: TSourceEditorWindow): Boolean;
procedure ShowCodeTabSkipCurrent(CurrentPageCtrl: TModulePageControl; ADesignForm: TDesignForm);
function Contains(AWindowInterface: TSourceEditorWindowInterface): Boolean;
function Contains(ASrcEditor: TSourceEditorWindow): Boolean;
procedure DeleteItem(Index: Integer);
function FindDesignForm(AModulePageCtrl: TModulePageControl): TDesignForm;
function FindModulePageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl; overload;
function FindModulePageControl(AForm: TSourceEditorWindowInterface): TModulePageControl; overload;
function IndexOf(AWindowInterface: TSourceEditorWindowInterface): Integer; overload;
function FindDesignForm(AModulePageCtrl: TModulePageControl): TDesignForm;
function FindModulePageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl; overload;
function FindModulePageControl(AForm: TSourceEditorWindowInterface): TModulePageControl; overload;
function IndexOf(AWindowInterface: TSourceEditorWindowInterface): Integer; overload;
procedure RefreshAllSourceWindowsModulePageControl;
procedure Remove(AWindowInterface: TSourceEditorWindowInterface); overload;
public
@ -244,6 +245,22 @@ begin
inherited Destroy;
end;
procedure TSourceEditorWindows.ShowCodeTabSkipCurrent(CurrentPageCtrl: TModulePageControl; ADesignForm: TDesignForm);
var
LSourceEditorWindow: TSourceEditorWindow;
LSourceEditorPageControl: TSourceEditorPageControl;
begin
for LSourceEditorWindow in Self do
for LSourceEditorPageControl in LSourceEditorWindow.PageControlList do
if LSourceEditorPageControl.PageControl = CurrentPageCtrl then
begin
LSourceEditorPageControl.PageControl.DesignForm := ADesignForm;
LSourceEditorPageControl.PageControl.InitPage;
end else
if LSourceEditorPageControl.PageControl.DesignForm = ADesignForm then
LSourceEditorPageControl.PageControl.ShowCode;
end;
function TSourceEditorWindows.Contains(AWindowInterface: TSourceEditorWindowInterface): Boolean;
begin
Result := IndexOf(AWindowInterface) >= 0;