From: Jean-Philippe Bruyère Date: Tue, 20 Nov 2018 16:22:12 +0000 (+0100) Subject: DebugLog X-Git-Tag: v0.8.7~29^2~12 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=0dc9fae6c0211f1975637ec4897eb0e759a1c3d7;p=jp%2Fcrow.git DebugLog --- diff --git a/Crow.csproj b/Crow.csproj index 558511b3..76650bd1 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -32,7 +32,7 @@ true false $(SolutionDir)build\Debug - XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0 + DEBUG_LOG;XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0 @@ -231,6 +231,8 @@ + + @@ -261,6 +263,7 @@ + diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index be2b1636..c13dd53d 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -23,11 +23,11 @@ namespace tests //app.AddWidget ("Interfaces/Divers/perfMeasures.crow").DataSource = app; while (true) { - #if MEASURE_TIME + /*#if MEASURE_TIME foreach (PerformanceMeasure m in app.PerfMeasures) m.NotifyChanges (); - #endif - Thread.Sleep(10); + #endif*/ + //Thread.Sleep(10); } } /*using (Display disp = new Display()) @@ -50,8 +50,12 @@ namespace tests static void App_KeyboardKeyDown (object sender, KeyboardKeyEventArgs e) { - GraphicObject obj = sender as GraphicObject; - obj.IFace.AddWidget(@"Interfaces/Divers/0.crow"); + Console.WriteLine((byte)e.Key); + switch (e.Key) { + case Key.Keypad1: + DebugLog.save (sender as Interface); + break; + } } } } diff --git a/Tests/CrowDebugger.cs b/Tests/CrowDebugger.cs deleted file mode 100644 index 7d85ff50..00000000 --- a/Tests/CrowDebugger.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// CrowDebugger.cs -// -// Author: -// Jean-Philippe Bruyère -// -// Copyright (c) 2013-2017 Jean-Philippe Bruyère -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; - -namespace Tests -{ - public class CrowDebugger - { - public CrowDebugger () - { - } - } -} - diff --git a/Tests/Showcase.cs b/Tests/Showcase.cs index e5a9316e..38bc175c 100644 --- a/Tests/Showcase.cs +++ b/Tests/Showcase.cs @@ -61,7 +61,11 @@ namespace Tests static void App_KeyboardKeyDown (object sender, KeyboardKeyEventArgs e) { - + switch (e.Key) { + case Key.Keypad1: + DebugLog.save (sender as Interface); + break; + } } public Showcase () diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 7bae42b0..7366607f 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -8,7 +8,7 @@ Exe Tests Tests - Tests.Showcase + tests.MainClass v4.5 AnyCPU 0.5 @@ -102,7 +102,7 @@ - + diff --git a/Tests/keysyms.cs b/Tests/keysyms.cs new file mode 100644 index 00000000..430954fe --- /dev/null +++ b/Tests/keysyms.cs @@ -0,0 +1,79 @@ +// +// keysyms.cs +// +// Author: +// Jean-Philippe Bruyère +// +// Copyright (c) 2013-2017 Jean-Philippe Bruyère +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.IO; + +namespace Tests +{ + static class keysyms + { + public static void Main(string[] args) + { + using (StreamWriter sw = new StreamWriter ("test.cs")) { + using (StreamReader r = new StreamReader ("/usr/include/X11/keysymdef.h")) { + bool skip = false; + int maxChar = 0; + sw.WriteLine ("/* autogenerated */"); + sw.WriteLine ("using System;\n"); + sw.WriteLine ("namespace XLib"); + sw.WriteLine ("{"); + sw.WriteLine ("\t[Flags]"); + sw.WriteLine ("\tpublic enum KeySym"); + sw.WriteLine ("\t{"); + while (!r.EndOfStream) { + string s = r.ReadLine ().Trim(); + if (skip) { + if (s.EndsWith ("*/")) + skip = false; + continue; + } + if (s.StartsWith ("/*")) { + if (!s.EndsWith ("*/")) + skip = true; + continue; + } + if (!s.StartsWith ("#define")) + continue; + string[] tmp = s.Split (new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries); + + if (tmp [1].Length > maxChar) + maxChar = tmp [1].Length; + + int nbTab = tmp [1].Length / 4; + nbTab = 8 - nbTab; + + sw.WriteLine ("\t\t{0}{1}= {2},", tmp[1],new String('\t',nbTab), tmp[2]); + } + sw.WriteLine ("\t}"); + sw.WriteLine ("}"); + Console.WriteLine ("max char: " + maxChar.ToString ()); + } + + } + } + } +} + diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 49decd8d..c7fbcb18 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -50,7 +50,10 @@ namespace Crow public class GraphicObject : ILayoutable, IValueChange, IDisposable { internal ReaderWriterLockSlim parentRWLock = new ReaderWriterLockSlim(); - + #if DEBUG_LOG + public int yIndex;//absolute index in the graphic tree for debug draw + public int xLevel;//x increment for debug draw + #endif #if DESIGN_MODE static MethodInfo miDesignAddDefLoc = typeof(GraphicObject).GetMethod("design_add_style_location", BindingFlags.Instance | BindingFlags.NonPublic); @@ -188,8 +191,9 @@ namespace Crow } #endregion - internal static ulong currentUid = 0; - internal ulong uid = 0; + #if DEBUG_LOG + internal static List GraphicObjects = new List(); + #endif internal bool isPopup = false; public GraphicObject focusParent { @@ -234,9 +238,9 @@ namespace Crow /// protected GraphicObject () { Clipping = new Region (); - #if DEBUG - uid = currentUid; - currentUid++; + #if DEBUG_LOG + GraphicObjects.Add (this); + DebugLog.AddEvent(DbgEvtType.GOClassCreation, this); #endif } /// @@ -261,7 +265,6 @@ namespace Crow /// public virtual void Initialize(){ loadDefaultValues (); - //initialized = true; } #region private fields LayoutingType registeredLayoutings = LayoutingType.All; @@ -504,7 +507,7 @@ namespace Crow } #if DEBUG [XmlIgnore]public string TreePath { - get { return this.GetType().Name + uid.ToString (); } + get { return this.GetType().Name + GraphicObjects.IndexOf(this).ToString (); } } #endif /// @@ -516,7 +519,7 @@ namespace Crow public virtual string Name { get { #if DEBUG - return string.IsNullOrEmpty(name) ? this.GetType().Name + uid.ToString () : name; + return string.IsNullOrEmpty(name) ? this.GetType().Name + GraphicObjects.IndexOf(this).ToString () : name; #else return name; #endif @@ -975,6 +978,10 @@ namespace Crow public virtual void OnDataSourceChanged(object sender, DataSourceChangeEventArgs e){ DataSourceChanged.Raise (this, e); + #if DEBUG_LOG + DebugLog.AddEvent(DbgEvtType.GONewDataSource, this); + #endif + #if DEBUG_BINDING Debug.WriteLine("New DataSource for => {0} \n\t{1}=>{2}", this.ToString(),e.OldDataSource,e.NewDataSource); #endif @@ -1189,6 +1196,9 @@ namespace Crow onInitialized (this, null); } protected virtual void onInitialized (object sender, EventArgs e){ + #if DEBUG_LOG + DebugLog.AddEvent(DbgEvtType.GOInitialized, this); + #endif Initialized.Raise(sender, e); } bool getDefaultEvent(EventInfo ei, List