]> O.S.I.I.S - jp/crow.git/commitdiff
using try/finally to ensure mutexes release
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 16 Jun 2021 14:00:50 +0000 (16:00 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 16 Jun 2021 14:00:50 +0000 (16:00 +0200)
31 files changed:
Crow/src/DebugUtils/DebugLogger.cs
Crow/src/Interface.cs
Crow/src/LayoutingQueueItem.cs
Crow/src/Widgets/DockStack.cs
Crow/src/Widgets/Group.cs
Crow/src/Widgets/GroupBase.cs
Crow/src/Widgets/Label.cs
Crow/src/Widgets/ScrollingStack.cs
Crow/src/Widgets/Table.cs
Crow/src/Widgets/TableRow.cs
Crow/src/Widgets/TemplatedGroup.cs
Crow/src/Widgets/Widget.cs
Crow/src/Widgets/Window.cs
Crow/src/Widgets/Wrapper.cs
Samples/DebugLogAnalyzer/src/DbgEventWidget.cs
Samples/DebugLogAnalyzer/src/DbgLogViewer.cs
Samples/DebugLogAnalyzer/src/DebugInterface.cs
Samples/DebugLogAnalyzer/src/Program.cs
Samples/DebugLogAnalyzer/ui/DebugLog.crow
Samples/ShowCase/ShowCase.cs
Samples/common/src/SampleBaseForEditor.cs
Samples/common/ui/Interfaces/Divers/0.crow
Samples/common/ui/Interfaces/Divers/02.crow [new file with mode: 0644]
Samples/common/ui/Interfaces/Divers/testBind0.crow
Samples/common/ui/Interfaces/Divers/testVisibility.crow
Samples/common/ui/Interfaces/Divers/welcome.crow
Samples/common/ui/Interfaces/Experimental/colorTable.crow
Samples/common/ui/Interfaces/Experimental/table2.crow [deleted file]
Samples/common/ui/Interfaces/Experimental/table3.crow [deleted file]
Samples/common/ui/Interfaces/TemplatedContainer/testTabView.crow
Samples/common/ui/Interfaces/TemplatedContainer/testTabView2.crow [deleted file]

index 2a9b75bb605dc6a10ac61776668ee790dc429516..e048008ff8a70b322ba38640d66269cc16544a54 100644 (file)
@@ -25,7 +25,7 @@ namespace Crow
                static bool logevt (DbgEvtType evtType)
                        //=> IncludeEvents != DbgEvtType.None && (evtType & DiscardEvents) == 0 && (evtType & IncludeEvents) == IncludeEvents;
                        //=> IncludeEvents != DbgEvtType.None && (evtType & DiscardEvents) == 0 && (evtType & IncludeEvents) == IncludeEvents;
-                       => IncludeEvents == DbgEvtType.All || (IncludeEvents != DbgEvtType.None && (evtType & IncludeEvents) == IncludeEvents);
+                       => IncludeEvents == DbgEvtType.All || (IncludeEvents != DbgEvtType.None && (evtType & IncludeEvents) != 0);
                        
 
 
index d39121b04022ca04e2a3c6d391d5205398e84a8d..8755d8172ee66eded7d63ab9bf002503ea50991b 100644 (file)
@@ -924,20 +924,23 @@ namespace Crow
                        DbgLogger.StartEvent (DbgEvtType.Update);
                        PerformanceMeasure.Begin (PerformanceMeasure.Kind.Update);
 
-                       processLayouting ();
+                       try {
+                               processLayouting ();
 
-                       clippingRegistration ();
+                               clippingRegistration ();
 
-                       if (ctx == null) {
-                               using (ctx = new Context (surf)) 
+                               if (ctx == null) {
+                                       using (ctx = new Context (surf)) 
+                                               processDrawing (ctx);
+                               }else
                                        processDrawing (ctx);
-                       }else
-                               processDrawing (ctx);
+                       } finally {
 
-                       PerformanceMeasure.End (PerformanceMeasure.Kind.Update);
-                       DbgLogger.EndEvent (DbgEvtType.Update, true);
+                               PerformanceMeasure.End (PerformanceMeasure.Kind.Update);
+                               DbgLogger.EndEvent (DbgEvtType.Update, true);
 
-                       Monitor.Exit (UpdateMutex);
+                               Monitor.Exit (UpdateMutex);
+                       }
 
                        PerformanceMeasure.Notify ();
                }
@@ -950,23 +953,23 @@ namespace Crow
                                        Monitor.Exit (LayoutMutex);
                                        return;
                 }
+
                                DbgLogger.StartEvent (DbgEvtType.ProcessLayouting);
                                PerformanceMeasure.Begin (PerformanceMeasure.Kind.Layouting);
+                               try {
+                                       DiscardQueue = new Queue<LayoutingQueueItem> (LayoutingQueue.Count);
+                                       while (LayoutingQueue.Count > 0) {
+                                               LayoutingQueueItem lqi = LayoutingQueue.Dequeue ();
+                                               lqi.ProcessLayouting ();
+                                       }
+                                       LayoutingQueue = DiscardQueue;
+                               } finally {
+                                       PerformanceMeasure.End (PerformanceMeasure.Kind.Layouting);
+                                       DbgLogger.EndEvent (DbgEvtType.ProcessLayouting, true);
 
-                               DiscardQueue = new Queue<LayoutingQueueItem> (LayoutingQueue.Count);
-                               //Debug.WriteLine ("======= Layouting queue start =======");
-                                                               
-                               while (LayoutingQueue.Count > 0) {
-                                       LayoutingQueueItem lqi = LayoutingQueue.Dequeue ();
-                                       lqi.ProcessLayouting ();
+                                       Monitor.Exit (LayoutMutex);
+                                       DiscardQueue = null;
                                }
-                               LayoutingQueue = DiscardQueue;
-
-                               PerformanceMeasure.End (PerformanceMeasure.Kind.Layouting);
-                               DbgLogger.EndEvent (DbgEvtType.ProcessLayouting, true);
-
-                               Monitor.Exit (LayoutMutex);
-                               DiscardQueue = null;
                        }
                }
                /// <summary>Degueue Widget to clip from DrawingQueue and register the last painted slot and the new one
@@ -1005,7 +1008,6 @@ namespace Crow
 
                                ctx.PushGroup ();
 
