]> O.S.I.I.S - jp/crow.git/commitdiff
ensure Groups use Children property (overridable) instead of children field
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 8 Feb 2016 08:12:54 +0000 (09:12 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Mon, 8 Feb 2016 08:12:54 +0000 (09:12 +0100)
Crow.userprefs [deleted file]
Tests/GOLIBTest_4.cs
Tests/GOLIBTests.cs
src/GraphicObjects/ComboBox.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/Grid.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/ListBox.cs
src/OpenTKGameWindow.cs

diff --git a/Crow.userprefs b/Crow.userprefs
deleted file mode 100644 (file)
index 142cd31..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<Properties GitUserInfo="UsingGIT" StartupItem="Tests/Tests.csproj">
-  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|Linux_x86" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="src/GraphicObjects/Group.cs">
-    <Files>
-      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="180" Column="41" />
-      <File FileName="src/GraphicObjects/Grid.cs" Line="1" Column="1" />
-      <File FileName="src/OpenTKGameWindow.cs" Line="1" Column="1" />
-      <File FileName="src/LayoutingQueueItem.cs" Line="1" Column="1" />
-      <File FileName="src/GraphicObjects/ILayoutable.cs" Line="1" Column="1" />
-      <File FileName="src/GraphicObjects/ComboBox.cs" Line="1" Column="1" />
-      <File FileName="src/GraphicObjects/GraduatedSlider.cs" Line="1" Column="1" />
-      <File FileName="src/GraphicObjects/Group.cs" Line="1" Column="1" />
-    </Files>
-  </MonoDevelop.Ide.Workbench>
-  <MonoDevelop.Ide.DebuggingService.Breakpoints>
-    <BreakpointStore />
-  </MonoDevelop.Ide.DebuggingService.Breakpoints>
-  <MonoDevelop.Ide.DebuggingService.PinnedWatches>
-    <Watch file="../../src/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs" line="1399" offsetX="14" offsetY="23383" expression="ex" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/Scroller.cs" line="95" offsetX="527" offsetY="1598" expression="layoutType" liveUpdate="False" />
-    <Watch file="src/XCursor.cs" line="49" offsetX="757" offsetY="351" expression="type" liveUpdate="False" />
-    <Watch file="src/XCursor.cs" line="50" offsetX="791" offsetY="377" expression="subtype" liveUpdate="False" />
-    <Watch file="src/XCursor.cs" line="51" offsetX="812" offsetY="409" expression="pos" liveUpdate="False" />
-    <Watch file="src/OpenTKGameWindow.cs" line="234" offsetX="746" offsetY="1618" expression="lqi" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/GenericStack.cs" line="171" offsetX="447" offsetY="1717" expression="layoutType" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/Combobox.cs" line="97" offsetX="750" offsetY="1303" expression="value" liveUpdate="False" />
-    <Watch file="src/Interface.cs" line="217" offsetX="623" offsetY="3315" expression="es" liveUpdate="False" />
-    <Watch file="src/Interface.cs" line="217" offsetX="623" offsetY="3339" expression="es.MemberName" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/GraphicObject.cs" line="907" offsetX="879" offsetY="9010" expression="targetValue" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/GraphicObject.cs" line="815" offsetX="511" offsetY="11050" expression="b.Expression" liveUpdate="False" />
-    <Watch file="src/CompilerServices/CompilerServices.cs" line="88" offsetX="630" offsetY="1184" expression="Expression" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/GraphicObject.cs" line="394" offsetX="672" offsetY="1844" expression="pi.Name" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/GenericStack.cs" line="108" offsetX="495" offsetY="1377" expression="layoutType" liveUpdate="False" />
-    <Watch file="src/Colors.cs" line="148" offsetX="367" offsetY="561" expression="R" liveUpdate="False" />
-    <Watch file="src/GraphicObjects/GraphicObject.cs" line="522" offsetX="531" offsetY="6462" expression="layoutType" liveUpdate="False" />
-  </MonoDevelop.Ide.DebuggingService.PinnedWatches>
-  <AuthorInfo Name="Jean-Philippe Bruyère" Email="jp_bruyere@hotmail.com" Copyright="jp" Company="" Trademark="" />
-</Properties>
\ No newline at end of file
index ec47b48c0d971fcc62469c717ae554569dcf3c1b..8fbfe4ec2309414d61e65c88dba5e6cc8c395dab 100644 (file)
@@ -146,9 +146,9 @@ namespace test
                                b.MouseLeave += delegate(object sender, MouseMoveEventArgs ee) {
                                        (sender as Border).Foreground = Color.Transparent;
                                };
-                               s.addChild (b);
+                               s.AddChild (b);
 
-                               s.addChild (
+                               s.AddChild (
                                        new Label (col.ToString ()){
                                                Bounds=new Rectangle(0,0,-1,-1),
                                        }
@@ -179,7 +179,7 @@ namespace test
                void onButClick(object send, MouseButtonEventArgs e)
                {
                        Color col = Color.ColorDic.ToArray () [i];
-                       HorizontalStack s = colors.addChild (new HorizontalStack () { Fit = true});
+                       HorizontalStack s = colors.AddChild (new HorizontalStack () { Fit = true});
                        s.HorizontalAlignment = HorizontalAlignment.Left;
                        Border b = new Border () {
                                Bounds = new Size (32, 20),
@@ -195,9 +195,9 @@ namespace test
                        b.MouseLeave += delegate(object sender, MouseMoveEventArgs ee) {
                                (sender as Border).Foreground = Color.Transparent;
                        };
-                       s.addChild (b);
+                       s.AddChild (b);
 
-                       s.addChild (
+                       s.AddChild (
                                new Label (col.ToString ()){
                                        Bounds=new Rectangle(0,0,-1,-1),
                                }
@@ -214,7 +214,7 @@ namespace test
                        lock (mutex) {
                                if (loadedCols.Count > 50 || allColsLoaded) {
                                        while (loadedCols.Count > 0) {
-                                               colors.addChild (loadedCols[0]);
+                                               colors.AddChild (loadedCols[0]);
                                                loadedCols.RemoveAt (0);
                                        }
                                }
index 31761743d0640bc9c3adb3b31aacad7a21acc2fe..2b2aabd6d7facce5f3dbb40b2a9decd30d8fe0e8 100644 (file)
@@ -39,11 +39,11 @@ namespace test
                string[] testFiles = {
                        "0.crow",
                        "testExpandable.goml",
+                       "4.crow",
+                       "testColorList.crow",
                        "5.crow",
                        "testSpinner.goml",
                        "testScrollbar.goml",
-                       "4.crow",
-                       "testColorList.crow",
                        "testGroupBox.goml",
                        "testGrid.goml",
                        "test_Listbox.goml",
@@ -163,9 +163,12 @@ namespace test
                        fps = (int)RenderFrequency;
 
 
-                       if (frameCpt > 200) {
+                       if (frameCpt > 50) {
                                resetFps ();
                                frameCpt = 0;
+                               GC.Collect();
+                               GC.WaitForPendingFinalizers();
+                               NotifyValueChanged("memory", GC.GetTotalMemory (false).ToString());
                        }
                        frameCpt++;
                }
index aee7da9b6dfbf25b60b6c2f5fbc93d0be2e8682f..c071cb5e8853c5915eef8634cac1eaafbe5bde9c 100644 (file)
@@ -173,7 +173,7 @@ namespace Crow
                                if (!threadedLoadingFinished && pendingChildrenAddition.Count < 50)
                                        return;
                                while (pendingChildrenAddition.Count > 0) {
-                                       _list.addChild (pendingChildrenAddition.Dequeue ());
+                                       _list.AddChild (pendingChildrenAddition.Dequeue ());
                                }
                        }
                }
index d23383628fdad449040d164e1db953b26e8e81d6..665ba65de7affb0e1398347cb813c16cf198f4ac 100644 (file)
@@ -28,15 +28,15 @@ namespace Crow
         Orientation _orientation;
                #endregion
 
-               public override T addChild<T> (T child)
+               public override T AddChild<T> (T child)
                {
-                       T tmp = base.addChild (child);
+                       T tmp = base.AddChild (child);
                        this.RegisterForLayouting (LayoutingType.PositionChildren);
                        return tmp;
                }
-               public override void removeChild (GraphicObject child)
+               public override void RemoveChild (GraphicObject child)
                {
-                       base.removeChild (child);
+                       base.RemoveChild (child);
                        this.RegisterForLayouting (LayoutingType.PositionChildren);
                }
 
index fc3d89889742ab3da53e0e2d94d228aab2f47145..c242899f2425d2d1c54e1d41e66837525658aecd 100644 (file)
@@ -29,15 +29,15 @@ namespace Crow
                int _rowCount;
                #endregion
 
-               public override T addChild<T> (T child)
+               public override T AddChild<T> (T child)
                {
-                       T tmp = base.addChild (child);
+                       T tmp = base.AddChild (child);
                        this.RegisterForLayouting (LayoutingType.PositionChildren);
                        return tmp;
                }
-               public override void removeChild (GraphicObject child)
+               public override void RemoveChild (GraphicObject child)
                {
-                       base.removeChild (child);
+                       base.RemoveChild (child);
                        this.RegisterForLayouting (LayoutingType.PositionChildren);
                }
 
index 8737b86657e9046c0ddbb916642aa01c89d53b99..9d9abbc671c22979b265eed5a826710060b5b736 100644 (file)
@@ -42,21 +42,21 @@ namespace Crow
         }
                        
                        
-        public virtual T addChild<T>(T child)
+        public virtual T AddChild<T>(T child)
         {
                        GraphicObject g = child as GraphicObject;
-            Children.Add(g);
+            children.Add(g);
             g.Parent = this as GraphicObject;            
                        g.RegisterForLayouting (LayoutingType.Sizing);
                        g.LayoutChanged += OnChildLayoutChanges;
             return (T)child;
         }
-        public virtual void removeChild(GraphicObject child)        
+        public virtual void RemoveChild(GraphicObject child)        
                {
                        child.LayoutChanged -= OnChildLayoutChanges;
                        child.ClearBinding ();
                        child.Parent = null;
-            Children.Remove(child);
+            children.Remove(child);
                        this.RegisterForLayouting (LayoutingType.Sizing);
         }
                public virtual void ClearChildren()
@@ -66,25 +66,25 @@ namespace Crow
                                g.LayoutChanged -= OnChildLayoutChanges;
                                g.ClearBinding ();
                                g.Parent = null;
-                               Children.RemoveAt(children.Count-1);
+                               children.RemoveAt(children.Count-1);
                        }
                        this.RegisterForLayouting (LayoutingType.Sizing);
                        ChildrenCleared.Raise (this, new EventArgs ());
                }
                public void putWidgetOnTop(GraphicObject w)
                {
-                       if (Children.Contains(w))
+                       if (children.Contains(w))
                        {
-                               Children.Remove(w);
-                               Children.Add(w);
+                               children.Remove(w);
+                               children.Add(w);
                        }
                }
                public void putWidgetOnBottom(GraphicObject w)
                {
-                       if (Children.Contains(w))
+                       if (children.Contains(w))
                        {
-                               Children.Remove(w);
-                               Children.Insert(0, w);
+                               children.Remove(w);
+                               children.Insert(0, w);
                        }
                }
 
@@ -93,7 +93,7 @@ namespace Crow
                        get {
                                if (!base.DrawingIsValid)
                                        return false;
-                               foreach (GraphicObject g in Children) {
+                               foreach (GraphicObject g in children) {
                                        if (!g.DrawingIsValid)
                                                return false;
                                }
@@ -103,7 +103,7 @@ namespace Crow
                public override void ResolveBindings ()
                {
                        base.ResolveBindings ();
-                       foreach (GraphicObject w in Children)
+                       foreach (GraphicObject w in children)
                                w.ResolveBindings ();
                }
                public override GraphicObject FindByName (string nameToFind)
@@ -111,7 +111,7 @@ namespace Crow
                        if (Name == nameToFind)
                                return this;
 
-                       foreach (GraphicObject w in Children) {
+                       foreach (GraphicObject w in children) {
                                GraphicObject r = w.FindByName (nameToFind);
                                if (r != null)
                                        return r;
@@ -120,7 +120,7 @@ namespace Crow
                }
                public override bool Contains (GraphicObject goToFind)
                {
-                       foreach (GraphicObject w in Children) {
+                       foreach (GraphicObject w in children) {
                                if (w == goToFind)
                                        return true;
                                if (w.Contains (goToFind))
@@ -140,14 +140,14 @@ namespace Crow
                        //position smaller objects in group when group size is fit
                        switch (layoutType) {
                        case LayoutingType.Width:
-                               foreach (GraphicObject c in Children) {
+                               foreach (GraphicObject c in children) {
                                        if (!c.Visible)
                                                continue;                                       
                                        c.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
                                }
                                break;
                        case LayoutingType.Height:
-                               foreach (GraphicObject c in Children) {
+                               foreach (GraphicObject c in children) {
                                        if (!c.Visible)
                                                continue;
                                        c.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);                                }
@@ -212,7 +212,7 @@ namespace Crow
                {
                        base.onDraw (gr);
 
-                       foreach (GraphicObject g in Children) {
+                       foreach (GraphicObject g in children) {
                                g.Paint (ref gr);
                        }
                }
@@ -252,7 +252,7 @@ namespace Crow
                                                #if DEBUG_CLIP_RECTANGLE
                                                clip.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
                                                #endif
-                                               foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+                                               foreach (GraphicObject c in children.Where(ch=>ch.Visible)) {
                                                        Rectangles childClip = clip.intersectingRects (ContextCoordinates(c.Slot));
                                                        if (!c.DrawingIsValid || childClip.count > 0)
                                                                c.Paint (ref gr, childClip);//, localClip);
@@ -275,7 +275,7 @@ namespace Crow
                                HostContainer.hoverWidget = this;
                                onMouseEnter (this, e);
                        }
-                       foreach (GraphicObject g in Children)
+                       foreach (GraphicObject g in children)
                        {
                                if (g.MouseIsIn(e.Position))
                                {
@@ -313,7 +313,7 @@ namespace Crow
                                                throw new Exception ("Crow." + subTree.Name + " type not found");
                     GraphicObject go = (GraphicObject)Activator.CreateInstance(t);
                     (go as IXmlSerializable).ReadXml(subTree);                    
-                    addChild(go);
+                    AddChild(go);
                 }
             }
         }
@@ -321,7 +321,7 @@ namespace Crow
         {
             base.WriteXml(writer);
 
-            foreach (GraphicObject go in Children)
+            foreach (GraphicObject go in children)
             {
                 writer.WriteStartElement(go.GetType().Name);
                 (go as IXmlSerializable).WriteXml(writer);
index dfa248cf2857e869b6a17ec1947d8a802331cf70..3822275e3ecaa91ed8ae0d8a9d6feb6b21de3b56 100644 (file)
@@ -101,7 +101,7 @@ namespace Crow
                                        ms.Seek(0,SeekOrigin.Begin);
                                        GraphicObject g = Interface.Load (ms, t);
                                        g.MouseClick += itemClick;
-                                       _list.addChild (g);
+                                       _list.AddChild (g);
                                        g.DataSource = item;
                                }
 
index 12099e484de0460aee65a9b2d17144244a889133..2083346ca2a255b9ae3ed8160cb0579c505fb878 100644 (file)
@@ -249,76 +249,76 @@ namespace Crow
                        updateTime.Restart ();                  
                        #endif
 
-                       surf = new ImageSurface(bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height,ClientRectangle.Width*4);
-                       ctx = new Context(surf);
+                       using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
+                               using (ctx = new Context (surf)){
 
-                       GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];
-                       GraphicObjects.CopyTo (invGOList,0);
-                       invGOList = invGOList.Reverse ().ToArray ();
+                                       GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];
+                                       GraphicObjects.CopyTo (invGOList, 0);
+                                       invGOList = invGOList.Reverse ().ToArray ();
 
-                       #if MEASURE_TIME
-                       layoutTime.Start ();
-                       #endif
-                       //Debug.WriteLine ("======= Layouting queue start =======");
-
-                       while (Interface.LayoutingQueue.Count > 0) {
-                               LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
-                               lqi.ProcessLayouting ();
-                       }
-
-                       #if MEASURE_TIME
-                       layoutTime.Stop ();
-                       #endif
-
-                       //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
-                       //final redraw clips should be added only when layout is completed among parents,
-                       //that's why it take place in a second pass
-                       GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count];
-                       gobjsToRedraw.CopyTo (gotr);
-                       gobjsToRedraw.Clear ();
-                       foreach (GraphicObject p in gotr) {
-                               p.registerClipRect ();
-                       }
+                                       #if MEASURE_TIME
+                                       layoutTime.Start ();
+                                       #endif
+                                       //Debug.WriteLine ("======= Layouting queue start =======");
 
-                       #if MEASURE_TIME
-                       updateTime.Stop ();
-                       drawingTime.Start ();
-                       #endif
+                                       while (Interface.LayoutingQueue.Count > 0) {
+                                               LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
+                                               lqi.ProcessLayouting ();
+                                       }
 
-                       lock (redrawClip) {
-                               if (redrawClip.count > 0) {                                     
-                                       #if DEBUG_CLIP_RECTANGLE
-                                       redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));
+                                       #if MEASURE_TIME
+                                       layoutTime.Stop ();
                                        #endif
-                                       redrawClip.clearAndClip (ctx);  
 
-                                       //Link.draw (ctx);
-                                       foreach (GraphicObject p in invGOList) {
-                                               if (p.Visible) {
+                                       //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
+                                       //final redraw clips should be added only when layout is completed among parents,
+                                       //that's why it take place in a second pass
+                                       GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count];
+                                       gobjsToRedraw.CopyTo (gotr);
+                                       gobjsToRedraw.Clear ();
+                                       foreach (GraphicObject p in gotr) {
+                                               p.registerClipRect ();
+                                       }
 
-                                                       ctx.Save ();
-                                                       if (redrawClip.count > 0) {
-                                                               Rectangles clip = redrawClip.intersectingRects (p.Slot);
+                                       #if MEASURE_TIME
+                                       updateTime.Stop ();
+                                       drawingTime.Start ();
+                                       #endif
 
-                                                               if (clip.count > 0)
-                                                                       p.Paint (ref ctx, clip);
+                                       lock (redrawClip) {
+                                               if (redrawClip.count > 0) {
+                                                       #if DEBUG_CLIP_RECTANGLE
+                                               redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));
+                                                       #endif
+                                                       redrawClip.clearAndClip (ctx);
+
+                                                       //Link.draw (ctx);
+                                                       foreach (GraphicObject p in invGOList) {
+                                                               if (p.Visible) {
+
+                                                                       ctx.Save ();
+                                                                       if (redrawClip.count > 0) {
+                                                                               Rectangles clip = redrawClip.intersectingRects (p.Slot);
+
+                                                                               if (clip.count > 0)
+                                                                                       p.Paint (ref ctx, clip);
+                                                                       }
+                                                                       ctx.Restore ();
+                                                               }
                                                        }
-                                                       ctx.Restore ();
+                                                       ctx.ResetClip ();
+                                                       #if DEBUG_CLIP_RECTANGLE
+                                               redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1));
+                                                       #endif
+                                                       redrawClip.Reset ();
                                                }
                                        }
-                                       ctx.ResetClip ();
-                                       #if DEBUG_CLIP_RECTANGLE
-                                       redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1));
+                                       #if MEASURE_TIME
+                                       drawingTime.Stop ();
                                        #endif
-                                       redrawClip.Reset ();
+                                       //surf.WriteToPng (@"/mnt/data/test.png");
                                }
                        }
-                       #if MEASURE_TIME
-                       drawingTime.Stop ();
-                       #endif
-                       //surf.WriteToPng (@"/mnt/data/test.png");
-                       ctx.Dispose ();
-                       surf.Dispose ();
 //                     if (ToolTip.isVisible) {
 //                             ToolTip.panel.processkLayouting();
 //                             if (ToolTip.panel.layoutIsValid)