<?xml version="1.0"?>
<Docker Background="Onyx">
<DockWindow Left="100" Top="100" Width="150" Height="150" Background="DarkRed" />
- <DockWindow Left="200" Top="200" Width="150" Height="150" Background="DarkGreen"/>
- <DockWindow Left="300" Top="300" Width="150" Height="150" Background="Blue"/>
- <DockWindow Left="400" Top="400" Width="150" Height="150" Background="DarkYellow"/>
- <DockWindow Left="500" Top="500" Width="150" Height="150" Background="Yellow"/>
+ <DockWindow Left="150" Top="150" Width="150" Height="150" Background="DarkGreen"/>
+ <DockWindow Left="200" Top="200" Width="150" Height="150" Background="Blue"/>
+ <DockWindow Left="250" Top="250" Width="150" Height="150" Background="DarkYellow"/>
+ <DockWindow Left="300" Top="300" Width="150" Height="150" Background="Yellow"/>
+ <DockWindow Left="350" Top="350" Width="150" Height="150" Background="BrownWeb"/>
+ <DockWindow Left="400" Top="400" Width="150" Height="150" Background="Teal"/>
+ <DockWindow Left="450" Top="450" Width="150" Height="150" Background="Maize"/>
</Docker>
<!--<Group Background="Jet" Margin = "0" Focusable="true" >
<Window Top="100" Left="100" Focusable="true" Caption="View 1" Width="300" Height="300"><GraphicObject Background="Green" Focusable="true" MouseEnter="{Background=Gray}" MouseLeave="{Background=Green}"/></Window>
dw.DockingPosition = Alignment.Top;
else if (lm.Y > r.Bottom - vTreshold)
dw.DockingPosition = Alignment.Bottom;
- else {
+ else if (this.Children.Contains (rootDock.CenterDockedObj) && !(rootDock.CenterDockedObj is DockWindow)) {
r.Inflate (-r.Width / 3, -r.Height / 3);
- if (r.ContainsOrIsEqual(lm))
+ if (r.ContainsOrIsEqual (lm))
dw.DockingPosition = Alignment.Center;
else
dw.DockingPosition = Alignment.Undefined;
- }
+ } else
+ dw.DockingPosition = Alignment.Undefined;
if (curDockPos != dw.DockingPosition)
RegisterForGraphicUpdate ();
RemoveChild(dw);
if (rootDock.CenterDockedObj == dw) {
- rootDock.CenterDockedObj = new GraphicObject (IFace) { IsEnabled = false, Background = Color.AmberSaeEce.AdjustAlpha(0.3) };
+ rootDock.CenterDockedObj = new GraphicObject (IFace) { IsEnabled = false };
InsertChild (idx, rootDock.CenterDockedObj);
SubStack = rootDock.CenterDockedObj;
}else if (dw.DockingPosition == Alignment.Left || dw.DockingPosition == Alignment.Top)
dsp.InsertChild (idx, SubStack);
dsp.SubStack = SubStack;
return;
-
-// Docker dk = Parent as Docker;
-// dk.RemoveChild (this);
-// dk.AddChild (SubStack);
-// dk.SubStack = SubStack;
-
-// if (SubStack is DockStack) {
-// Docker dk = Parent as Docker;
-// dk.RemoveChild (this);
-// dk.InsertChild (0, SubStack);
-// dk.SubStack = SubStack as DockStack;
-// }
-// SubStack = null;
-// return;
-// }
-// GraphicObject g = Children [0];
-// RemoveChild (g);
-// int i = dsp.Children.IndexOf (this);
-// dsp.RemoveChild (this);
-// dsp.InsertChild (i, g);
-// dsp.SubStack = g;
}
public void Dock(DockWindow dw){
Splitter splitter = instSplit.CreateInstance<Splitter> ();
int hTreshold = r.Width / dockingDiv;
DockStack activeStack = this;
-
+ Console.WriteLine ("******* Dockingtack {0}", this.Name);
if (Children.Count == 1) {
activeStack = this;
Orientation = dw.DockingPosition.GetOrientation ();
- }else if (dw.DockingPosition.GetOrientation() != Orientation) {
- int i = Children.IndexOf (rootDock.CenterDockedObj);
- RemoveChild (rootDock.CenterDockedObj);
+ }else if (dw.DockingPosition.GetOrientation() != Orientation) {
activeStack = instStack.CreateInstance<DockStack> ();
- activeStack.SubStack = rootDock.CenterDockedObj;
- SubStack = activeStack;
- InsertChild(i, activeStack);
- activeStack.AddChild (rootDock.CenterDockedObj);
+ int ci = Children.IndexOf (rootDock.CenterDockedObj);
+ if (ci <0 ){
+ DockStack dsp = Parent as DockStack;
+ if (dsp != null) {
+ int idx = dsp.Children.IndexOf (this);
+ dsp.RemoveChild (this);
+ dsp.SubStack = activeStack;
+ dsp.InsertChild (idx, activeStack);
+ activeStack.SubStack = this;
+ activeStack.AddChild (this);
+ } else {
+ Docker dk = Parent as Docker;
+ dk.RemoveChild (this);
+ dk.InsertChild (0, activeStack);
+ dk.SubStack = activeStack;
+ activeStack.AddChild (this);
+ activeStack.SubStack = this;
+ }
+ }else{
+ int i = Children.IndexOf (SubStack);
+ RemoveChild (SubStack);
+ activeStack.SubStack = SubStack;
+ SubStack = activeStack;
+ InsertChild(i, activeStack);
+ activeStack.AddChild (activeStack.SubStack);
+ }
activeStack.Orientation = dw.DockingPosition.GetOrientation ();
}
-
+ Console.WriteLine ("Docking {0} in {1}", dw.Name, activeStack.Name);
switch (dw.DockingPosition) {
case Alignment.Top:
dw.Height = vTreshold;
return Slot.ContainsOrIsEqual(m);
}
-// public override void OnLayoutChanges (LayoutingType layoutType)
-// {
-// base.OnLayoutChanges (layoutType);
-//
-// if (isDocked)
-// return;
-
-// Docker dv = Parent as Docker;
-// if (dv == null)
-// return;
-//
-// Rectangle dvCliRect = dv.ClientRectangle;
-//
-// if (layoutType == LayoutingType.X) {
-// if (Slot.X < dv.DockingThreshold)
-// dock (Alignment.Left);
-// else if (Slot.Right > dvCliRect.Width - dv.DockingThreshold)
-// dock (Alignment.Right);
-// }else if (layoutType == LayoutingType.Y) {
-// if (Slot.Y < dv.DockingThreshold)
-// dock (Alignment.Top);
-// else if (Slot.Bottom > dvCliRect.Height - dv.DockingThreshold)
-// dock (Alignment.Bottom);
-// }
-// }
-//
public override void onMouseMove (object sender, MouseMoveEventArgs e)
{
lastMousePos = e.Position;
void dock (DockStack target){
if (RootDock.CenterDockedObj is DockWindow && DockingPosition == Alignment.Center)
return;
+
lock (IFace.UpdateMutex) {
IsDocked = true;
- undockingMousePosOrig = lastMousePos;
+ //undockingMousePosOrig = lastMousePos;
savedSlot = this.LastPaintedSlot;
wasResizable = Resizable;
Resizable = false;