mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 10:28:21 +02:00
dockmanager example: removed old splitter code
git-svn-id: trunk@20731 -
This commit is contained in:
parent
eb2c5237fb
commit
7f6096c9bf
@ -20,7 +20,6 @@ object Dockable: TDockable
|
||||
Top = 0
|
||||
Width = 244
|
||||
Align = alClient
|
||||
OnChangeBounds = Shape1ChangeBounds
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 10
|
||||
|
@ -1,3 +1,5 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TDockable','FORMDATA',[
|
||||
'TPF0'#9'TDockable'#8'Dockable'#4'Left'#3#168#2#6'Height'#3#192#0#3'Top'#2#0#5
|
||||
+'Width'#3#244#0#7'Caption'#6#8'Dockable'#12'ClientHeight'#3#192#0#11'ClientW'
|
||||
@ -5,9 +7,8 @@ LazarusResources.Add('TDockable','FORMDATA',[
|
||||
+'.Height'#2#245#9'Font.Name'#6#13'MS Sans Serif'#8'OnResize'#7#10'FormResize'
|
||||
+#8'Position'#7#17'poOwnerFormCenter'#13'ShowInTaskBar'#7#7'stNever'#10'LCLVe'
|
||||
+'rsion'#6#6'0.9.27'#0#6'TShape'#6'Shape1'#4'Left'#2#0#6'Height'#3#192#0#3'To'
|
||||
+'p'#2#0#5'Width'#3#244#0#5'Align'#7#8'alClient'#14'OnChangeBounds'#7#18'Shap'
|
||||
+'e1ChangeBounds'#0#0#6'TLabel'#6'Label1'#4'Left'#2#10#6'Height'#2#14#3'Top'#2
|
||||
+#10#5'Width'#2'!'#7'Caption'#6#6'Label1'#11'ParentColor'#8#0#0#6'TLabel'#6'L'
|
||||
+'abel2'#4'Left'#2#10#6'Height'#2#14#3'Top'#2' '#5'Width'#2'1'#7'Caption'#6#9
|
||||
+'irgendwas'#11'ParentColor'#8#0#0#0
|
||||
+'p'#2#0#5'Width'#3#244#0#5'Align'#7#8'alClient'#0#0#6'TLabel'#6'Label1'#4'Le'
|
||||
+'ft'#2#10#6'Height'#2#14#3'Top'#2#10#5'Width'#2'!'#7'Caption'#6#6'Label1'#11
|
||||
+'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#10#6'Height'#2#14#3'Top'#2
|
||||
+' '#5'Width'#2'1'#7'Caption'#6#9'irgendwas'#11'ParentColor'#8#0#0#0
|
||||
]);
|
||||
|
@ -18,7 +18,6 @@ type
|
||||
Shape1: TShape;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormResize(Sender: TObject);
|
||||
procedure Shape1ChangeBounds(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
@ -44,14 +43,8 @@ begin
|
||||
]);
|
||||
end;
|
||||
|
||||
procedure TDockable.Shape1ChangeBounds(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$i fDockable.lrs}
|
||||
{$i fDockable.lrs}
|
||||
|
||||
end.
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TEasyDockMain','FORMDATA',[
|
||||
'TPF0'#13'TEasyDockMain'#12'EasyDockMain'#4'Left'#3#24#1#6'Height'#3#29#1#3'T'
|
||||
+'op'#2'{'#5'Width'#3#254#1#13'ActiveControl'#7#6'buDump'#7'Caption'#6#12'Eas'
|
||||
|
@ -16,7 +16,7 @@ unit fMain;
|
||||
//some defines, to demonstrate LCL flaws
|
||||
{$DEFINE Docker} //using control (undef: entire form) as dock site
|
||||
{$DEFINE easy} //using EasyDockSite (undef: default LDockTree)
|
||||
{$DEFINE dragForm} //create a form from the draggable images (or drag images)
|
||||
{.$DEFINE dragForm} //create a form from the draggable images (or drag images)
|
||||
//dragging forms is not supported on all platforms!
|
||||
|
||||
|
||||
|
@ -375,11 +375,8 @@ begin
|
||||
while zone <> nil do begin
|
||||
if (SitePos.X > zone.Right) or (SitePos.Y > zone.Bottom) then
|
||||
zone := zone.NextSibling
|
||||
{$IFDEF newSplitter}
|
||||
else if zone.HasSizer and PtInRect(zone.GetPartRect(zpSizer), SitePos) then
|
||||
break
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
else if zone.FirstChild <> nil then
|
||||
zone := zone.FirstChild
|
||||
else begin
|
||||
@ -577,11 +574,7 @@ begin
|
||||
OldZone.Free;
|
||||
end;
|
||||
end;
|
||||
{$IFDEF newSplitter}
|
||||
ResetBounds(True); //splitters may have to be inserted
|
||||
{$ELSE}
|
||||
FDockSite.Invalidate;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TEasyTree.PositionDockRect(ADockObject: TDragDockObject);
|
||||
@ -741,26 +734,19 @@ var
|
||||
Control: TControl;
|
||||
MouseMsg: TLMMouse absolute Message;
|
||||
Zone: TEasyZone;
|
||||
MousePos: TPoint;
|
||||
|
||||
function FindZone(fButtonDown: boolean): TEasyZonePart;
|
||||
var
|
||||
MousePos: TPoint;
|
||||
begin
|
||||
MousePos := SmallPointToPoint(MouseMsg.Pos);
|
||||
Zone := ZoneFromPoint(MousePos);
|
||||
//exact zone part
|
||||
{$IFDEF newSplitter}
|
||||
if (Zone = nil) then begin
|
||||
{$ELSE}
|
||||
if (Zone = nil) or (Zone.ChildControl = nil) then begin
|
||||
{$ENDIF}
|
||||
Result := zpNowhere;
|
||||
Control := nil;
|
||||
end else begin
|
||||
Control := Zone.ChildControl;
|
||||
Result := FHeader.FindPart(zone, MousePos, fButtonDown);
|
||||
//assert(Result in [zpNowhere..zpCloseButton], 'bad part');
|
||||
//DebugLn('IN ', PartNames[Result]);
|
||||
end;
|
||||
Part := Result;
|
||||
end;
|
||||
@ -806,8 +792,13 @@ begin
|
||||
case FindZone(False) of
|
||||
zpCaption: // mouse down on not buttons => start drag
|
||||
begin //problem here - app hangs!
|
||||
(* perhaps the mousedown
|
||||
*)
|
||||
DebugLn('start dragging from header: %s', [FDockSite.GetDockCaption(Control)]);
|
||||
Control.BeginDrag(False);
|
||||
//MousePos := Control.ClientToScreen(Point(1,1));
|
||||
//Mouse.CursorPos := MousePos; //todo: inside control?
|
||||
Control.BeginDrag(False); //doesn't work!?
|
||||
//Control.BeginDrag(True); //floats only - due to mouse outside control?
|
||||
end;
|
||||
end;
|
||||
LM_MOUSEMOVE:
|
||||
@ -1397,7 +1388,6 @@ begin
|
||||
// In a parent zone of vertical orientation the zone.PrevSibling.Bottom is zone.Top
|
||||
(* NewSplitter: exclude higher level splitters.
|
||||
*)
|
||||
{$IFDEF NewSplitter}
|
||||
zone := self;
|
||||
if zone.Parent <> nil then begin
|
||||
if (fTop = (zone.Parent.Orientation = doVertical)) then begin
|
||||
@ -1420,27 +1410,6 @@ begin
|
||||
end else begin
|
||||
Result := 0;
|
||||
end;
|
||||
{$ELSE} //include all splitters
|
||||
zone := self;
|
||||
while zone.Parent <> nil do begin
|
||||
if (fTop = (zone.Parent.Orientation = doVertical)) then begin
|
||||
prev := zone.PrevSibling;
|
||||
while prev <> nil do begin
|
||||
if prev.Visible then begin
|
||||
if fTop then
|
||||
Result := prev.Bottom
|
||||
else
|
||||
Result := prev.Right;
|
||||
exit;
|
||||
end;
|
||||
prev := prev.PrevSibling;
|
||||
end;
|
||||
end;
|
||||
zone := zone.Parent;
|
||||
end;
|
||||
//reached top zone
|
||||
Result := 0;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TEasyZone.GetLeft: Integer;
|
||||
|
@ -54,15 +54,9 @@ const //zone decoration sizes
|
||||
//minimal (Delphi) header
|
||||
GrabberSize = 10; // 12;
|
||||
dDDist = 1;
|
||||
{$IFDEF newSplitter}
|
||||
dDBorder = 1;
|
||||
dDHeader = GrabberSize; //?
|
||||
dDButton = GrabberSize - 2*dDBorder; //10?
|
||||
{$ELSE}
|
||||
dDBorder = 1;
|
||||
dDHeader = GrabberSize + dSizer; //?
|
||||
dDButton = GrabberSize - dDBorder; // 2*dDBorder; //10?
|
||||
{$ENDIF}
|
||||
|
||||
(* Zone part map.
|
||||
In portrait mode (header on top), the zone rectangle is adjusted according
|
||||
@ -76,7 +70,6 @@ const //zone decoration sizes
|
||||
zpAll excludes the splitter and client area.
|
||||
zpCaption excludes borders and buttons from zpAll.
|
||||
*)
|
||||
{$IFDEF newSplitter}
|
||||
(*
|
||||
The splitter is excluded first, if present.
|
||||
[zpSizer] entry is unused.
|
||||
@ -107,36 +100,6 @@ HeaderPartMap: array[TEasyHeaderStyle, TEasyZonePart] of TZonePartMap = (
|
||||
(dTop:dBorder; dBottom:-dButton; dLeft:-dButton; dRight:dBorder) //zpCloseButton // header close button
|
||||
)
|
||||
);
|
||||
{$ELSE}
|
||||
(* Sizer in header, just before caption
|
||||
*)
|
||||
HeaderPartMap: array[TEasyHeaderStyle, TEasyZonePart] of TZonePartMap = (
|
||||
//hsMinimal
|
||||
(
|
||||
{zpNowhere} (),
|
||||
{zpClient} (dTop:dDHeader; dBottom:0),
|
||||
{zpAll} (dTop:dSizer; dBottom:-dDHeader),
|
||||
{zpCaption} (dTop:dSizer+dDBorder; dBottom:-dDButton; dLeft:dDBorder; dRight:2*dDBorder+dDButton),
|
||||
{zpSizer} (dTop:0; dBottom:-dSizer),
|
||||
{$IFDEF restore}
|
||||
{zpRestoreButton} (),
|
||||
{$ENDIF}
|
||||
{zpCloseButton} (dTop:dSizer+dDBorder; dBottom:-dDButton; dLeft:-dDButton; dRight:dDBorder)
|
||||
),
|
||||
//hsForm
|
||||
(
|
||||
(), //zpNowhere - not in any zone
|
||||
(dTop:dHeader+dSizer; dBottom:0), //zpClient - on client control
|
||||
(dTop:dSizer; dBottom:-dHeader), //zpAll - total header rect
|
||||
(dTop:dSizer+dBorder; dBottom:-dButton; dLeft:dBorder; dRight:dBorder+dButton), //zpCaption
|
||||
(dTop:0; dBottom:-dSizer), //zpSizer - splitter/sizer
|
||||
{$IFDEF restore}
|
||||
(dTop:dSizer+dBorder; dBottom:-dButton; dLeft:-dButton; dRight:dButton+2*dBorder) //zpRestoreButton, // header restore button
|
||||
{$ENDIF}
|
||||
(dTop:dSizer+dBorder; dBottom:-dButton; dLeft:-dButton; dRight:dBorder) //zpCloseButton // header close button
|
||||
)
|
||||
);
|
||||
{$ENDIF}
|
||||
|
||||
constructor TEasyDockHeader.Create;
|
||||
|
||||
@ -181,7 +144,6 @@ begin
|
||||
Result := ARect;
|
||||
with HeaderPartMap[Style, APart] do begin
|
||||
if AOrientation = doVertical then begin //portrait
|
||||
{$IFDEF newSplitter}
|
||||
//handle client w/o splitter
|
||||
if (APart = zpSizer) then begin
|
||||
Result.Bottom := Result.Top + dSizer;
|
||||
@ -189,8 +151,6 @@ begin
|
||||
end;
|
||||
if HasSplitter then
|
||||
inc(Result.Top, dSizer); //exclude splitter(?)
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
if dTop > 0 then
|
||||
inc(Result.Top, dTop);
|
||||
if dBottom > 0 then
|
||||
@ -208,7 +168,6 @@ begin
|
||||
if dLeft < 0 then
|
||||
Result.Left := Result.Right + dLeft;
|
||||
end else begin //landscape
|
||||
{$IFDEF newSplitter}
|
||||
//handle client w/o splitter
|
||||
if (APart = zpSizer) then begin
|
||||
Result.Right := Result.Left + dSizer;
|
||||
@ -216,8 +175,6 @@ begin
|
||||
end;
|
||||
if HasSplitter then
|
||||
inc(Result.Left, dSizer);
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
if dTop > 0 then
|
||||
inc(Result.Left, dTop);
|
||||
if dBottom > 0 then
|
||||
|
Loading…
Reference in New Issue
Block a user