]> O.S.I.I.S - jp/crow.git/commitdiff
ctx & surf debug events
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 23 Jul 2021 05:58:34 +0000 (07:58 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 23 Jul 2021 05:58:34 +0000 (07:58 +0200)
Crow/src/DebugUtils/DbgEvtType.cs
Crow/src/DebugUtils/DbgWidgetEvent.cs
Crow/src/DebugUtils/DebugLogger.cs
Crow/src/ExtensionsMethods.cs
Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs
Samples/DebugLogAnalyzer/ui/main.crow

index be7f66dd5ae17cfae904e6d944001ffba17888a1..89e860763db20f67053f775a693b202f96e3438e 100644 (file)
@@ -75,6 +75,9 @@ namespace Crow
                GOUpdateCache                                   = Widget | Drawing | 0x03,
                GOPaintCache                                    = Widget | Drawing | 0x04,              
                GOPaint                                                 = Widget | Drawing | 0x05,
+               GOCreateSurface                                 = Widget | Drawing | 0x06,
+               GOCreateContext                                 = Widget | Drawing | 0x07,
+
 
                GOLockUpdate                                    = Widget | Lock | 0x01,
                GOLockClipping                                  = Widget | Lock | 0x02,
index 383fc94a08a1524cebc2541fc41538fce1ba57a9..d147ba252548d920d4d4ad4752a3a1edd2416140 100644 (file)
@@ -52,6 +52,10 @@ namespace Crow.DebugLogger
                                        return Colors.MediumVioletRed;
                                case DbgEvtType.GODraw:
                                        return Colors.SteelBlue;
+                               case DbgEvtType.GOCreateSurface:
+                                       return Colors.SkyBlue;
+                               case DbgEvtType.GOCreateContext:
+                                       return Colors.DeepSkyBlue;
                                case DbgEvtType.GORecreateCache:
                                        return Colors.CornflowerBlue;
                                case DbgEvtType.GOUpdateCache:
index b773b99074627f339c244676efbf66401279443c..07313382173bb07c958976e09c8ccce49dc25ff3 100644 (file)
@@ -265,7 +265,7 @@ lock (logMutex) {
                public static void Save(Interface iface, string dbgLogFilePath = "debug.log") {
 #if DEBUG_LOG
                        using (Stream stream = new FileStream (dbgLogFilePath, FileMode.Create, FileAccess.Write))
-                               Save (iface, stream);
+                               Save (iface, stream, 0);
                        Console.WriteLine ($"Crow Debug Log saved to: {System.IO.Path.GetFullPath(dbgLogFilePath)}");
 #endif
                }
index 45610be226b42303c7811a7cb14f6017ce7351ee..c435f7ca1b443196ede1c53713f741a87fc909df 100644 (file)
@@ -193,8 +193,13 @@ namespace Crow
                        return null;
                }
 
-               public static FileSystemInfo [] GetFileSystemInfosOrdered (this DirectoryInfo di)
-                       => di.GetFileSystemInfos ().OrderBy (f => f.Attributes).ThenBy (f => f.Name).ToArray ();
+               public static FileSystemInfo [] GetFileSystemInfosOrdered (this DirectoryInfo di) {
+                       try {
+                               return di.GetFileSystemInfos ().OrderBy (f => f.Attributes).ThenBy (f => f.Name).ToArray ();
+                       } catch {
+                               return null;
+                       }
+               }
 
                internal static bool IsAnyLineBreakCharacter (this char c) 
                        => c == '\n' || c == '\r' || c == '\u0085' || c == '\u2028' || c == '\u2029';
index 3ba9faaa2a6441d1cac5b1886f8a1ef7e8876004..c74bae6409878a9460343f130edc744c2eb79f64 100644 (file)
@@ -129,6 +129,16 @@ namespace Crow
                                NotifyValueChangedAuto (value);
                        }
                }
+               public string DebugLogFileFolder => System.IO.Path.GetDirectoryName (DebugLogFilePath);
+               public Command CMDSelectDebugLogFilePath => new Command ("...",
+                       () => {                         
+                               FileDialog dlg = IFace.LoadIMLFragment<FileDialog> (@"
+                               <FileDialog Caption='Select Log file' CurrentDirectory='{DebugLogFileFolder}'
+                                                       ShowFiles='true' ShowHidden='true' />");
+                               dlg.OkClicked += (sender, e) => DebugLogFilePath = (sender as FileDialog).SelectedFileFullPath;
+                               dlg.DataSource = this;
+                       }
+               );              
                int firstWidgetIndexToSave, lastWidgetIndexToSave;
                public int FirstWidgetIndexToSave {
                        get => firstWidgetIndexToSave;
@@ -430,7 +440,23 @@ namespace Crow
 
                }
                void loadLogFromDebugLogFilePath () {
+                       DebugLogAnalyzer.Program dla = IFace as DebugLogAnalyzer.Program;
+
+                       widgets = new List<DbgWidgetRecord>();
+                       events = new List<DbgEvent>();
 
+                       DbgLogger.Load(DebugLogFilePath, events, widgets);
+
+                       lock (dla.UpdateMutex) {
+                               for (int i = 0; i < widgets.Count; i++) {
+                                       widgets[i].listIndex = dla.Widgets.Count;
+                                       dla.Widgets.Add (widgets[i]);
+                               }
+                               for (int i = 0; i < events.Count; i++) {
+                                       dla.Events.Add (events[i]);
+                                       updateWidgetEvents (dla.Widgets, events[i]);
+                               }
+                       }                       
                }
 
                public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft;
index d6ed60543e542546f441b9d2156df9a691f97cde..bbeffe0f7596e23302872a48eca0d454732dae38 100644 (file)
@@ -73,6 +73,7 @@
                                <HorizontalStack Height="Fit" Width="Stretched" Background="Onyx" Margin="5">
                                        <Label Text="Debug log output file:" Fit="true"/>
                                        <TextBox Text="{²../../../../dbgIfaceWidget.DebugLogFilePath}"  />
+                                       <Button Command="{../../../../dbgIfaceWidget.CMDSelectDebugLogFilePath}"/>
                                </HorizontalStack>
                                <EnumSelector RadioButtonStyle="CheckBox2" Template="#Dbg.EnumSelector.template"
                                                Background="Grey"