-
                                for (int i = GraphicTree.Count -1; i >= 0 ; i--){
                                        Widget p = GraphicTree[i];
                                        if (!p.IsVisible)
index c6aa6dc679f642679237f07396820bef7bde83a8..3cfdaa47fdbe2e72a5b9a66f5fc80140afb7f08e 100644 (file)
@@ -82,55 +82,54 @@ namespace Crow
                public void ProcessLayouting()
                {
                        Widget go = Layoutable as Widget;
-//                     if (go == null) {
-//                             Debug.WriteLine ("ERROR: processLayouting on something else than a graphic object: " + this.ToString ());
-//                             return;
-//                     }
 
+                       DbgLogger.StartEvent (DbgEvtType.GOProcessLayouting, this);
                        go.parentRWLock.EnterReadLock ();
 
-                       if (go.Parent == null) {//TODO:improve this
-                               //cancel layouting for object without parent, maybe some were in queue when
-                               //removed from a listbox
-                               DbgLogger.AddEvent (DbgEvtType.GOProcessLayoutingWithNoParent, this);
-                               go.parentRWLock.ExitReadLock ();
-                               return;
-                       }
+                       try {
+
+                               if (go.Parent == null) {//TODO:improve this
+                                       //cancel layouting for object without parent, maybe some were in queue when
+                                       //removed from a listbox
+                                       DbgLogger.AddEvent (DbgEvtType.GOProcessLayoutingWithNoParent, this);
+                                       return;
+                               }
 #if DEBUG_LOG
-                       DbgLogger.StartEvent (DbgEvtType.GOProcessLayouting, this);
-                       Slot = graphicObject.Slot;
+                               Slot = graphicObject.Slot;
 #endif
-                       LayoutingTries++;
-                       if (!Layoutable.UpdateLayout (LayoutType)) {
-                               if (LayoutingTries < Interface.MaxLayoutingTries) {
-                                       Layoutable.RegisteredLayoutings |= LayoutType;
-                                       (Layoutable as Widget).IFace.LayoutingQueue.Enqueue (this);
+                               LayoutingTries++;
+                               if (!Layoutable.UpdateLayout (LayoutType)) {
+                                       if (LayoutingTries < Interface.MaxLayoutingTries) {
+                                               Layoutable.RegisteredLayoutings |= LayoutType;
+                                               (Layoutable as Widget).IFace.LayoutingQueue.Enqueue (this);
 #if DEBUG_LOG
-                                       result = Result.Requeued;
+                                               result = Result.Requeued;
 #endif
-                               } else if (DiscardCount < Interface.MaxDiscardCount) {
+                                       } else if (DiscardCount < Interface.MaxDiscardCount) {
 #if DEBUG_LOG
-                                       result = Result.Discarded;
+                                               result = Result.Discarded;
+#endif
+                                               LayoutingTries = 0;
+                                               DiscardCount++;
+                                               Layoutable.RegisteredLayoutings |= LayoutType;
+                                               (Layoutable as Widget).IFace.DiscardQueue.Enqueue (this);
+                                       }
+#if DEBUG_LOG
+                                       else {
+                                               result = Result.Deleted;
+                                       }
 #endif
-                                       LayoutingTries = 0;
-                                       DiscardCount++;
-                                       Layoutable.RegisteredLayoutings |= LayoutType;
-                                       (Layoutable as Widget).IFace.DiscardQueue.Enqueue (this);
                                }
 #if DEBUG_LOG
-                               else {
-                                       result = Result.Deleted;
+                               else{
+                                       result = Result.Success;
                                }
+                               NewSlot = graphicObject.Slot;
 #endif
+                       }finally {
+                               go.parentRWLock.ExitReadLock ();
+                               DbgLogger.EndEvent (DbgEvtType.GOProcessLayouting, this);
                        }
-#if DEBUG_LOG
-                       else{
-                               result = Result.Success;
-                       }
-                       NewSlot = graphicObject.Slot;
-                       DbgLogger.EndEvent (DbgEvtType.GOProcessLayouting, this);
-#endif
-                       go.parentRWLock.ExitReadLock ();
                }
 
                public static implicit operator Widget(LayoutingQueueItem queueItem) => queueItem.Layoutable as Widget;
index d72270c7b323c8fa37dbfb44bcc03153fc184cf5..41c7f8b45b2f269a1354dc5507495b960274e17d 100644 (file)
@@ -79,15 +79,18 @@ namespace Crow
                        Rectangle cb = ClientRectangle;
 
                        childrenRWLock.EnterReadLock ();
-                       foreach (Widget c in Children) {
-                               Rectangle bounds = c.Slot + cb.Position;
-                               if (!bounds.ContainsOrIsEqual (lm))
-                                       continue;
-                               rIn = bounds;
-                               focusedChild = c;
-                               break;
+                       try {
+                               foreach (Widget c in Children) {
+                                       Rectangle bounds = c.Slot + cb.Position;
+                                       if (!bounds.ContainsOrIsEqual (lm))
+                                               continue;
+                                       rIn = bounds;
+                                       focusedChild = c;
+                                       break;
+                               }
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
                        }
-                       childrenRWLock.ExitReadLock ();                 
                }
 
                public void onDragMouseMove (object sender, MouseMoveEventArgs e)
index 9e78f1877dc919f7c0778542b198c092d36234fd..a2a58b7f7e38257f281d9d68ffd0c562b5ee9b54 100644 (file)
@@ -35,12 +35,13 @@ namespace Crow
                        }
 
                        childrenRWLock.EnterWriteLock ();
-
-                       Children.Remove(child);
-                       child.Parent = null;
-                       child.LogicalParent = null;
-
-                       childrenRWLock.ExitWriteLock ();
+                       try {
+                               Children.Remove(child);
+                               child.Parent = null;
+                               child.LogicalParent = null;
+                       } finally {
+                               childrenRWLock.ExitWriteLock ();
+                       }
 
                        if (child == largestChild && Width == Measure.Fit)
                                searchLargestChild ();
@@ -56,14 +57,15 @@ namespace Crow
                                return;
                        }
                        childrenRWLock.EnterWriteLock ();
-                               
-                       g.Parent = this;
-                       Children.Insert (idx, g);
-                       
-                       childrenRWLock.ExitWriteLock ();
+                       try {   
+                               g.Parent = this;
+                               Children.Insert (idx, g);
+                       } finally {
+                               childrenRWLock.ExitWriteLock ();
+                       }
 
                        //largestChild = tallestChild = null;
-                       if (g.LastSlots.Width > contentSize.Width) {
+                       if (g.LastSlots.Width > contentSize.Width) {//TODO:Layout mutex?
                                largestChild = g;
                                contentSize.Width = g.LastSlots.Width;
                        }
@@ -79,16 +81,17 @@ namespace Crow
                public override void ClearChildren()
                {
                        childrenRWLock.EnterWriteLock ();
-
-                       while (Children.Count > 0) {
-                               Widget g = Children [Children.Count - 1];
-                               g.LayoutChanged -= OnChildLayoutChanges;
-                               Children.RemoveAt (Children.Count - 1);
-                               g.Dispose ();
+                       try {
+                               while (Children.Count > 0) {
+                                       Widget g = Children [Children.Count - 1];
+                                       g.LayoutChanged -= OnChildLayoutChanges;
+                                       Children.RemoveAt (Children.Count - 1);
+                                       g.Dispose ();
+                               }
+                       } finally {
+                               childrenRWLock.ExitWriteLock ();
                        }
 
-                       childrenRWLock.ExitWriteLock ();
-
                        resetChildrenMaxSize ();
 
                        RegisterForLayouting (LayoutingType.Sizing);
@@ -117,30 +120,33 @@ namespace Crow
                        base.OnLayoutChanges (layoutType);
 
                        childrenRWLock.EnterReadLock ();
-                       //position smaller objects in group when group size is fit
-                       switch (layoutType) {
-                       case LayoutingType.Width:
-                               //childrenRWLock.EnterReadLock ();
-                               foreach (Widget c in Children) {
-                                       if (c.Width.IsRelativeToParent)
-                                               c.RegisterForLayouting (LayoutingType.Width);
-                                       else
-                                               c.RegisterForLayouting (LayoutingType.X);
+                       try {
+                               //position smaller objects in group when group size is fit
+                               switch (layoutType) {
+                               case LayoutingType.Width:
+                                       //childrenRWLock.EnterReadLock ();
+                                       foreach (Widget c in Children) {
+                                               if (c.Width.IsRelativeToParent)
+                                                       c.RegisterForLayouting (LayoutingType.Width);
+                                               else
+                                                       c.RegisterForLayouting (LayoutingType.X);
+                                       }
+                                       //childrenRWLock.ExitReadLock ();
+                                       break;
+                               case LayoutingType.Height:
+                                       //childrenRWLock.EnterReadLock ();
+                                       foreach (Widget c in Children) {
+                                               if (c.Height.IsRelativeToParent)
+                                                       c.RegisterForLayouting (LayoutingType.Height);
+                                               else
+                                                       c.RegisterForLayouting (LayoutingType.Y);
+                                       }
+                                       //childrenRWLock.ExitReadLock ();
+                                       break;
                                }
-                               //childrenRWLock.ExitReadLock ();
-                               break;
-                       case LayoutingType.Height:
-                               //childrenRWLock.EnterReadLock ();
-                               foreach (Widget c in Children) {
-                                       if (c.Height.IsRelativeToParent)
-                                               c.RegisterForLayouting (LayoutingType.Height);
-                                       else
-                                               c.RegisterForLayouting (LayoutingType.Y);
-                               }
-                               //childrenRWLock.ExitReadLock ();
-                               break;
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
                        }
-                       childrenRWLock.ExitReadLock ();
                }
                #endregion
                public virtual void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
@@ -177,7 +183,7 @@ namespace Crow
                        }
                        DbgLogger.EndEvent(DbgEvtType.GOOnChildLayoutChange);
                }
-               //TODO: x,y position should be taken in account for computation of width and height
+               //TODO: x,y position should be taken in account for computation of width and height + Layout mutex?
                void resetChildrenMaxSize(){
                        largestChild = null;
                        tallestChild = null;
@@ -186,62 +192,63 @@ namespace Crow
                protected virtual void searchLargestChild (bool forceMeasure = false)
                {
                        DbgLogger.StartEvent (DbgEvtType.GOSearchLargestChild, this);
-
                        childrenRWLock.EnterReadLock ();
 
-                       largestChild = null;
-                       contentSize.Width = 0;
-                       for (int i = 0; i < Children.Count; i++) {
-                               if (!Children [i].IsVisible)
-                                       continue;
-                               int cw = 0;
-                               if (forceMeasure)
-                                       cw = Children [i].measureRawSize (LayoutingType.Width);
-                               else if (Children[i].Width.IsRelativeToParent || Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
-                                       continue;
-                               else
-                                       cw = Children [i].Slot.Width;
-                               if (cw > contentSize.Width) {
-                                       contentSize.Width = cw;
-                                       largestChild = Children [i];
+                       try {
+
+                               largestChild = null;
+                               contentSize.Width = 0;
+                               for (int i = 0; i < Children.Count; i++) {
+                                       if (!Children [i].IsVisible)
+                                               continue;
+                                       int cw = 0;
+                                       if (forceMeasure)
+                                               cw = Children [i].measureRawSize (LayoutingType.Width);
+                                       else if (Children[i].Width.IsRelativeToParent || Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                               continue;
+                                       else
+                                               cw = Children [i].Slot.Width;
+                                       if (cw > contentSize.Width) {
+                                               contentSize.Width = cw;
+                                               largestChild = Children [i];
+                                       }
                                }
+                               if (largestChild == null && !forceMeasure)
+                                       searchLargestChild (true);
+                       } finally {
+                               childrenRWLock.ExitReadLock ();                         
+                               DbgLogger.EndEvent (DbgEvtType.GOSearchLargestChild);
                        }
-                       if (largestChild == null && !forceMeasure)
-                               searchLargestChild (true);
-
-                       childrenRWLock.ExitReadLock ();
-
-                       DbgLogger.EndEvent (DbgEvtType.GOSearchLargestChild);
                }
                protected virtual void searchTallestChild (bool forceMeasure = false)
                {
                        DbgLogger.StartEvent (DbgEvtType.GOSearchTallestChild, this);
-
                        childrenRWLock.EnterReadLock ();
 
-                       tallestChild = null;
-                       contentSize.Height = 0;
-                       for (int i = 0; i < Children.Count; i++) {
-                               if (!Children [i].IsVisible)
-                                       continue;
-                               int ch = 0;
-                               if (forceMeasure)
-                                       ch = Children [i].measureRawSize (LayoutingType.Height);
-                               else if (Children[i].Height.IsRelativeToParent || Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
-                                       continue;
-                               else
-                                       ch = Children [i].Slot.Height;
-                               if (ch > contentSize.Height) {
-                                       contentSize.Height = ch;
-                                       tallestChild = Children [i];
+                       try {
+                               tallestChild = null;
+                               contentSize.Height = 0;
+                               for (int i = 0; i < Children.Count; i++) {
+                                       if (!Children [i].IsVisible)
+                                               continue;
+                                       int ch = 0;
+                                       if (forceMeasure)
+                                               ch = Children [i].measureRawSize (LayoutingType.Height);
+                                       else if (Children[i].Height.IsRelativeToParent || Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                               continue;
+                                       else
+                                               ch = Children [i].Slot.Height;
+                                       if (ch > contentSize.Height) {
+                                               contentSize.Height = ch;
+                                               tallestChild = Children [i];
+                                       }
                                }
+                               if (tallestChild == null && !forceMeasure)
+                                       searchTallestChild (true);
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
+                               DbgLogger.EndEvent (DbgEvtType.GOSearchTallestChild);
                        }
-                       if (tallestChild == null && !forceMeasure)
-                               searchTallestChild (true);
-
-                       childrenRWLock.ExitReadLock ();
-
-                       DbgLogger.EndEvent (DbgEvtType.GOSearchTallestChild);
                }
        }
 }
index 5784bc2951e20b12e7916848f9addadb4440fc9b..cac017c7d38203267282f4a0f661817733b9e6da 100644 (file)
@@ -20,14 +20,15 @@ namespace Crow
                        if (base.FindByDesignID (designID, out go))
                                return true;
                        childrenRWLock.EnterReadLock ();
-                       foreach (Widget w in Children) {
-                               if (!w.FindByDesignID (designID, out go))
-                                       continue;
+                       try {
+                               foreach (Widget w in Children) {
+                                       if (w.FindByDesignID (designID, out go))
+                                               return true;
+                               }
+                               return false;
+                       } finally {
                                childrenRWLock.ExitReadLock ();
-                               return true;
                        }
-                       childrenRWLock.ExitReadLock ();
-                       return false;
                }
                public override void getIML (System.Xml.XmlDocument doc, System.Xml.XmlNode parentElem)
                {
@@ -73,12 +74,13 @@ namespace Crow
                        }
 
                        childrenRWLock.EnterWriteLock ();
-
-                       Children.Remove(child);
-                       child.Parent = null;
-                       child.LogicalParent = null;
-
-                       childrenRWLock.ExitWriteLock ();
+                       try {
+                               Children.Remove(child);
+                               child.Parent = null;
+                               child.LogicalParent = null;
+                       } finally {
+                               childrenRWLock.ExitWriteLock ();
+                       }
                }
         public virtual void DeleteChild(Widget child)
                {
@@ -91,11 +93,12 @@ namespace Crow
                                return;
                        }
                        childrenRWLock.EnterWriteLock ();
-                               
-                       g.Parent = this;
-                       Children.Insert (idx, g);
-
-                       childrenRWLock.ExitWriteLock ();                        
+                       try {   
+                               g.Parent = this;
+                               Children.Insert (idx, g);
+                       } finally {
+                               childrenRWLock.ExitWriteLock ();
+                       }
                }
                public virtual void RemoveChild (int idx) {
                        RemoveChild (children[idx]);
@@ -107,53 +110,57 @@ namespace Crow
                {
                        childrenRWLock.EnterWriteLock ();
 
-                       while (Children.Count > 0) {
-                               Widget g = Children [Children.Count - 1];
-                               Children.RemoveAt (Children.Count - 1);
-                               g.Dispose ();
+                       try {
+                               while (Children.Count > 0) {
+                                       Widget g = Children [Children.Count - 1];
+                                       Children.RemoveAt (Children.Count - 1);
+                                       g.Dispose ();
+                               }
+                       } finally {
+                               childrenRWLock.ExitWriteLock ();
                        }
-
-                       childrenRWLock.ExitWriteLock ();
                }
                public override void OnDataSourceChanged (object sender, DataSourceChangeEventArgs e)
                {
                        base.OnDataSourceChanged (this, e);
+
+                       childrenRWLock.EnterReadLock ();
                        try {
-                               childrenRWLock.EnterReadLock ();
                                foreach (Widget g in Children) {
                                        if (g.localDataSourceIsNull & g.localLogicalParentIsNull)
                                                g.OnDataSourceChanged (g, e);   
                                }
+                       } finally {
                                childrenRWLock.ExitReadLock ();
-                       } catch (Exception) {
-                               childrenRWLock.ExitReadLock ();
-                               throw;
                        }
                }
 
                public void putWidgetOnTop(Widget w)
                {
-                       if (Children.Contains(w))
-                       {
-                               childrenRWLock.EnterWriteLock ();
-
-                               Children.Remove (w);
-                               Children.Add (w);
-
+                       childrenRWLock.EnterWriteLock ();
+                       try {
+                               if (Children.Contains(w))
+                               {
+                                       Children.Remove (w);
+                                       Children.Add (w);
+                               }
+                       } finally {
                                childrenRWLock.ExitWriteLock ();
                        }
                }
+
                public void putWidgetOnBottom(Widget w)
                {
-                       if (Children.Contains(w))
-                       {
-                               childrenRWLock.EnterWriteLock ();
-
-                               Children.Remove (w);
-                               Children.Insert (0, w);
-
+                       childrenRWLock.EnterWriteLock ();
+                       try {
+                               if (Children.Contains(w))
+                               {
+                                       Children.Remove (w);
+                                       Children.Insert (0, w);
+                               }
+                       } finally {
                                childrenRWLock.ExitWriteLock ();
-                       }
+                       }                       
                }
 
                #region GraphicObject overrides
@@ -165,15 +172,18 @@ namespace Crow
 
                        childrenRWLock.EnterReadLock ();
 
-                       foreach (Widget w in Children) {
-                               tmp = w.FindByName (nameToFind);
-                               if (tmp != null)
-                                       break;
-                       }
+                       try {
 
-                       childrenRWLock.ExitReadLock ();
+                               foreach (Widget w in Children) {
+                                       tmp = w.FindByName (nameToFind);
+                                       if (tmp != null)
+                                               break;
+                               }
+                               return tmp;
 
-                       return tmp;
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
+                       }
                }
                public override T FindByType<T> () 
                {
@@ -195,13 +205,18 @@ namespace Crow
                }
                public override bool Contains (Widget goToFind)
                {
-                       foreach (Widget w in Children) {
-                               if (w == goToFind)
-                                       return true;
-                               if (w.Contains (goToFind))
-                                       return true;
+                       childrenRWLock.EnterReadLock ();
+                       try {
+                               foreach (Widget w in Children) {
+                                       if (w == goToFind)
+                                               return true;
+                                       if (w.Contains (goToFind))
+                                               return true;
+                               }
+                               return false;
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
                        }
-                       return false;
                }
 
                protected override void onDraw (Context gr)
@@ -217,20 +232,14 @@ namespace Crow
                                gr.Clip ();
                        }
 
+                       childrenRWLock.EnterReadLock ();
                        try
                        {
-                               childrenRWLock.EnterReadLock ();
-
                                for (int i = 0; i < Children.Count; i++) 
-                                       Children[i].Paint (gr);                 
-
+                                       Children[i].Paint (gr);                         
+                       } finally {
                                childrenRWLock.ExitReadLock ();
                        }
-                       catch (System.Exception)
-                       {
-                               childrenRWLock.ExitReadLock ();
-                               throw;
-                       }
 
                        if (ClipToClientRect)
                                gr.Restore ();
@@ -257,17 +266,18 @@ namespace Crow
                                        }
 
                                        childrenRWLock.EnterReadLock ();
-
-                                       foreach (Widget c in Children) {
-                                               if (!c.IsVisible)
-                                                       continue;
-                                               if (Clipping.Contains (c.Slot + ClientRectangle.Position) == RegionOverlap.Out)
-                                                       continue;
-                                               c.Paint (gr);
+                                       try {
+                                               foreach (Widget c in Children) {
+                                                       if (!c.IsVisible)
+                                                               continue;
+                                                       if (Clipping.Contains (c.Slot + ClientRectangle.Position) == RegionOverlap.Out)
+                                                               continue;
+                                                       c.Paint (gr);
+                                               }
+                                       } finally {
+                                               childrenRWLock.ExitReadLock ();
                                        }
 
-                                       childrenRWLock.ExitReadLock ();
-
                                        #if DEBUG_CLIP_RECTANGLE
                                        /*gr.LineWidth = 1;
                                        gr.SetSourceColor(Color.DarkMagenta.AdjustAlpha (0.8));
@@ -290,14 +300,16 @@ namespace Crow
                        base.checkHoverWidget (e);//TODO:check if not possible to put it at beginning of meth to avoid doubled check to DropTarget.
                        if (!childrenRWLock.TryEnterReadLock (10))
                                return;
-                       for (int i = Children.Count - 1; i >= 0; i--) {
-                               if (Children[i].MouseIsIn (e.Position)) {
-                                       Children[i].checkHoverWidget (e);
-                                       childrenRWLock.ExitReadLock ();
-                                       return;
+                       try {
+                               for (int i = Children.Count - 1; i >= 0; i--) {
+                                       if (Children[i].MouseIsIn (e.Position)) {
+                                               Children[i].checkHoverWidget (e);
+                                               return;
+                                       }
                                }
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
                        }
-                       childrenRWLock.ExitReadLock ();                 
                }
                #endregion
 
@@ -305,9 +317,12 @@ namespace Crow
                {
                        if (disposing) {
                                childrenRWLock.EnterReadLock ();
-                               foreach (Widget c in Children)
-                                       c.Dispose ();
-                               childrenRWLock.ExitReadLock ();
+                               try {
+                                       foreach (Widget c in Children)
+                                               c.Dispose ();
+                               } finally {
+                                       childrenRWLock.ExitReadLock ();
+                               }
                        }
                        base.Dispose (disposing);
                }
index 17544ec76844fc1b166dcb1054c6203f461d0451..31127dddc4b306ca20c21386f8e9ccbbf1c29816 100644 (file)
@@ -611,9 +611,12 @@ namespace Crow
                                if (!System.Threading.Monitor.TryEnter (linesMutex))
                                        return false;
                        }
-                       bool result = base.UpdateLayout (layoutType);
-                       System.Threading.Monitor.Exit (linesMutex);
-                       return result;
+                       try {
+                               bool result = base.UpdateLayout (layoutType);                           
+                               return result;
+                       } finally {
+                               System.Threading.Monitor.Exit (linesMutex);
+                       }
                }
                public override int measureRawSize(LayoutingType lt)
                {
index 959a455053492a3f5733b8d4cecb12826319df0e..b00bb2113410b155457a0918dbca056fe1693c0f 100644 (file)
@@ -114,10 +114,8 @@ namespace Crow {
                                gr.Clip ();
                        }
 
-                       try
-                       {
-                               childrenRWLock.EnterReadLock ();
-                               
+                       childrenRWLock.EnterReadLock ();
+                       try     {                               
                                for (int i = Scroll; i < Children.Count && i < Scroll + visibleItems; i++) {
                                        if (!Children[i].IsVisible)
                                                continue;
@@ -125,13 +123,8 @@ namespace Crow {
                                                continue;*/
                                        Children[i].Paint (gr);
                                }
-
-                               childrenRWLock.ExitReadLock ();
-                       }
-                       catch (System.Exception)
-                       {
+                       } finally {
                                childrenRWLock.ExitReadLock ();
-                               throw;
                        }
 
                        if (ClipToClientRect)
@@ -159,17 +152,18 @@ namespace Crow {
                                        }
 
                                        childrenRWLock.EnterReadLock ();
-
-                                       for (int i = Scroll; i < Children.Count && i < Scroll + visibleItems; i++) {
-                                               if (!Children[i].IsVisible)
-                                                       continue;
-                                               /*if (Clipping.Contains (c.Slot + ClientRectangle.Position) == RegionOverlap.Out)
-                                                       continue;*/
-                                               Children[i].Paint (gr);
+                                       try {
+                                               for (int i = Scroll; i < Children.Count && i < Scroll + visibleItems; i++) {
+                                                       if (!Children[i].IsVisible)
+                                                               continue;
+                                                       /*if (Clipping.Contains (c.Slot + ClientRectangle.Position) == RegionOverlap.Out)
+                                                               continue;*/
+                                                       Children[i].Paint (gr);
+                                               }
+                                       } finally {
+                                               childrenRWLock.ExitReadLock ();
                                        }
 
-                                       childrenRWLock.ExitReadLock ();
-
                                        #if DEBUG_CLIP_RECTANGLE
                                        /*gr.LineWidth = 1;
                                        gr.SetSourceColor(Color.DarkMagenta.AdjustAlpha (0.8));
@@ -191,14 +185,16 @@ namespace Crow {
                        base.checkHoverWidget (e);//TODO:check if not possible to put it at beginning of meth to avoid doubled check to DropTarget.
                        if (!childrenRWLock.TryEnterReadLock (10))
                                return;
-                       for (int i = Children.Count - 1; i >= 0; i--) {
-                               if (Children[i].MouseIsIn (e.Position)) {
-                                       Children[i].checkHoverWidget (e);
-                                       childrenRWLock.ExitReadLock ();
-                                       return;
+                       try {
+                               for (int i = Children.Count - 1; i >= 0; i--) {
+                                       if (Children[i].MouseIsIn (e.Position)) {
+                                               Children[i].checkHoverWidget (e);
+                                               return;
+                                       }
                                }
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
                        }
-                       childrenRWLock.ExitReadLock ();                 
                }
                /// <summary> Process scrolling vertically, or if shift is down, vertically </summary>
                public override void onMouseWheel (object sender, MouseWheelEventArgs e) {                      
index 27cfb9636a9e5030bb6914a4de3116d10b9abcb3..1427e9ba9348df0299b62e6d608c0787d0674496 100644 (file)
@@ -265,29 +265,30 @@ namespace Crow
                        Column c = Columns[cIdx];
 
                        childrenRWLock.EnterReadLock ();
-
-                       c.LargestChild = null;
-                       int largestWidth = 0;   
-                       for (int i = 1; i < Children.Count; i++) {
-                               TableRow row = Children[i] as TableRow;
-                               if (!row.IsVisible)
-                                       continue;
-                               int cw = row.Children [cIdx]. measureRawSize (LayoutingType.Width);
-                               if (cw > largestWidth) {
-                                       largestWidth = cw;
-                                       c.LargestChild = row.Children [cIdx];
+                       try {
+                               c.LargestChild = null;
+                               int largestWidth = 0;   
+                               for (int i = 1; i < Children.Count; i++) {
+                                       TableRow row = Children[i] as TableRow;
+                                       if (!row.IsVisible)
+                                               continue;
+                                       int cw = row.Children [cIdx]. measureRawSize (LayoutingType.Width);
+                                       if (cw > largestWidth) {
+                                               largestWidth = cw;
+                                               c.LargestChild = row.Children [cIdx];
+                                       }
                                }
+                               if (HeaderRow.Children[cIdx].Slot.Width > largestWidth) {
+                                       c.LargestChild = HeaderRow.Children[cIdx];
+                                       return;
+                               }
+                               HeaderRow.Children[cIdx].Slot.Width = largestWidth;
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
+                               DbgLogger.EndEvent (DbgEvtType.GOSearchLargestChild);
                        }
-                       childrenRWLock.ExitReadLock ();
-
-                       if (HeaderRow.Children[cIdx].Slot.Width > largestWidth) {
-                               c.LargestChild = HeaderRow.Children[cIdx];
-                               return;
-                       }
-                       HeaderRow.Children[cIdx].Slot.Width = largestWidth;
                        //HeaderRow.adjustStretchedGo (LayoutingType.Width);
 
-                       DbgLogger.EndEvent (DbgEvtType.GOSearchLargestChild);
                }
                int splitIndex = -1;            
                const int minColumnSize = 10;           
index 1ce02c1550c49b593f3e387680efcce00869c576..1f646bcb9d3870243a587c898aafc9246089535a 100644 (file)
@@ -45,11 +45,13 @@ namespace Crow
                                return;
                        }
                        childrenRWLock.EnterWriteLock ();
-                               
-                       g.Parent = this;
-                       Children.Insert (idx, g);
-                       
-                       childrenRWLock.ExitWriteLock ();
+
+                       try {                           
+                               g.Parent = this;
+                               Children.Insert (idx, g);
+                       } finally {                     
+                               childrenRWLock.ExitWriteLock ();
+                       }
 
                        if (g.LastSlots.Height > contentSize.Height) {
                                tallestChild = g;
@@ -70,12 +72,13 @@ namespace Crow
                        }
 
                        childrenRWLock.EnterWriteLock ();
-
-                       Children.Remove(child);
-                       child.Parent = null;
-                       child.LogicalParent = null;
-
-                       childrenRWLock.ExitWriteLock ();
+                       try {
+                               Children.Remove(child);
+                               child.Parent = null;
+                               child.LogicalParent = null;
+                       } finally {                     
+                               childrenRWLock.ExitWriteLock ();
+                       }
 
                        if (child == tallestChild && Height == Measure.Fit)
                                searchTallestChild ();
@@ -86,16 +89,17 @@ namespace Crow
                public override void ClearChildren()
                {
                        childrenRWLock.EnterWriteLock ();
-
-                       while (Children.Count > 0) {
-                               Widget g = Children [Children.Count - 1];
-                               g.LayoutChanged -= OnChildLayoutChanges;
-                               Children.RemoveAt (Children.Count - 1);
-                               g.Dispose ();
+                       try {
+                               while (Children.Count > 0) {
+                                       Widget g = Children [Children.Count - 1];
+                                       g.LayoutChanged -= OnChildLayoutChanges;
+                                       Children.RemoveAt (Children.Count - 1);
+                                       g.Dispose ();
+                               }
+                       } finally {
+                               childrenRWLock.ExitWriteLock ();
                        }
 
-                       childrenRWLock.ExitWriteLock ();
-
                        resetChildrenMaxSize ();
 
                        RegisterForLayouting (LayoutingType.Sizing);
@@ -111,21 +115,20 @@ namespace Crow
                {
                        base.OnLayoutChanges (layoutType);
 
-                       childrenRWLock.EnterReadLock ();
                        //position smaller objects in group when group size is fit
-                       switch (layoutType) {
-                       case LayoutingType.Height:
+                       if (layoutType == LayoutingType.Height) {
                                childrenRWLock.EnterReadLock ();
-                               foreach (Widget c in Children) {
-                                       if (c.Height.IsRelativeToParent)
-                                               c.RegisterForLayouting (LayoutingType.Height);
-                                       else
-                                               c.RegisterForLayouting (LayoutingType.Y);
+                               try {
+                                       foreach (Widget c in Children) {
+                                               if (c.Height.IsRelativeToParent)
+                                                       c.RegisterForLayouting (LayoutingType.Height);
+                                               else
+                                                       c.RegisterForLayouting (LayoutingType.Y);
+                                       }
+                               } finally {
+                                       childrenRWLock.ExitReadLock ();
                                }
-                               childrenRWLock.ExitReadLock ();
-                               break;
                        }
-                       childrenRWLock.ExitReadLock ();
                }               
                public virtual void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
                {
@@ -152,32 +155,32 @@ namespace Crow
                protected virtual void searchTallestChild (bool forceMeasure = false)
                {
                        DbgLogger.StartEvent (DbgEvtType.GOSearchTallestChild, this);
-
                        childrenRWLock.EnterReadLock ();
 
-                       tallestChild = null;
-                       contentSize.Height = 0;
-                       for (int i = 0; i < Children.Count; i++) {
-                               if (!Children [i].IsVisible)
-                                       continue;
-                               int ch = 0;
-                               if (forceMeasure)
-                                       ch = Children [i].measureRawSize (LayoutingType.Height);
-                               else if (Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
-                                       continue;
-                               else
-                                       ch = Children [i].Slot.Height;
-                               if (ch > contentSize.Height) {
-                                       contentSize.Height = ch;
-                                       tallestChild = Children [i];
+                       try {
+                               tallestChild = null;
+                               contentSize.Height = 0;
+                               for (int i = 0; i < Children.Count; i++) {
+                                       if (!Children [i].IsVisible)
+                                               continue;
+                                       int ch = 0;
+                                       if (forceMeasure)
+                                               ch = Children [i].measureRawSize (LayoutingType.Height);
+                                       else if (Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                               continue;
+                                       else
+                                               ch = Children [i].Slot.Height;
+                                       if (ch > contentSize.Height) {
+                                               contentSize.Height = ch;
+                                               tallestChild = Children [i];
+                                       }
                                }
+                               if (tallestChild == null && !forceMeasure)
+                                       searchTallestChild (true);
+                       } finally {
+                               childrenRWLock.ExitReadLock ();
+                               DbgLogger.EndEvent (DbgEvtType.GOSearchTallestChild);
                        }
-                       if (tallestChild == null && !forceMeasure)
-                               searchTallestChild (true);
-
-                       childrenRWLock.ExitReadLock ();
-
-                       DbgLogger.EndEvent (DbgEvtType.GOSearchTallestChild);
                }
                void resetChildrenMaxSize(){
                        tallestChild = null;
index f489ca961edb730cac4183e18b7e129f3a8061b7..90c2355332c2e128651929696017dd29bca9e9ef 100644 (file)
@@ -365,14 +365,14 @@ namespace Crow {
                        try {
                                loadPage (data, itemsContainer, dataTest);
                        } catch (Exception ex) {
-                               while (Monitor.IsEntered (IFace.UpdateMutex))
+/*                             while (Monitor.IsEntered (IFace.UpdateMutex))
                                        Monitor.Exit (IFace.UpdateMutex);
                                while (Monitor.IsEntered (IFace.LayoutMutex)) 
-                                       Monitor.Exit (IFace.LayoutMutex);                       
+                                       Monitor.Exit (IFace.LayoutMutex);*/
                                System.Diagnostics.Debug.WriteLine ("loading thread aborted: " + ex.ToString());
+                       } finally {
+                               DbgLogger.EndEvent (DbgEvtType.TGLoadingThread);
                        }
-
-                       DbgLogger.EndEvent (DbgEvtType.TGLoadingThread);
                }
                //                      //if (!ItemTemplates.ContainsKey ("default"))
                //                      //      ItemTemplates ["default"] = Interface.GetItemTemplate (ItemTemplate);
@@ -392,7 +392,7 @@ namespace Crow {
 
                        DbgLogger.StartEvent (DbgEvtType.TGCancelLoadingThread, this);
 
-                       int updateMx = 0, layoutMx = 0;
+                       /*int updateMx = 0, layoutMx = 0;
 
                        while (Monitor.IsEntered (IFace.UpdateMutex)) {
                                Monitor.Exit (IFace.UpdateMutex);
@@ -401,14 +401,14 @@ namespace Crow {
                        while (Monitor.IsEntered (IFace.LayoutMutex)) {
                                Monitor.Exit (IFace.LayoutMutex);
                                layoutMx++;
-                       }                       
+                       }*/                     
 
                        loadingThread.Cancel ();
 
-                       for (int i = 0; i < layoutMx; i++)
+                       /*for (int i = 0; i < layoutMx; i++)
                                Monitor.Enter (IFace.LayoutMutex);
                        for (int i = 0; i < updateMx; i++)
-                               Monitor.Enter (IFace.UpdateMutex);
+                               Monitor.Enter (IFace.UpdateMutex);*/
 
                        loadingThread = null;
                        
@@ -500,6 +500,7 @@ namespace Crow {
                                }
                        }
                        
+                       try {
                                g = iTemp.CreateInstance();
                                #if DESIGN_MODE
                                g.design_isTGItem = true;
@@ -508,7 +509,9 @@ namespace Crow {
 //                             if (isPaged)
                                g.LogicalParent = this;
                                g.MouseClick += itemClick;
-                       Monitor.Exit (IFace.UpdateMutex);
+                       } finally {
+                               Monitor.Exit (IFace.UpdateMutex);
+                       }
 
                        if (iTemp.Expand != null) {
                                IToggle toggle = g as IToggle;
index dbed07b70d2465b281d5a210b6f459c8eed3b395..d47675b8108049ae3db5aa9af2959220d2e2d6ee 100644 (file)
@@ -332,7 +332,7 @@ namespace Crow
                /// Parent in the graphic tree, used for rendering and layouting
                /// </summary>
                [XmlIgnore]public virtual ILayoutable Parent {
-                       get { return parent; }
+                       get => parent;
                        set {
                                if (parent == value)
                                        return;
@@ -1012,12 +1012,12 @@ namespace Crow
                                if (value != null)
                                        rootDataLevel = true;
 
-                               DbgLogger.StartEvent(DbgEvtType.GOLockUpdate, this);
-                               lock (IFace.UpdateMutex) {
+                               /*DbgLogger.StartEvent(DbgEvtType.GOLockUpdate, this);
+                               lock (IFace.UpdateMutex) {*/
                                        OnDataSourceChanged (this, dse);
                                        NotifyValueChangedAuto (DataSource);
-                               }
-                               DbgLogger.EndEvent (DbgEvtType.GOLockUpdate);
+                               /*}
+                               DbgLogger.EndEvent (DbgEvtType.GOLockUpdate);*/
                        }
                        get {
                                return rootDataLevel ? dataSource : dataSource == null ?
@@ -1456,8 +1456,8 @@ namespace Crow
 
                        parentRWLock.EnterReadLock ();
                        if (parent != null) {                                   
-                               Parent.RegisterClip (LastPaintedSlot);
-                               Parent.RegisterClip (Slot);
+                               parent.RegisterClip (LastPaintedSlot);
+                               parent.RegisterClip (Slot);
                        }
                        parentRWLock.ExitReadLock ();
 
@@ -1473,30 +1473,26 @@ namespace Crow
                                return;
                        }
                        DbgLogger.StartEvent(DbgEvtType.GORegisterClip, this);
-                       Rectangle cb = ClientRectangle;
-                       Rectangle  r = clip + cb.Position;
-                       if (r.Right > cb.Right)
-                               r.Width -= r.Right - cb.Right;
-                       if (r.Bottom > cb.Bottom)
-                               r.Height -= r.Bottom - cb.Bottom;
-                       if (r.Width < 0 || r.Height < 0) {
-                               //Debug.WriteLine ($"Invalid clip: {clip}:{r} hnd:{this}");//\n{Environment.StackTrace}");                              
-                               DbgLogger.EndEvent (DbgEvtType.GORegisterClip);                         
-                               return;
-                       }
-                       if (cacheEnabled && !IsDirty)
-                               Clipping.UnionRectangle (r);
-                       if (Parent == null) {
-                               DbgLogger.EndEvent (DbgEvtType.GORegisterClip);
-                               return;
-                       }
-                       Widget p = Parent as Widget;
-                       if (p?.IsDirty == true && p?.CacheEnabled == true) {
+                       try {
+                               Rectangle cb = ClientRectangle;
+                               Rectangle  r = clip + cb.Position;
+                               if (r.Right > cb.Right)
+                                       r.Width -= r.Right - cb.Right;
+                               if (r.Bottom > cb.Bottom)
+                                       r.Height -= r.Bottom - cb.Bottom;
+                               if (r.Width < 0 || r.Height < 0)
+                                       return;
+                               if (cacheEnabled && !IsDirty)
+                                       Clipping.UnionRectangle (r);
+                               if (Parent == null)                                     
+                                       return;                         
+                               Widget p = Parent as Widget;
+                               if (p?.IsDirty == true && p?.CacheEnabled == true)
+                                       return;                         
+                               Parent.RegisterClip (r + Slot.Position);
+                       } finally {
                                DbgLogger.EndEvent (DbgEvtType.GORegisterClip);
-                               return;
                        }
-                       Parent.RegisterClip (r + Slot.Position);
-                       DbgLogger.EndEvent (DbgEvtType.GORegisterClip);
                }
                /// <summary> Full update, if width or height is 'Fit' a layouting is requested, and a redraw is done in any case. </summary>
                [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -1580,47 +1576,47 @@ namespace Crow
                        if (Parent == null)
                                return;
                        DbgLogger.StartEvent (DbgEvtType.GOLockLayouting, this);
-                       lock (IFace.LayoutMutex) {
-                               //prevent queueing same LayoutingType for this
-                               layoutType &= (~RegisteredLayoutings);
+                       try {
+                               lock (IFace.LayoutMutex) {
+                                       //prevent queueing same LayoutingType for this
+                                       layoutType &= (~RegisteredLayoutings);
 
-                               if (layoutType == LayoutingType.None) {
-                                       DbgLogger.EndEvent (DbgEvtType.GOLockLayouting);
-                                       return;
-                               }
-                               //dont set position for stretched item
-                               if (Width == Measure.Stretched)
-                                       layoutType &= (~LayoutingType.X);
-                               if (Height == Measure.Stretched)
-                                       layoutType &= (~LayoutingType.Y);
+                                       if (layoutType == LayoutingType.None)
+                                               return;
+                                       
+                                       //dont set position for stretched item
+                                       if (Width == Measure.Stretched)
+                                               layoutType &= (~LayoutingType.X);
+                                       if (Height == Measure.Stretched)
+                                               layoutType &= (~LayoutingType.Y);
 
-                               if (!ArrangeChildren)
-                                       layoutType &= (~LayoutingType.ArrangeChildren);
+                                       if (!ArrangeChildren)
+                                               layoutType &= (~LayoutingType.ArrangeChildren);
 
-                               //apply constraints depending on parent type
-                               Parent.ChildrenLayoutingConstraints (this, ref layoutType);
+                                       //apply constraints depending on parent type
+                                       Parent.ChildrenLayoutingConstraints (this, ref layoutType);
 
-//                             //prevent queueing same LayoutingType for this
-                               layoutType &= (~RegisteredLayoutings);
+       //                              //prevent queueing same LayoutingType for this
+                                       layoutType &= (~RegisteredLayoutings);
 
-                               if (layoutType == LayoutingType.None) {
-                                       DbgLogger.EndEvent (DbgEvtType.GOLockLayouting);
-                                       return;
-                               }
+                                       if (layoutType == LayoutingType.None)
+                                               return;
 
-                               //enqueue LQI LayoutingTypes separately
-                               if (layoutType.HasFlag (LayoutingType.Width))
-                                       IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this));
-                               if (layoutType.HasFlag (LayoutingType.Height))
-                                       IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this));
-                               if (layoutType.HasFlag (LayoutingType.X))
-                                       IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
-                               if (layoutType.HasFlag (LayoutingType.Y))
-                                       IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
-                               if (layoutType.HasFlag (LayoutingType.ArrangeChildren))
-                                       IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this));
+                                       //enqueue LQI LayoutingTypes separately
+                                       if (layoutType.HasFlag (LayoutingType.Width))
+                                               IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this));
+                                       if (layoutType.HasFlag (LayoutingType.Height))
+                                               IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this));
+                                       if (layoutType.HasFlag (LayoutingType.X))
+                                               IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
+                                       if (layoutType.HasFlag (LayoutingType.Y))
+                                               IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
+                                       if (layoutType.HasFlag (LayoutingType.ArrangeChildren))
+                                               IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this));
+                               }
+                       } finally {
+                               DbgLogger.EndEvent (DbgEvtType.GOLockLayouting);
                        }
-                       DbgLogger.EndEvent (DbgEvtType.GOLockLayouting);
                }
 
                /// <summary> trigger dependant sizing component update </summary>
