]> O.S.I.I.S - jp/crow.git/commitdiff
docker debug
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 4 Mar 2018 21:26:24 +0000 (22:26 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 4 Mar 2018 21:26:24 +0000 (22:26 +0100)
Default.style
Tests/Interfaces/Experimental/testDock.crow
src/GraphicObjects/DockStack.cs
src/GraphicObjects/DockWindow.cs
src/GraphicObjects/Docker.cs

index 2b905e3fc44517245fa969eac3e6bb5f7422206f..d4e7e4a7674994cb09ef4e0fc9be595cabf06f43 100644 (file)
@@ -111,15 +111,15 @@ ToolWindow {
 }
 Docker {
        AllowDrop = "false";
-       Margin="5";
+       Margin="1";
        Focusable="true";
 }
 DockStack {
-       Margin="5";
+       Margin="3";
        AllowDrop = "true";
        Focusable="true";
-       //DragEnter="{Background=DarkBlue}";
-       //DragLeave="{Background=Jet}";
+       //DragEnter="{Background=Blue}";
+       //DragLeave="{Background=Transparent}";
        //EndDrag="{Background=Jet}";
 }
 DockWindow {
index 38727e281c4ce6b574e34419623ff2ddcf894747..3f1aaa3d41d372c38f5ad928c3a8b52324103af4 100644 (file)
@@ -1,10 +1,13 @@
 <?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>
index 2c99a8b61dc5e3dfbfddfd725d5b12ef02849cd1..79643b4758461404bf0f2f5d65f1f19bb4c7c72d 100644 (file)
@@ -113,13 +113,14 @@ namespace Crow
                                        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 ();
@@ -213,7 +214,7 @@ namespace Crow
                        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)                          
@@ -234,27 +235,6 @@ namespace Crow
                        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> ();
@@ -264,21 +244,41 @@ namespace Crow
                        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;
index c793411492918cce218d806630454f4d3606b6e1..f333f6c4bc36dab742441fd34d311471689fc57c 100644 (file)
@@ -87,32 +87,6 @@ namespace Crow
                        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;
@@ -172,9 +146,10 @@ namespace Crow
                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;
index f189907c2bb5ba6cded2aab4ea5d33e7665a4666..3803d8dd4891081383d799ce42cf13856a84af99 100644 (file)
@@ -61,7 +61,7 @@ namespace Crow
                protected override void onInitialized (object sender, EventArgs e)
                {
                        base.onInitialized (sender, e);
-                       CenterDockedObj = new GraphicObject (IFace) { IsEnabled = false, Background = Color.Cobalt };
+                       CenterDockedObj = new GraphicObject (IFace) { IsEnabled = false };
                }
 
                public override void AddChild (GraphicObject g)
@@ -69,6 +69,13 @@ namespace Crow
                        base.AddChild (g);
                        g.LogicalParent = this;
                }
+               public override void RemoveChild (GraphicObject child)
+               {
+                       lock (IFace.UpdateMutex) {
+                               RegisterClip (ScreenCoordinates (LastPaintedSlot));
+                       }
+                       base.RemoveChild (child);
+               }
 
                public override void onMouseMove (object sender, MouseMoveEventArgs e)
                {