]> O.S.I.I.S - jp/crow.git/commitdiff
code clean
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 5 Feb 2016 15:15:25 +0000 (16:15 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 5 Feb 2016 15:15:25 +0000 (16:15 +0100)
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/Interface.cs

index e181fdf7d9f3d549e8f6d94d50e892c1251974bb..fe010d6ac0042b4a99ceef2e2e24621ad0b24dc1 100644 (file)
@@ -82,9 +82,30 @@ namespace Crow
                #endregion
 
                #region public fields
+               /// <summary>
+               /// The logical parent (used mainly for bindings) as opposed to the parent in the graphic tree
+               /// </summary>
                public GraphicObject LogicalParent;
+               /// <summary>
+               /// Original size and position 0=Stretched; -1=Fit
+               /// </summary>
                public Rectangle Bounds;
+               /// <summary>
+               /// Current size and position computed during layouting pass
+               /// </summary>
                public Rectangle Slot = new Rectangle ();
+               /// <summary>
+               /// keep last slot components for each layouting pass to track
+               /// changes and trigger update of other component accordingly
+               /// </summary>
+               public Rectangle LastSlots;
+               /// <summary>
+               /// keep last slot painted on screen to clear traces if moved or resized
+               /// TODO: we should ensure the whole parsed widget tree is the last painted
+               /// version to clear effective oldslot if parents have been moved or resized.
+               /// IDEA is to add a ScreenCoordinates function that use only lastPaintedSlots
+               /// </summary>
+               public Rectangle LastPaintedSlot;
                public object Tag;
                public byte[] bmp;
                #endregion
@@ -94,6 +115,9 @@ namespace Crow
                public List<LinkedListNode<LayoutingQueueItem>> RegisteredLQINodes { get; } = new List<LinkedListNode<LayoutingQueueItem>>();
                //TODO: it would save the recurent cost of a cast in event bubbling if parent type was GraphicObject
                //              or we could add to the interface the mouse events
+               /// <summary>
+               /// Parent in the graphic tree, used for rendering and layouting
+               /// </summary>
                [XmlIgnore]public ILayoutable Parent { 
                        get { return _parent; }
                        set {
@@ -442,7 +466,13 @@ namespace Crow
                        return false;
                }
 
-
+               public virtual void registerClipRect()
+               {
+                       HostContainer.redrawClip.AddRectangle (ScreenCoordinates(Slot));
+                       //this clipping should take only last painted slots in ancestor tree which
+                       //is not the case for now.
+                       HostContainer.redrawClip.AddRectangle (ScreenCoordinates(LastPaintedSlot));
+               }
                /// <summary>
                /// Clear chached object and add clipping region in redraw list of interface
                /// </summary>
@@ -466,31 +496,12 @@ namespace Crow
                                HostContainer.gobjsToRedraw.Add (this);
                }
 
-               /// <summary>
-               /// keep last slot components for each layouting pass to track
-               /// changes and trigger update of other component accordingly
-               /// </summary>
-               public Rectangle LastSlots;
-               /// <summary>
-               /// keep last slot painted on screen to clear traces if moved or resized
-               /// TODO: we should ensure the whole parsed widget tree is the last painted
-               /// version to clear effective oldslot if parents have been moved or resized.
-               /// IDEA is to add a ScreenCoordinates function that use only lastPaintedSlots
-               /// </summary>
-               public Rectangle LastPaintedSlot;
-
-               public virtual void registerClipRect()
-               {
-                       HostContainer.redrawClip.AddRectangle (ScreenCoordinates(Slot));
-                       //this clipping should take only last painted slots in ancestor tree which
-                       //is not the case for now.
-                       HostContainer.redrawClip.AddRectangle (ScreenCoordinates(LastPaintedSlot));
-               }
+               #region Layouting
                /// <summary> return size of content + margins </summary>
-               protected virtual Size measureRawSize ()
-               {
+               protected virtual Size measureRawSize () {
                        return Bounds.Size;
                }
+
                void deleteLQI(int lt){
                        LinkedListNode<LayoutingQueueItem>[] lqis = this.RegisteredLQINodes.Where (n => (lt & (int)n.Value.LayoutType) > 0).ToArray ();
                        for (int i = 0; i < lqis.Length; i++) {
@@ -712,7 +723,9 @@ namespace Crow
                        if (this.RegisteredLQINodes.Count () <= 0 && bmp == null)
                                this.RegisterForRedraw ();
                }
+               #endregion
 
+               #region Rendering
                /// <summary> This is the common overridable drawing routine to create new widget </summary>
                protected virtual void onDraw(Context gr)
                {
@@ -772,6 +785,7 @@ namespace Crow
                                ctx.Paint ();
                        }
                }
+               #endregion
 
         #region Keyboard handling
                public virtual void onKeyDown(object sender, KeyboardKeyEventArgs e){
index 14142e0d603561e020520cccb66b70df9e063b5c..7f952ac1c0cffa3b7dd6065f5c823c465b9cd7e7 100644 (file)
@@ -129,17 +129,6 @@ namespace Crow
                }
                protected override Size measureRawSize ()
                {
-//                     Size tmp = new Size ();
-//
-//                     foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
-//                             tmp.Width = Math.Max (tmp.Width, c.Slot.Right);
-//                             tmp.Height = Math.Max (tmp.Height, c.Slot.Bottom);
-//                     }
-//
-//                     tmp.Width += 2*Margin;
-//                     tmp.Height += 2*Margin;
-//
-//                     return tmp;
                        return new Size(maxChildrenWidth + 2 * Margin, maxChildrenHeight + 2 * Margin);
                }
                        
index e6be4220121c8c8294385c9df6a06f3ef4c21cfb..c96dffa02e86315a8aa813e2c637c85479bfe29c 100644 (file)
@@ -44,7 +44,7 @@ namespace Crow
                public static string LineBreak = "\r\n";
                public static bool FocusOnHover = false;
                /// <summary> Time to wait in millisecond before starting repeat loop</summary>
-               public static int DeviceRepeatDelay = 1000;
+               public static int DeviceRepeatDelay = 600;
                /// <summary> Time interval in millisecond between device event repeat</summary>
                public static int DeviceRepeatInterval = 100;
                public static bool ReplaceTabsWithSpace = false;