]> O.S.I.I.S - jp/crow.git/commitdiff
Dynamic layouting debug and improvments
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 7 Sep 2015 14:19:58 +0000 (16:19 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Mon, 7 Sep 2015 14:19:58 +0000 (16:19 +0200)
Templates/Window.goml
Tests/GOLIBTest_4.cs
Tests/GOLIBTest_stack.cs
Tests/Interfaces/test4.goml
Tests/Interfaces/testWindow.goml
Tests/Interfaces/test_stack.goml
Tests/Tests.csproj
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/Window.cs

index d082ca02442dd47fdba65f6f91744426f84e976c..2ec2598774f3bcb10f3da44d5350432e98bae96f 100755 (executable)
@@ -9,6 +9,6 @@
                                        MouseEnter="{Background=Red}" MouseLeave="{Background=Transparent}" MouseClick="butQuitPress"/>\r
                        </HorizontalStack>\r
                </Border>\r
-               <Container Name="Content" Margin="1" Width="0" Height="0"/>\r
+               <Container Name="Content" Margin="0" Width="0" Height="0"/>\r
        </VerticalStack>\r
 </Border>
\ No newline at end of file
index 8b1c7cd24e91f27970ef4451b1dca031b7163cfb..141f41d8c5d0fba3beb7a2a973185f550998a022 100644 (file)
@@ -83,9 +83,6 @@ namespace test
                {\r
                        base.OnLoad (e);\r
 \r
-                       this.Cursor = XCursor.NE;\r
-\r
-\r
                        LoadInterface("Interfaces/test4.goml", out c);\r
                        //LoadInterface("golibtests/test4.xml", out c2);\r
                        //c2.HorizontalAlignment = HorizontalAlignment.Left;\r
index 2164c72148c1c9941a963dece068c987e2542211..18490d6d459e30e33bf843fcd0196d0b8270fc89 100644 (file)
@@ -22,20 +22,12 @@ namespace test
                        : base(1024, 600,"test")\r
                {}\r
 \r
-               VerticalStack g;\r
-\r
                protected override void OnLoad (EventArgs e)\r
                {\r
                        base.OnLoad (e);\r
-                       LoadInterface("Interfaces/test_stack.goml", out g);\r
+                       LoadInterface("Interfaces/test_stack.goml");\r
 \r
                }\r
-               protected override void OnRenderFrame (FrameEventArgs e)\r
-               {\r
-                       GL.Clear (ClearBufferMask.ColorBufferBit);\r
-                       base.OnRenderFrame (e);\r
-                       SwapBuffers ();\r
-               }\r
 \r
                protected override void OnUpdateFrame (FrameEventArgs e)\r
                {\r
index 02dadec85ea81481553c9b08f381d4d68389c0d3..4d824a2e8742508d4263c20e6a42e2221f9b5b81 100755 (executable)
                                                TextAlignment="Center" Background="AoEnglish"/>\r
                                </HorizontalStack>\r
                        </VerticalStack>\r
-                       <HorizontalStack Height="350" Width="150">\r
-                               <Scroller Name="scroller1" Background="DimGray" Height="0" Width="0"  \r
+                       <HorizontalStack Height="350" Width="-1">\r
+                               <Scroller Name="scroller1" Background="DimGray" Height="0" Width="-1"  \r
                                         Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">\r
                                        <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1">\r
                                                <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"\r
index d4246ac293089f52f03a9da610e82a303ff2e3ae..ae9cbc2521983446ad33260a132d91b08ffcacb5 100755 (executable)
@@ -2,23 +2,28 @@
 <!--<Group>-->\r
 <Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,5" \r
        Focusable="True">\r
-       <VerticalStack Height="0" Width="0">\r
-               <Slider Name="slider" Height="10" Width="150"/>\r
-               <Label Text="{fps}"  Background="DarkRed"/>\r
-               <Label Text="{fpsMin}"  />\r
-               <Label Text="{fpsMax}"  />\r
-               <HorizontalStack Width="150" Height="-1" Margin="5" Background="Red">\r
+       <VerticalStack Name="contentVSStack" Height="0" Width="0" Margin="1" Spacing="10">\r
+               <Slider Name="slider" Height="20" Width="0"/>\r
+\r
+               <HorizontalStack Width="0" Height="-1" Margin="0" Background="Red">\r
                        <Checkbox Height="-1" Width="-1"/>\r
                        <Checkbox Height="-1" Width="-1"/>\r
                </HorizontalStack>\r
-               <GroupBox Title="test"  Height="-1" Width="-1" Margin="5">\r
-                       <VerticalStack Width="100">\r
+               <GroupBox Title="test"  Height="0" Width="0" Margin="0">\r
+                       <VerticalStack Width="0">\r
                                <RadioButton  Caption="Radio 1"/>\r
                                <RadioButton  Caption="Radio 2" IsChecked="true"/>\r
                                <RadioButton  Caption="Radio 3"/>\r
-\r
+                               <RadioButton  Caption="Radio 4"/>\r
+                               <RadioButton  Caption="Radio 5"/>\r
+                               <RadioButton  Caption="Radio 6"/>\r
+                               <RadioButton  Caption="Radio 7"/>\r
                        </VerticalStack>\r
                </GroupBox>\r
+<!--           <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->\r
        </VerticalStack>\r
 </Window>\r
 <!--</Group>-->\r
+<!--           <Label Text="{fps}"  Background="DarkRed"/>\r
+               <Label Text="{fpsMin}"  />\r
+               <Label Text="{fpsMax}"  />-->
\ No newline at end of file
index a1b4b4e07be394e47ad5bbfe71e52d0fddde6825..2991a92ebc442e6955f7dd17336d1c26c189c013 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>\r
-<VerticalStack Background="DarkBlue" Height="-1" Width="200">\r
-       <Label Text="label11" Width="0" Background="Green"/>\r
-       <Label Text="label21"/>\r
+<VerticalStack Background="DarkBlue" Height="300" Width="200">\r
+<!--   <Label Text="label11" Width="0" Background="Green"/>\r
+       <Label Text="label21"/>-->\r
 <!--   <HorizontalStack Width="-1" Height="-1" Margin="5"\r
                Focusable="True" Background="Blue">\r
                <Label Text="label12"/>\r
                <Label Text="label52"/>\r
        </HorizontalStack>\r
        <Label Text="label33" Background="Green" Width="0"/>-->\r
+<!--   <Label Text="label43"/>-->\r
+       <Border Margin="10">\r
+       <Label Text="label53" Background="Red" Height="0" CornerRadius="10"/>\r
+       </Border>\r
+       <Label Text="label43"/>\r
        <Label Text="label43"/>\r
-       <Label Text="label53"/>\r
-\r
 </VerticalStack>\r
index c3aca54939f59567e1ef2174a94509d249976620..a85eadf037a70ee3db6ed99f36ba70c50b2518d1 100644 (file)
@@ -8,7 +8,7 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>Tests</RootNamespace>
     <AssemblyName>Tests</AssemblyName>
-    <StartupObject>test3.GOLIBTest_HStack</StartupObject>
+    <StartupObject>test.GOLIBTest_4</StartupObject>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <OutputPath>..\bin\$(configuration)</OutputPath>
     <IntermediateOutputPath>obj\$(configuration)</IntermediateOutputPath>
index fc7aa2477cecfcdffcd1462a7f852fa660a43731..2f9aede9e1a875a350fbc039f90beec85c9d11aa 100644 (file)
@@ -68,13 +68,13 @@ namespace go
                        if (Orientation == Orientation.Horizontal) {\r
                                foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {\r
                                        tmp.Width += c.Slot.Width + Spacing;\r
-                                       tmp.Height = Math.Max (tmp.Height, c.Slot.Bottom);\r
+                                       tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height));\r
                                }\r
                                if (tmp.Width > 0)\r
                                        tmp.Width -= Spacing;\r
                        } else {\r
                                foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {\r
-                                       tmp.Width = Math.Max (tmp.Width, c.Slot.Right);\r
+                                       tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width));\r
                                        tmp.Height += c.Slot.Height + Spacing;\r
                                }\r
                                if (tmp.Height > 0)\r