@@ -1888,11 +1884,11 @@ namespace Crow
                                DbgLogger.EndEvent (DbgEvtType.GOPaint);
                                return; 
                        }
-                       lock (this) {
+                       //lock (this) {
                                if (cacheEnabled) {
                                        if (Slot.Width > Interface.MaxCacheSize || Slot.Height > Interface.MaxCacheSize)
                                                cacheEnabled = false;
-                               }
+                               }                               
 
                                if (cacheEnabled) {
                                        if (IsDirty) {
@@ -1915,9 +1911,10 @@ namespace Crow
                                        if (!IsEnabled)
                                                paintDisabled (ctx, rb);
 
-                               }
+                               }                               
+
                                LastPaintedSlot = Slot;
-                       }
+                       //}
                        Painted.Raise (this, null);
 
                        DbgLogger.EndEvent (DbgEvtType.GOPaint);
index f7bd51444447b6f01ea5ff499d5c3b408af84a45..07b575b0cdab7fe9b13650eb1321e3911f6172a9 100644 (file)
@@ -154,7 +154,7 @@ namespace Crow
                /// <param name="YDelta">mouse delta on the Y axis</param>
                /// <param name="currentDirection">Current Direction of the operation, none for moving, other value for resizing in the given direction</param>
                protected void moveAndResize (int XDelta, int YDelta, Direction currentDirection = (Direction)0) {
-                       lock (IFace.UpdateMutex) {
+                       //lock (IFace.UpdateMutex) {
                                int currentLeft = this.Left;
                                int currentTop = this.Top;
                                int currentWidth, currentHeight;
@@ -223,7 +223,7 @@ namespace Crow
                                        this.Width = currentWidth + XDelta;
                                        break;
                                }                               
-                       }
+                       //}
                }
 
                bool maySize => sizingHandle == null ? false : resizable & sizingHandle.IsHover;
