From e866cc54b36831e2669ba0c32f0b4af02850e781 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Sat, 18 Nov 2017 03:32:50 +0100 Subject: [PATCH] replace debug.write with console.write --- src/CompilerServices/CompilerServices.cs | 14 ++++---- src/GraphicObjects/Expandable.cs | 2 +- src/GraphicObjects/GenericStack.cs | 6 ++-- src/GraphicObjects/GraphicObject.cs | 46 ++++++++++++------------ src/GraphicObjects/Group.cs | 4 +-- src/GraphicObjects/Image.cs | 2 +- src/GraphicObjects/Scroller.cs | 8 ++--- src/GraphicObjects/ScrollingTextBox.cs | 8 ++--- src/GraphicObjects/TemplatedGroup.cs | 4 +-- src/GraphicObjects/Wrapper.cs | 2 +- src/IML/Context.cs | 2 +- src/IML/Reader.cs | 2 +- src/Instantiator.cs | 18 +++++----- src/Interface.cs | 36 ++++++++++++------- src/ItemTemplate.cs | 2 +- src/LayoutingQueueItem.cs | 14 ++++---- src/PerformanceMeasure.cs | 2 +- src/XCursor.cs | 2 +- 18 files changed, 92 insertions(+), 82 deletions(-) diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index 5edcc79e..8805c190 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -286,7 +286,7 @@ namespace Crow MemberInfo miDest = getMemberInfoWithReflexion (dest, destMember); if (miDest == null) { - Debug.WriteLine ("Reverse template binding error: " + destMember + " not found in " + dest); + Console.WriteLine ("Reverse template binding error: " + destMember + " not found in " + dest); return; } @@ -312,7 +312,7 @@ namespace Crow } } } catch (Exception ex) { - Debug.WriteLine (ex.ToString ()); + Console.WriteLine (ex.ToString ()); return; } @@ -642,7 +642,7 @@ namespace Crow FieldInfo fiEvt = getEventHandlerField (t, eventName); if (fiEvt == null) { #if DEBUG_BINDING - Debug.WriteLine ("RemoveHandlerByName: Event '" + eventName + "' not found in " + instance); + Console.WriteLine ("RemoveHandlerByName: Event '" + eventName + "' not found in " + instance); #endif return; } @@ -653,7 +653,7 @@ namespace Crow if (d.Method.Name == delegateName) { eiEvt.RemoveEventHandler (instance, d); #if DEBUG_BINDING - Debug.WriteLine ("\t{0} handler removed in {1} for: {2}", d.Method.Name,instance, eventName); + Console.WriteLine ("\t{0} handler removed in {1} for: {2}", d.Method.Name,instance, eventName); #endif } } @@ -672,7 +672,7 @@ namespace Crow if (d.Target == target) { eiEvt.RemoveEventHandler (instance, d); #if DEBUG_BINDING - Debug.WriteLine ("\t{0} handler removed in {1} for: {2}", d.Method.Name,instance, eventName); + Console.WriteLine ("\t{0} handler removed in {1} for: {2}", d.Method.Name,instance, eventName); #endif } } @@ -685,7 +685,7 @@ namespace Crow Type t = instance.GetType (); MethodInfo mi = t.GetMethod (method, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (mi == null) { - Debug.WriteLine ("Handler Method '{0}' not found in '{1}'", method, t); + Console.WriteLine ("Handler Method '{0}' not found in '{1}'", method, t); return null; } return Delegate.CreateDelegate (eventType, instance, mi); @@ -693,7 +693,7 @@ namespace Crow internal static Delegate compileDynEventHandler(EventInfo sourceEvent, string expression, NodeAddress currentNode = null){ #if DEBUG_BINDING - Debug.WriteLine ("\tCompile Event {0}: {1}", sourceEvent.Name, expression); + Console.WriteLine ("\tCompile Event {0}: {1}", sourceEvent.Name, expression); #endif Type lopType = null; diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index 1cb36450..ad135990 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -116,7 +116,7 @@ namespace Crow try { return GetIsExpandable == null ? true : GetIsExpandable (this); } catch (Exception ex) { - System.Diagnostics.Debug.WriteLine ("Not Expandable error: " + ex.ToString ()); + Console.WriteLine ("Not Expandable error: " + ex.ToString ()); return false; } } diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index cecdaffd..cb4911ac 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -138,7 +138,7 @@ namespace Crow public override void OnChildLayoutChanges (object sender, LayoutingEventArgs arg) { GraphicObject go = sender as GraphicObject; - //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString()); + //Console.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString()); switch (arg.LayoutType) { case LayoutingType.Width: if (Orientation == Orientation.Horizontal) { @@ -163,7 +163,7 @@ namespace Crow stretchedGO.Slot.Width = newW; stretchedGO.IsDirty = true; #if DEBUG_LAYOUTING - Debug.WriteLine ("\tAdjusting Width of " + stretchedGO.ToString()); + Console.WriteLine ("\tAdjusting Width of " + stretchedGO.ToString()); #endif stretchedGO.LayoutChanged -= OnChildLayoutChanges; stretchedGO.OnLayoutChanges (LayoutingType.Width); @@ -202,7 +202,7 @@ namespace Crow stretchedGO.Slot.Height = newH; stretchedGO.IsDirty = true; #if DEBUG_LAYOUTING - Debug.WriteLine ("\tAdjusting Height of " + stretchedGO.ToString()); + Console.WriteLine ("\tAdjusting Height of " + stretchedGO.ToString()); #endif stretchedGO.LayoutChanged -= OnChildLayoutChanges; stretchedGO.OnLayoutChanges (LayoutingType.Height); diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 1ba524d7..6118e8c4 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -53,14 +53,14 @@ namespace Crow protected virtual void Dispose(bool disposing){ if (disposed){ #if DEBUG_DISPOSE - Debug.WriteLine ("Trying to dispose already disposed obj: {0}", this.ToString()); + Console.WriteLine ("Trying to dispose already disposed obj: {0}", this.ToString()); #endif return; } if (disposing) { #if DEBUG_DISPOSE - Debug.WriteLine ("Disposing: {0}", this.ToString()); + Console.WriteLine ("Disposing: {0}", this.ToString()); if (IsQueueForRedraw) throw new Exception("Trying to dispose an object queued for Redraw: " + this.ToString()); #endif @@ -80,7 +80,7 @@ namespace Crow DataSource = null; parent = null; } else - Debug.WriteLine ("!!! Finalized by GC: {0}", this.ToString ()); + Console.WriteLine ("!!! Finalized by GC: {0}", this.ToString ()); Clipping?.Dispose (); bmp?.Dispose (); disposed = true; @@ -112,7 +112,7 @@ namespace Crow public event EventHandler ValueChanged; public virtual void NotifyValueChanged(string MemberName, object _value) { - //Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value); + //Console.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value); ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); } #endregion @@ -675,7 +675,7 @@ namespace Crow public virtual void OnDataSourceChanged(object sender, DataSourceChangeEventArgs e){ DataSourceChanged.Raise (this, e); #if DEBUG_BINDING - Debug.WriteLine("New DataSource for => {0} \n\t{1}=>{2}", this.ToString(),e.OldDataSource,e.NewDataSource); + Console.WriteLine("New DataSource for => {0} \n\t{1}=>{2}", this.ToString(),e.OldDataSource,e.NewDataSource); #endif } @@ -698,7 +698,7 @@ namespace Crow public void loadDefaultValues() { #if DEBUG_LOAD - Debug.WriteLine ("LoadDefValues for " + this.ToString ()); + Console.WriteLine ("LoadDefValues for " + this.ToString ()); #endif Type thisType = this.GetType (); @@ -792,7 +792,7 @@ namespace Crow il.Emit (OpCodes.Castclass, ei.EventHandlerType); il.Emit (OpCodes.Callvirt, ei.AddMethod); }else - Debug.WriteLine("error in styling, event not handled : " + trimed); + Console.WriteLine("error in styling, event not handled : " + trimed); } } @@ -902,7 +902,7 @@ namespace Crow /// public virtual void ClippingRegistration(){ #if DEBUG_UPDATE - Debug.WriteLine (string.Format("ClippingRegistration -> {0}", this.ToString ())); + Console.WriteLine (string.Format("ClippingRegistration -> {0}", this.ToString ())); #endif IsQueueForRedraw = false; if (Parent == null) @@ -916,7 +916,7 @@ namespace Crow /// Clip rectangle public virtual void RegisterClip(Rectangle clip){ #if DEBUG_UPDATE - Debug.WriteLine (string.Format("RegisterClip -> {1}:{0}", clip, this.ToString ())); + Console.WriteLine (string.Format("RegisterClip -> {1}:{0}", clip, this.ToString ())); #endif Rectangle r = clip + ClientRectangle.Position; if (CacheEnabled && !IsDirty) @@ -933,7 +933,7 @@ namespace Crow public void RegisterForGraphicUpdate () { #if DEBUG_UPDATE - Debug.WriteLine (string.Format("RegisterForGraphicUpdate (IsDirty set)-> {0}", this.ToString ())); + Console.WriteLine (string.Format("RegisterForGraphicUpdate (IsDirty set)-> {0}", this.ToString ())); #endif IsDirty = true; if (Width.IsFit || Height.IsFit) @@ -946,7 +946,7 @@ namespace Crow public void RegisterForRedraw () { #if DEBUG_UPDATE - Debug.WriteLine (string.Format("RegisterForRedraw (IsDirty set)-> {0}", this.ToString ())); + Console.WriteLine (string.Format("RegisterForRedraw (IsDirty set)-> {0}", this.ToString ())); #endif IsDirty = true; if (RegisteredLayoutings == LayoutingType.None) @@ -1013,7 +1013,7 @@ namespace Crow #if DEBUG_LAYOUTING CurrentInterface.currentLQI.Slot = LastSlots; CurrentInterface.currentLQI.NewSlot = Slot; - Debug.WriteLine ("\t\t{0} => {1}",LastSlots,Slot); + Console.WriteLine ("\t\t{0} => {1}",LastSlots,Slot); #endif switch (layoutType) { @@ -1037,7 +1037,7 @@ namespace Crow public virtual bool UpdateLayout (LayoutingType layoutType) { #if DEBUG_UPDATE - Debug.WriteLine (string.Format("UpdateLayout ({1})-> {0}", this.ToString (), layoutType)); + Console.WriteLine (string.Format("UpdateLayout ({1})-> {0}", this.ToString (), layoutType)); #endif //unset bit, it would be reset if LQI is re-queued registeredLayoutings &= (~layoutType); @@ -1190,7 +1190,7 @@ namespace Crow protected virtual void onDraw(Context gr) { #if DEBUG_UPDATE - Debug.WriteLine (string.Format("OnDraw -> {0}", this.ToString ())); + Console.WriteLine (string.Format("OnDraw -> {0}", this.ToString ())); #endif Rectangle rBack = new Rectangle (Slot.Size); @@ -1206,7 +1206,7 @@ namespace Crow protected virtual void RecreateCache () { #if DEBUG_UPDATE - Debug.WriteLine (string.Format("RecreateCache -> {0}", this.ToString ())); + Console.WriteLine (string.Format("RecreateCache -> {0}", this.ToString ())); #endif IsDirty = false; if (bmp != null) @@ -1220,7 +1220,7 @@ namespace Crow } protected virtual void UpdateCache(Context ctx){ #if DEBUG_UPDATE - Debug.WriteLine (string.Format("UpdateCache -> {0}", this.ToString ())); + Console.WriteLine (string.Format("UpdateCache -> {0}", this.ToString ())); #endif Rectangle rb = Slot + Parent.ClientRectangle.Position; if (clearBackground) { @@ -1240,7 +1240,7 @@ namespace Crow public virtual void Paint (ref Context ctx) { #if DEBUG_UPDATE - Debug.WriteLine (string.Format("Paint -> {0}", this.ToString ())); + Console.WriteLine (string.Format("Paint -> {0}", this.ToString ())); #endif //TODO:this test should not be necessary if (Slot.Height < 0 || Slot.Width < 0 || parent == null) @@ -1391,14 +1391,14 @@ namespace Crow public virtual void onMouseEnter(object sender, MouseMoveEventArgs e) { #if DEBUG_FOCUS - Debug.WriteLine("MouseEnter => " + this.ToString()); + Console.WriteLine("MouseEnter => " + this.ToString()); #endif MouseEnter.Raise (this, e); } public virtual void onMouseLeave(object sender, MouseMoveEventArgs e) { #if DEBUG_FOCUS - Debug.WriteLine("MouseLeave => " + this.ToString()); + Console.WriteLine("MouseLeave => " + this.ToString()); #endif MouseLeave.Raise (this, e); } @@ -1406,13 +1406,13 @@ namespace Crow protected virtual void onFocused(object sender, EventArgs e){ #if DEBUG_FOCUS - Debug.WriteLine("Focused => " + this.ToString()); + Console.WriteLine("Focused => " + this.ToString()); #endif Focused.Raise (this, e); } protected virtual void onUnfocused(object sender, EventArgs e){ #if DEBUG_FOCUS - Debug.WriteLine("UnFocused => " + this.ToString()); + Console.WriteLine("UnFocused => " + this.ToString()); #endif Unfocused.Raise (this, e); } @@ -1432,7 +1432,7 @@ namespace Crow } internal void ClearTemplateBinding(){ #if DEBUG_UPDATE - Debug.WriteLine (string.Format("ClearTemplateBinding: {0}", this.ToString())); + Console.WriteLine (string.Format("ClearTemplateBinding: {0}", this.ToString())); #endif if (ValueChanged == null) return; @@ -1441,7 +1441,7 @@ namespace Crow if (d.Method.Name == "dyn_tmpValueChanged") { eiEvt.RemoveEventHandler (this, d); #if DEBUG_BINDING - Debug.WriteLine ("\t{0} template binding handler removed in {1} for: {2}", d.Method.Name, this, "ValueChanged"); + Console.WriteLine ("\t{0} template binding handler removed in {1} for: {2}", d.Method.Name, this, "ValueChanged"); #endif } } diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index e4e9ba20..f84191e2 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -312,7 +312,7 @@ namespace Crow } void searchLargestChild(){ #if DEBUG_LAYOUTING - Debug.WriteLine("\tSearch largest child"); + Console.WriteLine("\tSearch largest child"); #endif largestChild = null; contentSize.Width = 0; @@ -329,7 +329,7 @@ namespace Crow } void searchTallestChild(){ #if DEBUG_LAYOUTING - Debug.WriteLine("\tSearch tallest child"); + Console.WriteLine("\tSearch tallest child"); #endif tallestChild = null; contentSize.Height = 0; diff --git a/src/GraphicObjects/Image.cs b/src/GraphicObjects/Image.cs index 6a4c590d..c463581a 100644 --- a/src/GraphicObjects/Image.cs +++ b/src/GraphicObjects/Image.cs @@ -84,7 +84,7 @@ namespace Crow } } } catch (Exception ex) { - Debug.WriteLine (ex.Message); + Console.WriteLine (ex.Message); _pic = null; } NotifyValueChanged ("Path", Path); diff --git a/src/GraphicObjects/Scroller.cs b/src/GraphicObjects/Scroller.cs index e38b2205..8bedfa24 100644 --- a/src/GraphicObjects/Scroller.cs +++ b/src/GraphicObjects/Scroller.cs @@ -134,20 +134,20 @@ namespace Crow } void OnChildLayoutChanges (object sender, LayoutingEventArgs arg) { - //Debug.WriteLine ("scroller childLayoutChanges"); + //Console.WriteLine ("scroller childLayoutChanges"); int maxScroll = MaximumScroll; - //Debug.WriteLine ("maxscroll={0}", maxScroll); + //Console.WriteLine ("maxscroll={0}", maxScroll); if (_verticalScrolling) { if (arg.LayoutType == LayoutingType.Height) { if (maxScroll < ScrollY) { - //Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll); + //Console.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll); ScrollY = maxScroll; } NotifyValueChanged("MaximumScroll", maxScroll); } } else if (arg.LayoutType == LayoutingType.Width) { if (maxScroll < ScrollX) { - //Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll); + //Console.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll); ScrollX = maxScroll; } NotifyValueChanged("MaximumScroll", maxScroll); diff --git a/src/GraphicObjects/ScrollingTextBox.cs b/src/GraphicObjects/ScrollingTextBox.cs index a435f9ee..292aab89 100644 --- a/src/GraphicObjects/ScrollingTextBox.cs +++ b/src/GraphicObjects/ScrollingTextBox.cs @@ -174,7 +174,7 @@ namespace Crow if (value == _selBegin) return; _selBegin = value; - System.Diagnostics.Debug.WriteLine ("SelBegin=" + _selBegin); + Console.WriteLine ("SelBegin=" + _selBegin); NotifyValueChanged ("SelBegin", _selBegin); NotifyValueChanged ("SelectedText", SelectedText); } @@ -423,7 +423,7 @@ namespace Crow rLineY = cb.Y + i * fe.Height, rLineW = lstr.Length * fe.MaxXAdvance; - System.Diagnostics.Debug.WriteLine ("sel start: " + selectionStart + " sel end: " + selectionEnd); + Console.WriteLine ("sel start: " + selectionStart + " sel end: " + selectionEnd); if (curL == selectionStart.Y) { rLineX += (selectionStart.X - ScrollX) * fe.MaxXAdvance; rLineW -= selectionStart.X * fe.MaxXAdvance; @@ -751,8 +751,8 @@ namespace Crow visibleLines = (int)Math.Floor ((double)ClientRectangle.Height / fe.Height); MaxScrollY = Math.Max (0, lines.Count - visibleLines); - System.Diagnostics.Debug.WriteLine ("update visible lines: " + visibleLines); - System.Diagnostics.Debug.WriteLine ("update MaxScrollY: " + MaxScrollY); + Console.WriteLine ("update visible lines: " + visibleLines); + Console.WriteLine ("update MaxScrollY: " + MaxScrollY); } diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs index 60f18994..a70b3918 100644 --- a/src/GraphicObjects/TemplatedGroup.cs +++ b/src/GraphicObjects/TemplatedGroup.cs @@ -332,7 +332,7 @@ namespace Crow #if DEBUG_LOAD loadingTime.Stop (); - Debug.WriteLine("Listbox {2} Loading: {0} ticks \t, {1} ms", + Console.WriteLine("Listbox {2} Loading: {0} ticks \t, {1} ms", loadingTime.ElapsedTicks, loadingTime.ElapsedMilliseconds, this.ToString()); #endif @@ -400,7 +400,7 @@ namespace Crow // protected void _list_LayoutChanged (object sender, LayoutingEventArgs e) // { // #if DEBUG_LAYOUTING -// Debug.WriteLine("list_LayoutChanged"); +// Console.WriteLine("list_LayoutChanged"); // #endif // if (_gsList.Orientation == Orientation.Horizontal) { // if (e.LayoutType == LayoutingType.Width) diff --git a/src/GraphicObjects/Wrapper.cs b/src/GraphicObjects/Wrapper.cs index 8b282ebb..b0fa5dfe 100644 --- a/src/GraphicObjects/Wrapper.cs +++ b/src/GraphicObjects/Wrapper.cs @@ -88,7 +88,7 @@ namespace Crow { //children can't stretch in a wrapper GraphicObject go = sender as GraphicObject; - //System.Diagnostics.Debug.WriteLine ("wrapper child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString()); + //Console.WriteLine ("wrapper child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString()); switch (arg.LayoutType) { case LayoutingType.Width: if (Orientation == Orientation.Horizontal && go.Width.Units == Unit.Percent){ diff --git a/src/IML/Context.cs b/src/IML/Context.cs index fb103580..d4cc3149 100644 --- a/src/IML/Context.cs +++ b/src/IML/Context.cs @@ -117,7 +117,7 @@ namespace Crow.IML try { ResolveName (bd); } catch (Exception ex) { - System.Diagnostics.Debug.WriteLine (ex.ToString ()); + Console.WriteLine (ex.ToString ()); continue; } } diff --git a/src/IML/Reader.cs b/src/IML/Reader.cs index 7a0c8405..9758b290 100644 --- a/src/IML/Reader.cs +++ b/src/IML/Reader.cs @@ -207,7 +207,7 @@ namespace Crow.IML2 Array.Copy (target, nodeIdx, dest, 0, destLength); } catch (Exception ex) { - System.Diagnostics.Debug.WriteLine (ex.ToString ()); + System.Diagnostics.Console.WriteLine (ex.ToString ()); } diff --git a/src/Instantiator.cs b/src/Instantiator.cs index 6cda11c3..b47d9f1b 100644 --- a/src/Instantiator.cs +++ b/src/Instantiator.cs @@ -77,7 +77,7 @@ namespace Crow } #if DEBUG_LOAD loadingTime.Stop (); - Debug.WriteLine ("IML Instantiator creation '{2}' : {0} ticks, {1} ms", + Console.WriteLine ("IML Instantiator creation '{2}' : {0} ticks, {1} ms", loadingTime.ElapsedTicks, loadingTime.ElapsedMilliseconds, imlPath); #endif } @@ -391,7 +391,7 @@ namespace Crow BindingDefinition bindingDef = sourceNA.GetBindingDef (sourceMember, expression); #if DEBUG_BINDING - Debug.WriteLine("Property Binding: " + bindingDef.ToString()); + Console.WriteLine("Property Binding: " + bindingDef.ToString()); #endif if (bindingDef.IsDataSourceBinding)//bind on data source @@ -426,7 +426,7 @@ namespace Crow BindingDefinition bindingDef = currentNode.GetBindingDef (sourceEvent.Name, expression); #if DEBUG_BINDING - Debug.WriteLine("Event Binding: " + bindingDef.ToString()); + Console.WriteLine("Event Binding: " + bindingDef.ToString()); #endif if (bindingDef.IsTemplateBinding | bindingDef.IsDataSourceBinding) { @@ -604,7 +604,7 @@ namespace Crow ctx.emitCachedDelegateHandlerAddition (dmIdx, CompilerServices.eiValueChange, origine); #if DEBUG_BINDING - Debug.WriteLine("\tCrow property binding: " + dm.Name); + Console.WriteLine("\tCrow property binding: " + dm.Name); #endif } @@ -676,7 +676,7 @@ namespace Crow foreach (MemberAddress ma in bindingCase.Value) { if (ma.Address.Count == 0){ - Debug.WriteLine("\t\tBUG: reverse template binding in normal template binding"); + Console.WriteLine("\t\tBUG: reverse template binding in normal template binding"); continue;//template binding } //first we try to get memberInfo of new parent, if it doesn't exist, it's a propery less binding @@ -920,8 +920,8 @@ namespace Crow ctx.emitCachedDelegateHandlerAddition(delDSIndex, CompilerServices.eiDSChange); #if DEBUG_BINDING - Debug.WriteLine("\tDataSource ValueChanged: " + delName); - Debug.WriteLine("\tDataSource Changed: " + dm.Name); + Console.WriteLine("\tDataSource ValueChanged: " + delName); + Console.WriteLine("\tDataSource Changed: " + dm.Name); #endif } /// @@ -939,11 +939,11 @@ namespace Crow PropertyInfo piDest = tDest.GetProperty (destMember); if (piDest == null) { - Debug.WriteLine ("Member '{0}' not found in new DataSource '{1}' of '{2}'", destMember, dest, orig); + Console.WriteLine ("Member '{0}' not found in new DataSource '{1}' of '{2}'", destMember, dest, orig); return; } #if DEBUG_BINDING - Debug.WriteLine ("DS Reverse binding: Member '{0}' found in new DS '{1}' of '{2}'", destMember, dest, orig); + Console.WriteLine ("DS Reverse binding: Member '{0}' found in new DS '{1}' of '{2}'", destMember, dest, orig); #endif #region ValueChanged emit diff --git a/src/Interface.cs b/src/Interface.cs index c1c96d48..07c7afbf 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -50,8 +50,17 @@ namespace Crow /// - Keyboard and Mouse logic /// - the resulting bitmap of the interface /// - public class Interface : ILayoutable + public class Interface : ILayoutable, IValueChange { + #region IValueChange implementation + public event EventHandler ValueChanged; + public void NotifyValueChanged(string MemberName, object _value) + { + //Console.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value); + ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); + } + #endregion + [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute] internal static extern void crow_mono_update(IntPtr region, byte[] bitmap); @@ -64,8 +73,8 @@ namespace Crow FontRenderingOptions = new FontOptions (); FontRenderingOptions.Antialias = Antialias.Subpixel; FontRenderingOptions.HintMetrics = HintMetrics.On; - FontRenderingOptions.HintStyle = HintStyle.Medium; - FontRenderingOptions.SubpixelOrder = SubpixelOrder.Rgb; + FontRenderingOptions.HintStyle = HintStyle.Full; + //FontRenderingOptions.SubpixelOrder = SubpixelOrder.Rgb; } public Interface(){ CurrentInterface = this; @@ -277,7 +286,7 @@ namespace Crow lock (UpdateMutex) { GraphicObject tmp = Load (path); AddWidget (tmp); - + tmp.DataSource = this; return tmp; } } @@ -342,9 +351,9 @@ namespace Crow { _activeWidget.IsActive = true; #if DEBUG_FOCUS - Debug.WriteLine("Active => " + _activeWidget.ToString()); + Console.WriteLine("Active => " + _activeWidget.ToString()); }else - Debug.WriteLine("Active => null"); + Console.WriteLine("Active => null"); #else } #endif @@ -360,9 +369,9 @@ namespace Crow _hoverWidget = value; #if DEBUG_FOCUS if (_hoverWidget != null) - Debug.WriteLine("Hover => " + _hoverWidget.ToString()); + Console.WriteLine("Hover => " + _hoverWidget.ToString()); else - Debug.WriteLine("Hover => null"); + Console.WriteLine("Hover => null"); #endif } } @@ -390,7 +399,7 @@ namespace Crow public void EnqueueForRepaint(GraphicObject g) { #if DEBUG_UPDATE - Debug.WriteLine (string.Format("\tEnqueueForRepaint -> {0}", g?.ToString ())); + Console.WriteLine (string.Format("\tEnqueueForRepaint -> {0}", g?.ToString ())); #endif lock (DrawingQueue) { if (g.IsQueueForRedraw) @@ -407,12 +416,12 @@ namespace Crow /// - Drawing /// Result: the Interface bitmap is drawn in memory (byte[] bmp) and a dirtyRect and bitmap are available /// - public void Update(){ - if (mouseRepeatCount > 0) { + public void Update(){ + if (mouseRepeatCount > 0) { int mc = mouseRepeatCount; mouseRepeatCount -= mc; if (_focusedWidget != null) { - for (int i = 0; i < mc; i++) { + for (int i = 0; i < mc; i++) { _focusedWidget.onMouseClick (this, new MouseButtonEventArgs (Mouse.X, Mouse.Y, MouseButton.Left, true)); } } @@ -473,7 +482,7 @@ namespace Crow if (Monitor.TryEnter (LayoutMutex)) { DiscardQueue = new Queue (); - //Debug.WriteLine ("======= Layouting queue start ======="); + //Console.WriteLine ("======= Layouting queue start ======="); LayoutingQueueItem lqi; while (LayoutingQueue.Count > 0) { lqi = LayoutingQueue.Dequeue (); @@ -844,6 +853,7 @@ namespace Crow KeyboardKeyEventArgs lastKeyDownEvt; void mouseRepeatThreadFunc() { + mouseRepeatOn = true; Thread.Sleep (Interface.DeviceRepeatDelay); while (mouseRepeatOn) { diff --git a/src/ItemTemplate.cs b/src/ItemTemplate.cs index 53619042..0d1937b0 100644 --- a/src/ItemTemplate.cs +++ b/src/ItemTemplate.cs @@ -76,7 +76,7 @@ namespace Crow } } if (dataType == null) { - Debug.WriteLine ("ItemTemplate error: DataType not found: {0}.", strDataType); + Console.WriteLine ("ItemTemplate error: DataType not found: {0}.", strDataType); return; } Type tmpGrpType = typeof(TemplatedGroup); diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index e87c4146..26425d1f 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -89,7 +89,7 @@ namespace Crow LQITime = new Stopwatch(); Slot = Rectangle.Empty; NewSlot = Rectangle.Empty; - Debug.WriteLine ("\tRegister => " + this.ToString ()); + Console.WriteLine ("\tRegister => " + this.ToString ()); #endif } #endregion @@ -101,25 +101,25 @@ namespace Crow //cancel layouting for object without parent, maybe some were in queue when //removed from a listbox #if DEBUG_UPDATE || DEBUG_LAYOUTING - Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ()); + Console.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ()); #endif return; } #if DEBUG_LAYOUTING LQITime.Start(); - Debug.WriteLine ("=> " + this.ToString ()); + Console.WriteLine ("=> " + this.ToString ()); #endif LayoutingTries++; if (!Layoutable.UpdateLayout (LayoutType)) { #if DEBUG_LAYOUTING - Debug.WriteLine ("\t\tRequeued"); + Console.WriteLine ("\t\tRequeued"); #endif if (LayoutingTries < Interface.MaxLayoutingTries) { Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).CurrentInterface.LayoutingQueue.Enqueue (this); } else if (DiscardCount < Interface.MaxDiscardCount) { #if DEBUG_LAYOUTING - Debug.WriteLine ("\t\tDiscarded"); + Console.WriteLine ("\t\tDiscarded"); #endif LayoutingTries = 0; DiscardCount++; @@ -128,13 +128,13 @@ namespace Crow } #if DEBUG_LAYOUTING else - Debug.WriteLine ("\tDELETED => " + this.ToString ()); + Console.WriteLine ("\tDELETED => " + this.ToString ()); #endif } #if DEBUG_LAYOUTING else{ if (LayoutingTries > 2 || DiscardCount > 0) - Debug.WriteLine (this.ToString ()); + Console.WriteLine (this.ToString ()); } LQITime.Stop(); #endif diff --git a/src/PerformanceMeasure.cs b/src/PerformanceMeasure.cs index 3c978e8b..ee81302c 100644 --- a/src/PerformanceMeasure.cs +++ b/src/PerformanceMeasure.cs @@ -82,7 +82,7 @@ namespace Crow maximum = timer.ElapsedTicks; } void ResetStats(){ - Debug.WriteLine("reset measure cpt:{0}",cptMeasures); + Console.WriteLine("reset measure cpt:{0}",cptMeasures); cptMeasures = total = current = maximum = 0; minimum = long.MaxValue; } diff --git a/src/XCursor.cs b/src/XCursor.cs index 627e2afd..6835715d 100644 --- a/src/XCursor.cs +++ b/src/XCursor.cs @@ -61,7 +61,7 @@ namespace Crow byte[] data; //magic: CARD32 ’Xcur’ (0x58, 0x63, 0x75, 0x72) if (new string (sr.ReadChars (4)) != "Xcur") { - Debug.WriteLine ("XCursor Load error: Wrong magic"); + Console.WriteLine ("XCursor Load error: Wrong magic"); return null; } //header: CARD32 bytes in this header -- 2.47.3