Remove TEXTCOLOR build option

This commit is contained in:
nhmall
2023-11-22 16:01:58 -05:00
parent 6272e18d7b
commit 04082a2033
60 changed files with 105 additions and 483 deletions
-6
View File
@@ -165,10 +165,8 @@ struct window_procs X11_procs = {
* Local functions.
*/
static winid find_free_window(void);
#ifdef TEXTCOLOR
static void nhFreePixel(XtAppContext, XrmValuePtr, XtPointer, XrmValuePtr,
Cardinal *);
#endif
static boolean new_resource_macro(String, unsigned);
static void load_default_resources(void);
static void release_default_resources(void);
@@ -708,7 +706,6 @@ load_boldfont(struct xwindow *wp, Widget w)
wp->boldfs = XLoadQueryFont(dpy, fontname);
}
#ifdef TEXTCOLOR
/* ARGSUSED */
static void
nhFreePixel(
@@ -736,7 +733,6 @@ nhFreePixel(
(unsigned long *) toVal->addr, 1, (unsigned long) 0);
}
}
#endif /*TEXTCOLOR*/
/* [ALI] Utility function to ask Xaw for font height, since the previous
* assumption of ascent + descent is not always valid.
@@ -1622,13 +1618,11 @@ X11_init_nhwindows(int *argcp, char **argv)
old_error_handler = XSetErrorHandler(panic_on_error);
#ifdef TEXTCOLOR
/* add new color converter to deal with overused colormaps */
XtSetTypeConverter(XtRString, XtRPixel, nhCvtStringToPixel,
(XtConvertArgList) nhcolorConvertArgs,
XtNumber(nhcolorConvertArgs), XtCacheByDisplay,
nhFreePixel);
#endif /* TEXTCOLOR */
/* Register the actions mentioned in "actions". */
XtAppAddActions(app_context, actions, XtNumber(actions));
-52
View File
@@ -57,13 +57,11 @@ extern int total_tiles_used, Tile_corr;
#define COL0_OFFSET 1 /* change to 0 to revert to displaying unused column 0 */
static X11_map_symbol glyph_char(const glyph_info *glyphinfo);
#ifdef TEXTCOLOR
static GC X11_make_gc(struct xwindow *wp, struct text_map_info_t *text_map,
X11_color color, boolean inverted);
#ifdef ENHANCED_SYMBOLS
static void X11_free_gc(struct xwindow *wp, GC gc, X11_color color);
#endif
#endif /* TEXTCOLOR */
#ifdef ENHANCED_SYMBOLS
static void X11_set_map_font(struct xwindow *wp);
#endif
@@ -129,10 +127,8 @@ X11_print_glyph(
register X11_map_symbol *ch_ptr;
X11_color color;
unsigned special;
#ifdef TEXTCOLOR
int colordif;
register X11_color *co_ptr;
#endif
color = glyphinfo->gm.sym.color;
special = glyphinfo->gm.glyphflags;
@@ -150,7 +146,6 @@ X11_print_glyph(
if (!map_info->is_tile)
update_bbox = TRUE;
}
#ifdef TEXTCOLOR
co_ptr = &map_info->text_map.colors[y][x];
colordif = (((special & MG_PET) != 0 && iflags.hilite_pet)
|| ((special & MG_OBJPILE) != 0 && iflags.hilite_pile)
@@ -177,7 +172,6 @@ X11_print_glyph(
map_info->text_map.framecolors[y][x] = bkglyphinfo->framecolor;
update_bbox = TRUE;
}
#endif
}
if (update_bbox) { /* update row bbox */
@@ -945,7 +939,6 @@ get_text_gc(struct xwindow *wp, Font font)
XtSetArg(arg[0], XtNbackground, &bgpixel);
XtGetValues(wp->w, arg, ONE);
#ifdef TEXTCOLOR
#define set_color_gc(nh_color, resource_name) \
set_gc(wp->w, font, resource_name, bgpixel, \
&map_info->text_map.color_gcs[nh_color], \
@@ -967,11 +960,6 @@ get_text_gc(struct xwindow *wp, Font font)
set_color_gc(CLR_BRIGHT_MAGENTA, XtNbright_magenta);
set_color_gc(CLR_BRIGHT_CYAN, XtNbright_cyan);
set_color_gc(CLR_WHITE, XtNwhite);
#else
set_gc(wp->w, font, XtNforeground, bgpixel,
&map_info->text_map.copy_gc,
&map_info->text_map.inv_copy_gc);
#endif
}
/*
@@ -1071,10 +1059,8 @@ map_all_unexplored(struct map_info_t *map_info) /* [was map_all_stone()] */
tile_map->glyphs[y][x].framecolor = NO_COLOR;
text_map->text[y][x] = (uchar) (!x ? mgnothg : mgunexp);
#ifdef TEXTCOLOR
text_map->colors[y][x] = NO_COLOR;
text_map->framecolors[y][x] = NO_COLOR;
#endif
}
}
@@ -1446,7 +1432,6 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
XSetForeground(dpy, tile_map->black_gc,
BlackPixelOfScreen(screen));
}
#ifdef TEXTCOLOR
{
uint32_t fc = tile_map->glyphs[row][cur_col].framecolor;
@@ -1457,7 +1442,6 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
tile_map->square_width - 1 ,
tile_map->square_height - 1);
}
#endif
}
}
@@ -1480,7 +1464,6 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
} else {
struct text_map_info_t *text_map = &map_info->text_map;
#ifdef TEXTCOLOR
{
register X11_color *c_ptr;
X11_map_symbol *t_ptr;
@@ -1520,38 +1503,9 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
} /* col loop */
} /* row loop */
}
#else /* !TEXTCOLOR */
{
int win_row, win_xstart;
int win_start_row, win_start_col;
win_start_row = start_row;
win_start_col = start_col;
/* We always start at the same x window position and have
the same character count. */
win_xstart = text_map->square_lbearing
+ ((win_start_col - COL0_OFFSET)
* text_map->square_width);
count = stop_col - start_col + 1;
for (row = start_row, win_row = win_start_row; row <= stop_row;
row++, win_row++) {
X11_draw_image_string(XtDisplay(wp->w), XtWindow(wp->w),
inverted ? text_map->inv_copy_gc
: text_map->copy_gc,
win_xstart,
text_map->square_ascent
+ (win_row * text_map->square_height),
&(text_map->text[row][start_col]),
count);
}
}
#endif /* ?TEXTCOLOR */
}
}
#ifdef TEXTCOLOR
static GC
X11_make_gc(
struct xwindow *wp UNUSED,
@@ -1621,7 +1575,6 @@ X11_free_gc(struct xwindow *wp, GC ggc, X11_color color)
}
}
#endif
#endif /* TEXTCOLOR */
static void
X11_draw_image_string(
@@ -1924,17 +1877,12 @@ destroy_map_window(struct xwindow *wp)
struct text_map_info_t *text_map = &map_info->text_map;
/* Free allocated GCs. */
#ifdef TEXTCOLOR
int i;
for (i = 0; i < CLR_MAX; i++) {
XtReleaseGC(wp->w, text_map->color_gcs[i]);
XtReleaseGC(wp->w, text_map->inv_color_gcs[i]);
}
#else
XtReleaseGC(wp->w, text_map->copy_gc);
XtReleaseGC(wp->w, text_map->inv_copy_gc);
#endif
/* Free the font structure if we allocated one */
#ifdef ENHANCED_SYMBOLS
-13
View File
@@ -300,15 +300,11 @@ HiliteField(Widget label,
struct xwindow *xw = xw_status_win;
int colr, attr;
#ifdef TEXTCOLOR
if ((colrattr & 0x00ff) >= CLR_MAX)
/* for !TEXTCOLOR, the following line is unconditional */
#endif
colrattr = (colrattr & ~0x00ff) | NO_COLOR;
colr = colrattr & 0x00ff; /* guaranteed to be >= 0 and < CLR_MAX */
attr = (colrattr >> 8) & 0x00ff;
/* potentially used even for !TEXTCOLOR configuration */
if (!grayPxl) {/* one-time init */
grayPxl = get_nhcolor(xw, CLR_GRAY).pixel;
blackPxl = get_nhcolor(xw, CLR_BLACK).pixel;
@@ -524,9 +520,7 @@ tt_reset_color(int fld, int cond, unsigned long *colormasks)
if (iflags.hilite_delta != 0L && (X11_condition_bits & bm) != 0) {
/* BL_RESET before first BL_CONDITION will have colormasks==Null
but condcolor() and condattr() can cope with that */
#ifdef TEXTCOLOR
colrattr = condcolor(bm, colormasks);
#endif
colrattr |= (condattr(bm, colormasks) << 8);
}
label = X11_cond_labels[cond];
@@ -724,10 +718,6 @@ X11_status_update_tty(int fld, genericptr_t ptr, int chg UNUSED, int percent,
for a field which isn't active */
*status_vals[fld] = '\0';
}
#ifndef TEXTCOLOR
/* even without color, attribute(s) bits still apply */
color = (color & ~0x00ff) | NO_COLOR;
#endif
#ifdef STATUS_HILITES
if (!iflags.hilite_delta)
color = NO_COLOR;
@@ -895,10 +885,7 @@ X11_status_update_fancy(int fld, genericptr_t ptr, int chg UNUSED,
} else {
int colr, attr;
#ifdef TEXTCOLOR
if ((colrattr & 0x00ff) >= CLR_MAX)
/* for !TEXTCOLOR, the following line is unconditional */
#endif
colrattr = (colrattr & ~0x00ff) | NO_COLOR;
colr = colrattr & 0x00ff; /* guaranteed to be >= 0 and < CLR_MAX */
attr = (colrattr >> 8) & 0x00ff;