@@ -386,15 +386,15 @@ namespace Crow
                        if (Parent is Interface)
                                (Parent as Interface).DeleteWidget (this);
                        else {
-                               Widget p = Parent as Widget;
-                               if (p is Group g) {
-                                       lock (IFace.UpdateMutex) {
-                                               RegisterClip (p.ScreenCoordinates (p.LastPaintedSlot));
-                                               g.DeleteChild (this);
-                                       }
-                                       //(Parent as Group).RegisterForRedraw ();
-                               } else if (Parent is Container c)
-                                       c.Child = null;
+                               lock (IFace.UpdateMutex) {
+                                       Widget p = Parent as Widget;
+                                       if (p is Group g) {
+                                                       RegisterClip (p.ScreenCoordinates (p.LastPaintedSlot));
+                                                       g.DeleteChild (this);
+                                               //(Parent as Group).RegisterForRedraw ();
+                                       } else if (Parent is Container c)
+                                               c.Child = null;
+                               }
                        }
                }
 
index ead1f533e9ff2cf660670122b8abbff34a0a8895..19243ba0c22b97b35a06391354050b0b37e7e78d 100644 (file)
@@ -109,27 +109,27 @@ namespace Crow
                                        int largestChild = 0;
 
                                        childrenRWLock.EnterReadLock();
