summaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-05-10 22:09:34 +0000
committerrodri <rgl@antares-labs.eu>2024-05-10 22:09:34 +0000
commitdd5b68da01f3e5cc820db84ef8bf0acab4ce853f (patch)
treea4324b015b8f2e5b972a29d746698af36a424dd9 /debug
parent01a95d40e7ff26c5816c35f35d08b03e15f8ec5c (diff)
download3dee-dd5b68da01f3e5cc820db84ef8bf0acab4ce853f.tar.gz
3dee-dd5b68da01f3e5cc820db84ef8bf0acab4ce853f.tar.bz2
3dee-dd5b68da01f3e5cc820db84ef8bf0acab4ce853f.zip
debug/plmon: paint selected timeslots differently and add an MMB quit option.
Diffstat (limited to 'debug')
-rw-r--r--debug/plmon.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/debug/plmon.c b/debug/plmon.c
index 88edf6b..efe24c0 100644
--- a/debug/plmon.c
+++ b/debug/plmon.c
@@ -16,6 +16,7 @@ enum {
CMain,
CBack,
CTdelim,
+ CSelect,
NCOLOR,
};
@@ -106,6 +107,9 @@ initcolors(void)
pal[CMain] = display->black;
pal[CBack] = display->white;
pal[CTdelim] = eallocimage(display, UR, screen->chan, 1, 0xEEEEEEff);
+ pal[CSelect] = eallocimage(display, Rect(0,0,2,2), screen->chan, 1, DWhite);
+ draw(pal[CSelect], UR, display->black, nil, ZP);
+ draw(pal[CSelect], rectaddpt(UR, Pt(1,1)), display->black, nil, ZP);
}
void
@@ -127,6 +131,25 @@ lmb(Mousectl *mc)
}
void
+mmb(Mousectl *mc)
+{
+ enum {
+ QUIT,
+ };
+ static char *items[] = {
+ [QUIT] "quit",
+ nil,
+ };
+ static Menu menu = { .item = items };
+
+ switch(menuhit(2, mc, &menu, _screen)){
+ case QUIT:
+ threadexitsall(nil);
+ }
+ nbsend(drawc, nil);
+}
+
+void
rmb(Mousectl *mc)
{
Task *t;
@@ -191,6 +214,8 @@ mouse(Mousectl *mc)
{
if(mc->buttons & 1)
lmb(mc);
+ if(mc->buttons & 2)
+ mmb(mc);
if(mc->buttons & 4)
rmb(mc);
if(mc->buttons & 8)
@@ -256,7 +281,7 @@ redraw(void)
// snprint(info, sizeof info, "t(%s) %.0f/px", units[abs(scale)/3], mag);
snprint(info, sizeof info, "t(%s)", units[abs(scale)/3]);
if(curts != nil)
- snprint(info+strlen(info), sizeof(info)-strlen(info), " t0 %llud t1 %llud", curts->t0, curts->t1);
+ snprint(info+strlen(info), sizeof(info)-strlen(info), " t0 %.2f t1 %.2f Δt %.2f", curts->t0*pow10(scale-(scale%3)), curts->t1*pow10(scale-(scale%3)), (curts->t1 - curts->t0)*pow10(scale-(scale%3)));
string(screen, addpt(screen->r.min, Pt(Graphoff+2,0)), pal[CMain], ZP, font, info);
line(screen, addpt(screen->r.min, Pt(0, Graphoff)), addpt(screen->r.min, Pt(Dx(screen->r), Graphoff)), 0, 0, 0, pal[CMain], ZP);
@@ -279,7 +304,7 @@ redraw(void)
r.max = Pt(p.x+1,p.y);
if(r.min.x < Graphoff)
r.min.x = Graphoff;
- draw(screen, rectaddpt(r, screen->r.min), pal[CMain], nil, ZP);
+ draw(screen, rectaddpt(r, screen->r.min), s == curts? pal[CSelect]: pal[CMain], nil, ZP);
}
}
line(screen, addpt(screen->r.min, Pt(Graphoff, 0)), addpt(screen->r.min, Pt(Graphoff, Dy(screen->r))), 0, 0, 0, pal[CMain], ZP);