@@ -125,13 +125,13 @@ namespace go
                                                else if (gobjs.Length == 1) {\r
                                                        int sz = Children.Where(ch=>ch.Visible).Except (gobjs).Sum (g => g.Slot.Width);\r
                                                        if (sz < Slot.Width) {\r
-                                                               gobjs [0].Slot.Width = Slot.Width - sz - (Children.Count-1) * Spacing;\r
+                                                               gobjs [0].Slot.Width = Slot.Width - sz - (Children.Count-1) * Spacing - 2 * Margin;\r
                                                                int idx = Children.IndexOf (gobjs [0]);\r
                                                                if (idx > 0 && idx < Children.Count - 1)\r
                                                                        gobjs [0].Slot.Width -= Spacing;\r
                                                                if (gobjs [0].LastSlots.Width != gobjs [0].Slot.Width) {\r
                                                                        gobjs [0].bmp = null;\r
-                                                                       //gobjs [0].OnLayoutChanges (LayoutingType.Width);\r
+                                                                       gobjs [0].OnLayoutChanges (LayoutingType.Width);\r
                                                                        gobjs [0].LastSlots.Width = gobjs [0].Slot.Width;\r
                                                                }\r
                                                        }\r
@@ -145,12 +145,13 @@ namespace go
                                                else if (gobjs.Length == 1) {\r
                                                        int sz = Children.Where(ch=>ch.Visible).Except (gobjs).Sum (g => g.Slot.Height);\r
                                                        if (sz < Slot.Height) {\r
-                                                               gobjs [0].Slot.Height = Slot.Height - sz- (Children.Count-1) * Spacing;\r
+                                                               gobjs [0].Slot.Height = Slot.Height - sz- (Children.Count-1) * Spacing - 2 * Margin;\r
                                                                int idx = Children.IndexOf (gobjs [0]);\r
                                                                if (idx > 0 && idx < Children.Count - 1)\r
                                                                        gobjs [0].Slot.Height -= Spacing;\r
                                                                if (gobjs [0].LastSlots.Height != gobjs [0].Slot.Height) {\r
                                                                        gobjs [0].bmp = null;\r
+                                                                       gobjs [0].OnLayoutChanges (LayoutingType.Height);\r
                                                                        gobjs [0].LastSlots.Height = gobjs [0].Slot.Height;\r
                                                                }\r
                                                        }\r
index 412942311ddc5d94d4e65cca723748d6bd8509fe..b21598c9abab9231638688193d0ffcff5955c1e2 100644 (file)
@@ -125,6 +125,9 @@ namespace go
                                        int crw = ClientRectangle.Width;\r
                                        foreach (GraphicObject c in Children.Where(ch => ch.Slot.Width != crw && ch.Visible))\r
                                                c.RegisterForLayouting ((int)LayoutingType.X);                                          \r
+                               } else {\r
+                                       foreach (GraphicObject c in Children.Where(ch => ch.Width == 0 && ch.Visible))\r
+                                               c.RegisterForLayouting ((int)LayoutingType.Width);                                                                                      \r
                                }\r
                                break;\r
                        case LayoutingType.Height:\r
@@ -132,6 +135,9 @@ namespace go
                                        int crh = ClientRectangle.Height;\r
                                        foreach (GraphicObject c in Children.Where(ch => ch.Slot.Height != crh && ch.Visible))\r
                                                c.RegisterForLayouting ((int)LayoutingType.Y);                                          \r
+                               } else {\r
+                                       foreach (GraphicObject c in Children.Where(ch => ch.Height == 0 && ch.Visible))\r
+                                               c.RegisterForLayouting ((int)LayoutingType.Height);                                                                                     \r
                                }\r
                                break;\r
                        }\r
index d7988c92b8cd10f0e9fd19c614ec09cdbb4e5ff2..c1a117ebe2f367fded9a53dac4fffe1ea62b7f6e 100644 (file)
@@ -150,9 +150,7 @@ namespace go
                                this.Width += e.XDelta;
                                this.Height += e.YDelta;
                                break;
-                       }
-               
-                       this.RegisterForLayouting ((int)LayoutingType.All);                     
+                       }               
                }
                public override void onMouseLeave (object sender, MouseMoveEventArgs e)
                {