ref: 507ddf3a5cb60f52a8bc2b8e013fd333d75208a4
dir: /mothra-col/
diff -r 8b4cfdf43705 sys/src/cmd/mothra/libpanel/draw.c --- a/sys/src/cmd/mothra/libpanel/draw.c Tue Feb 16 22:04:50 2021 +0100 +++ b/sys/src/cmd/mothra/libpanel/draw.c Tue Feb 16 22:52:10 2021 +0100 @@ -14,21 +14,22 @@ #define CKINSET 1 /* space around check mark frame */ #define CKBORDER 2 /* space around X inside frame */ static Image *pl_light, *pl_dark, *pl_tick, *pl_hilit; -Image *pl_blue, *pl_white, *pl_black; +Image *pl_blue, *pl_white, *pl_black, *pl_txt; int pl_drawinit(void){ - pl_white=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xFFFFFFFF); - pl_light=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xFFFFFFFF); - pl_dark=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x777777FF); - pl_black=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x000000FF); + pl_white=display->black; + pl_light=display->black; + pl_dark=allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x222222FF); + pl_black=allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x770000FF); pl_hilit=allocimage(display, Rect(0,0,1,1), CHAN1(CAlpha,8), 1, 0x80); - pl_blue=allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x0000FFFF); - if((pl_tick = allocimage(display, Rect(0, 0, TICKW, font->height), screen->chan, 0, DNofill)) != nil){ + pl_blue=allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF); + pl_txt=allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x884400FF); + if((pl_tick = allocimage(display, Rect(0, 0, TICKW, font->height), screen->chan, 0x00ff00, DNofill)) != nil){ draw(pl_tick, pl_tick->r, pl_white, nil, ZP); draw(pl_tick, Rect(TICKW/2, 0, TICKW/2+1, font->height), pl_black, nil, ZP); draw(pl_tick, Rect(0, 0, TICKW, TICKW), pl_black, nil, ZP); draw(pl_tick, Rect(0, font->height-TICKW, TICKW, font->height), pl_black, nil, ZP); } - if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0 || pl_blue==0 || pl_tick==0) sysfatal("allocimage: %r"); + if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0 || pl_blue==0 || pl_tick==0 || pl_txt==0) sysfatal("allocimage: %r"); return 1; } Rectangle pl_boxoutline(Image *b, Rectangle r, int style, int fill){ @@ -237,7 +238,7 @@ draw(b, r, pl_tick, nil, ZP); } void pl_clr(Image *b, Rectangle r){ - draw(b, r, display->white, 0, ZP); + draw(b, r, pl_white, 0, ZP); } void pl_fill(Image *b, Rectangle r){ draw(b, r, pl_light, 0, ZP); diff -r 8b4cfdf43705 sys/src/cmd/mothra/libpanel/message.c --- a/sys/src/cmd/mothra/libpanel/message.c Tue Feb 16 22:04:50 2021 +0100 +++ b/sys/src/cmd/mothra/libpanel/message.c Tue Feb 16 22:52:10 2021 +0100 @@ -29,7 +29,7 @@ end=s; c=*end; *end='\0'; - string(b, where, display->black, ZP, f, start); + string(b, where, pl_txt, ZP, f, start); *end=c; where.y+=font->height; s=end; diff -r 8b4cfdf43705 sys/src/cmd/mothra/libpanel/pldefs.h --- a/sys/src/cmd/mothra/libpanel/pldefs.h Tue Feb 16 22:04:50 2021 +0100 +++ b/sys/src/cmd/mothra/libpanel/pldefs.h Tue Feb 16 22:52:10 2021 +0100 @@ -41,7 +41,7 @@ SCROLLABSX, }; -extern Image *pl_blue, *pl_white, *pl_black; +extern Image *pl_blue, *pl_white, *pl_black, *pl_txt; /* * Scrollbar, slider orientations diff -r 8b4cfdf43705 sys/src/cmd/mothra/libpanel/rtext.c --- a/sys/src/cmd/mothra/libpanel/rtext.c Tue Feb 16 22:04:50 2021 +0100 +++ b/sys/src/cmd/mothra/libpanel/rtext.c Tue Feb 16 22:52:10 2021 +0100 @@ -194,14 +194,15 @@ && dr.max.x>r.min.x && dr.min.x<r.max.x){ if(t->b){ + if(t->flags&PL_HOT) border(b, dr, 1, pl_blue, ZP); draw(b, insetrect(dr, BORD), t->b, 0, t->b->r.min); if(t->flags&PL_STR) { line(b, Pt(dr.min.x, dr.min.y), Pt(dr.max.x, dr.max.y), Endsquare, Endsquare, 0, - display->black, ZP); + pl_txt, ZP); line(b, Pt(dr.min.x, dr.max.y), Pt(dr.max.x, dr.min.y), Endsquare, Endsquare, 0, - display->black, ZP); + pl_txt, ZP); } if(t->flags&PL_SEL) pl_highlight(b, dr); @@ -216,7 +217,7 @@ if(t->flags&PL_HOT) string(b, dr.min, pl_blue, ZP, t->font, t->text); else - string(b, dr.min, display->black, ZP, t->font, t->text); + string(b, dr.min, pl_txt, ZP, t->font, t->text); if(t->flags&PL_SEL) pl_highlight(b, dr); if(t->flags&PL_STR){ @@ -225,10 +226,19 @@ sp = Pt(dr.min.x, y); line(b, sp, Pt(dr.max.x, y), Endsquare, Endsquare, 0, - display->black, ZP); + pl_txt, ZP); sp = Pt(dr.max.x, y); } else sp = ZP; + if(t->flags&PL_HOT){ + int y = dr.max.y - 1; + if(lp.y != y) + lp = Pt(dr.min.x, y); + line(b, lp, Pt(dr.max.x, y), + Endsquare, Endsquare, 0, + pl_blue, ZP); + lp = Pt(dr.max.x, y); + } else lp = ZP; continue; } diff -r 8b4cfdf43705 sys/src/cmd/mothra/libpanel/textwin.c --- a/sys/src/cmd/mothra/libpanel/textwin.c Tue Feb 16 22:04:50 2021 +0100 +++ b/sys/src/cmd/mothra/libpanel/textwin.c Tue Feb 16 22:52:10 2021 +0100 @@ -155,7 +155,7 @@ default: buf[runetochar(buf, r)]='\0'; /***/ pl_clr(t->b, Rpt(*lp, addpt(*lp, stringsize(t->font, buf)))); - ur=string(t->b, *lp, display->black, ZP, t->font, buf); + ur=string(t->b, *lp, pl_txt, ZP, t->font, buf); break; } if(lp[1].y!=lp[0].y) diff -r 8b4cfdf43705 sys/src/cmd/mothra/mothra.c --- a/sys/src/cmd/mothra/mothra.c Tue Feb 16 22:04:50 2021 +0100 +++ b/sys/src/cmd/mothra/mothra.c Tue Feb 16 22:52:10 2021 +0100 @@ -12,6 +12,7 @@ #include <regexp.h> #include "mothra.h" #include "rtext.h" +#include "pldefs.h" int debug=0; int verbose=0; /* -v flag causes html errors to be written to file-descriptor 2 */ int killimgs=0; /* should mothra kill images? */ @@ -355,12 +356,10 @@ hrule=allocimage(display, Rect(0, 0, 1, 5), screen->chan, 1, DWhite); if(hrule==0) sysfatal("can't allocimage!"); - draw(hrule, Rect(0,1,1,3), display->black, 0, ZP); - linespace=allocimage(display, Rect(0, 0, 1, 5), screen->chan, 1, DWhite); - if(linespace==0) - sysfatal("can't allocimage!"); - bullet=allocimage(display, Rect(0,0,25, 8), screen->chan, 0, DWhite); - fillellipse(bullet, Pt(4,4), 3, 3, display->black, ZP); + draw(hrule, Rect(0,1,1,3), pl_txt, 0, ZP); + linespace=display->black; + bullet=allocimage(display, Rect(0,0,25, 8), screen->chan, 0, DBlack); + fillellipse(bullet, Pt(4,4), 3, 3, pl_txt, ZP); mkpanels(); unlockdisplay(display); eresized(0);