mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 20:39:25 +02:00
DockedFormEditor: Refactoring: Move SourceEditor into SourcePageControl to reduce code overhead
git-svn-id: trunk@64946 -
This commit is contained in:
parent
8191d53f6c
commit
e7b765a763
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1345,14 +1345,13 @@ components/dockedformeditor/source/dockeddesignform.pas svneol=native#text/pasca
|
|||||||
components/dockedformeditor/source/dockedformaccesses.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedformaccesses.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedgrip.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedgrip.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedmainide.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedmainide.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedmodulepagecontrol.pas svneol=native#text/pascal
|
|
||||||
components/dockedformeditor/source/dockedoptionsframe.lfm svneol=native#text/plain
|
components/dockedformeditor/source/dockedoptionsframe.lfm svneol=native#text/plain
|
||||||
components/dockedformeditor/source/dockedoptionsframe.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedoptionsframe.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedoptionside.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedoptionside.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedregister.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedregister.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedresizecontrol.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/dockedresizer.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedsourceeditorpagecontrols.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedsourcepagecontrol.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedsourcewindow.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedsourcewindow.pas svneol=native#text/pascal
|
||||||
components/dockedformeditor/source/dockedtools.pas svneol=native#text/pascal
|
components/dockedformeditor/source/dockedtools.pas svneol=native#text/pascal
|
||||||
components/education/README.txt svneol=native#text/plain
|
components/education/README.txt svneol=native#text/plain
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<CustomOptions Value="$(IDEBuildOptions)"/>
|
<CustomOptions Value="$(IDEBuildOptions)"/>
|
||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Files Count="18">
|
<Files Count="17">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="source\dockedregister.pas"/>
|
<Filename Value="source\dockedregister.pas"/>
|
||||||
<HasRegisterProc Value="True"/>
|
<HasRegisterProc Value="True"/>
|
||||||
@ -62,41 +62,37 @@
|
|||||||
<UnitName Value="DockedDesignForm"/>
|
<UnitName Value="DockedDesignForm"/>
|
||||||
</Item9>
|
</Item9>
|
||||||
<Item10>
|
<Item10>
|
||||||
<Filename Value="source\dockedmodulepagecontrol.pas"/>
|
<Filename Value="source\dockedsourcepagecontrol.pas"/>
|
||||||
<UnitName Value="DockedModulePageControl"/>
|
<UnitName Value="DockedSourcePageControl"/>
|
||||||
</Item10>
|
</Item10>
|
||||||
<Item11>
|
<Item11>
|
||||||
<Filename Value="source\dockedsourcewindow.pas"/>
|
<Filename Value="source\dockedsourcewindow.pas"/>
|
||||||
<UnitName Value="DockedSourceWindow"/>
|
<UnitName Value="DockedSourceWindow"/>
|
||||||
</Item11>
|
</Item11>
|
||||||
<Item12>
|
<Item12>
|
||||||
<Filename Value="source\dockedsourceeditorpagecontrols.pas"/>
|
|
||||||
<UnitName Value="DockedSourceEditorPageControls"/>
|
|
||||||
</Item12>
|
|
||||||
<Item13>
|
|
||||||
<Filename Value="source\dockedanchordesigner.pas"/>
|
<Filename Value="source\dockedanchordesigner.pas"/>
|
||||||
<UnitName Value="DockedAnchorDesigner"/>
|
<UnitName Value="DockedAnchorDesigner"/>
|
||||||
</Item13>
|
</Item12>
|
||||||
<Item14>
|
<Item13>
|
||||||
<Filename Value="source\dockedbasicanchordesigner.pas"/>
|
<Filename Value="source\dockedbasicanchordesigner.pas"/>
|
||||||
<UnitName Value="DockedBasicAnchorDesigner"/>
|
<UnitName Value="DockedBasicAnchorDesigner"/>
|
||||||
</Item14>
|
</Item13>
|
||||||
<Item15>
|
<Item14>
|
||||||
<Filename Value="source\dockedanchorcontrol.pas"/>
|
<Filename Value="source\dockedanchorcontrol.pas"/>
|
||||||
<UnitName Value="DockedAnchorControl"/>
|
<UnitName Value="DockedAnchorControl"/>
|
||||||
</Item15>
|
</Item14>
|
||||||
<Item16>
|
<Item15>
|
||||||
<Filename Value="source\dockedgrip.pas"/>
|
<Filename Value="source\dockedgrip.pas"/>
|
||||||
<UnitName Value="DockedGrip"/>
|
<UnitName Value="DockedGrip"/>
|
||||||
</Item16>
|
</Item15>
|
||||||
<Item17>
|
<Item16>
|
||||||
<Filename Value="source\dockedoptionsframe.lfm"/>
|
<Filename Value="source\dockedoptionsframe.lfm"/>
|
||||||
<Type Value="LFM"/>
|
<Type Value="LFM"/>
|
||||||
</Item17>
|
</Item16>
|
||||||
<Item18>
|
<Item17>
|
||||||
<Filename Value="source\dockedresizecontrol.pas"/>
|
<Filename Value="source\dockedresizecontrol.pas"/>
|
||||||
<UnitName Value="DockedResizeControl"/>
|
<UnitName Value="DockedResizeControl"/>
|
||||||
</Item18>
|
</Item17>
|
||||||
</Files>
|
</Files>
|
||||||
<CompatibilityMode Value="True"/>
|
<CompatibilityMode Value="True"/>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -10,10 +10,9 @@ interface
|
|||||||
uses
|
uses
|
||||||
DockedRegister, DockedStrConsts, DockedFormAccesses, DockedMainIDE,
|
DockedRegister, DockedStrConsts, DockedFormAccesses, DockedMainIDE,
|
||||||
DockedResizer, DockedOptionsIDE, DockedOptionsFrame, DockedTools,
|
DockedResizer, DockedOptionsIDE, DockedOptionsFrame, DockedTools,
|
||||||
DockedDesignForm, DockedModulePageControl, DockedSourceWindow,
|
DockedDesignForm, DockedSourcePageControl, DockedSourceWindow,
|
||||||
DockedSourceEditorPageControls, DockedAnchorDesigner,
|
DockedAnchorDesigner, DockedBasicAnchorDesigner, DockedAnchorControl,
|
||||||
DockedBasicAnchorDesigner, DockedAnchorControl, DockedGrip,
|
DockedGrip, DockedResizeControl, LazarusPackageIntf;
|
||||||
DockedResizeControl, LazarusPackageIntf;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ uses
|
|||||||
// IdeIntf
|
// IdeIntf
|
||||||
SrcEditorIntf, LazIDEIntf, FormEditingIntf, PropEdits, LazLoggerBase,
|
SrcEditorIntf, LazIDEIntf, FormEditingIntf, PropEdits, LazLoggerBase,
|
||||||
// DockedFormEditor
|
// DockedFormEditor
|
||||||
DockedResizer, DockedModulePageControl, DockedTools,
|
DockedResizer, DockedSourcePageControl, DockedTools,
|
||||||
DockedSourceEditorPageControls, DockedOptionsIDE, DockedDesignForm,
|
DockedOptionsIDE, DockedDesignForm,
|
||||||
DockedSourceWindow;
|
DockedSourceWindow;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -70,7 +70,7 @@ type
|
|||||||
|
|
||||||
TDockedMainIDE = class(TObject)
|
TDockedMainIDE = class(TObject)
|
||||||
public
|
public
|
||||||
class function GetCurrentPageControl: TModulePageControl;
|
class function GetCurrentPageControl: TSourcePageControl;
|
||||||
|
|
||||||
class procedure Screen_FormAdded(Sender: TObject; AForm: TCustomForm);
|
class procedure Screen_FormAdded(Sender: TObject; AForm: TCustomForm);
|
||||||
class procedure Screen_FormDel(Sender: TObject; AForm: TCustomForm);
|
class procedure Screen_FormDel(Sender: TObject; AForm: TCustomForm);
|
||||||
@ -115,11 +115,11 @@ end;
|
|||||||
|
|
||||||
function TDockedTabMaster.GetTabDisplayStateEditor(ASourceEditor: TSourceEditorInterface): TTabDisplayState;
|
function TDockedTabMaster.GetTabDisplayStateEditor(ASourceEditor: TSourceEditorInterface): TTabDisplayState;
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
if ASourceEditor = nil then
|
if ASourceEditor = nil then
|
||||||
Exit(tdsNone);
|
Exit(tdsNone);
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(ASourceEditor);
|
LPageCtrl := SourceWindows.FindPageControl(ASourceEditor);
|
||||||
if LPageCtrl = nil then Exit(tdsNone);
|
if LPageCtrl = nil then Exit(tdsNone);
|
||||||
case LPageCtrl.PageIndex of
|
case LPageCtrl.PageIndex of
|
||||||
0: Exit(tdsCode);
|
0: Exit(tdsCode);
|
||||||
@ -196,22 +196,22 @@ end;
|
|||||||
|
|
||||||
procedure TDockedTabMaster.ShowCode(ASourceEditor: TSourceEditorInterface);
|
procedure TDockedTabMaster.ShowCode(ASourceEditor: TSourceEditorInterface);
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedTabMaster.ShowCode'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedTabMaster.ShowCode'); {$ENDIF}
|
||||||
if ASourceEditor = nil then Exit;
|
if ASourceEditor = nil then Exit;
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(ASourceEditor);
|
LPageCtrl := SourceWindows.FindPageControl(ASourceEditor);
|
||||||
LPageCtrl.ShowCode;
|
LPageCtrl.ShowCode;
|
||||||
ASourceEditor.EditorControl.SetFocus;
|
ASourceEditor.EditorControl.SetFocus;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDockedTabMaster.ShowDesigner(ASourceEditor: TSourceEditorInterface; AIndex: Integer);
|
procedure TDockedTabMaster.ShowDesigner(ASourceEditor: TSourceEditorInterface; AIndex: Integer);
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedTabMaster.ShowDesigner'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedTabMaster.ShowDesigner'); {$ENDIF}
|
||||||
if ASourceEditor = nil then Exit;
|
if ASourceEditor = nil then Exit;
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(ASourceEditor);
|
LPageCtrl := SourceWindows.FindPageControl(ASourceEditor);
|
||||||
LPageCtrl.ShowDesigner(AIndex);
|
LPageCtrl.ShowDesigner(AIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -227,10 +227,10 @@ end;
|
|||||||
|
|
||||||
procedure TDockedTabMaster.OptionsModified;
|
procedure TDockedTabMaster.OptionsModified;
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
LPageIndex: Integer;
|
LPageIndex: Integer;
|
||||||
begin
|
begin
|
||||||
LPageCtrl := SourceWindows.LastActiveModulePageControl;
|
LPageCtrl := SourceWindows.LastActivePageControl;
|
||||||
LPageIndex := LPageCtrl.PageIndex;
|
LPageIndex := LPageCtrl.PageIndex;
|
||||||
DesignForms.RemoveAllAnchorDesigner;
|
DesignForms.RemoveAllAnchorDesigner;
|
||||||
SourceWindows.ShowCodeTabSkipCurrent(nil, nil);
|
SourceWindows.ShowCodeTabSkipCurrent(nil, nil);
|
||||||
@ -243,7 +243,7 @@ end;
|
|||||||
|
|
||||||
{ TDockedMainIDE }
|
{ TDockedMainIDE }
|
||||||
|
|
||||||
class function TDockedMainIDE.GetCurrentPageControl: TModulePageControl;
|
class function TDockedMainIDE.GetCurrentPageControl: TSourcePageControl;
|
||||||
var
|
var
|
||||||
LForm: TCustomForm;
|
LForm: TCustomForm;
|
||||||
LDesignForm: TDesignForm;
|
LDesignForm: TDesignForm;
|
||||||
@ -256,14 +256,14 @@ begin
|
|||||||
if LDesignForm = nil then Exit;
|
if LDesignForm = nil then Exit;
|
||||||
LSourceWindowIntf := LDesignForm.LastActiveSourceWindow;
|
LSourceWindowIntf := LDesignForm.LastActiveSourceWindow;
|
||||||
if not Assigned(LSourceWindowIntf) then Exit;
|
if not Assigned(LSourceWindowIntf) then Exit;
|
||||||
Result := SourceWindows.FindModulePageControl(LSourceWindowIntf.ActiveEditor);
|
Result := SourceWindows.FindPageControl(LSourceWindowIntf.ActiveEditor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TDockedMainIDE.Screen_FormAdded(Sender: TObject; AForm: TCustomForm);
|
class procedure TDockedMainIDE.Screen_FormAdded(Sender: TObject; AForm: TCustomForm);
|
||||||
var
|
var
|
||||||
LSourceEditor: TSourceEditorInterface;
|
LSourceEditor: TSourceEditorInterface;
|
||||||
LDesignForm: TDesignForm;
|
LDesignForm: TDesignForm;
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
if IsFormDesign(AForm) then
|
if IsFormDesign(AForm) then
|
||||||
begin
|
begin
|
||||||
@ -279,7 +279,7 @@ begin
|
|||||||
LSourceEditor := FindSourceEditorForDesigner(AForm.Designer);
|
LSourceEditor := FindSourceEditorForDesigner(AForm.Designer);
|
||||||
if LSourceEditor <> nil then
|
if LSourceEditor <> nil then
|
||||||
begin
|
begin
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceEditor);
|
LPageCtrl := SourceWindows.FindPageControl(LSourceEditor);
|
||||||
if LPageCtrl <> nil then
|
if LPageCtrl <> nil then
|
||||||
begin
|
begin
|
||||||
LPageCtrl.DesignForm := LDesignForm;
|
LPageCtrl.DesignForm := LDesignForm;
|
||||||
@ -298,7 +298,7 @@ end;
|
|||||||
class procedure TDockedMainIDE.Screen_FormDel(Sender: TObject; AForm: TCustomForm);
|
class procedure TDockedMainIDE.Screen_FormDel(Sender: TObject; AForm: TCustomForm);
|
||||||
var
|
var
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
if IsFormDesign(AForm) then
|
if IsFormDesign(AForm) then
|
||||||
begin
|
begin
|
||||||
@ -312,12 +312,12 @@ begin
|
|||||||
// don't set ActiveDesignForm := nil! we can't call OnChange tab, because tab don't exist anymore
|
// don't set ActiveDesignForm := nil! we can't call OnChange tab, because tab don't exist anymore
|
||||||
LSourceWindow.RemoveActiveDesignForm;
|
LSourceWindow.RemoveActiveDesignForm;
|
||||||
|
|
||||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
for LPageCtrl in LSourceWindow.PageControlList do
|
||||||
if LSourceEditorPageControl.PageControl.DesignForm <> nil then
|
if LPageCtrl.DesignForm <> nil then
|
||||||
if LSourceEditorPageControl.PageControl.DesignForm.Form = AForm then
|
if LPageCtrl.DesignForm.Form = AForm then
|
||||||
begin
|
begin
|
||||||
LSourceEditorPageControl.PageControl.DesignForm := nil;
|
LPageCtrl.DesignForm := nil;
|
||||||
LSourceEditorPageControl.PageControl.PageIndex := 0;
|
LPageCtrl.PageIndex := 0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
DesignForms.Remove(AForm);
|
DesignForms.Remove(AForm);
|
||||||
@ -383,7 +383,7 @@ var
|
|||||||
LDesigner: TIDesigner;
|
LDesigner: TIDesigner;
|
||||||
LSourceEditor: TSourceEditorInterface;
|
LSourceEditor: TSourceEditorInterface;
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||||
LDesignForm: TDesignForm;
|
LDesignForm: TDesignForm;
|
||||||
begin
|
begin
|
||||||
@ -395,7 +395,7 @@ begin
|
|||||||
'] SourceWindow[' + SourceWindowCaption(LSourceEditor) + ']');
|
'] SourceWindow[' + SourceWindowCaption(LSourceEditor) + ']');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// if we create directly new project then Activate is called without EditorCreate...
|
// if we create directly new project then Activate is called without EditorCreate...
|
||||||
if not (LSourceEditor.EditorControl.Parent.Parent is TModulePageControl) then
|
if not (LSourceEditor.EditorControl.Parent.Parent is TSourcePageControl) then
|
||||||
begin
|
begin
|
||||||
// possible is situation when we moved tab into other window
|
// possible is situation when we moved tab into other window
|
||||||
// then was not called event EditorDestroy - that generates problems with switching tabs
|
// then was not called event EditorDestroy - that generates problems with switching tabs
|
||||||
@ -405,8 +405,8 @@ begin
|
|||||||
EditorCreate(Sender);
|
EditorCreate(Sender);
|
||||||
end;
|
end;
|
||||||
LDesigner := LSourceEditor.GetDesigner(True);
|
LDesigner := LSourceEditor.GetDesigner(True);
|
||||||
// should be performed during EditorCreate (parent of parent is module page ctrl)
|
// should be performed during EditorCreate (parent of parent is SourcePageControl)
|
||||||
LPageCtrl := TModulePageControl(LSourceEditor.EditorControl.Parent.Parent);
|
LPageCtrl := TSourcePageControl(LSourceEditor.EditorControl.Parent.Parent);
|
||||||
if LPageCtrl = nil then Exit;
|
if LPageCtrl = nil then Exit;
|
||||||
|
|
||||||
LDesignForm := SourceWindows.FindDesignForm(LPageCtrl);
|
LDesignForm := SourceWindows.FindDesignForm(LPageCtrl);
|
||||||
@ -466,25 +466,21 @@ class procedure TDockedMainIDE.EditorCreate(Sender: TObject);
|
|||||||
var
|
var
|
||||||
LSourceEditor: TSourceEditorInterface;
|
LSourceEditor: TSourceEditorInterface;
|
||||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||||
LParent: TWinControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
LPageCtrl: TModulePageControl;
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.EditorCreate'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.EditorCreate'); {$ENDIF}
|
||||||
LSourceEditor := Sender as TSourceEditorInterface;
|
LSourceEditor := Sender as TSourceEditorInterface;
|
||||||
if LSourceEditor.EditorControl.Parent.Parent is TModulePageControl then Exit;
|
if LSourceEditor.EditorControl.Parent.Parent is TSourcePageControl then Exit;
|
||||||
LParent := LSourceEditor.EditorControl.Parent;
|
LPageCtrl := TSourcePageControl.Create(LSourceEditor);
|
||||||
LPageCtrl := TModulePageControl.Create(LSourceEditor.EditorControl.Owner);
|
|
||||||
LSourceEditor.EditorControl.Parent := LPageCtrl.Pages[0]; // ! SynEdit :)
|
|
||||||
LPageCtrl.OnChange := @TabChange;
|
LPageCtrl.OnChange := @TabChange;
|
||||||
LPageCtrl.Parent := LParent;
|
LSourceWindowIntf := SourceWindowGet(LSourceEditor);
|
||||||
LSourceWindowIntf := TSourceEditorWindowInterface(LPageCtrl.Owner);
|
SourceWindows.SourceWindow[LSourceWindowIntf].AddPageCtrl(LPageCtrl);
|
||||||
SourceWindows.SourceWindow[LSourceWindowIntf].AddPageCtrl(LSourceEditor, LPageCtrl);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TDockedMainIDE.EditorDestroyed(Sender: TObject);
|
class procedure TDockedMainIDE.EditorDestroyed(Sender: TObject);
|
||||||
var
|
var
|
||||||
LSourceEditor: TSourceEditorInterface;
|
LSourceEditor: TSourceEditorInterface;
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||||
LDesignForm: TDesignForm;
|
LDesignForm: TDesignForm;
|
||||||
begin
|
begin
|
||||||
@ -498,9 +494,9 @@ begin
|
|||||||
|
|
||||||
// parent don't exist anymore and we must search in each window...
|
// parent don't exist anymore and we must search in each window...
|
||||||
if Sender = nil then // but not for Sender = nil :P
|
if Sender = nil then // but not for Sender = nil :P
|
||||||
LPageCtrl := SourceWindows.LastActiveModulePageControl
|
LPageCtrl := SourceWindows.LastActivePageControl
|
||||||
else
|
else
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceEditor);
|
LPageCtrl := SourceWindows.FindPageControl(LSourceEditor);
|
||||||
|
|
||||||
if LPageCtrl = nil then Exit;
|
if LPageCtrl = nil then Exit;
|
||||||
|
|
||||||
@ -528,7 +524,7 @@ var
|
|||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LDesigner: TIDesigner;
|
LDesigner: TIDesigner;
|
||||||
LDesignForm: TDesignForm;
|
LDesignForm: TDesignForm;
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.TabChange'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.TabChange'); {$ENDIF}
|
||||||
// activate proper source editor window when user is clicking on page.
|
// activate proper source editor window when user is clicking on page.
|
||||||
@ -537,11 +533,10 @@ begin
|
|||||||
if LSourceWindowIntf <> SourceEditorManagerIntf.ActiveSourceWindow then
|
if LSourceWindowIntf <> SourceEditorManagerIntf.ActiveSourceWindow then
|
||||||
SourceEditorManagerIntf.ActiveSourceWindow := LSourceWindowIntf;
|
SourceEditorManagerIntf.ActiveSourceWindow := LSourceWindowIntf;
|
||||||
|
|
||||||
LPageCtrl := TModulePageControl(Sender);
|
LPageCtrl := TSourcePageControl(Sender);
|
||||||
if LSourceWindowIntf.ActiveEditor = nil then Exit;
|
if LSourceWindowIntf.ActiveEditor = nil then Exit;
|
||||||
if LPageCtrl = nil then Exit;
|
if LPageCtrl = nil then Exit;
|
||||||
|
|
||||||
// in case there is no module and is visible page other than code page.
|
|
||||||
LDesigner := LSourceWindowIntf.ActiveEditor.GetDesigner(True);
|
LDesigner := LSourceWindowIntf.ActiveEditor.GetDesigner(True);
|
||||||
LDesignForm := DesignForms.Find(LDesigner);
|
LDesignForm := DesignForms.Find(LDesigner);
|
||||||
if LDesignForm = nil then Exit;
|
if LDesignForm = nil then Exit;
|
||||||
@ -567,7 +562,7 @@ var
|
|||||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LDesignForm: TDesignForm;
|
LDesignForm: TDesignForm;
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
LResizer: TResizer;
|
LResizer: TResizer;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.GlobalSNOnChangeBounds'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.GlobalSNOnChangeBounds'); {$ENDIF}
|
||||||
@ -586,7 +581,7 @@ begin
|
|||||||
LSourceWindow.ActiveDesignForm := LDesignForm;
|
LSourceWindow.ActiveDesignForm := LDesignForm;
|
||||||
if LDesignForm <> nil then
|
if LDesignForm <> nil then
|
||||||
begin
|
begin
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceWindowIntf.ActiveEditor);
|
LPageCtrl := SourceWindows.FindPageControl(LSourceWindowIntf.ActiveEditor);
|
||||||
if not Assigned(LPageCtrl) then Exit;
|
if not Assigned(LPageCtrl) then Exit;
|
||||||
LResizer := LPageCtrl.Resizer;
|
LResizer := LPageCtrl.Resizer;
|
||||||
if not Assigned(LResizer) then Exit;
|
if not Assigned(LResizer) then Exit;
|
||||||
@ -600,25 +595,25 @@ class procedure TDockedMainIDE.OnShowDesignerForm(Sender: TObject; AEditor: TSou
|
|||||||
AComponentPaletteClassSelected: Boolean);
|
AComponentPaletteClassSelected: Boolean);
|
||||||
var
|
var
|
||||||
LDesignForm: TDesignForm;
|
LDesignForm: TDesignForm;
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LSourceEditorInterface: TSourceEditorInterface;
|
LSourceEditorInterface: TSourceEditorInterface;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.OnShowDesignerForm'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.OnShowDesignerForm'); {$ENDIF}
|
||||||
LDesignForm := DesignForms.Find(TCustomForm(Sender).Designer);
|
LDesignForm := DesignForms.Find(TCustomForm(Sender).Designer);
|
||||||
if (LDesignForm = nil) or LDesignForm.Hiding then Exit;
|
if (LDesignForm = nil) or LDesignForm.Hiding then Exit;
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(SourceEditorManagerIntf.ActiveEditor);
|
LPageCtrl := SourceWindows.FindPageControl(SourceEditorManagerIntf.ActiveEditor);
|
||||||
if LPageCtrl = nil then Exit;
|
if LPageCtrl = nil then Exit;
|
||||||
|
|
||||||
if AComponentPaletteClassSelected then
|
if AComponentPaletteClassSelected then
|
||||||
begin
|
begin
|
||||||
// if form is already opened do nothing, if not then show form for active module.
|
// if form is already opened do nothing, if not then show form
|
||||||
for LSourceWindow in SourceWindows do
|
for LSourceWindow in SourceWindows do
|
||||||
begin
|
begin
|
||||||
LSourceEditorInterface := LSourceWindow.SourceWindowIntf.ActiveEditor;
|
LSourceEditorInterface := LSourceWindow.SourceWindowIntf.ActiveEditor;
|
||||||
if (LSourceEditorInterface = nil) or (LSourceEditorInterface.GetDesigner(True) <> LDesignForm.Designer) then
|
if (LSourceEditorInterface = nil) or (LSourceEditorInterface.GetDesigner(True) <> LDesignForm.Designer) then
|
||||||
Continue;
|
Continue;
|
||||||
LPageCtrl := SourceWindows.FindModulePageControl(LSourceEditorInterface);
|
LPageCtrl := SourceWindows.FindPageControl(LSourceEditorInterface);
|
||||||
if LPageCtrl.FormPageActive then
|
if LPageCtrl.FormPageActive then
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
@ -667,7 +662,7 @@ end;
|
|||||||
|
|
||||||
class procedure TDockedMainIDE.OnDesignRefreshPropertyValues;
|
class procedure TDockedMainIDE.OnDesignRefreshPropertyValues;
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
|
|
||||||
function RootIsSelected: Boolean;
|
function RootIsSelected: Boolean;
|
||||||
var
|
var
|
||||||
@ -702,7 +697,7 @@ end;
|
|||||||
|
|
||||||
class procedure TDockedMainIDE.OnDesignModified(Sender: TObject);
|
class procedure TDockedMainIDE.OnDesignModified(Sender: TObject);
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.OnDesignModified'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TDockedMainIDE.OnDesignModified'); {$ENDIF}
|
||||||
LPageCtrl := GetCurrentPageControl;
|
LPageCtrl := GetCurrentPageControl;
|
||||||
@ -726,7 +721,7 @@ end;
|
|||||||
class procedure TDockedMainIDE.OnDesignMouseDown(Sender: TObject;
|
class procedure TDockedMainIDE.OnDesignMouseDown(Sender: TObject;
|
||||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} writeln('TDockedMainIDE.OnDesignMouseDown'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} writeln('TDockedMainIDE.OnDesignMouseDown'); {$ENDIF}
|
||||||
LPageCtrl := GetCurrentPageControl;
|
LPageCtrl := GetCurrentPageControl;
|
||||||
|
@ -1,143 +0,0 @@
|
|||||||
{
|
|
||||||
*****************************************************************************
|
|
||||||
See the file COPYING.modifiedLGPL.txt, included in this distribution,
|
|
||||||
for details about the license.
|
|
||||||
*****************************************************************************
|
|
||||||
|
|
||||||
Author: Michael W. Vogel
|
|
||||||
|
|
||||||
List of ModulePageControls linked to SourceEditorInterfaces. This List is used
|
|
||||||
in just one SourceEditor window.
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
unit DockedSourceEditorPageControls;
|
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
{$modeswitch advancedrecords}
|
|
||||||
{$modeswitch typehelpers}
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
// RTL
|
|
||||||
Classes, SysUtils, fgl,
|
|
||||||
// LCL
|
|
||||||
Forms,
|
|
||||||
// IDEIntf
|
|
||||||
SrcEditorIntf,
|
|
||||||
// DockedFormEditor
|
|
||||||
DockedModulePageControl;
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
{ TSourceEditorPageControl }
|
|
||||||
|
|
||||||
TSourceEditorPageControl = record
|
|
||||||
PageControl: TModulePageControl;
|
|
||||||
SourceEditor: TSourceEditorInterface;
|
|
||||||
class operator = (Item1, Item2: TSourceEditorPageControl): Boolean;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSourceEditorPageControls }
|
|
||||||
|
|
||||||
TSourceEditorPageControls = class(specialize TFPGList<TSourceEditorPageControl>)
|
|
||||||
private
|
|
||||||
function GetPageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl;
|
|
||||||
function GetSourceEditor(APageControl: TModulePageControl): TSourceEditorInterface;
|
|
||||||
public
|
|
||||||
procedure Add(ASrcEditor: TSourceEditorInterface; APageControl: TModulePageControl); overload;
|
|
||||||
function Contains(APageControl: TModulePageControl): Boolean;
|
|
||||||
function Contains(ASrcEditor: TSourceEditorInterface): Boolean;
|
|
||||||
function IndexOf(APageControl: TModulePageControl): Integer; overload;
|
|
||||||
function IndexOf(ASrcEditor: TSourceEditorInterface): Integer; overload;
|
|
||||||
procedure Remove(ASrcEditor: TSourceEditorInterface); overload;
|
|
||||||
public
|
|
||||||
property PageControl[ASrcEditor: TSourceEditorInterface]: TModulePageControl read GetPageControl;
|
|
||||||
property SourceEditor[APageControl: TModulePageControl]: TSourceEditorInterface read GetSourceEditor;
|
|
||||||
end;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
{ TSourceEditorPageControl }
|
|
||||||
|
|
||||||
class operator TSourceEditorPageControl. = (Item1, Item2: TSourceEditorPageControl): Boolean;
|
|
||||||
begin
|
|
||||||
Result := (Item1.PageControl = Item2.PageControl) and
|
|
||||||
(Item1.SourceEditor = Item2.SourceEditor);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSourceEditorPageControls }
|
|
||||||
|
|
||||||
function TSourceEditorPageControls.GetPageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl;
|
|
||||||
var
|
|
||||||
LIndex: Integer;
|
|
||||||
begin
|
|
||||||
LIndex := IndexOf(ASrcEditor);
|
|
||||||
if LIndex >= 0 then
|
|
||||||
Result := Items[LIndex].PageControl
|
|
||||||
else
|
|
||||||
Result := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSourceEditorPageControls.GetSourceEditor(APageControl: TModulePageControl): TSourceEditorInterface;
|
|
||||||
var
|
|
||||||
LIndex: Integer;
|
|
||||||
begin
|
|
||||||
LIndex := IndexOf(APageControl);
|
|
||||||
if LIndex >= 0 then
|
|
||||||
Result := Items[LIndex].SourceEditor
|
|
||||||
else
|
|
||||||
Result := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceEditorPageControls.Add(ASrcEditor: TSourceEditorInterface; APageControl: TModulePageControl);
|
|
||||||
var
|
|
||||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
|
||||||
begin
|
|
||||||
LSourceEditorPageControl.SourceEditor := ASrcEditor;
|
|
||||||
LSourceEditorPageControl.PageControl := APageControl;
|
|
||||||
Add(LSourceEditorPageControl);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSourceEditorPageControls.Contains(APageControl: TModulePageControl): Boolean;
|
|
||||||
begin
|
|
||||||
Result := IndexOf(APageControl) >= 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSourceEditorPageControls.Contains(ASrcEditor: TSourceEditorInterface): Boolean;
|
|
||||||
begin
|
|
||||||
Result := IndexOf(ASrcEditor) >= 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSourceEditorPageControls.IndexOf(APageControl: TModulePageControl): Integer;
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
Result := -1;
|
|
||||||
for i := 0 to Count - 1 do
|
|
||||||
if Items[i].PageControl = APageControl then
|
|
||||||
Exit(i);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSourceEditorPageControls.IndexOf(ASrcEditor: TSourceEditorInterface): Integer;
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
Result := -1;
|
|
||||||
for i := 0 to Count - 1 do
|
|
||||||
if Items[i].SourceEditor = ASrcEditor then
|
|
||||||
Exit(i);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceEditorPageControls.Remove(ASrcEditor: TSourceEditorInterface);
|
|
||||||
var
|
|
||||||
LIndex: Integer;
|
|
||||||
begin
|
|
||||||
LIndex := IndexOf(ASrcEditor);
|
|
||||||
if LIndex < 0 then Exit;
|
|
||||||
Delete(LIndex);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unit DockedModulePageControl;
|
unit DockedSourcePageControl;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
{ $define DEBUGDOCKEDFORMEDITOR}
|
{ $define DEBUGDOCKEDFORMEDITOR}
|
||||||
@ -21,7 +21,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
// RTL
|
// RTL
|
||||||
Classes, SysUtils,
|
Classes, SysUtils, fgl,
|
||||||
// LCL
|
// LCL
|
||||||
Forms, ComCtrls, Controls, LCLProc,
|
Forms, ComCtrls, Controls, LCLProc,
|
||||||
// IDEIntf
|
// IDEIntf
|
||||||
@ -32,23 +32,24 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TModulePageControl }
|
{ TSourcePageControl }
|
||||||
|
|
||||||
TModulePageControl = class(TPageControl)
|
TSourcePageControl = class(TPageControl)
|
||||||
private
|
private
|
||||||
FDesignerSetFocusAsyncCount: Integer;
|
FDesignerSetFocusAsyncCount: Integer;
|
||||||
FDesignForm: TDesignForm;
|
FDesignForm: TDesignForm;
|
||||||
FResizer: TResizer;
|
FResizer: TResizer;
|
||||||
|
FSourceEditor: TSourceEditorInterface;
|
||||||
FTabSheetAnchors: TTabSheet;
|
FTabSheetAnchors: TTabSheet;
|
||||||
FTabSheetCode: TTabSheet;
|
FTabSheetCode: TTabSheet;
|
||||||
FTabSheetDesigner: TTabSheet;
|
FTabSheetDesigner: TTabSheet;
|
||||||
procedure AsyncDesignerSetFocus({%H-}Data: PtrInt);
|
procedure AsyncDesignerSetFocus({%H-}Data: PtrInt);
|
||||||
procedure ModulePageControlMouseUp(Sender: TObject; {%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
procedure SourcePageControlMouseUp(Sender: TObject; {%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
||||||
procedure OnAdjustPage(Sender: TObject);
|
procedure OnAdjustPage(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
procedure SetDesignForm(const AValue: TDesignForm); virtual;
|
procedure SetDesignForm(const AValue: TDesignForm); virtual;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(ASourceEditor: TSourceEditorInterface); reintroduce;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure AdjustPage;
|
procedure AdjustPage;
|
||||||
function AnchorPageActive: Boolean;
|
function AnchorPageActive: Boolean;
|
||||||
@ -67,32 +68,50 @@ type
|
|||||||
public
|
public
|
||||||
property DesignForm: TDesignForm read FDesignForm write SetDesignForm;
|
property DesignForm: TDesignForm read FDesignForm write SetDesignForm;
|
||||||
property Resizer: TResizer read FResizer;
|
property Resizer: TResizer read FResizer;
|
||||||
|
property SourceEditor: TSourceEditorInterface read FSourceEditor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TSourcePageControls }
|
||||||
|
|
||||||
|
TSourcePageControls = class(specialize TFPGList<TSourcePageControl>)
|
||||||
|
private
|
||||||
|
function GetPageControl(ASrcEditor: TSourceEditorInterface): TSourcePageControl;
|
||||||
|
function GetSourceEditor(APageControl: TSourcePageControl): TSourceEditorInterface;
|
||||||
|
public
|
||||||
|
function Contains(APageControl: TSourcePageControl): Boolean;
|
||||||
|
function Contains(ASrcEditor: TSourceEditorInterface): Boolean;
|
||||||
|
function IndexOf(APageControl: TSourcePageControl): Integer; overload;
|
||||||
|
function IndexOf(ASrcEditor: TSourceEditorInterface): Integer; overload;
|
||||||
|
procedure Remove(ASrcEditor: TSourceEditorInterface); overload;
|
||||||
|
public
|
||||||
|
property PageControl[ASrcEditor: TSourceEditorInterface]: TSourcePageControl read GetPageControl;
|
||||||
|
property SourceEditor[APageControl: TSourcePageControl]: TSourceEditorInterface read GetSourceEditor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TModulePageControl }
|
{ TSourcePageControl }
|
||||||
|
|
||||||
procedure TModulePageControl.OnAdjustPage(Sender: TObject);
|
procedure TSourcePageControl.OnAdjustPage(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
AdjustPage;
|
AdjustPage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.ModulePageControlMouseUp(Sender: TObject;
|
procedure TSourcePageControl.SourcePageControlMouseUp(Sender: TObject;
|
||||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if DesignerPageActive then
|
if DesignerPageActive then
|
||||||
DesignerSetFocus;
|
DesignerSetFocus;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.AsyncDesignerSetFocus(Data: PtrInt);
|
procedure TSourcePageControl.AsyncDesignerSetFocus(Data: PtrInt);
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.AsyncDesignerSetFocus'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.AsyncDesignerSetFocus'); {$ENDIF}
|
||||||
DesignerSetFocus;
|
DesignerSetFocus;
|
||||||
FDesignerSetFocusAsyncCount := 0;
|
FDesignerSetFocusAsyncCount := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.SetDesignForm(const AValue: TDesignForm);
|
procedure TSourcePageControl.SetDesignForm(const AValue: TDesignForm);
|
||||||
begin
|
begin
|
||||||
if (AValue = FDesignForm) then
|
if (AValue = FDesignForm) then
|
||||||
// for show lfm code, if we want after editing lfm go back to form without any error
|
// for show lfm code, if we want after editing lfm go back to form without any error
|
||||||
@ -101,7 +120,7 @@ begin
|
|||||||
or ((AValue <> nil) and (FResizer.DesignForm = AValue)) then
|
or ((AValue <> nil) and (FResizer.DesignForm = AValue)) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.SetDesignForm: ', DbgSName(AValue)); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.SetDesignForm: ', DbgSName(AValue)); {$ENDIF}
|
||||||
|
|
||||||
FDesignForm := AValue;
|
FDesignForm := AValue;
|
||||||
if AValue = nil then
|
if AValue = nil then
|
||||||
@ -117,111 +136,119 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TModulePageControl.Create(TheOwner: TComponent);
|
constructor TSourcePageControl.Create(ASourceEditor: TSourceEditorInterface);
|
||||||
|
var
|
||||||
|
LParent: TWinControl;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.Create'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.Create'); {$ENDIF}
|
||||||
|
|
||||||
inherited Create(TheOwner);
|
inherited Create(ASourceEditor.EditorControl.Owner);
|
||||||
|
FSourceEditor := ASourceEditor;
|
||||||
FDesignerSetFocusAsyncCount := 0;
|
FDesignerSetFocusAsyncCount := 0;
|
||||||
FResizer := nil;
|
FResizer := nil;
|
||||||
|
|
||||||
TabPosition := DockedOptions.TabPosition;
|
TabPosition := DockedOptions.TabPosition;
|
||||||
Align := alClient;
|
Align := alClient;
|
||||||
ShowTabs := False;
|
ShowTabs := False;
|
||||||
OnMouseUp := @ModulePageControlMouseUp;
|
OnMouseUp := @SourcePageControlMouseUp;
|
||||||
|
|
||||||
FTabSheetCode := TTabSheet.Create(Self);
|
FTabSheetCode := TTabSheet.Create(Self);
|
||||||
FTabSheetCode.PageControl := Self;
|
FTabSheetCode.PageControl := Self;
|
||||||
FTabSheetCode.Caption := SCode;
|
FTabSheetCode.Caption := SCode;
|
||||||
|
|
||||||
|
// place SynEdit into code tab
|
||||||
|
LParent := ASourceEditor.EditorControl.Parent;
|
||||||
|
ASourceEditor.EditorControl.Parent := FTabSheetCode;
|
||||||
|
Parent := LParent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TModulePageControl.Destroy;
|
destructor TSourcePageControl.Destroy;
|
||||||
begin
|
begin
|
||||||
DesignForm := nil;
|
DesignForm := nil;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.AdjustPage;
|
procedure TSourcePageControl.AdjustPage;
|
||||||
begin
|
begin
|
||||||
if not DesignerPageActive then Exit;
|
if not DesignerPageActive then Exit;
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.AdjustPage'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.AdjustPage'); {$ENDIF}
|
||||||
if Assigned(FResizer) then
|
if Assigned(FResizer) then
|
||||||
FResizer.AdjustResizer(nil);
|
FResizer.AdjustResizer(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TModulePageControl.AnchorPageActive: Boolean;
|
function TSourcePageControl.AnchorPageActive: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := ActivePage = FTabSheetAnchors;
|
Result := ActivePage = FTabSheetAnchors;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.CreateResizer;
|
procedure TSourcePageControl.CreateResizer;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.CreateResizer'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.CreateResizer'); {$ENDIF}
|
||||||
if Assigned(FResizer) then
|
if Assigned(FResizer) then
|
||||||
raise Exception.Create('TModulePageControl.CreateResizer: Resizer already created');
|
raise Exception.Create('TSourcePageControl.CreateResizer: Resizer already created');
|
||||||
FResizer := TResizer.Create(Self);
|
FResizer := TResizer.Create(Self);
|
||||||
if not Assigned(FTabSheetDesigner) then
|
if not Assigned(FTabSheetDesigner) then
|
||||||
CreateTabSheetDesigner;
|
CreateTabSheetDesigner;
|
||||||
FResizer.Parent := FTabSheetDesigner;
|
FResizer.Parent := FTabSheetDesigner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.CreateTabSheetAnchors;
|
procedure TSourcePageControl.CreateTabSheetAnchors;
|
||||||
begin
|
begin
|
||||||
if not DockedOptions.AnchorTabVisible then Exit;
|
if not DockedOptions.AnchorTabVisible then Exit;
|
||||||
if Assigned(FTabSheetAnchors) then Exit;
|
if Assigned(FTabSheetAnchors) then Exit;
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.CreateTabSheetAnchors'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.CreateTabSheetAnchors'); {$ENDIF}
|
||||||
FTabSheetAnchors := TTabSheet.Create(Self);
|
FTabSheetAnchors := TTabSheet.Create(Self);
|
||||||
FTabSheetAnchors.PageControl := Self;
|
FTabSheetAnchors.PageControl := Self;
|
||||||
FTabSheetAnchors.Caption := SAnchors;
|
FTabSheetAnchors.Caption := SAnchors;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.CreateTabSheetDesigner;
|
procedure TSourcePageControl.CreateTabSheetDesigner;
|
||||||
begin
|
begin
|
||||||
if Assigned(FTabSheetDesigner) then Exit;
|
if Assigned(FTabSheetDesigner) then Exit;
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.CreateTabSheetDesigner'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.CreateTabSheetDesigner'); {$ENDIF}
|
||||||
FTabSheetDesigner := TTabSheet.Create(Self);
|
FTabSheetDesigner := TTabSheet.Create(Self);
|
||||||
FTabSheetDesigner.PageControl := Self;
|
FTabSheetDesigner.PageControl := Self;
|
||||||
FTabSheetDesigner.Caption := SDesigner;
|
FTabSheetDesigner.Caption := SDesigner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.DesignerSetFocus;
|
procedure TSourcePageControl.DesignerSetFocus;
|
||||||
begin
|
begin
|
||||||
if not Assigned(Resizer) then Exit;
|
if not Assigned(Resizer) then Exit;
|
||||||
if not Assigned(DesignForm) then Exit;
|
if not Assigned(DesignForm) then Exit;
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.DesignerSetFocus'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControl.DesignerSetFocus'); {$ENDIF}
|
||||||
Resizer.DesignerSetFocus;
|
Resizer.DesignerSetFocus;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.DesignerSetFocusAsync;
|
procedure TSourcePageControl.DesignerSetFocusAsync;
|
||||||
begin
|
begin
|
||||||
if FDesignerSetFocusAsyncCount = 0 then
|
if FDesignerSetFocusAsyncCount = 0 then
|
||||||
Application.QueueAsyncCall(@AsyncDesignerSetFocus, 0);
|
Application.QueueAsyncCall(@AsyncDesignerSetFocus, 0);
|
||||||
Inc(FDesignerSetFocusAsyncCount);
|
Inc(FDesignerSetFocusAsyncCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TModulePageControl.DesignerPageActive: Boolean;
|
function TSourcePageControl.DesignerPageActive: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (ActivePage = FTabSheetDesigner) or
|
Result := (ActivePage = FTabSheetDesigner) or
|
||||||
(ActivePage = FTabSheetAnchors);
|
(ActivePage = FTabSheetAnchors);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TModulePageControl.FormPageActive: Boolean;
|
function TSourcePageControl.FormPageActive: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := ActivePage = FTabSheetDesigner;
|
Result := ActivePage = FTabSheetDesigner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.RemoveDesignPages;
|
procedure TSourcePageControl.RemoveDesignPages;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.RemoveDesignPages'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControls.RemoveDesignPages'); {$ENDIF}
|
||||||
FreeAndNil(FTabSheetAnchors);
|
FreeAndNil(FTabSheetAnchors);
|
||||||
FreeAndNil(FTabSheetDesigner);
|
FreeAndNil(FTabSheetDesigner);
|
||||||
ShowTabs := False;
|
ShowTabs := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.InitPage;
|
procedure TSourcePageControl.InitPage;
|
||||||
begin
|
begin
|
||||||
ShowTabs := PageCount > 1;
|
ShowTabs := PageCount > 1;
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.InitPage: ShowTabs[' + ShowTabs.ToString(TUseBoolStrs.True) + ']'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControls.InitPage: ShowTabs[' + ShowTabs.ToString(TUseBoolStrs.True) + ']'); {$ENDIF}
|
||||||
if ActivePage = FTabSheetDesigner then
|
if ActivePage = FTabSheetDesigner then
|
||||||
begin
|
begin
|
||||||
Resizer.Parent := FTabSheetDesigner;
|
Resizer.Parent := FTabSheetDesigner;
|
||||||
@ -242,24 +269,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.RefreshResizer;
|
procedure TSourcePageControl.RefreshResizer;
|
||||||
begin
|
begin
|
||||||
if not Assigned(FResizer) then Exit;
|
if not Assigned(FResizer) then Exit;
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.RefreshResizer'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControls.RefreshResizer'); {$ENDIF}
|
||||||
FreeAndNil(FResizer);
|
FreeAndNil(FResizer);
|
||||||
CreateResizer;
|
CreateResizer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.ShowCode;
|
procedure TSourcePageControl.ShowCode;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.ShowCode'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControls.ShowCode'); {$ENDIF}
|
||||||
PageIndex := 0;
|
PageIndex := 0;
|
||||||
InitPage;
|
InitPage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TModulePageControl.ShowDesigner(AIndex: Integer);
|
procedure TSourcePageControl.ShowDesigner(AIndex: Integer);
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TModulePageControl.ShowDesigner'); {$ENDIF}
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourcePageControls.ShowDesigner'); {$ENDIF}
|
||||||
if (AIndex = 0) or not (Pages[AIndex].TabVisible) then
|
if (AIndex = 0) or not (Pages[AIndex].TabVisible) then
|
||||||
AIndex := 1;
|
AIndex := 1;
|
||||||
if PageCount <= AIndex then Exit;
|
if PageCount <= AIndex then Exit;
|
||||||
@ -269,5 +296,68 @@ begin
|
|||||||
OnChange(Self);
|
OnChange(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TSourcePageControls }
|
||||||
|
|
||||||
|
function TSourcePageControls.GetPageControl(ASrcEditor: TSourceEditorInterface): TSourcePageControl;
|
||||||
|
var
|
||||||
|
LIndex: Integer;
|
||||||
|
begin
|
||||||
|
LIndex := IndexOf(ASrcEditor);
|
||||||
|
if LIndex >= 0 then
|
||||||
|
Result := Items[LIndex]
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourcePageControls.GetSourceEditor(APageControl: TSourcePageControl): TSourceEditorInterface;
|
||||||
|
var
|
||||||
|
LIndex: Integer;
|
||||||
|
begin
|
||||||
|
LIndex := IndexOf(APageControl);
|
||||||
|
if LIndex >= 0 then
|
||||||
|
Result := Items[LIndex].SourceEditor
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourcePageControls.Contains(APageControl: TSourcePageControl): Boolean;
|
||||||
|
begin
|
||||||
|
Result := IndexOf(APageControl) >= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourcePageControls.Contains(ASrcEditor: TSourceEditorInterface): Boolean;
|
||||||
|
begin
|
||||||
|
Result := IndexOf(ASrcEditor) >= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourcePageControls.IndexOf(APageControl: TSourcePageControl): Integer;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result := -1;
|
||||||
|
for i := 0 to Count - 1 do
|
||||||
|
if Items[i] = APageControl then
|
||||||
|
Exit(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourcePageControls.IndexOf(ASrcEditor: TSourceEditorInterface): Integer;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result := -1;
|
||||||
|
for i := 0 to Count - 1 do
|
||||||
|
if Items[i].SourceEditor = ASrcEditor then
|
||||||
|
Exit(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourcePageControls.Remove(ASrcEditor: TSourceEditorInterface);
|
||||||
|
var
|
||||||
|
LIndex: Integer;
|
||||||
|
begin
|
||||||
|
LIndex := IndexOf(ASrcEditor);
|
||||||
|
if LIndex < 0 then Exit;
|
||||||
|
Delete(LIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
@ -32,7 +32,7 @@ uses
|
|||||||
// IDEIntf
|
// IDEIntf
|
||||||
SrcEditorIntf, LazIDEIntf, FormEditingIntf, ExtendedNotebook,
|
SrcEditorIntf, LazIDEIntf, FormEditingIntf, ExtendedNotebook,
|
||||||
// DockedFormEditor
|
// DockedFormEditor
|
||||||
DockedSourceEditorPageControls, DockedDesignForm, DockedModulePageControl,
|
DockedDesignForm, DockedSourcePageControl,
|
||||||
DockedOptionsIDE, DockedTools;
|
DockedOptionsIDE, DockedTools;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -42,23 +42,23 @@ type
|
|||||||
TSourceWindow = class
|
TSourceWindow = class
|
||||||
private
|
private
|
||||||
FActiveDesignForm: TDesignForm;
|
FActiveDesignForm: TDesignForm;
|
||||||
|
FDefaultNotebookPageChanged: TNotifyEvent;
|
||||||
FLastActiveSourceEditor: TSourceEditorInterface;
|
FLastActiveSourceEditor: TSourceEditorInterface;
|
||||||
FLastTopParent: TControl;
|
FLastTopParent: TControl;
|
||||||
FNotebookPageChanged: TNotifyEvent;
|
FNotebook: TExtendedNotebook;
|
||||||
FPageControlList: TSourceEditorPageControls;
|
FPageControlList: TSourcePageControls;
|
||||||
FSourceEditorNotebook: TExtendedNotebook;
|
|
||||||
FSourceWindowIntf: TSourceEditorWindowInterface;
|
FSourceWindowIntf: TSourceEditorWindowInterface;
|
||||||
function GetActiveEditor: TSourceEditorInterface;
|
function GetActiveEditor: TSourceEditorInterface;
|
||||||
procedure HookIntoOnPageChanged;
|
procedure HookIntoOnPageChanged;
|
||||||
|
procedure NoteBookPageChanged(Sender: TObject);
|
||||||
procedure SetActiveDesignForm(const AValue: TDesignForm);
|
procedure SetActiveDesignForm(const AValue: TDesignForm);
|
||||||
procedure SourceEditorPageChanged(Sender: TObject);
|
|
||||||
procedure UpdateEditorPageCaption(Sender: TObject);
|
procedure UpdateEditorPageCaption(Sender: TObject);
|
||||||
public
|
public
|
||||||
constructor Create(ASourceWindowIntf: TSourceEditorWindowInterface);
|
constructor Create(ASourceWindowIntf: TSourceEditorWindowInterface);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure AddPageCtrl(ASourceEditor: TSourceEditorInterface; APageControl: TModulePageControl);
|
procedure AddPageCtrl(APageControl: TSourcePageControl);
|
||||||
procedure AdjustPageControl;
|
procedure AdjustPageControl;
|
||||||
function FindModulePageControl(ASourceEditor: TSourceEditorInterface): TModulePageControl;
|
function FindPageControl(ASourceEditor: TSourceEditorInterface): TSourcePageControl;
|
||||||
procedure RemoveActiveDesignForm;
|
procedure RemoveActiveDesignForm;
|
||||||
procedure RemovePageCtrl(ASourceEditor: TSourceEditorInterface);
|
procedure RemovePageCtrl(ASourceEditor: TSourceEditorInterface);
|
||||||
public
|
public
|
||||||
@ -66,7 +66,7 @@ type
|
|||||||
property ActiveEditor: TSourceEditorInterface read GetActiveEditor;
|
property ActiveEditor: TSourceEditorInterface read GetActiveEditor;
|
||||||
property LastActiveSourceEditor: TSourceEditorInterface read FLastActiveSourceEditor write FLastActiveSourceEditor;
|
property LastActiveSourceEditor: TSourceEditorInterface read FLastActiveSourceEditor write FLastActiveSourceEditor;
|
||||||
property LastTopParent: TControl read FLastTopParent write FLastTopParent;
|
property LastTopParent: TControl read FLastTopParent write FLastTopParent;
|
||||||
property PageControlList: TSourceEditorPageControls read FPageControlList;
|
property PageControlList: TSourcePageControls read FPageControlList;
|
||||||
property SourceWindowIntf: TSourceEditorWindowInterface read FSourceWindowIntf;
|
property SourceWindowIntf: TSourceEditorWindowInterface read FSourceWindowIntf;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ type
|
|||||||
TSourceWindows = class(specialize TFPGList<TSourceWindow>)
|
TSourceWindows = class(specialize TFPGList<TSourceWindow>)
|
||||||
private
|
private
|
||||||
FLastActiveSourceWindow: TSourceEditorWindowInterface;
|
FLastActiveSourceWindow: TSourceEditorWindowInterface;
|
||||||
function GetLastActiveModulePageControl: TModulePageControl;
|
function GetLastActivePageControl: TSourcePageControl;
|
||||||
function GetLastActiveSourceEditor: TSourceEditorInterface;
|
function GetLastActiveSourceEditor: TSourceEditorInterface;
|
||||||
function GetSourceWindowIntf(ASrcEditor: TSourceWindow): TSourceEditorWindowInterface;
|
function GetSourceWindowIntf(ASrcEditor: TSourceWindow): TSourceEditorWindowInterface;
|
||||||
function GetSourceWindow(ASourceWindowIntf: TSourceEditorWindowInterface): TSourceWindow;
|
function GetSourceWindow(ASourceWindowIntf: TSourceEditorWindowInterface): TSourceWindow;
|
||||||
@ -86,18 +86,18 @@ type
|
|||||||
function Contains(ASourceWindowIntf: TSourceEditorWindowInterface): Boolean;
|
function Contains(ASourceWindowIntf: TSourceEditorWindowInterface): Boolean;
|
||||||
function Contains(ASrcEditor: TSourceWindow): Boolean;
|
function Contains(ASrcEditor: TSourceWindow): Boolean;
|
||||||
procedure DeleteItem(Index: Integer);
|
procedure DeleteItem(Index: Integer);
|
||||||
function FindDesignForm(AModulePageCtrl: TModulePageControl): TDesignForm;
|
function FindDesignForm(APageCtrl: TSourcePageControl): TDesignForm;
|
||||||
function FindModulePageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl;
|
function FindPageControl(ASrcEditor: TSourceEditorInterface): TSourcePageControl;
|
||||||
function IndexOf(ASourceWindowIntf: TSourceEditorWindowInterface): Integer; overload;
|
function IndexOf(ASourceWindowIntf: TSourceEditorWindowInterface): Integer; overload;
|
||||||
function LastSourceEditorNotFound: Boolean;
|
function LastSourceEditorNotFound: Boolean;
|
||||||
procedure RefreshActivePageControls;
|
procedure RefreshActivePageControls;
|
||||||
procedure RefreshAllPageControls;
|
procedure RefreshAllPageControls;
|
||||||
procedure Remove(ASourceWindowIntf: TSourceEditorWindowInterface); overload;
|
procedure Remove(ASourceWindowIntf: TSourceEditorWindowInterface); overload;
|
||||||
procedure ShowCodeTabSkipCurrent(CurrentPageCtrl: TModulePageControl; ADesignForm: TDesignForm);
|
procedure ShowCodeTabSkipCurrent(CurrentPageCtrl: TSourcePageControl; ADesignForm: TDesignForm);
|
||||||
public
|
public
|
||||||
property LastActiveSourceWindow: TSourceEditorWindowInterface read FLastActiveSourceWindow write FLastActiveSourceWindow;
|
property LastActiveSourceWindow: TSourceEditorWindowInterface read FLastActiveSourceWindow write FLastActiveSourceWindow;
|
||||||
property LastActiveSourceEditor: TSourceEditorInterface read GetLastActiveSourceEditor write SetLastActiveSourceEditor;
|
property LastActiveSourceEditor: TSourceEditorInterface read GetLastActiveSourceEditor write SetLastActiveSourceEditor;
|
||||||
property LastActiveModulePageControl: TModulePageControl read GetLastActiveModulePageControl;
|
property LastActivePageControl: TSourcePageControl read GetLastActivePageControl;
|
||||||
property SourceWindowIntf[ASrcEditor: TSourceWindow]: TSourceEditorWindowInterface read GetSourceWindowIntf;
|
property SourceWindowIntf[ASrcEditor: TSourceWindow]: TSourceEditorWindowInterface read GetSourceWindowIntf;
|
||||||
property SourceWindow[ASourceWindowIntf: TSourceEditorWindowInterface]: TSourceWindow read GetSourceWindow;
|
property SourceWindow[ASourceWindowIntf: TSourceEditorWindowInterface]: TSourceWindow read GetSourceWindow;
|
||||||
end;
|
end;
|
||||||
@ -116,46 +116,21 @@ begin
|
|||||||
for i := 0 to FSourceWindowIntf.ControlCount - 1 do
|
for i := 0 to FSourceWindowIntf.ControlCount - 1 do
|
||||||
if FSourceWindowIntf.Controls[i] is TExtendedNotebook then
|
if FSourceWindowIntf.Controls[i] is TExtendedNotebook then
|
||||||
begin
|
begin
|
||||||
FSourceEditorNotebook := TExtendedNotebook(FSourceWindowIntf.Controls[i]);
|
FNotebook := TExtendedNotebook(FSourceWindowIntf.Controls[i]);
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
if not Assigned(FSourceEditorNotebook) then Exit;
|
if not Assigned(FNotebook) then Exit;
|
||||||
FNotebookPageChanged := FSourceEditorNotebook.OnChange;
|
FDefaultNotebookPageChanged := FNotebook.OnChange;
|
||||||
FSourceEditorNotebook.OnChange := @SourceEditorPageChanged;
|
FNotebook.OnChange := @NoteBookPageChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceWindow.GetActiveEditor: TSourceEditorInterface;
|
procedure TSourceWindow.NoteBookPageChanged(Sender: TObject);
|
||||||
begin
|
|
||||||
Result := FSourceWindowIntf.ActiveEditor;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceWindow.SetActiveDesignForm(const AValue: TDesignForm);
|
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
if FActiveDesignForm = AValue then Exit;
|
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourceWindow.NoteBookPageChanged SourceWindow[' + FSourceWindowIntf.Caption + ']'); {$ENDIF}
|
||||||
if FActiveDesignForm <> nil then
|
FDefaultNotebookPageChanged(Sender);
|
||||||
// don't hide now if soon form will be hidden (for example on the IDE start)
|
LPageCtrl := FindPageControl(ActiveEditor);
|
||||||
if not FActiveDesignForm.Hiding then
|
|
||||||
FActiveDesignForm.HideWindow;
|
|
||||||
FActiveDesignForm := AValue;
|
|
||||||
|
|
||||||
LPageCtrl := FindModulePageControl(ActiveEditor);
|
|
||||||
// important when we want back to tab where was oppened form
|
|
||||||
if (AValue <> nil) then
|
|
||||||
LazarusIDE.DoShowDesignerFormOfSrc(ActiveEditor);
|
|
||||||
|
|
||||||
if LPageCtrl = nil then Exit;
|
|
||||||
LPageCtrl.DesignForm := AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceWindow.SourceEditorPageChanged(Sender: TObject);
|
|
||||||
var
|
|
||||||
LPageCtrl: TModulePageControl;
|
|
||||||
begin
|
|
||||||
{$IFDEF DEBUGDOCKEDFORMEDITOR} DebugLn('TSourceWindow.SourceEditorPageChanged SourceEditorWindow[' + FSourceWindowIntf.Caption + ']'); {$ENDIF}
|
|
||||||
FNotebookPageChanged(Sender);
|
|
||||||
LPageCtrl := FindModulePageControl(ActiveEditor);
|
|
||||||
if not Assigned(LPageCtrl) then Exit;
|
if not Assigned(LPageCtrl) then Exit;
|
||||||
if LPageCtrl.DesignerPageActive then
|
if LPageCtrl.DesignerPageActive then
|
||||||
begin
|
begin
|
||||||
@ -168,12 +143,37 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSourceWindow.GetActiveEditor: TSourceEditorInterface;
|
||||||
|
begin
|
||||||
|
Result := FSourceWindowIntf.ActiveEditor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceWindow.SetActiveDesignForm(const AValue: TDesignForm);
|
||||||
|
var
|
||||||
|
LPageCtrl: TSourcePageControl;
|
||||||
|
begin
|
||||||
|
if FActiveDesignForm = AValue then Exit;
|
||||||
|
if FActiveDesignForm <> nil then
|
||||||
|
// don't hide now if soon form will be hidden (for example on the IDE start)
|
||||||
|
if not FActiveDesignForm.Hiding then
|
||||||
|
FActiveDesignForm.HideWindow;
|
||||||
|
FActiveDesignForm := AValue;
|
||||||
|
|
||||||
|
LPageCtrl := FindPageControl(ActiveEditor);
|
||||||
|
// important when we want back to tab where was oppened form
|
||||||
|
if (AValue <> nil) then
|
||||||
|
LazarusIDE.DoShowDesignerFormOfSrc(ActiveEditor);
|
||||||
|
|
||||||
|
if LPageCtrl = nil then Exit;
|
||||||
|
LPageCtrl.DesignForm := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSourceWindow.UpdateEditorPageCaption(Sender: TObject);
|
procedure TSourceWindow.UpdateEditorPageCaption(Sender: TObject);
|
||||||
var
|
var
|
||||||
LSourceEditor: TSourceEditorInterface;
|
LSourceEditor: TSourceEditorInterface;
|
||||||
LSourceWindowIntf: TSourceEditorWindowInterface;
|
LSourceWindowIntf: TSourceEditorWindowInterface;
|
||||||
begin
|
begin
|
||||||
// if a unit is cloned to undocked empty source editor window, the ModulePageControl
|
// if a unit is cloned to undocked empty source editor window, the SourcePageControl
|
||||||
// is not created, the only workaround I found is, to activate the new created
|
// is not created, the only workaround I found is, to activate the new created
|
||||||
// source editor in this window
|
// source editor in this window
|
||||||
if not (Sender is TSourceEditorInterface) then Exit;
|
if not (Sender is TSourceEditorInterface) then Exit;
|
||||||
@ -193,35 +193,35 @@ constructor TSourceWindow.Create(ASourceWindowIntf: TSourceEditorWindowInterface
|
|||||||
begin
|
begin
|
||||||
FLastActiveSourceEditor := nil;
|
FLastActiveSourceEditor := nil;
|
||||||
FSourceWindowIntf := ASourceWindowIntf;
|
FSourceWindowIntf := ASourceWindowIntf;
|
||||||
FPageControlList := TSourceEditorPageControls.Create;
|
FPageControlList := TSourcePageControls.Create;
|
||||||
FSourceEditorNotebook := nil;
|
FNotebook := nil;
|
||||||
HookIntoOnPageChanged;
|
HookIntoOnPageChanged;
|
||||||
FSourceWindowIntf.AddUpdateEditorPageCaptionHandler(@UpdateEditorPageCaption);
|
FSourceWindowIntf.AddUpdateEditorPageCaptionHandler(@UpdateEditorPageCaption);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSourceWindow.Destroy;
|
destructor TSourceWindow.Destroy;
|
||||||
begin
|
begin
|
||||||
if Assigned(FSourceEditorNotebook) then
|
if Assigned(FNotebook) then
|
||||||
FSourceEditorNotebook.OnChange := FNotebookPageChanged;
|
FNotebook.OnChange := FDefaultNotebookPageChanged;
|
||||||
FPageControlList.Free;
|
FPageControlList.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceWindow.AddPageCtrl(ASourceEditor: TSourceEditorInterface; APageControl: TModulePageControl);
|
procedure TSourceWindow.AddPageCtrl(APageControl: TSourcePageControl);
|
||||||
begin
|
begin
|
||||||
FPageControlList.Add(ASourceEditor, APageControl);
|
FPageControlList.Add(APageControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceWindow.AdjustPageControl;
|
procedure TSourceWindow.AdjustPageControl;
|
||||||
var
|
var
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
LPageCtrl := FindModulePageControl(ActiveEditor);
|
LPageCtrl := FindPageControl(ActiveEditor);
|
||||||
if LPageCtrl <> nil then
|
if LPageCtrl <> nil then
|
||||||
LPageCtrl.AdjustPage;
|
LPageCtrl.AdjustPage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceWindow.FindModulePageControl(ASourceEditor: TSourceEditorInterface): TModulePageControl;
|
function TSourceWindow.FindPageControl(ASourceEditor: TSourceEditorInterface): TSourcePageControl;
|
||||||
var
|
var
|
||||||
LParent: TWinControl;
|
LParent: TWinControl;
|
||||||
begin
|
begin
|
||||||
@ -230,8 +230,8 @@ begin
|
|||||||
LParent := ASourceEditor.EditorControl.Parent;
|
LParent := ASourceEditor.EditorControl.Parent;
|
||||||
while LParent <> nil do
|
while LParent <> nil do
|
||||||
begin
|
begin
|
||||||
if LParent is TModulePageControl then
|
if LParent is TSourcePageControl then
|
||||||
Exit(TModulePageControl(LParent));
|
Exit(TSourcePageControl(LParent));
|
||||||
LParent := LParent.Parent;
|
LParent := LParent.Parent;
|
||||||
end;
|
end;
|
||||||
Result := nil;
|
Result := nil;
|
||||||
@ -262,9 +262,9 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceWindows.GetLastActiveModulePageControl: TModulePageControl;
|
function TSourceWindows.GetLastActivePageControl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
Result := FindModulePageControl(LastActiveSourceEditor);
|
Result := FindPageControl(LastActiveSourceEditor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceWindows.GetLastActiveSourceEditor: TSourceEditorInterface;
|
function TSourceWindows.GetLastActiveSourceEditor: TSourceEditorInterface;
|
||||||
@ -331,16 +331,16 @@ begin
|
|||||||
Delete(Index);
|
Delete(Index);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceWindows.FindDesignForm(AModulePageCtrl: TModulePageControl): TDesignForm;
|
function TSourceWindows.FindDesignForm(APageCtrl: TSourcePageControl): TDesignForm;
|
||||||
var
|
var
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LSourceEditorInterface: TSourceEditorInterface;
|
LSourceEditorInterface: TSourceEditorInterface;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if AModulePageCtrl = nil then Exit;
|
if APageCtrl = nil then Exit;
|
||||||
for LSourceWindow in Self do
|
for LSourceWindow in Self do
|
||||||
begin
|
begin
|
||||||
if AModulePageCtrl.Owner = LSourceWindow.SourceWindowIntf then
|
if APageCtrl.Owner = LSourceWindow.SourceWindowIntf then
|
||||||
begin
|
begin
|
||||||
LSourceEditorInterface := LSourceWindow.ActiveEditor;
|
LSourceEditorInterface := LSourceWindow.ActiveEditor;
|
||||||
if LSourceEditorInterface = nil then Exit;
|
if LSourceEditorInterface = nil then Exit;
|
||||||
@ -350,7 +350,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceWindows.FindModulePageControl(ASrcEditor: TSourceEditorInterface): TModulePageControl;
|
function TSourceWindows.FindPageControl(ASrcEditor: TSourceEditorInterface): TSourcePageControl;
|
||||||
var
|
var
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
begin
|
begin
|
||||||
@ -373,18 +373,18 @@ end;
|
|||||||
function TSourceWindows.LastSourceEditorNotFound: Boolean;
|
function TSourceWindows.LastSourceEditorNotFound: Boolean;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
begin
|
begin
|
||||||
if (LastActiveSourceWindow = nil) or (LastActiveSourceEditor = nil) then
|
if (LastActiveSourceWindow = nil) or (LastActiveSourceEditor = nil) then
|
||||||
Exit(False);
|
Exit(False);
|
||||||
|
|
||||||
LSourceWindow := SourceWindow[LastActiveSourceWindow];
|
LSourceWindow := SourceWindow[LastActiveSourceWindow];
|
||||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
for LPageCtrl in LSourceWindow.PageControlList do
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
for i := 0 to LastActiveSourceWindow.Count - 1 do
|
for i := 0 to LastActiveSourceWindow.Count - 1 do
|
||||||
if LSourceEditorPageControl.SourceEditor = LastActiveSourceWindow.Items[i] then
|
if LPageCtrl.SourceEditor = LastActiveSourceWindow.Items[i] then
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
Break;
|
Break;
|
||||||
@ -393,7 +393,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// after moving code editor into other window, sometimes IDE switch to other tab
|
// after moving code editor into other window, sometimes IDE switch to other tab
|
||||||
// this line prevent this.
|
// this line prevent this.
|
||||||
LSourceWindow.LastActiveSourceEditor := LSourceEditorPageControl.SourceEditor;
|
LSourceWindow.LastActiveSourceEditor := LPageCtrl.SourceEditor;
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -403,12 +403,12 @@ end;
|
|||||||
procedure TSourceWindows.RefreshActivePageControls;
|
procedure TSourceWindows.RefreshActivePageControls;
|
||||||
var
|
var
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LPageCtrl: TModulePageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
for LSourceWindow in Self do
|
for LSourceWindow in Self do
|
||||||
begin
|
begin
|
||||||
LPageCtrl := LSourceWindow.FindModulePageControl(LSourceWindow.ActiveEditor);
|
LPageCtrl := LSourceWindow.FindPageControl(LSourceWindow.ActiveEditor);
|
||||||
// for example LPageCtrl is nil when we clone module to new window
|
// for example LPageCtrl is nil when we clone source to new window
|
||||||
if (LPageCtrl = nil) or (csDestroying in LSourceWindow.SourceWindowIntf.ComponentState) then
|
if (LPageCtrl = nil) or (csDestroying in LSourceWindow.SourceWindowIntf.ComponentState) then
|
||||||
Continue;
|
Continue;
|
||||||
if (LSourceWindow.ActiveEditor = nil)
|
if (LSourceWindow.ActiveEditor = nil)
|
||||||
@ -428,13 +428,13 @@ end;
|
|||||||
procedure TSourceWindows.RefreshAllPageControls;
|
procedure TSourceWindows.RefreshAllPageControls;
|
||||||
var
|
var
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
for LSourceWindow in SourceWindows do
|
for LSourceWindow in SourceWindows do
|
||||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
for LPageCtrl in LSourceWindow.PageControlList do
|
||||||
begin
|
begin
|
||||||
LSourceEditorPageControl.PageControl.TabPosition := DockedOptions.TabPosition;
|
LPageCtrl.TabPosition := DockedOptions.TabPosition;
|
||||||
LSourceEditorPageControl.PageControl.RefreshResizer;
|
LPageCtrl.RefreshResizer;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -449,20 +449,20 @@ begin
|
|||||||
LastActiveSourceWindow := nil;
|
LastActiveSourceWindow := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceWindows.ShowCodeTabSkipCurrent(CurrentPageCtrl: TModulePageControl; ADesignForm: TDesignForm);
|
procedure TSourceWindows.ShowCodeTabSkipCurrent(CurrentPageCtrl: TSourcePageControl; ADesignForm: TDesignForm);
|
||||||
var
|
var
|
||||||
LSourceWindow: TSourceWindow;
|
LSourceWindow: TSourceWindow;
|
||||||
LSourceEditorPageControl: TSourceEditorPageControl;
|
LPageCtrl: TSourcePageControl;
|
||||||
begin
|
begin
|
||||||
for LSourceWindow in Self do
|
for LSourceWindow in Self do
|
||||||
for LSourceEditorPageControl in LSourceWindow.PageControlList do
|
for LPageCtrl in LSourceWindow.PageControlList do
|
||||||
if LSourceEditorPageControl.PageControl = CurrentPageCtrl then
|
if LPageCtrl = CurrentPageCtrl then
|
||||||
begin
|
begin
|
||||||
LSourceEditorPageControl.PageControl.DesignForm := ADesignForm;
|
LPageCtrl.DesignForm := ADesignForm;
|
||||||
LSourceEditorPageControl.PageControl.InitPage;
|
LPageCtrl.InitPage;
|
||||||
end else
|
end else
|
||||||
if LSourceEditorPageControl.PageControl.DesignForm = ADesignForm then
|
if LPageCtrl.DesignForm = ADesignForm then
|
||||||
LSourceEditorPageControl.PageControl.ShowCode;
|
LPageCtrl.ShowCode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Loading…
Reference in New Issue
Block a user