-
-                                       foreach (Widget c in Children) {
-                                               if (!c.Visible)
-                                                       continue;
-                                               if (c.Height.IsRelativeToParent &&
-                                                   c.RegisteredLayoutings.HasFlag (LayoutingType.Height)) {
-                                                       childrenRWLock.ExitReadLock();
-                                                       return -1;
+                                       try {
+                                               foreach (Widget c in Children) {
+                                                       if (!c.IsVisible)
+                                                               continue;
+                                                       if (c.Height.IsRelativeToParent &&
+                                                           c.RegisteredLayoutings.HasFlag (LayoutingType.Height)) {                                                    
+                                                               return -1;
+                                                       }
+                                                       if (dy + c.Slot.Height > ClientRectangle.Height) {
+                                                               dy = 0;
+                                                               tmp += largestChild + Spacing;
+                                                               largestChild = c.Slot.Width;
+                                                       } else if (largestChild < c.Slot.Width)
+                                                               largestChild = c.Slot.Width;
+
+                                                       dy += c.Slot.Height + Spacing;
                                                }
-                                               if (dy + c.Slot.Height > ClientRectangle.Height) {
-                                                       dy = 0;
-                                                       tmp += largestChild + Spacing;
-                                                       largestChild = c.Slot.Width;
-                                               } else if (largestChild < c.Slot.Width)
-                                                       largestChild = c.Slot.Width;
-
-                                               dy += c.Slot.Height + Spacing;
+                                       } finally {
+                                               childrenRWLock.ExitReadLock ();
                                        }
 
-                                       childrenRWLock.ExitReadLock ();
-
                                        if (dy == 0)
                                                tmp -= Spacing;
                                        return tmp + largestChild + 2 * Margin;
@@ -144,27 +144,27 @@ namespace Crow
                                int tallestChild = 0;
 
                                childrenRWLock.EnterReadLock();
+                               try {
+                                       foreach (Widget c in Children) {
+                                               if (!c.IsVisible)
+                                                       continue;
+                                               if (c.Width.IsRelativeToParent &&
+                                                   c.RegisteredLayoutings.HasFlag (LayoutingType.Width)) {
+                                                       return -1;
+                                               }
+                                               if (dx + c.Slot.Width > ClientRectangle.Width) {
+                                                       dx = 0;
+                                                       tmp += tallestChild + Spacing;
+                                                       tallestChild = c.Slot.Height;
+                                               } else if (tallestChild < c.Slot.Height)
+                                                       tallestChild = c.Slot.Height;
 
-                               foreach (Widget c in Children) {
-                                       if (!c.Visible)
-                                               continue;
-                                       if (c.Width.IsRelativeToParent &&
-                                           c.RegisteredLayoutings.HasFlag (LayoutingType.Width)) {
-                                               childrenRWLock.ExitReadLock();
-                                               return -1;
+                                               dx += c.Slot.Width + Spacing;
                                        }
-                                       if (dx + c.Slot.Width > ClientRectangle.Width) {
-                                               dx = 0;
-                                               tmp += tallestChild + Spacing;
-                                               tallestChild = c.Slot.Height;
-                                       } else if (tallestChild < c.Slot.Height)
-                                               tallestChild = c.Slot.Height;
-
-                                       dx += c.Slot.Width + Spacing;
+                               } finally {
+                                       childrenRWLock.ExitReadLock();
                                }
 
-                               childrenRWLock.ExitReadLock();
-
                                if (dx == 0)
                                        tmp -= Spacing;
                                return tmp + tallestChild + 2 * Margin;
@@ -192,30 +192,35 @@ namespace Crow
                }
                public override void OnLayoutChanges (LayoutingType layoutType)
                {
-                       switch (layoutType) {
-                       case LayoutingType.Width:
-                               foreach (Widget c in Children) {
-                                       if (c.Width.IsRelativeToParent)
-                                               c.RegisterForLayouting (LayoutingType.Width);
-                               }
-                               if (Height == Measure.Fit)
-                                       RegisterForLayouting (LayoutingType.Height);
-                               RegisterForLayouting (LayoutingType.X);
-                               break;
-                       case LayoutingType.Height:
-                               foreach (Widget c in Children) {
-                                       if (c.Height.IsRelativeToParent)
-                                               c.RegisterForLayouting (LayoutingType.Height);
+                       childrenRWLock.EnterReadLock();
+                       try {
+                               switch (layoutType) {
+                               case LayoutingType.Width:
+                                       foreach (Widget c in Children) {
+                                               if (c.Width.IsRelativeToParent)
+                                                       c.RegisterForLayouting (LayoutingType.Width);
+                                       }
+                                       if (Height == Measure.Fit)
+                                               RegisterForLayouting (LayoutingType.Height);
+                                       RegisterForLayouting (LayoutingType.X);
+                                       break;
+                               case LayoutingType.Height:
+                                       foreach (Widget c in Children) {
+                                               if (c.Height.IsRelativeToParent)
+                                                       c.RegisterForLayouting (LayoutingType.Height);
+                                       }
+                                       if (Width == Measure.Fit)
+                                               RegisterForLayouting (LayoutingType.Width);
+                                       RegisterForLayouting (LayoutingType.Y);
+                                       break;
+                               default:
+                                       return;
                                }
-                               if (Width == Measure.Fit)
-                                       RegisterForLayouting (LayoutingType.Width);
-                               RegisterForLayouting (LayoutingType.Y);
-                               break;
-                       default:
-                               return;
+                               RegisterForLayouting (LayoutingType.ArrangeChildren);
+                               raiseLayoutChanged (layoutType);
+                       } finally {
+                               childrenRWLock.ExitReadLock();
                        }
-                       RegisterForLayouting (LayoutingType.ArrangeChildren);
-                       raiseLayoutChanged (layoutType);
                }
                #endregion
        }
index 6af3f6dfd2b7bd6b58e6759e2b70bb536046971b..b369d2488ae04901d30dc5a793debb62fa9349ec 100644 (file)
@@ -30,12 +30,15 @@ namespace Crow
                long ticksPerPixel;
                double pixelPerTick;
 
+               object dataMutex = new object();
+
                public DbgEvent Event {
                        get => evt;
                        set {
                                if (evt == value)
                                        return;
-                               evt = value;
+                               lock (dataMutex)
+                                       evt = value;
                                updatePixelPerTicks ();
                                NotifyValueChangedAuto (evt);
                                RegisterForRedraw ();
@@ -46,6 +49,8 @@ namespace Crow
                        private set {
                                if (hoverEvt == value)
                                        return;
+                               lock (dataMutex)
+                                       evt = value;
                                hoverEvt = value;
                                NotifyValueChangedAuto (hoverEvt);
                        }
@@ -83,24 +88,27 @@ namespace Crow
 
                protected override void onDraw (Context gr)
                {
-                       if (Event == null) {
-                               base.onDraw (gr);
-                               return;
-                       }
+                       lock (dataMutex) {
+
+                               if (Event == null) {
+                                       base.onDraw (gr);
+                                       return;
+                               }
 
-                       gr.LineWidth = 1;
-                       gr.SetDash (new double [] { 1.0, 3.0 }, 0);
+                               gr.LineWidth = 1;
+                               gr.SetDash (new double [] { 1.0, 3.0 }, 0);
 
-                       Rectangle cb = ClientRectangle;
+                               Rectangle cb = ClientRectangle;
 
-                       if (Event.Duration == 0) {
-                               gr.SetSource (Event.Color);
-                               gr.Rectangle (cb);
-                               gr.Fill ();
-                               return;
-                       }
+                               if (Event.Duration == 0) {
+                                       gr.SetSource (Event.Color);
+                                       gr.Rectangle (cb);
+                                       gr.Fill ();
+                                       return;
+                               }
 
-                       drawEvent (gr, cb.Height, Event);
+                               drawEvent (gr, cb.Height, Event);
+                       }
                }
                void drawEvent (Context ctx, int h, DbgEvent dbge)
                {
index d39cc62a6c56779490b5b1b70a1b074785ae4332..251090ef0a8e6982e5fcd110ed684a6d1fe61161 100644 (file)
@@ -481,7 +481,7 @@ namespace Crow
                                if (lastTick >= 0 && hoverTick >= 0)
                                        ScrollX += lastTick - hoverTick;
                                if (lastLine >= 0 && hoverLine >= 0)
-                               ScrollY += lastLine - hoverLine;
+                                       ScrollY += lastLine - hoverLine;
                                updateMouseLocalPos (e.Position);
                        } else {
                                HoverWidget = (hoverLine < 0 || hoverLine >= widgets.Count) ? null : widgets [hoverLine];
index 1653f163d264884c30a1f4eca1faec117000c5bc..64de2163832c4a000a5d7378c3366be0a5ce7bff 100644 (file)
@@ -43,13 +43,28 @@ namespace Crow
                                }
                                catch (System.Exception ex)
                                {
-                                       while (Monitor.IsEntered(LayoutMutex))
+                                       while (Monitor.IsEntered(LayoutMutex)) {
+                                               Console.WriteLine ($"[DebugIFace] trying to exit LayoutMutex on error");
+                                               Monitor.Exit (LayoutMutex);
+                                       }
+                                       while (Monitor.IsEntered(UpdateMutex)) {
+                                               Console.WriteLine ($"[DebugIFace] trying to exit UpdateMutex on error");
+                                               Monitor.Exit (UpdateMutex);
+                                       }
+                                       while (Monitor.IsEntered(ClippingMutex)) {
+                                               Console.WriteLine ($"[DebugIFace] trying to exit ClippingMutex on error");
+                                               Monitor.Exit (ClippingMutex);
+                                       }
+
+
+                                       /*while (Monitor.IsEntered(LayoutMutex))
                                                Monitor.Exit (LayoutMutex);
                                        while (Monitor.IsEntered(UpdateMutex))
                                                Monitor.Exit (UpdateMutex);
                                        while (Monitor.IsEntered(ClippingMutex))
-                                               Monitor.Exit (ClippingMutex);
-                                       delSetCurrentException (ex);                                    
+                                               Monitor.Exit (ClippingMutex);*/
+                                       delSetCurrentException (ex);
+                                       Console.WriteLine ($"[DbgIFace] {ex}");
                                        ClearInterface();
                                        Thread.Sleep(1000);     
                                }
index 8cee874a17ba11458793483e310de280545afa8b..13e0234dbe7a81ad928ad5be8ee736eb9c6d812a 100644 (file)
@@ -21,8 +21,7 @@ namespace DebugLogAnalyzer
                
                static void Main (string [] args)
                {
-                       DbgLogger.IncludeEvents = DbgEvtType.None;
-                       DbgLogger.DiscardEvents = DbgEvtType.All;
+                       initDebugLog ();
 
                        using (Program app = new Program ()) {
                                CurrentProgramInstance = app;
@@ -195,15 +194,6 @@ namespace DebugLogAnalyzer
                }
                public List<DbgWidgetEvent> CurWidgetRootEvents => curWidget == null? new List<DbgWidgetEvent>() : curWidget.RootEvents;
 
-               public bool DebugLogToFile {
-                       get => Configuration.Global.Get<bool> (nameof(DebugLogToFile));
-                       set {
-                               if (DbgLogger.ConsoleOutput != value)
-                                       return;                         
-                               Configuration.Global.Set (nameof(DebugLogToFile), value);
-                               NotifyValueChanged(DebugLogToFile);
-                       }
-               }
                /*public string DebugLogFilePath {
                        get => Configuration.Global.Get<string> (nameof (DebugLogFilePath));
                        set {
@@ -216,8 +206,8 @@ namespace DebugLogAnalyzer
                public bool DebugLogOnStartup {
                        get => Configuration.Global.Get<bool> (nameof(DebugLogOnStartup));
                        set {
-                               if (DbgLogger.ConsoleOutput != value)
-                                       return;                         
+                               if (DebugLogOnStartup == value)
+                                       return;
                                Configuration.Global.Set (nameof(DebugLogOnStartup), value);
                                NotifyValueChanged(DebugLogOnStartup);
                        }
index 2b5ab978a03760700a4ebac4a9da1f30ff69e201..a4e947afcf1cd94950b62b945fe196282bb52a58 100644 (file)
@@ -31,7 +31,7 @@
                                        <Label Style="smallLabValue" Tooltip="VisibleTicks" Text="{../../dbv.VisibleTicks}"/>                           
                                </HorizontalStack>
                        </VerticalStack>
-                       <!--<VerticalStack Name="AllEvents" Width="Stretched" IsVisible="false">
+                       <VerticalStack Name="AllEvents" Width="Stretched" IsVisible="false">
                                <TreeView Height="Stretched" Name="dbgTV" Data="{Events}" SelectedItem="{²CurrentEvent}" Background="DarkGrey"                                                 
                                                        ItemTemplate="#Dbg.DbgEventTreeItems.itemp"/> 
                                <ListBox Data="{CurWidgetEvents}" Height="100" SelectedItem="{²CurrentEvent}">
@@ -50,7 +50,7 @@
                        <VerticalStack Name="CurWidgetEvents" Width="Stretched" IsVisible="false">
                                <TreeView Height="Stretched" Data="{CurrentWidgetEvents}" Background="DarkGrey"                                                 
                                                        ItemTemplate="#Dbg.DbgEventTreeItems.itemp"/> 
-                       </VerticalStack>-->
+                       </VerticalStack>
                </TabView>
                <Splitter/>
                <HorizontalStack Height="30%">
index 95d15a85790515fe647341fde48f73788858c195..fdbe6aa3fd6be09a24ea6a6779f676be3559f9d2 100644 (file)
@@ -21,9 +21,7 @@ namespace ShowCase
        {
                static void Main ()
                {
-                       DbgLogger.IncludeEvents = DbgEvtType.Layouting;
-                       //DbgLogger.DiscardEvents = DbgEvtType.All;
-                       //DbgLogger.ConsoleOutput = !Configuration.Global.Get<bool> (nameof (DebugLogToFile));                  
+                       initDebugLog ();
 
                        Environment.SetEnvironmentVariable ("FONTCONFIG_PATH", @"C:\Users\Jean-Philippe\source\vcpkg\installed\x64-windows\tools\fontconfig\fonts");
 
@@ -108,17 +106,6 @@ namespace ShowCase
                        reloadChrono.Reset ();
                }
 
-
-               public bool DebugLogToFile {
-                       get => !DbgLogger.ConsoleOutput;
-                       set {
-                               if (DbgLogger.ConsoleOutput != value)
-                                       return;
-                               DbgLogger.ConsoleOutput = !value;
-                               Configuration.Global.Set (nameof(DebugLogToFile), DebugLogToFile);
-                               NotifyValueChanged(DebugLogToFile);
-                       }
-               }
                public string DebugLogFilePath {
                        get => Configuration.Global.Get<string> (nameof (DebugLogFilePath));
                        set {
index 4af718a2a83d12749a68d41453885331776cfe5f..54ad877708723ad7d47482834ec4331ec97def15 100644 (file)
@@ -98,6 +98,23 @@ namespace Samples
                                NotifyValueChanged(debugLogRecording);
                        }
                }
+               public bool DebugLogToFile {
+                       get => Configuration.Global.Get<bool> (nameof(DebugLogToFile));
+                       set {
+                               if (DebugLogToFile != value)
+                                       return;                         
+                               Configuration.Global.Set (nameof(DebugLogToFile), value);
+                               NotifyValueChanged(DebugLogToFile);
+                               DbgLogger.ConsoleOutput = !value;
+                       }
+               }
+               protected static void initDebugLog () {
+                       DbgLogger.IncludeEvents = DbgEvtType.None;
+                       DbgLogger.DiscardEvents = DbgEvtType.All;
+                       //DbgLogger.DiscardEvents = DbgEvtType.All;
+                       DbgLogger.ConsoleOutput = !Configuration.Global.Get<bool> (nameof (DebugLogToFile));
+               }
+
 
                public new bool IsDirty => source != origSource;
 
index f84ad20a69e5e2f544bade64721060f6a351dc66..263edfc725702ac74528985f55611cc1f636f385 100644 (file)
@@ -2,26 +2,21 @@
 <Window Caption="Showcase" Height="90%" Width="90%" Background="DarkGrey">
        <HorizontalStack>
                <VerticalStack Width="30%" Margin="5">
-                       <GroupBox Caption="Performance" Height="Fit">
-                               <VerticalStack DataSource="{updateMeasure}" Width="90%" Height="Fit" Spacing="2">
+                       <ListBox Data="{PerfMeasures}" Height="Fit">
+                               <Template>
+                                       <GroupBox Caption="Performance">
+                                               <VerticalStack Name="ItemsContainer" Width="90%" Spacing="2"/>
+                                       </GroupBox>
+                               </Template>
+                               <ItemTemplate>
                                        <HorizontalStack Style="HStackMeasure">
-                                               <Label Text="Cur:" Style="FpsLabel"/>
-                                               <Label Text="{current}" Style="FpsDisp"/>
+                                               <Label Text="{Name}" Style="FpsLabel" Width="80"/>
+                                               <Label Text="{current}" Style="FpsDisp" Width="60" TextAlignment="Right" Margin="2"/>
+                                               <Label Text="{minimum}" Style="FpsDisp" Width="60" TextAlignment="Right" Margin="2"/>
+                                               <Label Text="{maximum}" Style="FpsDisp" Width="60" TextAlignment="Right" Margin="2"/>
                                        </HorizontalStack>
-                                       <HorizontalStack Style="HStackMeasure">
-                                               <Label Text="Min:" Style="FpsLabel"/>
-                                               <Label Text="{minimum}" Style="FpsDisp"/>
-                                       </HorizontalStack>
-                                       <HorizontalStack Style="HStackMeasure">
-                                               <Label Text="Mean:" Style="FpsLabel"/>
-                                               <Label Text="{mean}" Style="FpsDisp"/>
-                                       </HorizontalStack>
-                                       <HorizontalStack Style="HStackMeasure">
-                                               <Label Text="Max:" Style="FpsLabel"/>
-                                               <Label Text="{maximum}" Style="FpsDisp"/>
-                                       </HorizontalStack>                                                                              
-                               </VerticalStack>
-                       </GroupBox>
+                               </ItemTemplate>
+                       </ListBox>
                        <Label Width="Stretched" Margin="3" Background="DimGrey" />
                        <TextBox Text="TextBox" Multiline="true" Margin="3" />
                        <HorizontalStack Height="Fit" Margin="5" Background="DimGrey" CornerRadius="10">
@@ -75,7 +70,7 @@
                <Splitter />
                <VerticalStack Width="Stretched" Margin="5" Spacing="5">
                        <Expandable>
-                               <Image Path="#Crow.Icons.crow.svg" />
+                               <Image Path="#Crow.Icons.crow.svg" Background="White" Height="100" Width="Stretched" Margin="20"/>
                        </Expandable>
                        <Popper >
                                <Image Path="#Crow.Icons.crow.svg" Background="White" Height="100" Width="100" Margin="20" />
diff --git a/Samples/common/ui/Interfaces/Divers/02.crow b/Samples/common/ui/Interfaces/Divers/02.crow
new file mode 100644 (file)
index 0000000..978687e
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ListBox Data="{PerfMeasures}">
+       <Template>
+               <GroupBox Caption="Performance" Height="Fit">
+                       <VerticalStack Name="ItemsContainer" Width="90%" Height="Fit" Spacing="2"/>
+               </GroupBox>
+       </Template>
+       <ItemTemplate>
+               <HorizontalStack Style="HStackMeasure">
+                       <Label Text="{Name}" Style="FpsLabel" Width="100"/>
+                       <Label Text="{current}" Style="FpsDisp" Width="80" TextAlignment="Right" Margin="2"/>
+               </HorizontalStack>
+       </ItemTemplate>
+</ListBox>
\ No newline at end of file
index 5d8f226cb3234a0a61dfaa81b5c2dd3858bc8e5b..9fecb30f4dcc2b8ce8ba8906393e602278f7d8b1 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <VerticalStack Fit="true">
-       <TextBox Text="{Datas}" Width="100" />
-       <Button Caption="Set Text to Null" MouseClick="onSetDataToNull"/>
+       <TextBox Text="{Datas}" Width="100" Name="tb"/>
+       <Button Caption="Set Text to Null" MouseClick="{../tb.Text=''}"/>
 </VerticalStack>
\ No newline at end of file
index 581bab06dc24be0fe3babddd23361f1139f9d04c..af33613aa115175eaf37a22f7be0b575b041ad24 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <Container Margin="20" Background="Red" >
-       <!--<Container Margin="20" Background="Green" MouseDown="{../go1.Visible=True}" >
-               <Widget Name="go1" Margin="20" Background="DimGrey" Visible="false" MouseDown="{Visible=false}"
+       <Container Margin="20" Background="Green" MouseDown="{../go1.IsVisible='True'}" >
+               <Widget Name="go1" Margin="20" Background="DimGrey" Visible="false" MouseDown="{IsVisible='false'}"
                        MouseEnter="{Background=Blue}"
                        MouseLeave="{Background=DimGrey}"/>
-       </Container>-->
+       </Container>
 </Container>
index fa6da1e62be7bf00ec61845b0114b5bf4c9985fb..9c7e942c11af502d23408f1bb6116eeba4977cce 100644 (file)
@@ -1,21 +1,19 @@
 <?xml version="1.0"?>
-<Border BorderStyle="Sunken" Fit="true" Background="0.7,0.7,0.7,0.5" CornerRadius="10">
-       <VerticalStack Margin="20">
-               <Image Path="#Crow.Icons.crow.svg"/>
+<Border BorderStyle="Sunken" Fit="true" Background="0.8,0.8,0.9,0.5" CornerRadius="30">
+       <VerticalStack Margin="20" Spacing="10">
+               <Image Path="#Crow.Icons.crow.svg" Width="64" Height="64" Background="WhiteSmoke" CornerRadius="5" Margin="5"/>
 <!--           <Label Font="Times bold, 60" Text="C.R.O.W"/>-->
-               <HorizontalStack Fit="true" DataSource="{CrowVersion}" Spacing="0">
-                       <Label Foreground="Black" Font="mono, 12" Text="version: "/>            
-                       <Label Foreground="Black" Font="mono, 12" Text="{Major}"/>              
+               <HorizontalStack Fit="true" DataSource="{CrowVersion}" Spacing="0" Background="Grey" Margin="10" CornerRadius="15">
+                       <Label Foreground="Jet" Font="mono, 12" Text="version: "/>              
+                       <Label Foreground="Black" Font="mono, 16" Text="{Major}"/>              
                        <Label Foreground="Black" Font="mono, 12" Text="."/>
-                       <Label Foreground="Black" Font="mono, 12" Text="{Minor}"/>
+                       <Label Foreground="Black" Font="mono, 16" Text="{Minor}"/>
                        <Label Foreground="Black" Font="mono, 12" Text="."/>
-                       <Label Foreground="DimGrey" Font="mono, 12" Text="{Build}"/>
+                       <Label Foreground="DarkBlue" Font="mono, 14" Text="{Build}" VerticalAlignment="Bottom"/>
                </HorizontalStack>
-               <Widget Height="30"/>
                <Label Font="20" Text="Press &lt;F2&gt; and &lt;F3&gt; to cycle into the examples"/>
                <Label Font="20" Text="Those are basic tests used to validate changes,"/>
-               <Widget Height="30"/>
-               <Label Foreground="DimGrey" Font="20" Text="&lt;F5&gt; => File dialog example"/>
-               <Label Foreground="DimGrey" Font="20" Text="&lt;F6&gt; => Window example"/>
+               <Label Foreground="Onyx" Font="20" Text="&lt;F5&gt; => File dialog example"/>
+               <Label Foreground="Onyx" Font="20" Text="&lt;F6&gt; => Window example"/>
        </VerticalStack>
 </Border>
\ No newline at end of file
index 297902611704c2d60770e7d74eb291ab76a09e50..e654abed093701f2b3ae0c20cd529dc73228e602 100644 (file)
@@ -1,13 +1,15 @@
 <ListBox Data="{TestList}" >        
        <Template>
                <Scroller>
-                       <Table Name="ItemsContainer" Columns="name,Fit;color,100" Height="Fit" Width="Stretched" VerticalAlignment="Top"/> 
+                       <Table Name="ItemsContainer" Columns="name,Fit;color,100" Height="Fit" Width="Fit" VerticalAlignment="Top"/>
                </Scroller>
        </Template>
        <ItemTemplate>
                <TableRow>
                        <Label Text="{}" Margin="5" />
-                       <Widget Background="{}" Width="50" Height="10"/>
+                       <Container Height="Stretched" Margin="5">
+                               <Widget Background="{}" />
+                       </Container>
                </TableRow>
        </ItemTemplate>
 
diff --git a/Samples/common/ui/Interfaces/Experimental/table2.crow b/Samples/common/ui/Interfaces/Experimental/table2.crow
deleted file mode 100644 (file)
index 4aa3eeb..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<List Data="{TestList}">
-       <Table Foreground="White" Columns="test,Fit;test,Fit" Width="Fit" Height="Fit"
-               Spacing="1" ColumnSpacing="1"
-               VerticalLineWidth="1" Margin="0" RowsMargin="0"> 
-               <TableRow
-                               MouseEnter="{Background=RoyalBlue}"
-                               MouseLeave="{Background=Transparent}">
-                       <Label Text="col1qsf" Margin="5" />
-                       <Label Text="col1qsf" Margin="5" />
-                       <Label Text="col1qsf" Margin="5" />
-               </TableRow>
-               <TableRow 
-                               MouseEnter="{Background=RoyalBlue}"
-                               MouseLeave="{Background=Transparent}">
-                       <Label Text="col1qsf" Margin="5"/>
-                       <Label Text="col1qsfsdqfdqsfdqsfdqsf" Margin="5"/>
-                       <Label Text="col1qsfdsqfdqsf" Margin="5"/>
-               </TableRow>
-       </Table>
-</List>
\ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Experimental/table3.crow b/Samples/common/ui/Interfaces/Experimental/table3.crow
deleted file mode 100644 (file)
index 0a9e0b5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<Table Foreground="White" Columns="test,Fit;test,Fit" Background="White" Width="Fit" Height="Fit" Margin="100" Spacing="10" > 
-       <TableRow Height="Fit"  Spacing="3" Margin="10"
-                       MouseEnter="{Background=RoyalBlue}"
-                       MouseLeave="{Background=Transparent}">
-               <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/>
-               <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/>
-               <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/>
-       </TableRow>
-</Table>
\ No newline at end of file
index f54a718230cda162e91b75e4cf6639549940c0dd..3def987f80fc0523d30518874380ce586c8d2d91 100644 (file)
@@ -2,23 +2,23 @@
 <VerticalStack >
        <HorizontalStack Height="Fit">
                <Label Text="Selected Tab:"/>
-               <Label Name="lab" />
+               <Label Name="lab" Text="{../../tabview1.SelectedItem}" />
        </HorizontalStack>
-       <TabView Name="tabview1" Background="DimGrey" Orientation="Horizontal"
-               SelectedItemChanged="{../lab.Background='Blue'}">
-               <VerticalStack Name="tab #1" Margin="20">
+       <TabView Name="tabview1" Orientation="Horizontal"
+               SelectedItemChanged="{../../lab.Background=Blue}">
+               <VerticalStack Name="tab #1" Margin="20" Background="Onyx">
                        <CheckBox/>
                        <CheckBox/>
                        <CheckBox/>
                        <CheckBox/>
                </VerticalStack>
-               <VerticalStack Name="tab #2" Margin="20">
+               <VerticalStack Name="tab #2" Margin="20" Background="Onyx">
                        <RadioButton/>
                        <RadioButton/>
                        <RadioButton/>
                        <RadioButton/>
                </VerticalStack>
-               <VerticalStack Name="tab #3" Margin="20">
+               <VerticalStack Name="tab #3" Margin="20" Background="Onyx">
                        <TextBox/>
                        <TextBox/>
                        <TextBox/>
diff --git a/Samples/common/ui/Interfaces/TemplatedContainer/testTabView2.crow b/Samples/common/ui/Interfaces/TemplatedContainer/testTabView2.crow
deleted file mode 100644 (file)
index 8e208ae..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<HorizontalStack Height="90%" Width="99%" Spacing="50">
-       <VerticalStack Width="40%">     
-               <HorizontalStack Height="Fit">
-                       <Label Text="Selected Tab:"/>
-                       <Label Text="{../../tabview1.SelectedTab}"/>
-               </HorizontalStack>
-               <TabView Name="tabview1" Background="DimGrey" Orientation="Horizontal" Margin="5" >
-                       <TabItem Name="TabItem1" Caption="tab-1.1" Background="DimGrey">
-                               <VerticalStack Margin="20">
-                                       <CheckBox/>
-                                       <CheckBox/>
-                                       <CheckBox/>
-                                       <CheckBox/>
-                               </VerticalStack>
-                       </TabItem>
-                       <TabItem Name="TabItem2" Caption="tab-1.2" Background="DimGrey">
-                               <VerticalStack Height="Fit" Margin="10">
-                                       <RadioButton Fit="true"/>
-                                       <RadioButton/>
-                                       <RadioButton/>
-                                       <RadioButton/>
-                               </VerticalStack>
-                       </TabItem>
-                       <TabItem Name="TabItem3" Background="DimGrey" Caption="tab-1.3">
-                               <Container Margin="5" CornerRadius="2" >
-                                       <TextBox Margin="5" Multiline="true" TextAlignment="Left"/>
-                               </Container>
-                       </TabItem>
-               </TabView>
-               <Button Background="vgradient|0:DimGrey|1:Black" HorizontalAlignment="Right"
-                       Caption="Add new tab" Width="Fit" Height="30" MouseDown="onAddTabButClick"/>    
-       </VerticalStack>
-       <VerticalStack Width="40%">     
-               <HorizontalStack Height="Fit">
-                       <Label Text="Selected Tab:"/>
-                       <Label Text="{../../tabview2.SelectedTab}"/>
-               </HorizontalStack>
-               <TabView Name="tabview2" Background="DimGrey" Orientation="Horizontal" >
-                       <TabItem Name="TabItem1" Caption="tab-2.1" Background="DimGrey">
-                               <VerticalStack Margin="20">
-                                       <CheckBox/>
-                                       <CheckBox/>
-                                       <CheckBox/>
-                                       <CheckBox/>
-                               </VerticalStack>
-                       </TabItem>
-                       <TabItem Name="TabItem2" Caption="tab-2.2" Background="DimGrey">
-                               <VerticalStack Height="Fit" Margin="10">
-                                       <RadioButton Fit="true"/>
-                                       <RadioButton/>
-                                       <RadioButton/>
-                                       <RadioButton/>
-                               </VerticalStack>
-                       </TabItem>
-                       <TabItem Name="TabItem3" Background="DimGrey" Caption="tab-2.3">
-                               <Container Margin="5" CornerRadius="2" >
-                                       <TextBox Margin="5" Multiline="true" TextAlignment="Left"/>
-                               </Container>
-                       </TabItem>
-               </TabView>
-               <Button Background="vgradient|0:DimGrey|1:Black" HorizontalAlignment="Right"
-                       Caption="Add new tab" Width="Fit" Height="30" MouseDown="onAddTabButClick2"/>   
-       </VerticalStack>
-</HorizontalStack>