]> O.S.I.I.S - jp/crow.git/commitdiff
code clean and debug
authorjpbruyere <jp.bruyere@hotmail.com>
Sun, 1 Jan 2017 17:23:48 +0000 (18:23 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sun, 1 Jan 2017 17:23:48 +0000 (18:23 +0100)
Tests/BasicTests.cs
Tests/Interfaces/TemplatedContainer/testDirViewer2.crow [deleted file]
Tests/Tests.csproj
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/PrivateContainer.cs
src/Interface.cs
src/Rectangles.cs

index 62fc6eb59a3f70abd726860d65e3dbbf145571b7..1ae9094f318bc8040be6e0fb9987be817e2c8c45 100644 (file)
@@ -131,14 +131,17 @@ namespace Tests
                        testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/test2WayBinding.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/testPropLess.crow" };
-                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray ();
-                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray ();
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray ();
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedContainer", "*.crow")).ToArray ();
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray ();
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray ();
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Unsorted", "*.crow")).ToArray ();
 
                        object tc = Color.AirForceBlueRaf;
                        CrowInterface.LoadInterface(testFiles[idx]).DataSource = this;
@@ -230,6 +233,7 @@ namespace Tests
                {
                        Console.WriteLine ("starting example");
                        BasicTests win = new BasicTests ();
+                       win.VSync = OpenTK.VSyncMode.Adaptive;
                        win.Run (30);
                }
                protected override void OnUpdateFrame (OpenTK.FrameEventArgs e)
diff --git a/Tests/Interfaces/TemplatedContainer/testDirViewer2.crow b/Tests/Interfaces/TemplatedContainer/testDirViewer2.crow
deleted file mode 100644 (file)
index c4f0904..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<HorizontalStack>
-       <Window Resizable="false" Focusable="true" Title="Open File..." Width="20%" Height="100%"
-                       MinimumSize="10,1">
-               <DirectoryView Name="dv" Margin="10" Root="./" SelectedItemChanged="Tv_SelectedItemChanged"/>
-       </Window>
-       <Splitter/>
-       <VerticalStack Width="80%" Height="100%">
-               <Window Resizable="false" Focusable="true" Title="{../dv.SelectedItem}"
-                               Height="50%" Width="Stretched"
-                               MinimumSize="10,1">
-                       <Container Margin="10" Name="crowContainer"/>
-               </Window>
-               <Splitter/>
-               <Window Resizable="false" Focusable="true" Title="{../dv.SelectedItem}"
-                               Height="50%" Width="Stretched"
-                               MinimumSize="10,1">
-                       <TextBox Multiline="true" Margin="10" Height="Stretched"
-                               Text="{CurSources}"/>
-               </Window>
-       </VerticalStack>
-</HorizontalStack>
index 6e460322e919253a39507a51b5792e2e7a02b0ce..e5d7ec71eabb6b6de475d29ef5fa630fae281de6 100644 (file)
     <None Include="Interfaces\TemplatedContainer\test_Listbox.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
-    <None Include="Interfaces\TemplatedContainer\testDirViewer2.crow">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
     <None Include="Interfaces\TemplatedContainer\testGroupBox.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
index 9c1a8cc436fc38af7aa0940b42a2c978f34660bc..e5313ea2cc6d4366eeb9d99dbbf9158316ca27ac 100644 (file)
@@ -1084,9 +1084,6 @@ namespace Crow
                /// of the widget </summary>
                public virtual void Paint (ref Context ctx)
                {
-                       if (!Visible)
-                               return;
-
                        //TODO:this test should not be necessary
                        if (Slot.Height < 0 || Slot.Width < 0)
                                return;
index 0afefeb910dacd90b3cc3a0407e71fb8a5d77747..9c65e935a36bc1962d84e2ecce965388b396d748 100644 (file)
@@ -158,8 +158,10 @@ namespace Crow
                                gr.Clip ();
                        }
 
-                       if (child != null)
-                               child.Paint (ref gr);
+                       if (child != null) {
+                               if (child.Visible)
+                                       child.Paint (ref gr);
+                       }
                        gr.Restore ();
                }
                protected override void UpdateCache (Context ctx)
index b90f2ac995ce1214b33aeedb9b7339124e4b2e71..0cff9b87cb6e0cf35c3a84598ef26839f6e414e5 100644 (file)
@@ -101,10 +101,10 @@ namespace Crow
 //                     if (g.RegisteredLayoutings != LayoutingType.None)
 //                             return;
                        ILayoutable l = g;
