mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 19:18:14 +02:00
dockmanager example: improved queue handling.
git-svn-id: trunk@20792 -
This commit is contained in:
parent
aed2c24191
commit
2e40dd65d5
@ -8,7 +8,7 @@
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<Title Value="easyeditor"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
<ActiveEditorIndexAtStart Value="2"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -36,14 +36,14 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="24">
|
||||
<Units Count="27">
|
||||
<Unit0>
|
||||
<Filename Value="easyeditor.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="easyeditor"/>
|
||||
<CursorPos X="47" Y="17"/>
|
||||
<CursorPos X="1" Y="15"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="54"/>
|
||||
<UsageCount Value="56"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="editmain.pas"/>
|
||||
@ -51,10 +51,10 @@
|
||||
<ComponentName Value="MainForm"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="EditMain"/>
|
||||
<CursorPos X="38" Y="90"/>
|
||||
<TopLine Value="70"/>
|
||||
<CursorPos X="1" Y="14"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="54"/>
|
||||
<UsageCount Value="56"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
@ -63,10 +63,10 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="fDockBook"/>
|
||||
<CursorPos X="1" Y="286"/>
|
||||
<TopLine Value="238"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="34"/>
|
||||
<CursorPos X="24" Y="28"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="35"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
@ -197,9 +197,7 @@
|
||||
<Filename Value="..\..\..\lcl\include\customform.inc"/>
|
||||
<CursorPos X="1" Y="1690"/>
|
||||
<TopLine Value="1666"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="feditform.pas"/>
|
||||
@ -209,140 +207,149 @@
|
||||
<UnitName Value="fEditForm"/>
|
||||
<CursorPos X="37" Y="41"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="23"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="25"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="feditbook.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="EditBook"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="fEditBook"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<CursorPos X="59" Y="6"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="10"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="..\..\..\lcl\comctrls.pp"/>
|
||||
<UnitName Value="ComCtrls"/>
|
||||
<CursorPos X="14" Y="1456"/>
|
||||
<TopLine Value="1432"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
<Filename Value="..\..\..\lcl\include\toolbutton.inc"/>
|
||||
<CursorPos X="1" Y="320"/>
|
||||
<TopLine Value="287"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit25>
|
||||
<Unit26>
|
||||
<Filename Value="..\..\..\lcl\themes.pas"/>
|
||||
<UnitName Value="Themes"/>
|
||||
<CursorPos X="17" Y="2020"/>
|
||||
<TopLine Value="2005"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit26>
|
||||
</Units>
|
||||
<JumpHistory Count="29" HistoryIndex="28">
|
||||
<JumpHistory Count="26" HistoryIndex="25">
|
||||
<Position1>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="58" Column="1" TopLine="24"/>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="67" Column="3" TopLine="65"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="116" Column="5" TopLine="68"/>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="103" Column="7" TopLine="75"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="213" Column="1" TopLine="178"/>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="92" Column="1" TopLine="67"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="77" Column="25" TopLine="71"/>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="229" Column="10" TopLine="220"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="85" Column="19" TopLine="71"/>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="232" Column="48" TopLine="224"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="103" Column="27" TopLine="75"/>
|
||||
<Caret Line="83" Column="19" TopLine="75"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="67" Column="3" TopLine="65"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="103" Column="7" TopLine="75"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="92" Column="1" TopLine="67"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="229" Column="10" TopLine="220"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="232" Column="48" TopLine="224"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="83" Column="19" TopLine="75"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="232" Column="42" TopLine="205"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="238" Column="21" TopLine="208"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="89" Column="19" TopLine="64"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="14" Column="7" TopLine="1"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="24" Column="20" TopLine="1"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="13" Column="24" TopLine="1"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="47" Column="1" TopLine="1"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="40" Column="27" TopLine="10"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="11" Column="31" TopLine="1"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="14" Column="7" TopLine="1"/>
|
||||
<Caret Line="83" Column="1" TopLine="59"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="24" Column="20" TopLine="1"/>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="41" Column="1" TopLine="1"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="13" Column="24" TopLine="1"/>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="97" Column="1" TopLine="54"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="47" Column="1" TopLine="1"/>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="244" Column="9" TopLine="236"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="40" Column="27" TopLine="10"/>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="30" Column="6" TopLine="10"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="11" Column="31" TopLine="1"/>
|
||||
<Caret Line="89" Column="21" TopLine="64"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="83" Column="1" TopLine="59"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="41" Column="1" TopLine="1"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="97" Column="1" TopLine="54"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="244" Column="9" TopLine="236"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="30" Column="6" TopLine="10"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="editmain.pas"/>
|
||||
<Caret Line="89" Column="21" TopLine="64"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="feditform.pas"/>
|
||||
<Caret Line="41" Column="37" TopLine="1"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="..\..\..\lcl\include\customform.inc"/>
|
||||
<Caret Line="1690" Column="1" TopLine="1666"/>
|
||||
</Position29>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="37" Column="27" TopLine="1"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="feditbook.pas"/>
|
||||
<Caret Line="14" Column="73" TopLine="1"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="feditbook.pas"/>
|
||||
<Caret Line="44" Column="1" TopLine="12"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\package\fdockbook.pas"/>
|
||||
<Caret Line="28" Column="24" TopLine="1"/>
|
||||
</Position26>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
@ -351,6 +358,13 @@
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)\"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
|
@ -7,7 +7,7 @@ uses
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, EditMain, EasyDockMgr, fEditForm;
|
||||
Forms, EditMain, EasyDockMgr, fEditForm, fEditBook;
|
||||
|
||||
{$IFDEF WINDOWS}{$R easyeditor.rc}{$ENDIF}
|
||||
|
||||
|
@ -9,9 +9,9 @@ multiple editor windows. It does not demonstrate any editing capabilities.
|
||||
|
||||
This is the first working version of dockable SynEdit components.
|
||||
|
||||
ToDo:
|
||||
- maintain a list of open editor windows
|
||||
- open files in the (last) active editor window
|
||||
Done:
|
||||
+ maintain a list of open editor windows (active window first)
|
||||
+ open files in the (last) active editor window
|
||||
|
||||
*)
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
object EditBook: TEditBook
|
||||
inherited EditBook: TEditBook
|
||||
Left = 310
|
||||
Height = 300
|
||||
Top = 159
|
||||
Width = 400
|
||||
Caption = 'EditBook'
|
||||
OnActivate = FormActivate
|
||||
LCLVersion = '0.9.27'
|
||||
OnClose = FormClose
|
||||
end
|
||||
|
@ -1,7 +1,6 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TEditBook','FORMDATA',[
|
||||
'TPF0'#9'TEditBook'#8'EditBook'#4'Left'#3'6'#1#6'Height'#3','#1#3'Top'#3#159#0
|
||||
+#5'Width'#3#144#1#7'Caption'#6#8'EditBook'#10'OnActivate'#7#12'FormActivate'
|
||||
+#10'LCLVersion'#6#6'0.9.27'#0#0
|
||||
'TPF0'#241#9'TEditBook'#8'EditBook'#4'Left'#3'6'#1#3'Top'#3#159#0#7'Caption'#6
|
||||
+#8'EditBook'#10'OnActivate'#7#12'FormActivate'#7'OnClose'#7#9'FormClose'#0#0
|
||||
]);
|
||||
|
@ -1,4 +1,10 @@
|
||||
unit fEditBook;
|
||||
(* Maintain a chain of active (editor) windows.
|
||||
Move form to front whenever activated.
|
||||
Dequeue form when destroyed.
|
||||
|
||||
The queue head is stored in the global variable MRUEdit;
|
||||
*)
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -11,17 +17,17 @@ uses
|
||||
type
|
||||
TEditBook = class(TEasyDockBook)
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
private
|
||||
{ private declarations }
|
||||
protected
|
||||
NRUEdit: TEditBook;
|
||||
NRUEdit: TEditBook; //Next Recently Used EditBook
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
EditBook: TEditBook;
|
||||
MRUEdit: TEditBook;
|
||||
MRUEdit: TEditBook; //Most Rectently Used EditBook
|
||||
|
||||
implementation
|
||||
|
||||
@ -31,15 +37,33 @@ procedure TEditBook.FormActivate(Sender: TObject);
|
||||
var
|
||||
prev: TEditBook;
|
||||
begin
|
||||
//enQ self as first
|
||||
if MRUEdit = Self then
|
||||
exit;
|
||||
exit; //is alread head
|
||||
prev := MRUEdit;
|
||||
while (prev <> nil) and (prev.NRUEdit <> self) do
|
||||
prev := prev.NRUEdit;
|
||||
if prev <> nil then
|
||||
prev.NRUEdit := self.NRUEdit;
|
||||
NRUEdit := MRUEdit;
|
||||
MRUEdit := self;
|
||||
prev.NRUEdit := self.NRUEdit; //was already in Q
|
||||
NRUEdit := MRUEdit; //old head
|
||||
MRUEdit := self; //become head
|
||||
end;
|
||||
|
||||
procedure TEditBook.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
var
|
||||
prev: TEditBook;
|
||||
begin
|
||||
//deQ self
|
||||
prev := MRUEdit;
|
||||
if prev = self then
|
||||
MRUEdit := NRUEdit
|
||||
else begin
|
||||
while (prev <> nil) and (prev.NRUEdit <> self) do
|
||||
prev := prev.NRUEdit;
|
||||
if prev.NRUEdit = self then
|
||||
prev.NRUEdit := NRUEdit;
|
||||
//else not in chain?
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
@ -7,7 +7,7 @@ Unmanaged docking requires:
|
||||
- OnGetSiteInfo handler, at least indicating acceptance
|
||||
- OnDockOver handler, indicating acceptance, optionally placing the DockRect
|
||||
- OnDockDrop handler, when the control is not docked as an immediate client
|
||||
of the dock site (here: into dedicated panel).
|
||||
of the dock site (here: dedicated panel becomes the Parent).
|
||||
|
||||
In this (notebook) implementation:
|
||||
The form is a dock site that manages docked clients itself.
|
||||
@ -23,6 +23,9 @@ In this (notebook) implementation:
|
||||
TWinControls are not really draggable, unless they have parts that do not
|
||||
normally react on mouse buttons (borders...). E.g. a SynEdit has to be wrapped
|
||||
into a form, before it can be dragged and docked by dragging the form.
|
||||
|
||||
Apply ToolButtonAutoSizeAlign.patch to improve the appearance and behaviour
|
||||
of the toolbar buttons.
|
||||
*)
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
Loading…
Reference in New Issue
Block a user