From: Jean-Philippe Bruyère Date: Sat, 24 Nov 2018 09:48:34 +0000 (+0100) Subject: debug log viewer, X backends X-Git-Tag: v0.9.5-beta~149^2~10 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=98eada369aa50115e677a1b337662fee9f0ca011;p=jp%2Fcrow.git debug log viewer, X backends --- diff --git a/Crow.csproj b/Crow.csproj index 25ca07a2..fdb6d7c1 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -113,12 +113,9 @@ - - - @@ -228,11 +225,16 @@ - - - - - + + + + + + + + + + @@ -264,6 +266,8 @@ + + diff --git a/Crow.sln b/Crow.sln index dc694b6b..64088c26 100644 --- a/Crow.sln +++ b/Crow.sln @@ -18,7 +18,6 @@ Global {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|Any CPU {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.Build.0 = Release|Any CPU {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index 02b6742d..732edbc3 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -7,27 +7,30 @@ namespace tests { class MainClass { + static Interface app; + public static void Main(string[] args) { - using (Interface app = new Interface ()) { + using (app = new Interface ()) { // XWindow win = new XWindow (app); // win.Show (); //app.LoadIMLFragment (@""); - app.KeyboardKeyDown += App_KeyboardKeyDown; + app.Keyboard.KeyDown += App_KeyboardKeyDown; - app.AddWidget (@"Interfaces/Divers/0.crow").DataSource = app; + //app.AddWidget (@"Interfaces/Divers/0.crow").DataSource = app; //app.AddWidget (@"Interfaces/Splitter/1.crow").DataSource = app; //app.AddWidget (@"Interfaces/Container/0.crow").DataSource = app; //app.AddWidget (@"Interfaces/Divers/colorPicker.crow").DataSource = app; //app.AddWidget ("Interfaces/Divers/perfMeasures.crow").DataSource = app; + app.AddWidget ("#Tests.ui.dbgLog.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()) @@ -48,14 +51,16 @@ namespace tests }*/ } - static void App_KeyboardKeyDown (object sender, KeyboardKeyEventArgs e) + static void App_KeyboardKeyDown (object sender, KeyEventArgs e) { Console.WriteLine((byte)e.Key); + //#if DEBUG_LOG switch (e.Key) { - case Key.Keypad1: - DebugLog.save (sender as Interface); + case Key.F2: + DebugLog.save (app); break; } + //#endif } } } diff --git a/Tests/Showcase.cs b/Tests/Showcase.cs index 38bc175c..17c0bfc0 100644 --- a/Tests/Showcase.cs +++ b/Tests/Showcase.cs @@ -43,7 +43,7 @@ namespace Tests static void Main () { using (Showcase app = new Showcase ()) { - app.KeyboardKeyDown += App_KeyboardKeyDown; + app.Keyboard.KeyDown += App_KeyboardKeyDown; GraphicObject g = app.AddWidget ("#Tests.ui.showcase.crow"); g.DataSource = app; @@ -59,13 +59,15 @@ namespace Tests } } - static void App_KeyboardKeyDown (object sender, KeyboardKeyEventArgs e) + static void App_KeyboardKeyDown (object sender, KeyEventArgs e) { + #if DEBUG_LOG switch (e.Key) { - case Key.Keypad1: + case Key.F2: DebugLog.save (sender as Interface); break; } + #endif } public Showcase () diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 973930e7..0aef448b 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -419,6 +419,7 @@ Crow.TabItem.template + diff --git a/Tests/test.style b/Tests/test.style index 926910f6..434f8042 100644 --- a/Tests/test.style +++ b/Tests/test.style @@ -32,3 +32,9 @@ labPerfVal{ Font = "droid, 8"; Width = "50%"; } +DbgLogViewer{ + Background = "WhiteSmoke"; + Font = "mono, 8"; + Foreground = "Jet"; + Focusable = "true"; +} diff --git a/Tests/ui/dbgLog.crow b/Tests/ui/dbgLog.crow new file mode 100755 index 00000000..09cc2eb2 --- /dev/null +++ b/Tests/ui/dbgLog.crow @@ -0,0 +1,22 @@ + + + + + + + + + + diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index c7fbcb18..a55682b1 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -423,9 +423,9 @@ namespace Crow /// Occurs when mouse leave this object public event EventHandler MouseLeave; /// Occurs when key is pressed when this object is active - public event EventHandler KeyDown; + public event EventHandler KeyDown; /// Occurs when key is released when this object is active - public event EventHandler KeyUp; + public event EventHandler KeyUp; /// Occurs when translated key event occurs in the host when this object is active public event EventHandler KeyPress; /// Occurs when this object received focus @@ -505,7 +505,7 @@ namespace Crow this.RegisterForRedraw (); } } - #if DEBUG + #if DEBUG_LOG [XmlIgnore]public string TreePath { get { return this.GetType().Name + GraphicObjects.IndexOf(this).ToString (); } } @@ -518,7 +518,7 @@ namespace Crow [DesignCategory ("Divers")][DefaultValue(null)] public virtual string Name { get { - #if DEBUG + #if DEBUG_LOG return string.IsNullOrEmpty(name) ? this.GetType().Name + GraphicObjects.IndexOf(this).ToString () : name; #else return name; @@ -1027,9 +1027,9 @@ namespace Crow /// Loads the default values from XML attributes default public void loadDefaultValues() { -// #if DEBUG_LOAD -// Debug.WriteLine ("LoadDefValues for " + this.ToString ()); -// #endif + #if DEBUG_LOG + DbgEvent dbgEvt = DebugLog.AddEvent(DbgEvtType.GOInitialization, this); + #endif Type thisType = this.GetType (); @@ -1193,12 +1193,14 @@ namespace Crow } catch (Exception ex) { throw new Exception ("Error applying style <" + styleKey + ">:", ex); } + + #if DEBUG_LOG + dbgEvt.end = DebugLog.chrono.ElapsedTicks; + #endif + 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