-                       while (l.Parent != null)
-                               l = l.Parent;
-                       if (!(l is Interface))
-                               return;
+//                     while (l.Parent != null)
+//                             l = l.Parent;
+//                     if (!(l is Interface))
+//                             return;
 
                        lock (DrawingQueue) {
                                if (g.IsQueueForRedraw)
@@ -412,15 +412,9 @@ namespace Crow
                                while (DrawingQueue.Count > 0) {
                                        GraphicObject g = DrawingQueue.Dequeue ();
                                        g.IsQueueForRedraw = false;
-                                       try {
-                                               if (g.Parent == null)
-                                                       continue;
-                                               g.Parent.RegisterClip (g.LastPaintedSlot);
-                                               if (g.getSlot () != g.LastPaintedSlot)
-                                                       g.Parent.RegisterClip (g.getSlot ());
-                                       } catch (Exception ex) {
-                                               Debug.WriteLine ("Error Register Clip: " + ex.ToString ());
-                                       }
+                                       g.Parent.RegisterClip (g.LastPaintedSlot);
+                                       if (g.getSlot () != g.LastPaintedSlot)
+                                               g.Parent.RegisterClip (g.getSlot ());
                                }
                        }
                        #if MEASURE_TIME
index 5168f3dbc69e40c49a484897b168942a1c852ac1..9f3c3337e6a330fdb673a3ff91768fcd360a653e 100644 (file)
@@ -35,7 +35,7 @@ namespace Crow
                     return false;
             return true;
         }
-        
+
         public bool intersect(Rectangle r)
         {
             foreach (Rectangle rInList in list)
@@ -43,102 +43,10 @@ namespace Crow
                     return true;
             return false;
         }
-        
-        public Rectangles intersectingRects(Rectangle r)
-        {
-            Rectangles tmp = new Rectangles();
-
-            foreach (Rectangle rInList in list)
-                if (rInList.Intersect(r))
-                    tmp.list.Add(rInList);//on bypass le test déjà fait a l'ajout intial du rect dans la liste
-
-            return tmp;
-        }
-        public Rectangles SmallerContainedRects(Rectangle r)
-        {
-            Rectangles tmp = new Rectangles();
-
-            foreach (Rectangle rInList in list)
-                if (r.ContainsOrIsEqual(rInList) && rInList.Size < r.Size)
-                    tmp.list.Add(rInList);
-
-            return tmp;
-        }
-               /// <summary>
-               /// Return rectangles with size smaller than r.size
-               /// </summary>
-        public Rectangles SmallerRects(Rectangle r)
-        {
-            Rectangles tmp = new Rectangles();
-
-            foreach (Rectangle rInList in list)
-                if (rInList.Size < r.Size)
-                    tmp.list.Add(rInList);
-
-            return tmp;
-        }
-        public Rectangles containedOrEqualRects(Rectangle r)
-        {
-            Rectangles tmp = new Rectangles();
-
-            foreach (Rectangle rInList in list)
-                               if (r.ContainsOrIsEqual(rInList))// && rInList.Size <= r.Size)
-                    tmp.list.Add(rInList);
-
-            return tmp;
-        }
-               public void Srcoll(GraphicObject w)
-               {
-                       Scroller sw = w as Scroller;
-                       if (sw == null)
-                               return;
-
-                       List<Rectangle> newList = new List<Rectangle>();
-
-                       foreach (Rectangle rInList in list)
-                       {
-                               Rectangle r = rInList;
-
-                               if (sw.VerticalScrolling)
-                                       r.Top -= (int)sw.ScrollY;
-                               if (sw.HorizontalScrolling)
-                                       r.Left -= (int)sw.ScrollX;
-
-                               newList.Add(r);
-                       }
-                       list = newList;        
-               }
-        public void Rebase(GraphicObject w)
-        {
-                       Rectangle r = w.Parent.ContextCoordinates(w.Slot);
-            List<Rectangle> newList = new List<Rectangle>();
-
-            foreach (Rectangle rInList in list)
-            {
-                Rectangle rebasedR = rInList;
-                rebasedR.TopLeft-= r.TopLeft;
-
-                               Scroller sw = w as Scroller;
-                if (sw != null)
-                {
-                                       if (sw.VerticalScrolling) {
-                                               rebasedR.Top -= (int)sw.ScrollY;
-//                                             if (sw.scrollY < 0)
-//                                                     Debug.WriteLine ("..");
-                                       }if (sw.HorizontalScrolling)
-                                               rebasedR.Left -= (int)sw.ScrollX;
-                }
-
-                newList.Add(rebasedR);
-            }
-                       list = newList;        
-        }
                public void stroke(Context ctx, Color c)
                {
                        foreach (Rectangle r in list)
-                       {
                                ctx.Rectangle(r);
-                       }
 
                        ctx.SetSourceColor(c);
 
@@ -153,17 +61,15 @@ namespace Crow
                 ctx.Rectangle(r);
 
                        ctx.ClipPreserve();
-                       ctx.Operator = Operator.Clear; 
+                       ctx.Operator = Operator.Clear;
             ctx.Fill();
-            ctx.Operator = Operator.Over;            
+            ctx.Operator = Operator.Over;
         }
 
         public void clip(Context ctx)
         {
             foreach (Rectangle r in list)
-            {
-                ctx.Rectangle(r);
-            }
+               ctx.Rectangle(r);
 
             ctx.Clip();
         }