there are no pastel paints in the dungeons and dragons world - rob pike

This commit is contained in:
stanley lieber 2011-05-09 16:51:12 +00:00
parent 2febff5948
commit ec236059b6

View file

@ -23,6 +23,7 @@ enum
static int topped; static int topped;
static int id; static int id;
static int reverse;
static Image *cols[NCOL]; static Image *cols[NCOL];
static Image *grey; static Image *grey;
@ -30,6 +31,7 @@ static Image *darkgrey;
static Cursor *lastcursor; static Cursor *lastcursor;
static Image *titlecol; static Image *titlecol;
static Image *lighttitlecol; static Image *lighttitlecol;
static Image *dholdcol;
static Image *holdcol; static Image *holdcol;
static Image *lightholdcol; static Image *lightholdcol;
static Image *paleholdcol; static Image *paleholdcol;
@ -41,19 +43,36 @@ wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling)
Rectangle r; Rectangle r;
if(cols[0] == nil){ if(cols[0] == nil){
/* there are no pastel paints in the dungeons and dragons world
* - rob pike
*/
reverse = 0;
if(getenv("reverse") != nil)
reverse = ~0xFF;
/* greys are multiples of 0x11111100+0xFF, 14* being palest */ /* greys are multiples of 0x11111100+0xFF, 14* being palest */
grey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xEEEEEEFF); grey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xEEEEEEFF^reverse);
darkgrey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF); darkgrey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF^reverse);
cols[BACK] = display->white; 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); 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[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF);
cols[TEXT] = display->black; cols[TEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse);
cols[HTEXT] = display->black; cols[HTEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse);
titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreygreen); if(reverse == 0) {
lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreygreen); titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreygreen);
holdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DMedblue); 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); lightholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreyblue);
paleholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreyblue); paleholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreyblue);
if(reverse == 0)
holdcol = dholdcol;
else
holdcol = paleholdcol;
} }
w = emalloc(sizeof(Window)); w = emalloc(sizeof(Window));
w->screenr = i->r; w->screenr = i->r;
@ -700,7 +719,7 @@ wsetcols(Window *w)
w->cols[TEXT] = w->cols[HTEXT] = lightholdcol; w->cols[TEXT] = w->cols[HTEXT] = lightholdcol;
else else
if(w == input) if(w == input)
w->cols[TEXT] = w->cols[HTEXT] = display->black; w->cols[TEXT] = w->cols[HTEXT] = cols[TEXT];
else else
w->cols[TEXT] = w->cols[HTEXT] = darkgrey; w->cols[TEXT] = w->cols[HTEXT] = darkgrey;
} }
@ -1300,7 +1319,6 @@ wclosewin(Window *w)
if(hidden[i] == w){ if(hidden[i] == w){
--nhidden; --nhidden;
memmove(hidden+i, hidden+i+1, (nhidden-i)*sizeof(hidden[0])); memmove(hidden+i, hidden+i+1, (nhidden-i)*sizeof(hidden[0]));
hidden[nhidden] = nil;
break; break;
} }
for(i=0; i<nwindow; i++) for(i=0; i<nwindow; i++)