mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 11:38:19 +02:00
DockedFormEditor: Cleanup name space for better reading: Rename SourceEditorWindow to SourceWindow
git-svn-id: trunk@64944 -
This commit is contained in:
parent
8e8bab9ffd
commit
f42f58fea5
.gitattributes
components/dockedformeditor
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1353,7 +1353,7 @@ components/dockedformeditor/source/dockedregister.pas svneol=native#text/pascal
|
||||
components/dockedformeditor/source/dockedresizecontrol.pas svneol=native#text/pascal
|
||||
components/dockedformeditor/source/dockedresizer.pas svneol=native#text/pascal
|
||||
components/dockedformeditor/source/dockedsourceeditorpagecontrols.pas svneol=native#text/pascal
|
||||
components/dockedformeditor/source/dockedsourceeditorwindow.pas svneol=native#text/pascal
|
||||
components/dockedformeditor/source/dockedsourcewindow.pas svneol=native#text/pascal
|
||||
components/dockedformeditor/source/dockedtools.pas svneol=native#text/pascal
|
||||
components/education/README.txt svneol=native#text/plain
|
||||
components/education/educationlaz.lpk svneol=native#text/plain
|
||||
|
@ -66,8 +66,8 @@
|
||||
<UnitName Value="DockedModulePageControl"/>
|
||||
</Item10>
|
||||
<Item11>
|
||||
<Filename Value="source\dockedsourceeditorwindow.pas"/>
|
||||
<UnitName Value="DockedSourceEditorWindow"/>
|
||||
<Filename Value="source\dockedsourcewindow.pas"/>
|
||||
<UnitName Value="DockedSourceWindow"/>
|
||||
</Item11>
|
||||
<Item12>
|
||||
<Filename Value="source\dockedsourceeditorpagecontrols.pas"/>
|
||||
|
@ -10,7 +10,7 @@ interface
|
||||
uses
|
||||
DockedRegister, DockedStrConsts, DockedFormAccesses, DockedMainIDE,
|
||||
DockedResizer, DockedOptionsIDE, DockedOptionsFrame, DockedTools,
|
||||
DockedDesignForm, DockedModulePageControl, DockedSourceEditorWindow,
|
||||
DockedDesignForm, DockedModulePageControl, DockedSourceWindow,
|
||||
DockedSourceEditorPageControls, DockedAnchorDesigner,
|
||||
DockedBasicAnchorDesigner, DockedAnchorControl, DockedGrip,
|
||||
DockedResizeControl, LazarusPackageIntf;
|
||||
|
@ -39,7 +39,7 @@ uses
|
||||
// DockedFormEditor
|
||||
DockedResizer, DockedModulePageControl, DockedTools,
|
||||
DockedSourceEditorPageControls, DockedOptionsIDE, DockedDesignForm,
|
||||
DockedSourceEditorWindow;
|
||||
DockedSourceWindow;
|
||||
|
||||
type
|
||||
|
||||
@ -119,7 +119,7 @@ var
|
||||
begin
|
||||
if ASourceEditor = nil then
|
||||
Exit(tdsNone);
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(ASourceEditor);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(ASourceEditor);
|
||||
if LPageCtrl = nil then Exit(tdsNone);
|
||||
case LPageCtrl.PageIndex of
|
||||
0: Exit(tdsCode);
|
||||
@ -200,7 +200,7 @@ var
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedTabMaster.ShowCode'); {$ENDIF}
|
||||
if ASourceEditor = nil then Exit;
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(ASourceEditor);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(ASourceEditor);
|
||||
LPageCtrl.ShowCode;
|
||||
ASourceEditor.EditorControl.SetFocus;
|
||||
end;
|
||||
@ -211,7 +211,7 @@ var
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedTabMaster.ShowDesigner'); {$ENDIF}
|
||||
if ASourceEditor = nil then Exit;
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(ASourceEditor);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(ASourceEditor);
|
||||
LPageCtrl.ShowDesigner(AIndex);
|
||||
end;
|
||||
|
||||
@ -230,12 +230,12 @@ var
|
||||
LPageCtrl: TModulePageControl;
|
||||
LPageIndex: Integer;
|
||||
begin
|
||||
LPageCtrl := SourceEditorWindows.LastActiveModulePageControl;
|
||||
LPageCtrl := SourceWindows.LastActiveModulePageControl;
|
||||
LPageIndex := LPageCtrl.PageIndex;
|
||||
DesignForms.RemoveAllAnchorDesigner;
|
||||
SourceEditorWindows.ShowCodeTabSkipCurrent(nil, nil);
|
||||
SourceEditorWindows.RefreshActivePageControls;
|
||||
TDockedMainIDE.EditorActivated(SourceEditorWindows.LastActiveSourceEditor);
|
||||
SourceWindows.ShowCodeTabSkipCurrent(nil, nil);
|
||||
SourceWindows.RefreshActivePageControls;
|
||||
TDockedMainIDE.EditorActivated(SourceWindows.LastActiveSourceEditor);
|
||||
if LPageIndex = 0 then Exit;
|
||||
LPageCtrl.TabIndex := LPageIndex;
|
||||
LPageCtrl.OnChange(LPageCtrl);
|
||||
@ -247,16 +247,16 @@ class function TDockedMainIDE.GetCurrentPageControl: TModulePageControl;
|
||||
var
|
||||
LForm: TCustomForm;
|
||||
LDesignForm: TDesignForm;
|
||||
LSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
begin
|
||||
Result := nil;
|
||||
if (FormEditingHook = nil) or (GlobalDesignHook = nil) then Exit;
|
||||
LForm := FormEditingHook.GetDesignerForm(GlobalDesignHook.LookupRoot);
|
||||
LDesignForm := DesignForms.Find(LForm);
|
||||
if LDesignForm = nil then Exit;
|
||||
LSourceEditorWindowInterface := LDesignForm.LastActiveSourceWindow;
|
||||
if not Assigned(LSourceEditorWindowInterface) then Exit;
|
||||
Result := SourceEditorWindows.FindModulePageControl(LSourceEditorWindowInterface.ActiveEditor);
|
||||
LSourceWindowIntf := LDesignForm.LastActiveSourceWindow;
|
||||
if not Assigned(LSourceWindowIntf) then Exit;
|
||||
Result := SourceWindows.FindModulePageControl(LSourceWindowIntf.ActiveEditor);
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.Screen_FormAdded(Sender: TObject; AForm: TCustomForm);
|
||||
@ -279,7 +279,7 @@ begin
|
||||
LSourceEditor := FindSourceEditorForDesigner(AForm.Designer);
|
||||
if LSourceEditor <> nil then
|
||||
begin
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(LSourceEditor);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceEditor);
|
||||
if LPageCtrl <> nil then
|
||||
begin
|
||||
LPageCtrl.DesignForm := LDesignForm;
|
||||
@ -297,7 +297,7 @@ end;
|
||||
|
||||
class procedure TDockedMainIDE.Screen_FormDel(Sender: TObject; AForm: TCustomForm);
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
||||
begin
|
||||
if IsFormDesign(AForm) then
|
||||
@ -305,14 +305,14 @@ begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.Screen_FormDel ', DbgSName(AForm)); {$ENDIF}
|
||||
AForm.Parent := nil;
|
||||
|
||||
for LSourceEditorWindow in SourceEditorWindows do
|
||||
for LSourceWindow in SourceWindows do
|
||||
begin
|
||||
if LSourceEditorWindow.ActiveDesignForm <> nil then
|
||||
if LSourceEditorWindow.ActiveDesignForm.Form = AForm then
|
||||
if LSourceWindow.ActiveDesignForm <> nil then
|
||||
if LSourceWindow.ActiveDesignForm.Form = AForm then
|
||||
// don't set ActiveDesignForm := nil! we can't call OnChange tab, because tab don't exist anymore
|
||||
LSourceEditorWindow.RemoveActiveDesignForm;
|
||||
LSourceWindow.RemoveActiveDesignForm;
|
||||
|
||||
for LSourceEditorPageControl in LSourceEditorWindow.PageControlList do
|
||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
||||
if LSourceEditorPageControl.PageControl.DesignForm <> nil then
|
||||
if LSourceEditorPageControl.PageControl.DesignForm.Form = AForm then
|
||||
begin
|
||||
@ -329,14 +329,14 @@ end;
|
||||
|
||||
class procedure TDockedMainIDE.WindowCreate(Sender: TObject);
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
begin
|
||||
if not (Sender is TSourceEditorWindowInterface) then Exit;
|
||||
if Sender.ClassNameIs('TSourceNotebook') then
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.WindowCreate SourceEditor created'); {$ENDIF}
|
||||
LSourceEditorWindow := Sender as TSourceEditorWindowInterface;
|
||||
SourceEditorWindows.Add(TSourceEditorWindow.Create(LSourceEditorWindow));
|
||||
LSourceWindowIntf := Sender as TSourceEditorWindowInterface;
|
||||
SourceWindows.Add(TSourceWindow.Create(LSourceWindowIntf));
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -349,32 +349,32 @@ begin
|
||||
for LDesignForm in DesignForms do
|
||||
if LDesignForm.LastActiveSourceWindow = Sender then
|
||||
LDesignForm.LastActiveSourceWindow := nil;
|
||||
SourceEditorWindows.Remove(Sender as TSourceEditorWindowInterface);
|
||||
SourceWindows.Remove(Sender as TSourceEditorWindowInterface);
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.WindowHide(Sender: TObject);
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LDesignForm: TDesignForm;
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.WindowHide'); {$ENDIF}
|
||||
LSourceEditorWindow := SourceEditorWindows.SourceEditorWindow[Sender as TSourceEditorWindowInterface];
|
||||
if not Assigned(LSourceEditorWindow) or (LSourceEditorWindow.ActiveDesignForm = nil) then
|
||||
LSourceWindow := SourceWindows.SourceWindow[Sender as TSourceEditorWindowInterface];
|
||||
if not Assigned(LSourceWindow) or (LSourceWindow.ActiveDesignForm = nil) then
|
||||
Exit;
|
||||
LDesignForm := LSourceEditorWindow.ActiveDesignForm;
|
||||
LDesignForm := LSourceWindow.ActiveDesignForm;
|
||||
LDesignForm.HideWindow;
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.WindowShow(Sender: TObject);
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LDesignForm: TDesignForm;
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.WindowShow'); {$ENDIF}
|
||||
LSourceEditorWindow := SourceEditorWindows.SourceEditorWindow[Sender as TSourceEditorWindowInterface];
|
||||
if not Assigned(LSourceEditorWindow) or (LSourceEditorWindow.ActiveDesignForm = nil) then
|
||||
LSourceWindow := SourceWindows.SourceWindow[Sender as TSourceEditorWindowInterface];
|
||||
if not Assigned(LSourceWindow) or (LSourceWindow.ActiveDesignForm = nil) then
|
||||
Exit;
|
||||
LDesignForm := LSourceEditorWindow.ActiveDesignForm;
|
||||
LDesignForm := LSourceWindow.ActiveDesignForm;
|
||||
LDesignForm.ShowWindow;
|
||||
end;
|
||||
|
||||
@ -384,7 +384,7 @@ var
|
||||
LSourceEditor: TSourceEditorInterface;
|
||||
var
|
||||
LPageCtrl: TModulePageControl;
|
||||
LSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
LDesignForm: TDesignForm;
|
||||
begin
|
||||
if Sender is TSourceEditorInterface then
|
||||
@ -392,7 +392,7 @@ begin
|
||||
LSourceEditor := TSourceEditorInterface(Sender);
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR}
|
||||
DebugLn('TDockedMainIDE.EditorActivated [' + LSourceEditor.PageCaption +
|
||||
'] SourceEditorWindow[' + SourceEditorWindowCaption(LSourceEditor) + ']');
|
||||
'] SourceWindow[' + SourceWindowCaption(LSourceEditor) + ']');
|
||||
{$ENDIF}
|
||||
// if we create directly new project then Activate is called without EditorCreate...
|
||||
if not (LSourceEditor.EditorControl.Parent.Parent is TModulePageControl) then
|
||||
@ -400,7 +400,7 @@ begin
|
||||
// possible is situation when we moved tab into other window
|
||||
// then was not called event EditorDestroy - that generates problems with switching tabs
|
||||
// or when we moving tab to first window ( then is raising : duplicates not allowed in dictionary).
|
||||
if SourceEditorWindows.LastSourceEditorNotFound then
|
||||
if SourceWindows.LastSourceEditorNotFound then
|
||||
EditorDestroyed(nil);
|
||||
EditorCreate(Sender);
|
||||
end;
|
||||
@ -409,7 +409,7 @@ begin
|
||||
LPageCtrl := TModulePageControl(LSourceEditor.EditorControl.Parent.Parent);
|
||||
if LPageCtrl = nil then Exit;
|
||||
|
||||
LDesignForm := SourceEditorWindows.FindDesignForm(LPageCtrl);
|
||||
LDesignForm := SourceWindows.FindDesignForm(LPageCtrl);
|
||||
if LDesigner = nil then
|
||||
LPageCtrl.RemoveDesignPages
|
||||
else begin
|
||||
@ -420,13 +420,13 @@ begin
|
||||
LPageCtrl.CreateTabSheetAnchors;
|
||||
end;
|
||||
|
||||
LSourceEditorWindowInterface := TSourceEditorWindowInterface(LPageCtrl.Owner);
|
||||
SourceEditorWindows.LastActiveSourceEditorWindow := LSourceEditorWindowInterface;
|
||||
SourceEditorWindows.LastActiveSourceEditor := LSourceEditor;
|
||||
LSourceWindowIntf := TSourceEditorWindowInterface(LPageCtrl.Owner);
|
||||
SourceWindows.LastActiveSourceWindow := LSourceWindowIntf;
|
||||
SourceWindows.LastActiveSourceEditor := LSourceEditor;
|
||||
|
||||
// when we switch tab, design form should be hidden
|
||||
if (LDesigner = nil) or (LDesignForm = nil) then
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].ActiveDesignForm := nil
|
||||
SourceWindows.SourceWindow[LSourceWindowIntf].ActiveDesignForm := nil
|
||||
else begin
|
||||
// during form loading for example from package, ActiveDesignForm assignment,
|
||||
// blocks the message queue responsible for hiding form
|
||||
@ -435,19 +435,19 @@ begin
|
||||
// maybe we can fix this in future
|
||||
if not LDesignForm.Hiding then
|
||||
// Prevent unexpected events (when is deactivated some control outside designed form)
|
||||
if (LDesignForm.LastActiveSourceWindow = LSourceEditorWindowInterface)
|
||||
if (LDesignForm.LastActiveSourceWindow = LSourceWindowIntf)
|
||||
// important!!! for many error - switching between editors...
|
||||
and LPageCtrl.DesignerPageActive then
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].ActiveDesignForm := LDesignForm
|
||||
SourceWindows.SourceWindow[LSourceWindowIntf].ActiveDesignForm := LDesignForm
|
||||
else
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].ActiveDesignForm := nil;
|
||||
SourceWindows.SourceWindow[LSourceWindowIntf].ActiveDesignForm := nil;
|
||||
end;
|
||||
|
||||
if LPageCtrl.DesignerPageActive then
|
||||
begin
|
||||
if not LDesignForm.Hiding then
|
||||
begin
|
||||
SourceEditorWindows.ShowCodeTabSkipCurrent(LPageCtrl, LDesignForm);
|
||||
SourceWindows.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
|
||||
@ -465,7 +465,7 @@ end;
|
||||
class procedure TDockedMainIDE.EditorCreate(Sender: TObject);
|
||||
var
|
||||
LSourceEditor: TSourceEditorInterface;
|
||||
LSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
LParent: TWinControl;
|
||||
LPageCtrl: TModulePageControl;
|
||||
begin
|
||||
@ -477,30 +477,30 @@ begin
|
||||
LSourceEditor.EditorControl.Parent := LPageCtrl.Pages[0]; // ! SynEdit :)
|
||||
LPageCtrl.OnChange := @TabChange;
|
||||
LPageCtrl.Parent := LParent;
|
||||
LSourceEditorWindowInterface := TSourceEditorWindowInterface(LPageCtrl.Owner);
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].AddPageCtrl(LSourceEditor, LPageCtrl);
|
||||
LSourceWindowIntf := TSourceEditorWindowInterface(LPageCtrl.Owner);
|
||||
SourceWindows.SourceWindow[LSourceWindowIntf].AddPageCtrl(LSourceEditor, LPageCtrl);
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.EditorDestroyed(Sender: TObject);
|
||||
var
|
||||
LSourceEditor: TSourceEditorInterface;
|
||||
LPageCtrl: TModulePageControl;
|
||||
LSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
LDesignForm: TDesignForm;
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.EditorDestroyed'); {$ENDIF}
|
||||
// sender is here as special parameter, because is possible situation where is moved editor
|
||||
// to another window and was not triggered EditorDestroy - for more info goto editoractivate
|
||||
if Sender = nil then
|
||||
LSourceEditor := SourceEditorWindows.LastActiveSourceEditor
|
||||
LSourceEditor := SourceWindows.LastActiveSourceEditor
|
||||
else
|
||||
LSourceEditor := TSourceEditorInterface(Sender);
|
||||
|
||||
// parent don't exist anymore and we must search in each window...
|
||||
if Sender = nil then // but not for Sender = nil :P
|
||||
LPageCtrl := SourceEditorWindows.LastActiveModulePageControl
|
||||
LPageCtrl := SourceWindows.LastActiveModulePageControl
|
||||
else
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(LSourceEditor);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceEditor);
|
||||
|
||||
if LPageCtrl = nil then Exit;
|
||||
|
||||
@ -508,24 +508,24 @@ begin
|
||||
|
||||
// goto first comment (forced destroy)
|
||||
if Sender = nil then
|
||||
LSourceEditorWindowInterface := SourceEditorWindows.LastActiveSourceEditorWindow
|
||||
LSourceWindowIntf := SourceWindows.LastActiveSourceWindow
|
||||
else
|
||||
LSourceEditorWindowInterface := TSourceEditorWindowInterface(LPageCtrl.Owner);
|
||||
LSourceWindowIntf := TSourceEditorWindowInterface(LPageCtrl.Owner);
|
||||
|
||||
if LDesignForm <> nil then
|
||||
begin
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].ActiveDesignForm := nil;
|
||||
SourceWindows.SourceWindow[LSourceWindowIntf].ActiveDesignForm := nil;
|
||||
LDesignForm.LastActiveSourceWindow := nil;
|
||||
end;
|
||||
|
||||
SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface].RemovePageCtrl(LSourceEditor);
|
||||
SourceWindows.SourceWindow[LSourceWindowIntf].RemovePageCtrl(LSourceEditor);
|
||||
LPageCtrl.Free;
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.TabChange(Sender: TObject);
|
||||
var
|
||||
LActiveSourceWindowInterface: TSourceEditorWindowInterface;
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LDesigner: TIDesigner;
|
||||
LDesignForm: TDesignForm;
|
||||
LPageCtrl: TModulePageControl;
|
||||
@ -533,60 +533,60 @@ begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.TabChange'); {$ENDIF}
|
||||
// activate proper source editor window when user is clicking on page.
|
||||
// (at clicking time can be active other source window)
|
||||
LActiveSourceWindowInterface := TComponent(Sender).Owner as TSourceEditorWindowInterface;
|
||||
if LActiveSourceWindowInterface <> SourceEditorManagerIntf.ActiveSourceWindow then
|
||||
SourceEditorManagerIntf.ActiveSourceWindow := LActiveSourceWindowInterface;
|
||||
LSourceWindowIntf := TComponent(Sender).Owner as TSourceEditorWindowInterface;
|
||||
if LSourceWindowIntf <> SourceEditorManagerIntf.ActiveSourceWindow then
|
||||
SourceEditorManagerIntf.ActiveSourceWindow := LSourceWindowIntf;
|
||||
|
||||
LPageCtrl := TModulePageControl(Sender);
|
||||
if LActiveSourceWindowInterface.ActiveEditor = nil then Exit;
|
||||
if LSourceWindowIntf.ActiveEditor = nil then Exit;
|
||||
if LPageCtrl = nil then Exit;
|
||||
|
||||
// in case there is no module and is visible page other than code page.
|
||||
LDesigner := LActiveSourceWindowInterface.ActiveEditor.GetDesigner(True);
|
||||
LDesigner := LSourceWindowIntf.ActiveEditor.GetDesigner(True);
|
||||
LDesignForm := DesignForms.Find(LDesigner);
|
||||
if LDesignForm = nil then Exit;
|
||||
LSourceEditorWindow := SourceEditorWindows.SourceEditorWindow[LActiveSourceWindowInterface];
|
||||
if LSourceEditorWindow = nil then Exit;
|
||||
LSourceWindow := SourceWindows.SourceWindow[LSourceWindowIntf];
|
||||
if LSourceWindow = nil then Exit;
|
||||
|
||||
if not LPageCtrl.DesignerPageActive then
|
||||
begin
|
||||
LSourceEditorWindow.ActiveDesignForm := nil;
|
||||
LSourceWindow.ActiveDesignForm := nil;
|
||||
LPageCtrl.InitPage;
|
||||
LActiveSourceWindowInterface.ActiveEditor.EditorControl.SetFocus;
|
||||
LSourceWindowIntf.ActiveEditor.EditorControl.SetFocus;
|
||||
end else begin
|
||||
LSourceEditorWindow.ActiveDesignForm := LDesignForm;
|
||||
LSourceWindow.ActiveDesignForm := LDesignForm;
|
||||
// enable autosizing after creating a new form
|
||||
DockedTabMaster.EnableAutoSizing(LDesignForm.Form);
|
||||
SourceEditorWindows.ShowCodeTabSkipCurrent(LPageCtrl, LDesignForm);
|
||||
SourceWindows.ShowCodeTabSkipCurrent(LPageCtrl, LDesignForm);
|
||||
LPageCtrl.DesignerSetFocus;
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TDockedMainIDE.GlobalSNOnChangeBounds(Sender: TObject);
|
||||
var
|
||||
LSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LDesignForm: TDesignForm;
|
||||
LPageCtrl: TModulePageControl;
|
||||
LResizer: TResizer;
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.GlobalSNOnChangeBounds'); {$ENDIF}
|
||||
// Check parent. Maybe is different? If yes then window changed state (docked/undocked) and we need to perform few actions
|
||||
LSourceEditorWindowInterface := Sender as TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf := Sender as TSourceEditorWindowInterface;
|
||||
|
||||
// dock/undock event :)
|
||||
LSourceEditorWindow := SourceEditorWindows.SourceEditorWindow[LSourceEditorWindowInterface];
|
||||
if LSourceEditorWindow = nil then Exit;
|
||||
if LSourceEditorWindow.LastTopParent <> LSourceEditorWindowInterface.GetTopParent then
|
||||
LSourceWindow := SourceWindows.SourceWindow[LSourceWindowIntf];
|
||||
if LSourceWindow = nil then Exit;
|
||||
if LSourceWindow.LastTopParent <> LSourceWindowIntf.GetTopParent then
|
||||
begin
|
||||
LSourceEditorWindow.LastTopParent := LSourceEditorWindowInterface.GetTopParent;
|
||||
LSourceWindow.LastTopParent := LSourceWindowIntf.GetTopParent;
|
||||
// refresh for popupparent
|
||||
LDesignForm := LSourceEditorWindow.ActiveDesignForm;
|
||||
LSourceEditorWindow.ActiveDesignForm := nil;
|
||||
LSourceEditorWindow.ActiveDesignForm := LDesignForm;
|
||||
LDesignForm := LSourceWindow.ActiveDesignForm;
|
||||
LSourceWindow.ActiveDesignForm := nil;
|
||||
LSourceWindow.ActiveDesignForm := LDesignForm;
|
||||
if LDesignForm <> nil then
|
||||
begin
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(LSourceEditorWindowInterface.ActiveEditor);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceWindowIntf.ActiveEditor);
|
||||
if not Assigned(LPageCtrl) then Exit;
|
||||
LResizer := LPageCtrl.Resizer;
|
||||
if not Assigned(LResizer) then Exit;
|
||||
@ -601,24 +601,24 @@ class procedure TDockedMainIDE.OnShowDesignerForm(Sender: TObject; AEditor: TSou
|
||||
var
|
||||
LDesignForm: TDesignForm;
|
||||
LPageCtrl: TModulePageControl;
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LSourceEditorInterface: TSourceEditorInterface;
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.OnShowDesignerForm'); {$ENDIF}
|
||||
LDesignForm := DesignForms.Find(TCustomForm(Sender).Designer);
|
||||
if (LDesignForm = nil) or LDesignForm.Hiding then Exit;
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(SourceEditorManagerIntf.ActiveEditor);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(SourceEditorManagerIntf.ActiveEditor);
|
||||
if LPageCtrl = nil then Exit;
|
||||
|
||||
if AComponentPaletteClassSelected then
|
||||
begin
|
||||
// if form is already opened do nothing, if not then show form for active module.
|
||||
for LSourceEditorWindow in SourceEditorWindows do
|
||||
for LSourceWindow in SourceWindows do
|
||||
begin
|
||||
LSourceEditorInterface := LSourceEditorWindow.SourceEditorWindowInterface.ActiveEditor;
|
||||
LSourceEditorInterface := LSourceWindow.SourceWindowIntf.ActiveEditor;
|
||||
if (LSourceEditorInterface = nil) or (LSourceEditorInterface.GetDesigner(True) <> LDesignForm.Designer) then
|
||||
Continue;
|
||||
LPageCtrl := SourceEditorWindows.FindModulePageControl(LSourceEditorInterface);
|
||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceEditorInterface);
|
||||
if LPageCtrl.FormPageActive then
|
||||
Exit;
|
||||
end;
|
||||
@ -636,7 +636,7 @@ class procedure TDockedMainIDE.OnDesignShowMethod(const Name: String);
|
||||
var
|
||||
LDesignForm: TDesignForm;
|
||||
LSecondEditor: TSourceEditorInterface = nil;
|
||||
LSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
i: Integer;
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.OnDesignShowMethod'); {$ENDIF}
|
||||
@ -645,13 +645,13 @@ begin
|
||||
if LDesignForm = nil then Exit;
|
||||
for i := 0 to SourceEditorManagerIntf.SourceWindowCount - 1 do
|
||||
begin
|
||||
LSourceEditorWindowInterface := SourceEditorManagerIntf.SourceWindows[i];
|
||||
if LDesignForm.LastActiveSourceWindow = LSourceEditorWindowInterface then
|
||||
LSourceWindowIntf := SourceEditorManagerIntf.SourceWindows[i];
|
||||
if LDesignForm.LastActiveSourceWindow = LSourceWindowIntf then
|
||||
Continue;
|
||||
if LSourceEditorWindowInterface.ActiveEditor <> nil then
|
||||
if LSourceEditorWindowInterface.ActiveEditor.GetDesigner(True) = LDesignForm.Designer then
|
||||
if LSourceWindowIntf.ActiveEditor <> nil then
|
||||
if LSourceWindowIntf.ActiveEditor.GetDesigner(True) = LDesignForm.Designer then
|
||||
begin
|
||||
LSecondEditor := LSourceEditorWindowInterface.ActiveEditor;
|
||||
LSecondEditor := LSourceWindowIntf.ActiveEditor;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
@ -8,13 +8,13 @@
|
||||
Michael W. Vogel
|
||||
|
||||
This is the access to one SourceEditor window. There can be more then just one
|
||||
(that list is SourceEditorWindows).
|
||||
(that list is SourceWindows).
|
||||
Each SourceEditor window can hold a lot of units, forms etc. available per
|
||||
SourceEditorWindowInterface in PageControlList.
|
||||
|
||||
}
|
||||
|
||||
unit DockedSourceEditorWindow;
|
||||
unit DockedSourceWindow;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$modeswitch advancedrecords}
|
||||
@ -37,9 +37,9 @@ uses
|
||||
|
||||
type
|
||||
|
||||
{ TSourceEditorWindow }
|
||||
{ TSourceWindow }
|
||||
|
||||
TSourceEditorWindow = class
|
||||
TSourceWindow = class
|
||||
private
|
||||
FActiveDesignForm: TDesignForm;
|
||||
FLastActiveSourceEditor: TSourceEditorInterface;
|
||||
@ -47,14 +47,14 @@ type
|
||||
FNotebookPageChanged: TNotifyEvent;
|
||||
FPageControlList: TSourceEditorPageControls;
|
||||
FSourceEditorNotebook: TExtendedNotebook;
|
||||
FSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
FSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
function GetActiveEditor: TSourceEditorInterface;
|
||||
procedure HookIntoOnPageChanged;
|
||||
procedure SetActiveDesignForm(const AValue: TDesignForm);
|
||||
procedure SourceEditorPageChanged(Sender: TObject);
|
||||
procedure UpdateEditorPageCaption(Sender: TObject);
|
||||
public
|
||||
constructor Create(ASourceEditorWindowInterface: TSourceEditorWindowInterface);
|
||||
constructor Create(ASourceWindowIntf: TSourceEditorWindowInterface);
|
||||
destructor Destroy; override;
|
||||
procedure AddPageCtrl(ASourceEditor: TSourceEditorInterface; APageControl: TModulePageControl);
|
||||
procedure AdjustPageControl;
|
||||
@ -67,56 +67,56 @@ type
|
||||
property LastActiveSourceEditor: TSourceEditorInterface read FLastActiveSourceEditor write FLastActiveSourceEditor;
|
||||
property LastTopParent: TControl read FLastTopParent write FLastTopParent;
|
||||
property PageControlList: TSourceEditorPageControls read FPageControlList;
|
||||
property SourceEditorWindowInterface: TSourceEditorWindowInterface read FSourceEditorWindowInterface;
|
||||
property SourceWindowIntf: TSourceEditorWindowInterface read FSourceWindowIntf;
|
||||
end;
|
||||
|
||||
{ TSourceEditorWindows }
|
||||
{ TSourceWindows }
|
||||
|
||||
TSourceEditorWindows = class(specialize TFPGList<TSourceEditorWindow>)
|
||||
TSourceWindows = class(specialize TFPGList<TSourceWindow>)
|
||||
private
|
||||
FLastActiveSourceEditorWindow: TSourceEditorWindowInterface;
|
||||
FLastActiveSourceWindow: TSourceEditorWindowInterface;
|
||||
function GetLastActiveModulePageControl: TModulePageControl;
|
||||
function GetLastActiveSourceEditor: TSourceEditorInterface;
|
||||
function GetWindowInterface(ASrcEditor: TSourceEditorWindow): TSourceEditorWindowInterface;
|
||||
function GetSourceEditorWindow(AWindowInterface: TSourceEditorWindowInterface): TSourceEditorWindow;
|
||||
function GetSourceWindowIntf(ASrcEditor: TSourceWindow): TSourceEditorWindowInterface;
|
||||
function GetSourceWindow(ASourceWindowIntf: TSourceEditorWindowInterface): TSourceWindow;
|
||||
procedure SetLastActiveSourceEditor(AValue: TSourceEditorInterface);
|
||||
public
|
||||
constructor CreateNew;
|
||||
destructor Destroy; override;
|
||||
function Contains(AWindowInterface: TSourceEditorWindowInterface): Boolean;
|
||||
function Contains(ASrcEditor: TSourceEditorWindow): Boolean;
|
||||
function Contains(ASourceWindowIntf: TSourceEditorWindowInterface): Boolean;
|
||||
function Contains(ASrcEditor: TSourceWindow): Boolean;
|
||||
procedure DeleteItem(Index: Integer);
|
||||
function FindDesignForm(AModulePageCtrl: TModulePageControl): TDesignForm;
|
||||
function FindModulePageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl;
|
||||
function IndexOf(AWindowInterface: TSourceEditorWindowInterface): Integer; overload;
|
||||
function IndexOf(ASourceWindowIntf: TSourceEditorWindowInterface): Integer; overload;
|
||||
function LastSourceEditorNotFound: Boolean;
|
||||
procedure RefreshActivePageControls;
|
||||
procedure RefreshAllPageControls;
|
||||
procedure Remove(AWindowInterface: TSourceEditorWindowInterface); overload;
|
||||
procedure Remove(ASourceWindowIntf: TSourceEditorWindowInterface); overload;
|
||||
procedure ShowCodeTabSkipCurrent(CurrentPageCtrl: TModulePageControl; ADesignForm: TDesignForm);
|
||||
public
|
||||
property LastActiveSourceEditorWindow: TSourceEditorWindowInterface read FLastActiveSourceEditorWindow write FLastActiveSourceEditorWindow;
|
||||
property LastActiveSourceWindow: TSourceEditorWindowInterface read FLastActiveSourceWindow write FLastActiveSourceWindow;
|
||||
property LastActiveSourceEditor: TSourceEditorInterface read GetLastActiveSourceEditor write SetLastActiveSourceEditor;
|
||||
property LastActiveModulePageControl: TModulePageControl read GetLastActiveModulePageControl;
|
||||
property WindowInterface[ASrcEditor: TSourceEditorWindow]: TSourceEditorWindowInterface read GetWindowInterface;
|
||||
property SourceEditorWindow[AWindowInterface: TSourceEditorWindowInterface]: TSourceEditorWindow read GetSourceEditorWindow;
|
||||
property SourceWindowIntf[ASrcEditor: TSourceWindow]: TSourceEditorWindowInterface read GetSourceWindowIntf;
|
||||
property SourceWindow[ASourceWindowIntf: TSourceEditorWindowInterface]: TSourceWindow read GetSourceWindow;
|
||||
end;
|
||||
|
||||
var
|
||||
SourceEditorWindows: TSourceEditorWindows;
|
||||
SourceWindows: TSourceWindows;
|
||||
|
||||
implementation
|
||||
|
||||
{ TSourceEditorWindow }
|
||||
{ TSourceWindow }
|
||||
|
||||
procedure TSourceEditorWindow.HookIntoOnPageChanged;
|
||||
procedure TSourceWindow.HookIntoOnPageChanged;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to FSourceEditorWindowInterface.ControlCount - 1 do
|
||||
if FSourceEditorWindowInterface.Controls[i] is TExtendedNotebook then
|
||||
for i := 0 to FSourceWindowIntf.ControlCount - 1 do
|
||||
if FSourceWindowIntf.Controls[i] is TExtendedNotebook then
|
||||
begin
|
||||
FSourceEditorNotebook := TExtendedNotebook(FSourceEditorWindowInterface.Controls[i]);
|
||||
FSourceEditorNotebook := TExtendedNotebook(FSourceWindowIntf.Controls[i]);
|
||||
Break;
|
||||
end;
|
||||
if not Assigned(FSourceEditorNotebook) then Exit;
|
||||
@ -124,12 +124,12 @@ begin
|
||||
FSourceEditorNotebook.OnChange := @SourceEditorPageChanged;
|
||||
end;
|
||||
|
||||
function TSourceEditorWindow.GetActiveEditor: TSourceEditorInterface;
|
||||
function TSourceWindow.GetActiveEditor: TSourceEditorInterface;
|
||||
begin
|
||||
Result := FSourceEditorWindowInterface.ActiveEditor;
|
||||
Result := FSourceWindowIntf.ActiveEditor;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindow.SetActiveDesignForm(const AValue: TDesignForm);
|
||||
procedure TSourceWindow.SetActiveDesignForm(const AValue: TDesignForm);
|
||||
var
|
||||
LPageCtrl: TModulePageControl;
|
||||
begin
|
||||
@ -149,11 +149,11 @@ begin
|
||||
LPageCtrl.DesignForm := AValue;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindow.SourceEditorPageChanged(Sender: TObject);
|
||||
procedure TSourceWindow.SourceEditorPageChanged(Sender: TObject);
|
||||
var
|
||||
LPageCtrl: TModulePageControl;
|
||||
begin
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourceEditorWindow.SourceEditorPageChanged SourceEditorWindow[' + FSourceEditorWindowInterface.Caption + ']'); {$ENDIF}
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourceWindow.SourceEditorPageChanged SourceEditorWindow[' + FSourceWindowIntf.Caption + ']'); {$ENDIF}
|
||||
FNotebookPageChanged(Sender);
|
||||
LPageCtrl := FindModulePageControl(ActiveEditor);
|
||||
if not Assigned(LPageCtrl) then Exit;
|
||||
@ -168,10 +168,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindow.UpdateEditorPageCaption(Sender: TObject);
|
||||
procedure TSourceWindow.UpdateEditorPageCaption(Sender: TObject);
|
||||
var
|
||||
LSourceEditor: TSourceEditorInterface;
|
||||
LSourceEditorWindow: TSourceEditorWindowInterface;
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
begin
|
||||
// if a unit is cloned to undocked empty source editor window, the ModulePageControl
|
||||
// is not created, the only workaround I found is, to activate the new created
|
||||
@ -179,27 +179,27 @@ begin
|
||||
if not (Sender is TSourceEditorInterface) then Exit;
|
||||
if SourceEditorManagerIntf.ActiveSourceWindow = nil then Exit;
|
||||
LSourceEditor := TSourceEditorInterface(Sender);
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourceEditorWindow.UpdateEditorPageCaption [' + SourceEditorWindowCaption(LSourceEditor) + ']'); {$ENDIF}
|
||||
LSourceEditorWindow := SourceEditorWindow(LSourceEditor);
|
||||
if not Assigned(LSourceEditorWindow)
|
||||
or (SourceEditorManagerIntf.ActiveSourceWindow = LSourceEditorWindow)
|
||||
or (SourceEditorWindows.LastActiveSourceEditorWindow = LSourceEditorWindow)
|
||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourceWindow.UpdateEditorPageCaption [' + SourceWindowCaption(LSourceEditor) + ']'); {$ENDIF}
|
||||
LSourceWindowIntf := SourceWindowGet(LSourceEditor);
|
||||
if not Assigned(LSourceWindowIntf)
|
||||
or (SourceEditorManagerIntf.ActiveSourceWindow = LSourceWindowIntf)
|
||||
or (SourceWindows.LastActiveSourceWindow = LSourceWindowIntf)
|
||||
then
|
||||
Exit;
|
||||
LSourceEditorWindow.ActiveEditor := LSourceEditor;
|
||||
LSourceWindowIntf.ActiveEditor := LSourceEditor;
|
||||
end;
|
||||
|
||||
constructor TSourceEditorWindow.Create(ASourceEditorWindowInterface: TSourceEditorWindowInterface);
|
||||
constructor TSourceWindow.Create(ASourceWindowIntf: TSourceEditorWindowInterface);
|
||||
begin
|
||||
FLastActiveSourceEditor := nil;
|
||||
FSourceEditorWindowInterface := ASourceEditorWindowInterface;
|
||||
FSourceWindowIntf := ASourceWindowIntf;
|
||||
FPageControlList := TSourceEditorPageControls.Create;
|
||||
FSourceEditorNotebook := nil;
|
||||
HookIntoOnPageChanged;
|
||||
FSourceEditorWindowInterface.AddUpdateEditorPageCaptionHandler(@UpdateEditorPageCaption);
|
||||
FSourceWindowIntf.AddUpdateEditorPageCaptionHandler(@UpdateEditorPageCaption);
|
||||
end;
|
||||
|
||||
destructor TSourceEditorWindow.Destroy;
|
||||
destructor TSourceWindow.Destroy;
|
||||
begin
|
||||
if Assigned(FSourceEditorNotebook) then
|
||||
FSourceEditorNotebook.OnChange := FNotebookPageChanged;
|
||||
@ -207,12 +207,12 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindow.AddPageCtrl(ASourceEditor: TSourceEditorInterface; APageControl: TModulePageControl);
|
||||
procedure TSourceWindow.AddPageCtrl(ASourceEditor: TSourceEditorInterface; APageControl: TModulePageControl);
|
||||
begin
|
||||
FPageControlList.Add(ASourceEditor, APageControl);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindow.AdjustPageControl;
|
||||
procedure TSourceWindow.AdjustPageControl;
|
||||
var
|
||||
LPageCtrl: TModulePageControl;
|
||||
begin
|
||||
@ -221,7 +221,7 @@ begin
|
||||
LPageCtrl.AdjustPage;
|
||||
end;
|
||||
|
||||
function TSourceEditorWindow.FindModulePageControl(ASourceEditor: TSourceEditorInterface): TModulePageControl;
|
||||
function TSourceWindow.FindModulePageControl(ASourceEditor: TSourceEditorInterface): TModulePageControl;
|
||||
var
|
||||
LParent: TWinControl;
|
||||
begin
|
||||
@ -237,112 +237,112 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindow.RemoveActiveDesignForm;
|
||||
procedure TSourceWindow.RemoveActiveDesignForm;
|
||||
begin
|
||||
FActiveDesignForm := nil;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindow.RemovePageCtrl(ASourceEditor: TSourceEditorInterface);
|
||||
procedure TSourceWindow.RemovePageCtrl(ASourceEditor: TSourceEditorInterface);
|
||||
begin
|
||||
FPageControlList.Remove(ASourceEditor);
|
||||
if LastActiveSourceEditor = ASourceEditor then
|
||||
LastActiveSourceEditor := nil;
|
||||
end;
|
||||
|
||||
{ TSourceEditorWindows }
|
||||
{ TSourceWindows }
|
||||
|
||||
function TSourceEditorWindows.GetWindowInterface(ASrcEditor: TSourceEditorWindow): TSourceEditorWindowInterface;
|
||||
function TSourceWindows.GetSourceWindowIntf(ASrcEditor: TSourceWindow): TSourceEditorWindowInterface;
|
||||
var
|
||||
LIndex: Integer;
|
||||
begin
|
||||
LIndex := IndexOf(ASrcEditor);
|
||||
if LIndex >= 0 then
|
||||
Result := Items[LIndex].SourceEditorWindowInterface
|
||||
Result := Items[LIndex].SourceWindowIntf
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.GetLastActiveModulePageControl: TModulePageControl;
|
||||
function TSourceWindows.GetLastActiveModulePageControl: TModulePageControl;
|
||||
begin
|
||||
Result := FindModulePageControl(LastActiveSourceEditor);
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.GetLastActiveSourceEditor: TSourceEditorInterface;
|
||||
function TSourceWindows.GetLastActiveSourceEditor: TSourceEditorInterface;
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
begin
|
||||
Result := nil;
|
||||
if not Assigned(LastActiveSourceEditorWindow) then Exit;
|
||||
LSourceEditorWindow := SourceEditorWindow[LastActiveSourceEditorWindow];
|
||||
if not Assigned(LSourceEditorWindow) then Exit;
|
||||
Result := LSourceEditorWindow.LastActiveSourceEditor;
|
||||
if not Assigned(LastActiveSourceWindow) then Exit;
|
||||
LSourceWindow := SourceWindow[LastActiveSourceWindow];
|
||||
if not Assigned(LSourceWindow) then Exit;
|
||||
Result := LSourceWindow.LastActiveSourceEditor;
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.GetSourceEditorWindow(AWindowInterface: TSourceEditorWindowInterface): TSourceEditorWindow;
|
||||
function TSourceWindows.GetSourceWindow(ASourceWindowIntf: TSourceEditorWindowInterface): TSourceWindow;
|
||||
var
|
||||
LIndex: Integer;
|
||||
begin
|
||||
LIndex := IndexOf(AWindowInterface);
|
||||
LIndex := IndexOf(ASourceWindowIntf);
|
||||
if LIndex >= 0 then
|
||||
Result := Items[LIndex]
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindows.SetLastActiveSourceEditor(AValue: TSourceEditorInterface);
|
||||
procedure TSourceWindows.SetLastActiveSourceEditor(AValue: TSourceEditorInterface);
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
begin
|
||||
if not Assigned(LastActiveSourceEditorWindow) then Exit;
|
||||
LSourceEditorWindow := SourceEditorWindow[LastActiveSourceEditorWindow];
|
||||
if not Assigned(LSourceEditorWindow) then Exit;
|
||||
LSourceEditorWindow.LastActiveSourceEditor := AValue;
|
||||
if not Assigned(LastActiveSourceWindow) then Exit;
|
||||
LSourceWindow := SourceWindow[LastActiveSourceWindow];
|
||||
if not Assigned(LSourceWindow) then Exit;
|
||||
LSourceWindow.LastActiveSourceEditor := AValue;
|
||||
end;
|
||||
|
||||
constructor TSourceEditorWindows.CreateNew;
|
||||
constructor TSourceWindows.CreateNew;
|
||||
begin
|
||||
inherited Create;
|
||||
FLastActiveSourceEditorWindow := nil;
|
||||
FLastActiveSourceWindow := nil;
|
||||
end;
|
||||
|
||||
destructor TSourceEditorWindows.Destroy;
|
||||
destructor TSourceWindows.Destroy;
|
||||
begin
|
||||
while Count > 0 do
|
||||
DeleteItem(0);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.Contains(AWindowInterface: TSourceEditorWindowInterface): Boolean;
|
||||
function TSourceWindows.Contains(ASourceWindowIntf: TSourceEditorWindowInterface): Boolean;
|
||||
begin
|
||||
Result := IndexOf(AWindowInterface) >= 0;
|
||||
Result := IndexOf(ASourceWindowIntf) >= 0;
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.Contains(ASrcEditor: TSourceEditorWindow): Boolean;
|
||||
function TSourceWindows.Contains(ASrcEditor: TSourceWindow): Boolean;
|
||||
begin
|
||||
Result := IndexOf(ASrcEditor) >= 0;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindows.DeleteItem(Index: Integer);
|
||||
procedure TSourceWindows.DeleteItem(Index: Integer);
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
begin
|
||||
LSourceEditorWindow := Items[Index];
|
||||
LSourceEditorWindow.Free;
|
||||
LSourceWindow := Items[Index];
|
||||
LSourceWindow.Free;
|
||||
Delete(Index);
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.FindDesignForm(AModulePageCtrl: TModulePageControl): TDesignForm;
|
||||
function TSourceWindows.FindDesignForm(AModulePageCtrl: TModulePageControl): TDesignForm;
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LSourceEditorInterface: TSourceEditorInterface;
|
||||
begin
|
||||
Result := nil;
|
||||
if AModulePageCtrl = nil then Exit;
|
||||
for LSourceEditorWindow in Self do
|
||||
for LSourceWindow in Self do
|
||||
begin
|
||||
if AModulePageCtrl.Owner = LSourceEditorWindow.SourceEditorWindowInterface then
|
||||
if AModulePageCtrl.Owner = LSourceWindow.SourceWindowIntf then
|
||||
begin
|
||||
LSourceEditorInterface := LSourceEditorWindow.ActiveEditor;
|
||||
LSourceEditorInterface := LSourceWindow.ActiveEditor;
|
||||
if LSourceEditorInterface = nil then Exit;
|
||||
Result := DesignForms.Find(LSourceEditorInterface.GetDesigner(True));
|
||||
Exit;
|
||||
@ -350,41 +350,41 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.FindModulePageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl;
|
||||
function TSourceWindows.FindModulePageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl;
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
begin
|
||||
Result := nil;
|
||||
for LSourceEditorWindow in Self do
|
||||
if LSourceEditorWindow.PageControlList.Contains(ASrcEditor) then
|
||||
Exit(LSourceEditorWindow.PageControlList.PageControl[ASrcEditor]);
|
||||
for LSourceWindow in Self do
|
||||
if LSourceWindow.PageControlList.Contains(ASrcEditor) then
|
||||
Exit(LSourceWindow.PageControlList.PageControl[ASrcEditor]);
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.IndexOf(AWindowInterface: TSourceEditorWindowInterface): Integer;
|
||||
function TSourceWindows.IndexOf(ASourceWindowIntf: TSourceEditorWindowInterface): Integer;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
for i := 0 to Count - 1 do
|
||||
if Items[i].SourceEditorWindowInterface = AWindowInterface then
|
||||
if Items[i].SourceWindowIntf = ASourceWindowIntf then
|
||||
Exit(i);
|
||||
end;
|
||||
|
||||
function TSourceEditorWindows.LastSourceEditorNotFound: Boolean;
|
||||
function TSourceWindows.LastSourceEditorNotFound: Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
begin
|
||||
if (LastActiveSourceEditorWindow = nil) or (LastActiveSourceEditor = nil) then
|
||||
if (LastActiveSourceWindow = nil) or (LastActiveSourceEditor = nil) then
|
||||
Exit(False);
|
||||
|
||||
LSourceEditorWindow := SourceEditorWindow[LastActiveSourceEditorWindow];
|
||||
for LSourceEditorPageControl in LSourceEditorWindow.PageControlList do
|
||||
LSourceWindow := SourceWindow[LastActiveSourceWindow];
|
||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
||||
begin
|
||||
Result := True;
|
||||
for i := 0 to LastActiveSourceEditorWindow.Count - 1 do
|
||||
if LSourceEditorPageControl.SourceEditor = LastActiveSourceEditorWindow.Items[i] then
|
||||
for i := 0 to LastActiveSourceWindow.Count - 1 do
|
||||
if LSourceEditorPageControl.SourceEditor = LastActiveSourceWindow.Items[i] then
|
||||
begin
|
||||
Result := False;
|
||||
Break;
|
||||
@ -393,26 +393,26 @@ begin
|
||||
begin
|
||||
// after moving code editor into other window, sometimes IDE switch to other tab
|
||||
// this line prevent this.
|
||||
LSourceEditorWindow.LastActiveSourceEditor := LSourceEditorPageControl.SourceEditor;
|
||||
LSourceWindow.LastActiveSourceEditor := LSourceEditorPageControl.SourceEditor;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindows.RefreshActivePageControls;
|
||||
procedure TSourceWindows.RefreshActivePageControls;
|
||||
var
|
||||
LWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LPageCtrl: TModulePageControl;
|
||||
begin
|
||||
for LWindow in Self do
|
||||
for LSourceWindow in Self do
|
||||
begin
|
||||
LPageCtrl := LWindow.FindModulePageControl(LWindow.ActiveEditor);
|
||||
LPageCtrl := LSourceWindow.FindModulePageControl(LSourceWindow.ActiveEditor);
|
||||
// for example LPageCtrl is nil when we clone module to new window
|
||||
if (LPageCtrl = nil) or (csDestroying in LWindow.SourceEditorWindowInterface.ComponentState) then
|
||||
if (LPageCtrl = nil) or (csDestroying in LSourceWindow.SourceWindowIntf.ComponentState) then
|
||||
Continue;
|
||||
if (LWindow.ActiveEditor = nil)
|
||||
or (LWindow.ActiveEditor.GetDesigner(True) <> nil)
|
||||
if (LSourceWindow.ActiveEditor = nil)
|
||||
or (LSourceWindow.ActiveEditor.GetDesigner(True) <> nil)
|
||||
then
|
||||
LPageCtrl.RemoveDesignPages
|
||||
else
|
||||
@ -425,37 +425,37 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindows.RefreshAllPageControls;
|
||||
procedure TSourceWindows.RefreshAllPageControls;
|
||||
var
|
||||
LWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
||||
begin
|
||||
for LWindow in SourceEditorWindows do
|
||||
for LSourceEditorPageControl in LWindow.PageControlList do
|
||||
for LSourceWindow in SourceWindows do
|
||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
||||
begin
|
||||
LSourceEditorPageControl.PageControl.TabPosition := DockedOptions.TabPosition;
|
||||
LSourceEditorPageControl.PageControl.RefreshResizer;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindows.Remove(AWindowInterface: TSourceEditorWindowInterface);
|
||||
procedure TSourceWindows.Remove(ASourceWindowIntf: TSourceEditorWindowInterface);
|
||||
var
|
||||
LIndex: Integer;
|
||||
begin
|
||||
LIndex := IndexOf(AWindowInterface);
|
||||
LIndex := IndexOf(ASourceWindowIntf);
|
||||
if LIndex < 0 then Exit;
|
||||
DeleteItem(LIndex);
|
||||
if LastActiveSourceEditorWindow = AWindowInterface then
|
||||
LastActiveSourceEditorWindow := nil;
|
||||
if LastActiveSourceWindow = ASourceWindowIntf then
|
||||
LastActiveSourceWindow := nil;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorWindows.ShowCodeTabSkipCurrent(CurrentPageCtrl: TModulePageControl; ADesignForm: TDesignForm);
|
||||
procedure TSourceWindows.ShowCodeTabSkipCurrent(CurrentPageCtrl: TModulePageControl; ADesignForm: TDesignForm);
|
||||
var
|
||||
LSourceEditorWindow: TSourceEditorWindow;
|
||||
LSourceWindow: TSourceWindow;
|
||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
||||
begin
|
||||
for LSourceEditorWindow in Self do
|
||||
for LSourceEditorPageControl in LSourceEditorWindow.PageControlList do
|
||||
for LSourceWindow in Self do
|
||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
||||
if LSourceEditorPageControl.PageControl = CurrentPageCtrl then
|
||||
begin
|
||||
LSourceEditorPageControl.PageControl.DesignForm := ADesignForm;
|
||||
@ -466,10 +466,10 @@ begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
SourceEditorWindows := TSourceEditorWindows.CreateNew;
|
||||
SourceWindows := TSourceWindows.CreateNew;
|
||||
|
||||
finalization
|
||||
SourceEditorWindows.Free;
|
||||
SourceWindows.Free;
|
||||
|
||||
end.
|
||||
|
@ -35,8 +35,8 @@ function EnumerationString(Str1, Str2: String): String;
|
||||
function FindSourceEditorForDesigner(ADesigner: TIDesigner): TSourceEditorInterface;
|
||||
procedure IDEMessage(AString: String);
|
||||
function LinedString(Str1, Str2: String): String;
|
||||
function SourceEditorWindow(ASourceEditor: TSourceEditorInterface): TSourceEditorWindowInterface;
|
||||
function SourceEditorWindowCaption(ASourceEditor: TSourceEditorInterface): String;
|
||||
function SourceWindowCaption(ASourceEditor: TSourceEditorInterface): String;
|
||||
function SourceWindowGet(ASourceEditor: TSourceEditorInterface): TSourceEditorWindowInterface;
|
||||
|
||||
implementation
|
||||
|
||||
@ -90,7 +90,18 @@ begin
|
||||
Result := Str1 + LineEnding + Str2;
|
||||
end;
|
||||
|
||||
function SourceEditorWindow(ASourceEditor: TSourceEditorInterface): TSourceEditorWindowInterface;
|
||||
function SourceWindowCaption(ASourceEditor: TSourceEditorInterface): String;
|
||||
var
|
||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||
begin
|
||||
LSourceWindowIntf := SourceWindowGet(ASourceEditor);
|
||||
if Assigned(LSourceWindowIntf) then
|
||||
Result := LSourceWindowIntf.Caption
|
||||
else
|
||||
Result := 'nil';
|
||||
end;
|
||||
|
||||
function SourceWindowGet(ASourceEditor: TSourceEditorInterface): TSourceEditorWindowInterface;
|
||||
var
|
||||
LWinControl: TWinControl;
|
||||
begin
|
||||
@ -105,16 +116,5 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function SourceEditorWindowCaption(ASourceEditor: TSourceEditorInterface): String;
|
||||
var
|
||||
LSourceEditorWindowInterface: TSourceEditorWindowInterface;
|
||||
begin
|
||||
LSourceEditorWindowInterface := SourceEditorWindow(ASourceEditor);
|
||||
if Assigned(LSourceEditorWindowInterface) then
|
||||
Result := LSourceEditorWindowInterface.Caption
|
||||
else
|
||||
Result := 'nil';
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user