changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/cmd/mothra/libpanel/rtext.c

revision 4346: 293098f5b0b5
parent 4261: ad442868d0f9
child 4851: 5e6b75672328
     1.1--- a/sys/src/cmd/mothra/libpanel/rtext.c
     1.2+++ b/sys/src/cmd/mothra/libpanel/rtext.c
     1.3@@ -168,7 +168,7 @@ void pl_stuffbitmap(Panel *p, Image *b){
     1.4 
     1.5 void pl_rtdraw(Image *b, Rectangle r, Rtext *t, Point offs){
     1.6 	static Image *backup;
     1.7-	Point lp;
     1.8+	Point lp, sp;
     1.9 	Rectangle dr;
    1.10 	Image *bb;
    1.11 
    1.12@@ -181,6 +181,7 @@ void pl_rtdraw(Image *b, Rectangle r, Rt
    1.13 		b=backup;
    1.14 	pl_clr(b, r);
    1.15 	lp=ZP;
    1.16+	sp=ZP;
    1.17 	offs=subpt(r.min, offs);
    1.18 	for(;t;t=t->next) if(!eqrect(t->r, Rect(0,0,0,0))){
    1.19 		dr=rectaddpt(t->r, offs);
    1.20@@ -191,6 +192,14 @@ void pl_rtdraw(Image *b, Rectangle r, Rt
    1.21 			if(t->b){
    1.22 				draw(b, insetrect(dr, BORD), t->b, 0, t->b->r.min);
    1.23 				if(t->flags&PL_HOT) border(b, dr, 1, display->black, ZP);
    1.24+				if(t->flags&PL_STR) {
    1.25+					line(b, Pt(dr.min.x, dr.min.y), Pt(dr.max.x, dr.max.y),
    1.26+						Endsquare, Endsquare, 0,
    1.27+						display->black, ZP);
    1.28+					line(b, Pt(dr.min.x, dr.max.y), Pt(dr.max.x, dr.min.y),
    1.29+						Endsquare, Endsquare, 0,
    1.30+						display->black, ZP);
    1.31+				}
    1.32 				if(t->flags&PL_SEL)
    1.33 					pl_highlight(b, dr);
    1.34 			}
    1.35@@ -204,17 +213,30 @@ void pl_rtdraw(Image *b, Rectangle r, Rt
    1.36 				string(b, dr.min, display->black, ZP, t->font, t->text);
    1.37 				if(t->flags&PL_SEL)
    1.38 					pl_highlight(b, dr);
    1.39-				if(t->flags&PL_HOT){
    1.40-					if(lp.y+1 != dr.max.y)
    1.41-						lp = Pt(dr.min.x, dr.max.y-1);
    1.42-					line(b, lp, Pt(dr.max.x, dr.max.y-1),
    1.43+				if(t->flags&PL_STR){
    1.44+					int y = dr.max.y - t->font->height/2;
    1.45+					if(sp.y != y)
    1.46+						sp = Pt(dr.min.x, y);
    1.47+					line(b, sp, Pt(dr.max.x, y),
    1.48 						Endsquare, Endsquare, 0,
    1.49 						display->black, ZP);
    1.50-					lp = Pt(dr.max.x, dr.max.y-1);
    1.51-					continue;
    1.52-				}
    1.53+					sp = Pt(dr.max.x, y);
    1.54+				} else
    1.55+					sp = ZP;
    1.56+				if(t->flags&PL_HOT){
    1.57+					int y = dr.max.y - 1;
    1.58+					if(lp.y != y)
    1.59+						lp = Pt(dr.min.x, y);
    1.60+					line(b, lp, Pt(dr.max.x, y),
    1.61+						Endsquare, Endsquare, 0,
    1.62+						display->black, ZP);
    1.63+					lp = Pt(dr.max.x, y);
    1.64+				} else
    1.65+					lp = ZP;
    1.66+				continue;
    1.67 			}
    1.68-			lp=ZP;
    1.69+			lp = ZP;
    1.70+			sp = ZP;
    1.71 		}
    1.72 	}
    1.73 	if(b!=bb)