commit 43e654a6b5e2be6a422e08d2c22d4feffc1ee9ee
parent a2b14de8f7c952386a04042b1ef26c9330589c35
Author: Kyle Milz <krwmilz@gmail.com>
Date: Sat, 21 Aug 2021 04:43:57 +0000
Unconditionally enable GREY
Diffstat:
6 files changed, 0 insertions(+), 85 deletions(-)
diff --git a/dvi-draw.c b/dvi-draw.c
@@ -162,7 +162,6 @@ put_bitmap(bitmap, x, y)
}
}
-#if GREY
static void shrink_glyph_grey(struct glyph *);
@@ -198,7 +197,6 @@ put_image(g, x, y)
}
}
}
-#endif /* GREY */
/*
* Byte reading routines for dvi file.
@@ -493,7 +491,6 @@ shrink_glyph(g)
print_bitmap(&g->bitmap2);
}
-#ifdef GREY
static void
shrink_glyph_grey(g)
struct glyph *g;
@@ -583,7 +580,6 @@ shrink_glyph_grey(g)
g->y2 = g->y / shrink_factor;
g->fg = fg_current;
}
-#endif /* GREY */
/*
* Find font #n.
@@ -905,7 +901,6 @@ set_char P2C(wide_ubyte, cmd, wide_ubyte, ch)
if (shrink_factor == 1)
put_bitmap(&g->bitmap, PXL_H - g->x, PXL_V - g->y);
else {
-#ifdef GREY
if (use_grey) {
if (g->pixmap2 == NULL) {
shrink_glyph_grey(g);
@@ -917,12 +912,6 @@ set_char P2C(wide_ubyte, cmd, wide_ubyte, ch)
}
put_bitmap(&g->bitmap2, PXL_H - g->x2, PXL_V - g->y2);
}
-#else
- if (g->bitmap2.bits == NULL) {
- shrink_glyph(g);
- }
- put_bitmap(&g->bitmap2, PXL_H - g->x2, PXL_V - g->y2);
-#endif
}
#ifndef TEXXET
return g->dvi_adv;
diff --git a/dvi-init.c b/dvi-init.c
@@ -106,7 +106,6 @@ reset_fonts()
free(g->bitmap2.bits);
g->bitmap2.bits = NULL;
}
-#ifdef GREY
if (g->pixmap2) {
XDestroyImage(g->image2);
g->pixmap2 = NULL;
@@ -116,7 +115,6 @@ reset_fonts()
}
}
g->fg = NULL;
-#endif /* GREY */
}
}
@@ -147,7 +145,6 @@ reset_colors()
free(bg_head);
bg_head = bgp;
}
-#if GREY
if (use_grey) {
struct font *f;
struct glyph *g;
@@ -157,7 +154,6 @@ reset_colors()
for (g = f->glyph; g <= f->glyph + f->maxchar; ++g)
g->fg = NULL;
}
-#endif /* GREY */
bg_current = NULL;
fg_active = NULL;
color_warned = False;
@@ -663,13 +659,11 @@ read_postamble()
g <= fontp->glyph + fontp->maxchar; ++g) {
if (g->bitmap.bits != NULL) free(g->bitmap.bits);
if (g->bitmap2.bits != NULL) free(g->bitmap2.bits);
-#ifdef GREY
if (g->pixmap2 != NULL) {
XDestroyImage(g->image2);
if (g->pixmap2_t != NULL)
free(g->pixmap2_t);
}
-#endif
}
free((char *) fontp->glyph);
}
diff --git a/events.c b/events.c
@@ -134,9 +134,7 @@ static ACTION_DECL(Act_show_display_attributes);
static ACTION_DECL(Act_set_shrink_factor);
static ACTION_DECL(Act_shrink_to_dpi);
static ACTION_DECL(Act_set_density);
-#if GREY
static ACTION_DECL(Act_set_greyscaling);
-#endif
static ACTION_DECL(Act_set_color);
#if BUTTONS
static ACTION_DECL(Act_set_expert_mode);
@@ -180,9 +178,7 @@ XtActionsRec Actions[] = {
{"set-density", Act_set_density},
{"print", Act_print},
{"open-dvi-file", Act_open_dvi_file},
-#if GREY
{"set-greyscaling", Act_set_greyscaling},
-#endif
{"set-color", Act_set_color},
#if BUTTONS
{"set-expert-mode", Act_set_expert_mode},
@@ -596,7 +592,6 @@ static short alt_stat; /* 1 = wait for expose, */
static volatile int event_freq = 70;
static void can_exposures();
-#if GREY
#define gamma resource._gamma
@@ -660,7 +655,6 @@ in the xdvi manual page for more details.");
}
}
-#endif /* GREY */
/*
@@ -798,7 +792,6 @@ do_color_change()
Pixel set_bits;
Pixel clr_bits;
-#if GREY
if (use_grey) {
if (our_visual->class == TrueColor) {
@@ -1018,7 +1011,6 @@ do_color_change()
} /* end if use_grey */
else
-#endif /* GREY */
{
static GC foreGC2_bak = NULL;
@@ -1747,9 +1739,7 @@ ACTION(Act_set_shrink_factor)
mane.shrinkfactor = arg;
if (arg != 1 && arg != bak_shrink) {
bak_shrink = arg;
-#if GREY
if (use_grey) fg_active = NULL;
-#endif /* GREY */
reset_fonts();
}
@@ -1785,9 +1775,7 @@ ACTION(Act_shrink_to_dpi)
mane.shrinkfactor = arg;
if (arg != 1 && arg != bak_shrink) {
bak_shrink = arg;
-#if GREY
if (use_grey) fg_active = NULL;
-#endif /* GREY */
reset_fonts();
}
@@ -1811,7 +1799,6 @@ ACTION(Act_set_density)
GET_ARG4(arg, arg = atoi(*params), sign * number,
{XBell(DISP, 0); return;});
-#if GREY
if (use_grey) {
float newgamma = arg != 0 ? arg / 100.0 : 1.0;
@@ -1822,7 +1809,6 @@ ACTION(Act_set_density)
reset_colors();
}
else
-#endif /* GREY */
{
if (arg < 0) {
XBell(DISP, 0);
@@ -1839,7 +1825,6 @@ ACTION(Act_set_density)
XFlush(DISP);
}
-#if GREY
static
ACTION(Act_set_greyscaling)
@@ -1857,7 +1842,6 @@ ACTION(Act_set_greyscaling)
XFlush(DISP);
}
-#endif /* GREY */
static
@@ -2033,16 +2017,12 @@ ACTION(Act_magnifier)
attr.border_pixel = brdr_Pixel;
attr.background_pixel = bg_current->pixel;
attr.override_redirect = True;
-#ifdef GREY
attr.colormap = our_colormap;
-#endif
alt.win = XCreateWindow(DISP, RootWindowOfScreen(SCRN),
x, y, alt.width, alt.height, MAGBORD,
our_depth, InputOutput, our_visual,
CWSaveUnder | CWBorderPixel | CWBackPixel |
-#ifdef GREY
CWColormap |
-#endif
CWOverrideRedirect, &attr);
XSelectInput(DISP, alt.win, ExposureMask);
XMapWindow(DISP, alt.win);
diff --git a/special.c b/special.c
@@ -1119,9 +1119,7 @@ set_fg_color(const struct rgb *color)
fg_current->next = NULL;
fg_current->color = *color;
fg_current->pixel_good = False;
-#if GREY
fg_current->palette_good = False;
-#endif
break;
}
if (fg_current->color.r == color->r
diff --git a/xdvi.c b/xdvi.c
@@ -221,13 +221,11 @@ static XrmOptionDescRec options[] = {
{"-density", ".densityPercent", XrmoptionSepArg, (XPointer) NULL},
{"-nocolor", ".color", XrmoptionNoArg, (XPointer) "off"},
{"+nocolor", ".color", XrmoptionNoArg, (XPointer) "on"},
-#ifdef GREY
{"-nogrey", ".grey", XrmoptionNoArg, (XPointer) "off"},
{"+nogrey", ".grey", XrmoptionNoArg, (XPointer) "on"},
{"-gamma", ".gamma", XrmoptionSepArg, (XPointer) NULL},
{"-install", ".install", XrmoptionNoArg, (XPointer) "on"},
{"-noinstall", ".install", XrmoptionNoArg, (XPointer) "off"},
-#endif
{"-p", ".pixelsPerInch", XrmoptionSepArg, (XPointer) NULL},
{"-margins", ".Margin", XrmoptionSepArg, (XPointer) NULL},
{"-sidemargin", ".sideMargin", XrmoptionSepArg, (XPointer) NULL},
@@ -359,9 +357,7 @@ static const char base_translations[] = ""
"<Key>KP_Delete:up-or-previous()\n"
"<Key>KP_Enter:forward-page()\n"
#endif
-#if GREY
"\"G\":set-greyscaling()\n"
-#endif
"\"C\":set-color()\n"
#if BUTTONS
"\"x\":set-expert-mode()\n"
@@ -419,10 +415,8 @@ static XtResource application_resources[] = {
offset(dvips_hang), XtRImmediate, (XtPointer) 700},
{"dvipsFailHangTime", "DvipsFailHangTime", XtRInt, sizeof(int),
offset(dvips_fail_hang), XtRImmediate, (XtPointer) 5000},
-#ifdef GREY
{"gamma", "Gamma", XtRFloat, sizeof(float),
offset(_gamma), XtRString, "1"},
-#endif
{"pixelsPerInch", "PixelsPerInch", XtRInt, sizeof(int),
offset(_pixels_per_inch), XtRImmediate, (XtPointer) BDPI},
{"sideMargin", "Margin", XtRString, sizeof(char *),
@@ -529,7 +523,6 @@ static XtResource application_resources[] = {
offset(_use_color), XtRString, "true"},
{"dvipsPath", "DvipsPath", XtRString, sizeof(char *),
offset(dvips_path), XtRString, (XtPointer) DEFAULT_DVIPS_PATH},
-#ifdef GREY
{"grey", "Grey", XtRBoolean, sizeof(Boolean),
offset(_use_grey), XtRString, "true"},
{"install", "Install", XtRBool3, sizeof(Bool3),
@@ -537,7 +530,6 @@ static XtResource application_resources[] = {
};
static XtResource app_pixel_resources[] = { /* get these later */
-#endif /* GREY */
{"foreground", "Foreground", XtRPixel, sizeof(Pixel),
offset(_fore_Pixel), XtRString, XtDefaultForeground},
{"background", "Background", XtRPixel, sizeof(Pixel),
@@ -555,9 +547,7 @@ static const char *usagestr[] = {
/* shrinkFactor */ "shrink",
/* S */ "density",
/* density */ silent,
-#ifdef GREY
/* gamma */ "g",
-#endif
/* p */ "pixels",
/* margins */ "dimen",
/* sidemargin */ "dimen",
@@ -810,14 +800,12 @@ atopix(const char *arg, Boolean allow_minus)
**/
-#ifdef GREY
static Arg temp_args1[] = {
{XtNdepth, (XtArgVal) 0},
{XtNvisual, (XtArgVal) 0},
{XtNcolormap, (XtArgVal) 0},
};
#define temp_args1a (temp_args1 + 2)
-#endif
static Arg temp_args2[] = {
{XtNiconX, (XtArgVal) 0},
@@ -835,7 +823,6 @@ static Arg set_wh_args[] = {
};
-#ifdef GREY
/*
* Alternate routine to convert color name to Pixel (needed to substitute
@@ -919,7 +906,6 @@ XdviCvtStringToBool3(dpy, args, num_args, fromVal, toVal, closure_ret)
return True;
}
-#endif /* GREY */
/*
@@ -1589,10 +1575,8 @@ or invalid argument:\n\t\"%s\", \"%s\".",
DISP = XtDisplay(top_level);
SCRN = XtScreen(top_level);
-#if GREY
XtSetTypeConverter(XtRString, XtRBool3, XdviCvtStringToBool3,
NULL, 0, XtCacheNone, NULL);
-#endif
accels_cr = XtParseAcceleratorTable(
"<Key>Return:set()notify()unset()");
@@ -1681,7 +1665,6 @@ or invalid argument:\n\t\"%s\", \"%s\".",
printf("Atom(%s) = %lu\n", atom_names[i], atoms[i]);
}
-#if GREY
our_depth = DefaultDepthOfScreen(SCRN);
our_visual = DefaultVisualOfScreen(SCRN);
our_colormap = DefaultColormapOfScreen(SCRN);
@@ -1760,7 +1743,6 @@ or invalid argument:\n\t\"%s\", \"%s\".",
XtSetValues(top_level, temp_args1a, 1);
}
-#endif /* GREY */
enable_intr();
@@ -1903,11 +1885,9 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
* values, but I don't think that makes any difference.)
*/
-#if GREY
XtGetApplicationResources(top_level, (XtPointer) &resource,
app_pixel_resources, XtNumber(app_pixel_resources),
(ArgList) NULL, 0);
-#endif
copy = resource.copy;
@@ -1923,7 +1903,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
bg_initial.g = back_color_data.green;
bg_initial.b = back_color_data.blue;
-#if GREY
if (our_depth == 1)
use_grey = False;
@@ -1938,7 +1917,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
XStoreColor(DISP, our_colormap, &tmp_color);
}
}
-#endif
/*
* Step 3: Initialize the dvi file and set titles.
@@ -2207,10 +2185,8 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
* and ruleGC, but not copyGC or highGC.
*/
-#if GREY
if (resource._gamma == 0.0)
resource._gamma = 1.0;
-#endif
#define MakeGC(fcn, fg, bg) (values.function = fcn, \
values.foreground=fg, values.background=bg, \
diff --git a/xdvi.h b/xdvi.h
@@ -281,12 +281,10 @@ struct glyph {
short x, y; /* x and y offset in pixels */
struct bitmap bitmap; /* bitmap for character */
short x2, y2; /* x and y offset in pixels (shrunken bitmap) */
-#if GREY
struct fgrec *fg; /* fgrec for which these pixmaps are valid */
XImage *image2;
char *pixmap2;
char *pixmap2_t;
-#endif /* GREY */
struct bitmap bitmap2; /* shrunken bitmap for character */
};
@@ -384,9 +382,7 @@ extern struct _resource {
int dvips_fail_hang;
int wheel_unit;
int _density;
-#ifdef GREY
float _gamma;
-#endif
int _pixels_per_inch;
const char *sidemargin;
const char *topmargin;
@@ -434,10 +430,8 @@ extern struct _resource {
#endif
const char *mg_arg[5];
Boolean _use_color;
-#ifdef GREY
Boolean _use_grey;
Bool3 install;
-#endif
const char *dvips_path;
} resource;
@@ -453,14 +447,10 @@ extern struct _resource {
#define hush_chars resource._hush_chars
#define hush_chk resource._hush_chk
#define use_color resource._use_color
-#ifdef GREY
#define use_grey resource._use_grey
-#endif
-#if GREY
Pixel plane_masks[4];
-#endif
XColor color_data[2];
#define fore_color_data color_data[0]
@@ -511,10 +501,8 @@ struct fgrec {
struct rgb color;
Boolean pixel_good; /* if the pixel entry is valid */
Pixel pixel;
-#if GREY
Boolean palette_good; /* if the palette entry is valid */
Pixel palette[16]; /* non-TrueColor only */
-#endif
};
struct bgrec *bg_head = NULL; /* head of list */
@@ -578,15 +566,9 @@ Screen *SCRN;
extern XtActionsRec Actions[];
extern Cardinal num_actions;
XtAccelerators accels_cr, accels_cr_click;
-#ifdef GREY
Visual *our_visual;
unsigned int our_depth;
Colormap our_colormap;
-#else
-#define our_depth (unsigned int) DefaultDepthOfScreen(SCRN)
-#define our_visual DefaultVisualOfScreen(SCRN)
-#define our_colormap DefaultColormapOfScreen(SCRN)
-#endif
GC ruleGC;
GC foreGC, highGC;
GC foreGC2;
@@ -614,10 +596,8 @@ struct wheel_acts {
struct wheel_acts *wheel_actions;
-#ifdef GREY
Pixel *pixeltbl;
Pixel *pixeltbl_t;
-#endif /* GREY */
/*
* Flag values and masks for event_flags
@@ -847,9 +827,7 @@ extern Bool compile_action(const char *, struct xdvi_action **);
extern void create_buttons(void);
extern void set_button_panel_height(XtArgVal);
#endif /* BUTTONS */
-#if GREY
extern void init_plane_masks(void);
-#endif
extern Pixel alloc_color(const struct rgb *, Pixel);
extern void do_color_change(void);
extern void expose(struct WindowRec *, int, int, unsigned int,