diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-07-23 07:58:34 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-07-23 07:58:34 +0200 |
| commit | 61d58bc83b6e4af1a7e98e30c3fbdaf31388026a (patch) | |
| tree | 78c98a12c930d2d3723c12d5b983fbe212ef0e7b | |
| parent | 5d5294ae25c1f7569bd3a7cd894a4ac2b4b99889 (diff) | |
ctx & surf debug events
| -rw-r--r-- | Crow/src/DebugUtils/DbgEvtType.cs | 3 | ||||
| -rw-r--r-- | Crow/src/DebugUtils/DbgWidgetEvent.cs | 4 | ||||
| -rw-r--r-- | Crow/src/DebugUtils/DebugLogger.cs | 2 | ||||
| -rw-r--r-- | Crow/src/ExtensionsMethods.cs | 9 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs | 26 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/ui/main.crow | 1 |
6 files changed, 42 insertions, 3 deletions
diff --git a/Crow/src/DebugUtils/DbgEvtType.cs b/Crow/src/DebugUtils/DbgEvtType.cs index be7f66dd..89e86076 100644 --- a/Crow/src/DebugUtils/DbgEvtType.cs +++ b/Crow/src/DebugUtils/DbgEvtType.cs @@ -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, diff --git a/Crow/src/DebugUtils/DbgWidgetEvent.cs b/Crow/src/DebugUtils/DbgWidgetEvent.cs index 383fc94a..d147ba25 100644 --- a/Crow/src/DebugUtils/DbgWidgetEvent.cs +++ b/Crow/src/DebugUtils/DbgWidgetEvent.cs @@ -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: diff --git a/Crow/src/DebugUtils/DebugLogger.cs b/Crow/src/DebugUtils/DebugLogger.cs index b773b990..07313382 100644 --- a/Crow/src/DebugUtils/DebugLogger.cs +++ b/Crow/src/DebugUtils/DebugLogger.cs @@ -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 } diff --git a/Crow/src/ExtensionsMethods.cs b/Crow/src/ExtensionsMethods.cs index 45610be2..c435f7ca 100644 --- a/Crow/src/ExtensionsMethods.cs +++ b/Crow/src/ExtensionsMethods.cs @@ -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'; diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs index 3ba9faaa..c74bae64 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs @@ -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; diff --git a/Samples/DebugLogAnalyzer/ui/main.crow b/Samples/DebugLogAnalyzer/ui/main.crow index d6ed6054..bbeffe0f 100644 --- a/Samples/DebugLogAnalyzer/ui/main.crow +++ b/Samples/DebugLogAnalyzer/ui/main.crow @@ -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" |