diff options
| -rw-r--r-- | sys/src/cmd/rio/dat.h | 14 | ||||
| -rw-r--r-- | sys/src/cmd/rio/data.c | 25 | ||||
| -rw-r--r-- | sys/src/cmd/rio/rio.c | 32 | ||||
| -rw-r--r-- | sys/src/cmd/rio/scrl.c | 4 | ||||
| -rw-r--r-- | sys/src/cmd/rio/wctl.c | 8 | ||||
| -rw-r--r-- | sys/src/cmd/rio/wind.c | 50 | ||||
| -rw-r--r-- | sys/src/cmd/rio/xfid.c | 5 |
7 files changed, 63 insertions, 75 deletions
diff --git a/sys/src/cmd/rio/dat.h b/sys/src/cmd/rio/dat.h index d74d6e425..5680a303a 100644 --- a/sys/src/cmd/rio/dat.h +++ b/sys/src/cmd/rio/dat.h @@ -317,9 +317,19 @@ Cursor sightcursor; Cursor whitearrow; Cursor query; Cursor *corners[9]; + Image *background; -Image *lightgrey; -Image *red; +Image *cols[NCOL]; +Image *titlecol; +Image *lighttitlecol; +Image *dholdcol; +Image *holdcol; +Image *lightholdcol; +Image *paleholdcol; +Image *paletextcol; +Image *sizecol; +int reverse; /* there are no pastel paints in the dungeons and dragons world -- rob pike */ + Window **window; Window *wkeyboard; /* window of simulated keyboard */ int nwindow; diff --git a/sys/src/cmd/rio/data.c b/sys/src/cmd/rio/data.c index 86e589b3e..65599b9a4 100644 --- a/sys/src/cmd/rio/data.c +++ b/sys/src/cmd/rio/data.c @@ -176,5 +176,28 @@ void iconinit(void) { background = allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x777777FF); - red = allocimage(display, Rect(0,0,1,1), RGB24, 1, 0xDD0000FF); + + /* greys are multiples of 0x11111100+0xFF, 14* being palest */ + cols[BACK] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xFFFFFFFF^reverse); + cols[HIGH] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xCCCCCCFF^reverse); + cols[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF^reverse); + cols[TEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse); + cols[HTEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse); + if(!reverse) { + titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreygreen); + lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreygreen); + } else { + titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPurpleblue); + lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF);; + } + dholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DMedblue); + lightholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreyblue); + paleholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreyblue); + paletextcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF^reverse); + sizecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DRed); + + if(reverse == 0) + holdcol = dholdcol; + else + holdcol = paleholdcol; } diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c index 92fd60846..2e91e3413 100644 --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -46,7 +46,6 @@ Channel* initkbd(void); char *fontname; int mainpid; -int reverse; enum { @@ -228,7 +227,7 @@ threadmain(int argc, char *argv[]) r = screen->r; r.max.x = r.min.x+300; r.max.y = r.min.y+80; - i = allocwindow(wscreen, r, Refbackup, DWhite); + i = allocwindow(wscreen, r, Refbackup, DNofill); wkeyboard = new(i, FALSE, scrolling, 0, nil, "/bin/rc", kbdargv); if(wkeyboard == nil) error("can't create keyboard window"); @@ -653,10 +652,10 @@ resized(void) break; incref(w); if(j < nhidden){ - im = allocimage(display, r, screen->chan, 0, DWhite); + im = allocimage(display, r, screen->chan, 0, DNofill); r = ZR; } else - im = allocwindow(wscreen, r, Refbackup, DWhite); + im = allocwindow(wscreen, r, Refbackup, DNofill); if(im) wsendctlmesg(w, Reshaped, r, im); wclose(w); @@ -846,12 +845,13 @@ sweep(void) p = onscreen(mouse->xy); r = canonrect(Rpt(p0, p)); if(Dx(r)>5 && Dy(r)>5){ - i = allocwindow(wscreen, r, Refnone, 0xEEEEEEFF); /* grey */ + i = allocwindow(wscreen, r, Refnone, DNofill); freeimage(oi); if(i == nil) goto Rescue; oi = i; - border(i, r, Selborder, red, ZP); + border(i, r, Selborder, sizecol, ZP); + draw(i, insetrect(r, Selborder), cols[BACK], nil, ZP); flushimage(display, 1); } } @@ -861,11 +861,10 @@ sweep(void) if(i==nil || Dx(i->r)<100 || Dy(i->r)<3*font->height) goto Rescue; oi = i; - i = allocwindow(wscreen, oi->r, Refbackup, DWhite); + i = allocwindow(wscreen, oi->r, Refbackup, DNofill); freeimage(oi); if(i == nil) goto Rescue; - border(i, r, Selborder, red, ZP); cornercursor(input, mouse->xy, 1); goto Return; @@ -890,7 +889,9 @@ drawedge(Image **bp, Rectangle r) originwindow(b, r.min, r.min); else{ freeimage(b); - *bp = allocwindow(wscreen, r, Refbackup, DRed); + b = allocwindow(wscreen, r, Refbackup, DNofill); + if(b != nil) draw(b, r, sizecol, nil, ZP); + *bp = b; } } @@ -944,7 +945,7 @@ drag(Window *w, Rectangle *rp) moveto(mousectl, mouse->xy); /* force cursor update; ugly */ menuing = FALSE; flushimage(display, 1); - if(mouse->buttons!=0 || (ni=allocwindow(wscreen, r, Refbackup, DWhite))==nil){ + if(mouse->buttons!=0 || (ni=allocwindow(wscreen, r, Refbackup, DNofill))==nil){ moveto(mousectl, om); while(mouse->buttons) readmouse(mousectl); @@ -1023,7 +1024,6 @@ whichrect(Rectangle r, Point p, int which) Image* bandsize(Window *w) { - Image *i; Rectangle r, or; Point p, startp; int which, but; @@ -1060,11 +1060,7 @@ bandsize(Window *w) } if(abs(p.x-startp.x)+abs(p.y-startp.y) <= 1) return nil; - i = allocwindow(wscreen, or, Refbackup, DWhite); - if(i == nil) - return nil; - border(i, r, Selborder, red, ZP); - return i; + return allocwindow(wscreen, or, Refbackup, DNofill); } Window* @@ -1157,7 +1153,7 @@ whide(Window *w) if(nhidden >= nelem(hidden)) return 0; incref(w); - i = allocimage(display, w->screenr, w->i->chan, 0, DWhite); + i = allocimage(display, w->screenr, w->i->chan, 0, DNofill); if(i){ if(w == input) input = nil; @@ -1180,7 +1176,7 @@ wunhide(Window *w) if(j == nhidden) return -1; /* not hidden */ incref(w); - i = allocwindow(wscreen, w->i->r, Refbackup, DWhite); + i = allocwindow(wscreen, w->i->r, Refbackup, DNofill); if(i){ --nhidden; memmove(hidden+j, hidden+j+1, (nhidden-j)*sizeof(Window*)); diff --git a/sys/src/cmd/rio/scrl.c b/sys/src/cmd/rio/scrl.c index 47480ac90..4edbd66e4 100644 --- a/sys/src/cmd/rio/scrl.c +++ b/sys/src/cmd/rio/scrl.c @@ -21,7 +21,7 @@ scrtemps(void) if(scrtmp) return; h = BIG*Dy(screen->r); - scrtmp = allocimage(display, Rect(0, 0, 32, h), screen->chan, 0, DWhite); + scrtmp = allocimage(display, Rect(0, 0, 32, h), screen->chan, 0, DNofill); if(scrtmp == nil) error("scrtemps"); } @@ -70,7 +70,7 @@ wscrdraw(Window *w) scrtemps(); if(w->i == nil) - error("scrdraw"); + return; r = w->scrollr; b = scrtmp; r1 = r; diff --git a/sys/src/cmd/rio/wctl.c b/sys/src/cmd/rio/wctl.c index 557e9e84d..efe6949ff 100644 --- a/sys/src/cmd/rio/wctl.c +++ b/sys/src/cmd/rio/wctl.c @@ -330,14 +330,13 @@ wctlnew(Rectangle rect, char *arg, int pid, int hideit, int scrollit, char *dir, argv[3] = nil; } if(hideit) - i = allocimage(display, rect, screen->chan, 0, DWhite); + i = allocimage(display, rect, screen->chan, 0, DNofill); else - i = allocwindow(wscreen, rect, Refbackup, DWhite); + i = allocwindow(wscreen, rect, Refbackup, DNofill); if(i == nil){ strcpy(err, Ewalloc); return -1; } - border(i, rect, Selborder, red, ZP); new(i, hideit, scrollit, pid, dir, "/bin/rc", argv); @@ -366,12 +365,11 @@ wctlcmd(Window *w, Rectangle r, int cmd, char *err) } if(eqrect(r, w->screenr)) return 1; - i = allocwindow(wscreen, r, Refbackup, DWhite); + i = allocwindow(wscreen, r, Refbackup, DNofill); if(i == nil){ strcpy(err, Ewalloc); return -1; } - border(i, r, Selborder, red, ZP); wsendctlmesg(w, Reshaped, i->r, i); return 1; case Scroll: diff --git a/sys/src/cmd/rio/wind.c b/sys/src/cmd/rio/wind.c index 337ed5bd2..259626486 100644 --- a/sys/src/cmd/rio/wind.c +++ b/sys/src/cmd/rio/wind.c @@ -21,21 +21,9 @@ enum MinWater = 20000, /* room to leave available when reallocating */ }; -extern int reverse; /* there are no pastel paints in the dungeons and dragons world -- rob pike */ - -static int topped; -static int id; - -static Image *cols[NCOL]; -static Image *grey; -static Image *darkgrey; +static int topped; +static int id; static Cursor *lastcursor; -static Image *titlecol; -static Image *lighttitlecol; -static Image *dholdcol; -static Image *holdcol; -static Image *lightholdcol; -static Image *paleholdcol; Window* wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling) @@ -43,31 +31,6 @@ wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling) Window *w; Rectangle r; - if(cols[0] == nil){ - /* greys are multiples of 0x11111100+0xFF, 14* being palest */ - grey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xEEEEEEFF^reverse); - darkgrey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF^reverse); - cols[BACK] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xFFFFFFFF^reverse); - cols[HIGH] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xCCCCCCFF^reverse); - cols[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF); - cols[TEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse); - cols[HTEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse); - if(reverse == 0) { - titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreygreen); - lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreygreen); - } else { - titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPurpleblue); - lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF^reverse); - } - dholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DMedblue); - lightholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreyblue); - paleholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreyblue); - - if(reverse == 0) - holdcol = dholdcol; - else - holdcol = paleholdcol; - } w = emalloc(sizeof(Window)); w->screenr = i->r; r = insetrect(i->r, Selborder+1); @@ -162,16 +125,15 @@ wresize(Window *w, Image *i, int move) } void -wrefresh(Window *w, Rectangle) +wrefresh(Window *w, Rectangle r) { /* BUG: rectangle is ignored */ if(w == input) wborder(w, Selborder); else wborder(w, Unselborder); - if(w->mouseopen) - return; - draw(w->i, insetrect(w->i->r, Borderwidth), w->cols[BACK], nil, w->i->r.min); + r = insetrect(w->i->r, Selborder); + draw(w->i, r, w->cols[BACK], nil, w->entire.min); w->ticked = 0; if(w->p0 > 0) frdrawsel(w, frptofchar(w, 0), 0, w->p0, 0); @@ -760,7 +722,7 @@ wsetcols(Window *w) if(w == input) w->cols[TEXT] = w->cols[HTEXT] = cols[TEXT]; else - w->cols[TEXT] = w->cols[HTEXT] = darkgrey; + w->cols[TEXT] = w->cols[HTEXT] = paletextcol; } void diff --git a/sys/src/cmd/rio/xfid.c b/sys/src/cmd/rio/xfid.c index c9e4eb974..cc4edee92 100644 --- a/sys/src/cmd/rio/xfid.c +++ b/sys/src/cmd/rio/xfid.c @@ -183,11 +183,10 @@ xfidattach(Xfid *x) err = Ebadrect; else{ if(hideit) - i = allocimage(display, r, screen->chan, 0, DWhite); + i = allocimage(display, r, screen->chan, 0, DNofill); else - i = allocwindow(wscreen, r, Refbackup, DWhite); + i = allocwindow(wscreen, r, Refbackup, DNofill); if(i){ - border(i, r, Selborder, display->black, ZP); if(pid == 0) pid = -1; /* make sure we don't pop a shell! - UGH */ w = new(i, hideit, scrollit, pid, nil, nil, nil); |
