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);
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 ();
}
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
ctx.PushGroup ();
-
for (int i = GraphicTree.Count -1; i >= 0 ; i--){
Widget p = GraphicTree[i];
if (!p.IsVisible)
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;
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)
}
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 ();
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;
}
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);
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)
}
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;
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);
}
}
}
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)
{
}
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)
{
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]);
{
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
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> ()
{
}
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)
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 ();
}
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));
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
{
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);
}
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)
{
gr.Clip ();
}
- try
- {
- childrenRWLock.EnterReadLock ();
-
+ childrenRWLock.EnterReadLock ();
+ try {
for (int i = Scroll; i < Children.Count && i < Scroll + visibleItems; i++) {
if (!Children[i].IsVisible)
continue;
continue;*/
Children[i].Paint (gr);
}
-
- childrenRWLock.ExitReadLock ();
- }
- catch (System.Exception)
- {
+ } finally {
childrenRWLock.ExitReadLock ();
- throw;
}
if (ClipToClientRect)
}
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));
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) {
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;
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;
}
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 ();
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);
{
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)
{
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;
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);
DbgLogger.StartEvent (DbgEvtType.TGCancelLoadingThread, this);
- int updateMx = 0, layoutMx = 0;
+ /*int updateMx = 0, layoutMx = 0;
while (Monitor.IsEntered (IFace.UpdateMutex)) {
Monitor.Exit (IFace.UpdateMutex);
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;
}
}
+ try {
g = iTemp.CreateInstance();
#if DESIGN_MODE
g.design_isTGItem = true;
// 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;
/// 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;
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 ?
parentRWLock.EnterReadLock ();
if (parent != null) {
- Parent.RegisterClip (LastPaintedSlot);
- Parent.RegisterClip (Slot);
+ parent.RegisterClip (LastPaintedSlot);
+ parent.RegisterClip (Slot);
}
parentRWLock.ExitReadLock ();
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)]
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>
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) {
if (!IsEnabled)
paintDisabled (ctx, rb);
- }
+ }
+
LastPaintedSlot = Slot;
- }
+ //}
Painted.Raise (this, null);
DbgLogger.EndEvent (DbgEvtType.GOPaint);
/// <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;
this.Width = currentWidth + XDelta;
break;
}
- }
+ //}
}
bool maySize => sizingHandle == null ? false : resizable & sizingHandle.IsHover;
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;
+ }
}
}
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;
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;
}
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
}
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 ();
private set {
if (hoverEvt == value)
return;
+ lock (dataMutex)
+ evt = value;
hoverEvt = value;
NotifyValueChangedAuto (hoverEvt);
}
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)
{
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];
}
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);
}
static void Main (string [] args)
{
- DbgLogger.IncludeEvents = DbgEvtType.None;
- DbgLogger.DiscardEvents = DbgEvtType.All;
+ initDebugLog ();
using (Program app = new Program ()) {
CurrentProgramInstance = app;
}
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 {
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);
}
<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}">
<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%">
{
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");
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 {
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;
<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">
<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" />
--- /dev/null
+<?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
<?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
<?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>
<?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 <F2> and <F3> 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="<F5> => File dialog example"/>
- <Label Foreground="DimGrey" Font="20" Text="<F6> => Window example"/>
+ <Label Foreground="Onyx" Font="20" Text="<F5> => File dialog example"/>
+ <Label Foreground="Onyx" Font="20" Text="<F6> => Window example"/>
</VerticalStack>
</Border>
\ No newline at end of file
<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>
+++ /dev/null
-<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
+++ /dev/null
-<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
<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/>
+++ /dev/null
-<?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>