mothra: remove extraneous lines and decoration (fake 3d). patch extracted from my forked mess by Ori_B.
This commit is contained in:
parent
60c34ebb2d
commit
9a7c5d5653
|
@ -19,7 +19,7 @@ int pl_drawinit(int ldepth){
|
||||||
plldepth=ldepth;
|
plldepth=ldepth;
|
||||||
pl_white=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xFFFFFFFF);
|
pl_white=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xFFFFFFFF);
|
||||||
pl_light=allocimagemix(display, DPalebluegreen, DWhite);
|
pl_light=allocimagemix(display, DPalebluegreen, DWhite);
|
||||||
pl_dark =allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
|
pl_dark=allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
|
||||||
pl_black=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x000000FF);
|
pl_black=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x000000FF);
|
||||||
pl_hilit=allocimage(display, Rect(0,0,1,1), CHAN1(CAlpha,8), 1, 0x80);
|
pl_hilit=allocimage(display, Rect(0,0,1,1), CHAN1(CAlpha,8), 1, 0x80);
|
||||||
if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0) return 0;
|
if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0) return 0;
|
||||||
|
@ -38,6 +38,13 @@ void pl_relief(Image *b, Image *ul, Image *lr, Rectangle r, int wid){
|
||||||
}
|
}
|
||||||
Rectangle pl_boxoutline(Image *b, Rectangle r, int style, int fill){
|
Rectangle pl_boxoutline(Image *b, Rectangle r, int style, int fill){
|
||||||
if(plldepth==0) switch(style){
|
if(plldepth==0) switch(style){
|
||||||
|
case SUP:
|
||||||
|
case TUP:
|
||||||
|
pl_relief(b, pl_white, pl_white, r, BWID);
|
||||||
|
r=insetrect(r, BWID);
|
||||||
|
if(fill) draw(b, r, pl_white, 0, ZP);
|
||||||
|
else border(b, r, SPACE, pl_white, ZP);
|
||||||
|
break;
|
||||||
case UP:
|
case UP:
|
||||||
pl_relief(b, pl_black, pl_black, r, BWID);
|
pl_relief(b, pl_black, pl_black, r, BWID);
|
||||||
r=insetrect(r, BWID);
|
r=insetrect(r, BWID);
|
||||||
|
@ -68,6 +75,13 @@ Rectangle pl_boxoutline(Image *b, Rectangle r, int style, int fill){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else switch(style){
|
else switch(style){
|
||||||
|
case SUP:
|
||||||
|
case TUP:
|
||||||
|
pl_relief(b, pl_white, pl_white, r, BWID);
|
||||||
|
r=insetrect(r, BWID);
|
||||||
|
if(fill) draw(b, r, pl_light, 0, ZP);
|
||||||
|
else border(b, r, SPACE, pl_white, ZP);
|
||||||
|
break;
|
||||||
case UP:
|
case UP:
|
||||||
pl_relief(b, pl_white, pl_black, r, BWID);
|
pl_relief(b, pl_white, pl_black, r, BWID);
|
||||||
r=insetrect(r, BWID);
|
r=insetrect(r, BWID);
|
||||||
|
@ -97,7 +111,10 @@ Rectangle pl_boxoutline(Image *b, Rectangle r, int style, int fill){
|
||||||
else border(b, r, SPACE, pl_white, ZP);
|
else border(b, r, SPACE, pl_white, ZP);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return insetrect(r, SPACE);
|
switch(style){
|
||||||
|
case SUP: return insetrect(r, SPACE-SPACE);
|
||||||
|
default: return insetrect(r, SPACE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Rectangle pl_outline(Image *b, Rectangle r, int style){
|
Rectangle pl_outline(Image *b, Rectangle r, int style){
|
||||||
return pl_boxoutline(b, r, style, 0);
|
return pl_boxoutline(b, r, style, 0);
|
||||||
|
|
|
@ -9,8 +9,10 @@ void plgrabkb(Panel *g){
|
||||||
plkbfocus=g;
|
plkbfocus=g;
|
||||||
}
|
}
|
||||||
void plkeyboard(Rune c){
|
void plkeyboard(Rune c){
|
||||||
if(plkbfocus)
|
if(plkbfocus){
|
||||||
plkbfocus->type(plkbfocus, c);
|
plkbfocus->type(plkbfocus, c);
|
||||||
|
flushimage(display, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -45,4 +47,5 @@ void plmouse(Panel *g, Mouse *m){
|
||||||
g->flags&=~REMOUSE;
|
g->flags&=~REMOUSE;
|
||||||
g->lastmouse=hit;
|
g->lastmouse=hit;
|
||||||
}
|
}
|
||||||
|
flushimage(display, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,9 @@ Rtext *pl_rthit(Rtext *, Point, Point, Point);
|
||||||
* States, also styles
|
* States, also styles
|
||||||
*/
|
*/
|
||||||
enum{
|
enum{
|
||||||
UP,
|
SUP, // scrollbar
|
||||||
|
TUP, // textview
|
||||||
|
UP, // deprecated
|
||||||
DOWN1,
|
DOWN1,
|
||||||
DOWN2,
|
DOWN2,
|
||||||
DOWN3,
|
DOWN3,
|
||||||
|
|
|
@ -65,6 +65,7 @@ int pl_hitpopup(Panel *g, Mouse *m){
|
||||||
if(g->state!=DOWN){
|
if(g->state!=DOWN){
|
||||||
if(pp->save!=0){
|
if(pp->save!=0){
|
||||||
draw(g->b, p->r, pp->save, 0, p->r.min);
|
draw(g->b, p->r, pp->save, 0, p->r.min);
|
||||||
|
flushimage(display, 1);
|
||||||
freeimage(pp->save);
|
freeimage(pp->save);
|
||||||
pp->save=0;
|
pp->save=0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,9 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, Point offs){
|
||||||
Point lp, sp;
|
Point lp, sp;
|
||||||
Rectangle dr;
|
Rectangle dr;
|
||||||
Image *bb;
|
Image *bb;
|
||||||
|
Image *pl_blue;
|
||||||
|
|
||||||
|
pl_blue=allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x0000FFFF);
|
||||||
bb = b;
|
bb = b;
|
||||||
if(backup==0 || backup->chan!=b->chan || rectinrect(r, backup->r)==0){
|
if(backup==0 || backup->chan!=b->chan || rectinrect(r, backup->r)==0){
|
||||||
freeimage(backup);
|
freeimage(backup);
|
||||||
|
@ -195,7 +197,6 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, Point offs){
|
||||||
&& dr.min.x<r.max.x){
|
&& dr.min.x<r.max.x){
|
||||||
if(t->b){
|
if(t->b){
|
||||||
draw(b, insetrect(dr, BORD), t->b, 0, t->b->r.min);
|
draw(b, insetrect(dr, BORD), t->b, 0, t->b->r.min);
|
||||||
if(t->flags&PL_HOT) border(b, dr, 1, display->black, ZP);
|
|
||||||
if(t->flags&PL_STR) {
|
if(t->flags&PL_STR) {
|
||||||
line(b, Pt(dr.min.x, dr.min.y), Pt(dr.max.x, dr.max.y),
|
line(b, Pt(dr.min.x, dr.min.y), Pt(dr.max.x, dr.max.y),
|
||||||
Endsquare, Endsquare, 0,
|
Endsquare, Endsquare, 0,
|
||||||
|
@ -214,7 +215,10 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, Point offs){
|
||||||
pl_stuffbitmap(t->p, bb);
|
pl_stuffbitmap(t->p, bb);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
string(b, dr.min, display->black, ZP, t->font, t->text);
|
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);
|
||||||
if(t->flags&PL_SEL)
|
if(t->flags&PL_SEL)
|
||||||
pl_highlight(b, dr);
|
pl_highlight(b, dr);
|
||||||
if(t->flags&PL_STR){
|
if(t->flags&PL_STR){
|
||||||
|
@ -227,15 +231,6 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, Point offs){
|
||||||
sp = Pt(dr.max.x, y);
|
sp = Pt(dr.max.x, y);
|
||||||
} else
|
} else
|
||||||
sp = ZP;
|
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,
|
|
||||||
display->black, ZP);
|
|
||||||
lp = Pt(dr.max.x, y);
|
|
||||||
} else
|
|
||||||
lp = ZP;
|
lp = ZP;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct Scrollbar{
|
||||||
void pl_drawscrollbar(Panel *p){
|
void pl_drawscrollbar(Panel *p){
|
||||||
Scrollbar *sp;
|
Scrollbar *sp;
|
||||||
sp=p->data;
|
sp=p->data;
|
||||||
sp->interior=pl_outline(p->b, p->r, p->state);
|
sp->interior=pl_outline(p->b, p->r, SUP); /* SUP was p->state */
|
||||||
pl_sliderupd(p->b, sp->interior, sp->dir, sp->lo, sp->hi);
|
pl_sliderupd(p->b, sp->interior, sp->dir, sp->lo, sp->hi);
|
||||||
}
|
}
|
||||||
int pl_hitscrollbar(Panel *g, Mouse *m){
|
int pl_hitscrollbar(Panel *g, Mouse *m){
|
||||||
|
|
|
@ -47,7 +47,7 @@ void pl_drawtextview(Panel *p){
|
||||||
Point size;
|
Point size;
|
||||||
|
|
||||||
tp=p->data;
|
tp=p->data;
|
||||||
r=pl_outline(p->b, p->r, UP);
|
r=pl_outline(p->b, p->r, TUP);
|
||||||
twid=r.max.x-r.min.x;
|
twid=r.max.x-r.min.x;
|
||||||
if(twid!=tp->twid){
|
if(twid!=tp->twid){
|
||||||
tp->twid=twid;
|
tp->twid=twid;
|
||||||
|
@ -80,7 +80,7 @@ int pl_hittextview(Panel *p, Mouse *m){
|
||||||
if(oldhitword==oldhitfirst)
|
if(oldhitword==oldhitfirst)
|
||||||
pl_passon(oldhitword, m);
|
pl_passon(oldhitword, m);
|
||||||
if(m->buttons&OUT)
|
if(m->buttons&OUT)
|
||||||
p->state=UP;
|
p->state=PASSIVE;
|
||||||
else if(m->buttons&7){
|
else if(m->buttons&7){
|
||||||
p->state=DOWN;
|
p->state=DOWN;
|
||||||
tp->buttons=m->buttons;
|
tp->buttons=m->buttons;
|
||||||
|
@ -100,7 +100,7 @@ int pl_hittextview(Panel *p, Mouse *m){
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(p->state==DOWN) hitme=1;
|
if(p->state==DOWN) hitme=1;
|
||||||
p->state=UP;
|
p->state=PASSIVE;
|
||||||
}
|
}
|
||||||
if(tp->hitfirst!=oldhitfirst || tp->hitword!=oldhitword){
|
if(tp->hitfirst!=oldhitfirst || tp->hitword!=oldhitword){
|
||||||
plrtseltext(tp->text, tp->hitword, tp->hitfirst);
|
plrtseltext(tp->text, tp->hitword, tp->hitfirst);
|
||||||
|
@ -214,7 +214,7 @@ void plinittextview(Panel *v, int flags, Point minsize, Rtext *t, void (*hit)(Pa
|
||||||
Textview *tp;
|
Textview *tp;
|
||||||
tp=v->data;
|
tp=v->data;
|
||||||
v->flags=flags|LEAF;
|
v->flags=flags|LEAF;
|
||||||
v->state=UP;
|
v->state=PASSIVE;
|
||||||
v->draw=pl_drawtextview;
|
v->draw=pl_drawtextview;
|
||||||
v->hit=pl_hittextview;
|
v->hit=pl_hittextview;
|
||||||
v->type=pl_typetextview;
|
v->type=pl_typetextview;
|
||||||
|
|
|
@ -136,7 +136,7 @@ void tw_draw(Textwin *t, int first, int last){
|
||||||
er=t->text+last;
|
er=t->text+last;
|
||||||
for(r=t->text+first,lp=t->loc+(first-t->top);r!=er;r++,lp++){
|
for(r=t->text+first,lp=t->loc+(first-t->top);r!=er;r++,lp++){
|
||||||
if(lp->y+t->hgt>t->r.max.y){
|
if(lp->y+t->hgt>t->r.max.y){
|
||||||
fprint(2, "chr %C, index %ld of %d, loc %d %d, off bottom\n",
|
fprint(2, "chr %C, index %lld of %d, loc %d %d, off bottom\n",
|
||||||
*r, lp-t->loc, t->bot-t->top, lp->x, lp->y);
|
*r, lp-t->loc, t->bot-t->top, lp->x, lp->y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue