aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/DebugLogAnalyzer/src
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-07-02 14:59:09 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-07-02 14:59:09 +0200
commitfeeb0691af647cad8f7ce7c60fd3ec14591df56a (patch)
tree371912ee8c404ffec110a283c97a252057852c59 /Samples/DebugLogAnalyzer/src
parenta4386e4844dbb85b804770d936b2d47c7584d258 (diff)
lock on ext method search, IList<widget> in dbg log
Diffstat (limited to 'Samples/DebugLogAnalyzer/src')
-rw-r--r--Samples/DebugLogAnalyzer/src/DbgLogViewer.cs55
-rw-r--r--Samples/DebugLogAnalyzer/src/DebugInterface.cs2
-rw-r--r--Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs9
3 files changed, 30 insertions, 36 deletions
diff --git a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs b/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs
index 89cf3e0c..2ac0326f 100644
--- a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs
+++ b/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs
@@ -47,8 +47,8 @@ namespace Crow
DbgWidgetRecord curWidget, hoverWidget;
DbgEvent curEvent, hoverEvent;
- List<DbgEvent> events = new List<DbgEvent> ();
- List<DbgWidgetRecord> widgets = new List<DbgWidgetRecord> ();
+ IList<DbgEvent> events = new List<DbgEvent> ();
+ IList<DbgWidgetRecord> widgets = new List<DbgWidgetRecord> ();
public DbgEvtType Filter {
@@ -61,7 +61,7 @@ namespace Crow
RegisterForGraphicUpdate();
}
}
- public List<DbgEvent> Events {
+ public IList<DbgEvent> Events {
get => events;
set {
if (events == value)
@@ -91,7 +91,7 @@ namespace Crow
RegisterForGraphicUpdate ();
}
}
- public List<DbgWidgetRecord> Widgets {
+ public IList<DbgWidgetRecord> Widgets {
get => widgets;
set {
if (widgets == value)
@@ -159,6 +159,7 @@ namespace Crow
return;
hoverEvent = value;
NotifyValueChanged (nameof (HoverEvent), hoverEvent);
+ RegisterForRepaint ();
}
}
@@ -201,8 +202,20 @@ namespace Crow
updateMargins ();
}
}
-
- void drawEvents (Context ctx, List<DbgEvent> evts)
+ RectangleD getWidgetEvtBounds (DbgEvent evt, ref Rectangle cb, double penY) {
+ double x = xScale * (evt.begin - minTicks - ScrollX);
+ double w = Math.Max (Math.Max (2.0, 2.0 * xScale), (double)(evt.end - evt.begin) * xScale);
+ if (x < 0.0) {
+ w += x;
+ x = 0.0;
+ }
+ x += leftMargin + cb.Left;
+ double rightDiff = x + w - cb.Right;
+ if (rightDiff > 0)
+ w -= rightDiff;
+ return new RectangleD(x, penY, w, fe.Height);
+ }
+ void drawEvents (Context ctx, IList<DbgEvent> evts)
{
if (evts == null || evts.Count == 0)
return;
@@ -224,26 +237,8 @@ namespace Crow
penY += (lIdx) * fe.Height;
ctx.SetSource (evt.Color);
-
- double x = xScale * (evt.begin - minTicks - ScrollX);
- double w = Math.Max (Math.Max (2.0, 2.0 * xScale), (double)(evt.end - evt.begin) * xScale);
- if (x < 0.0) {
- w += x;
- x = 0.0;
- }
- x += leftMargin + cb.Left;
- double rightDiff = x + w - cb.Right;
- if (rightDiff > 0)
- w -= rightDiff;
- RectangleD r = new RectangleD(x, penY, w, fe.Height);
- ctx.Rectangle (r);
+ ctx.Rectangle (getWidgetEvtBounds (evt, ref cb, penY));
ctx.Fill ();
- /*if (evt == CurrentEvent) {
- r.Inflate(2,2);
- ctx.SetSource(Colors.White);
- ctx.Rectangle(r);
- ctx.Stroke();
- }*/
}
} else if (evt.type.HasFlag (DbgEvtType.IFace)) {
double x = xScale * (evt.begin - minTicks - ScrollX);
@@ -400,6 +395,12 @@ namespace Crow
ctx.SetSource (0.1, 0.1, 0.1, 0.4);
ctx.Rectangle (ContextCoordinates (r));
ctx.Fill ();
+
+ if (hoverEvent is DbgWidgetEvent wevt) {
+ ctx.SetSource (1.0,1.0,1.0,0.7);
+ ctx.SetDash (new double[] {1, 2});
+ ctx.Rectangle ((Rectangle)getWidgetEvtBounds (wevt, ref cb, y).Inflated (1), 1);
+ }
}
if (currentLine >= ScrollY && currentLine < scrollY + visibleLines) {
@@ -439,6 +440,8 @@ namespace Crow
ctx.SetSource (Colors.Black);
ctx.ShowText (str);
+
+
}
public override void OnLayoutChanges (LayoutingType layoutType)
{
@@ -477,7 +480,7 @@ namespace Crow
if (lastLine >= 0 && hoverLine >= 0)
ScrollY += lastLine - hoverLine;
updateMouseLocalPos (e.Position);
- } else {
+ } else if (widgets != null) {
HoverWidget = (hoverLine < 0 || hoverLine >= widgets.Count) ? null : widgets [hoverLine];
//HoverEvent = hoverWidget?.Events.FirstOrDefault (ev => ev.begin <= hoverTick && ev.end >= hoverTick);
double tickPerPixel = (double)visibleTicks / ClientRectangle.Width;
diff --git a/Samples/DebugLogAnalyzer/src/DebugInterface.cs b/Samples/DebugLogAnalyzer/src/DebugInterface.cs
index 64de2163..4f6a84aa 100644
--- a/Samples/DebugLogAnalyzer/src/DebugInterface.cs
+++ b/Samples/DebugLogAnalyzer/src/DebugInterface.cs
@@ -13,7 +13,7 @@ namespace Crow
static DebugInterface() {
DbgLogger.IncludeEvents = DbgEvtType.None;
DbgLogger.DiscardEvents = DbgEvtType.None;
- DbgLogger.ConsoleOutput = true;
+ DbgLogger.ConsoleOutput = false;
}
public DebugInterface (IntPtr hWin) : base (hWin)
{
diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs
index 38d94f3d..a1bb8156 100644
--- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs
+++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs
@@ -120,15 +120,6 @@ namespace Crow
NotifyValueChangedAuto (discardedEvents);
}
}
- public bool DebugLogToFile {
- get => initialized ? !(bool)fiDbg_ConsoleOutput.GetValue (dbgIFace) : false;
- set {
- if (!initialized || DebugLogToFile == value)
- return;
- fiDbg_ConsoleOutput.SetValue (dbgIFace, !value);
- NotifyValueChangedAuto (DebugLogToFile);
- }
- }
public string DebugLogFilePath {
get => Configuration.Global.Get<string> ("DebugLogFilePath");
set {