diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2008-07-01 15:42:36 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2008-07-01 15:42:36 +0000 |
commit | 6552be7f745c5a8d506148c8af9d367c9d996d24 (patch) | |
tree | b9d673871a1490b64273a265d4d961316a2174db /Build/source/texk/xdvik/gui | |
parent | 48e2b240973977c208bc840b589b75b91a6f4c30 (diff) |
xdvik 22.84.14
git-svn-id: svn://tug.org/texlive/trunk@9142 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvik/gui')
43 files changed, 5829 insertions, 5252 deletions
diff --git a/Build/source/texk/xdvik/gui/Makefile.in b/Build/source/texk/xdvik/gui/Makefile.in index affe40e0b51..125e595dfcb 100644 --- a/Build/source/texk/xdvik/gui/Makefile.in +++ b/Build/source/texk/xdvik/gui/Makefile.in @@ -6,7 +6,7 @@ # -### NOTE: ac_include paths must be relative to texk/xdvik, since that +### NOTE: kpse_include paths must be relative to texk/xdvik, since that ### is from where the configure is run! kpse_include ../make/paths.mk kpse_include ../make/library.mk @@ -15,6 +15,9 @@ kpse_include ../make/programs.mk kpathsea_parent = ../.. +# additional flags for kpathsea +LIBKPATHSEACPPFLAGS=@LIBKPATHSEACPPFLAGS@ + CPP = @CPP@ RANLIB = @RANLIB@ @@ -24,7 +27,7 @@ x_cppflags = @X_CFLAGS@ # Extra xdvi-specific compiler options. ps_def = @PS_DEF@ -DXSERVER_INFO -prog_cflags = @XTRA_WARN_CFLAGS@ -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) +prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBKPATHSEACPPFLAGS) -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) # Note: to be able to use one depend.mk file for both Motif/Xaw (which # is needed since only maintainers are supposed to invoke `make depend') diff --git a/Build/source/texk/xdvik/gui/Makefile.in.orig b/Build/source/texk/xdvik/gui/Makefile.in.orig new file mode 100644 index 00000000000..873f41e92de --- /dev/null +++ b/Build/source/texk/xdvik/gui/Makefile.in.orig @@ -0,0 +1,83 @@ +# Makefile for xdvik +# +# - 1999/05/08: janl: Removed submakes for libwww and kpathsea. That's what +# the top makefile is for! +# + + +### NOTE: ac_include paths must be relative to texk/xdvik, since that +### is from where the configure is run! +ac_include ../make/paths.mk +ac_include ../make/library.mk +ac_include ../make/common.mk +ac_include ../make/programs.mk + +kpathsea_parent = ../.. + +# additional flags for kpathsea +LIBKPATHSEACPPFLAGS=@LIBKPATHSEACPPFLAGS@ + +CPP = @CPP@ +RANLIB = @RANLIB@ + +# Make `#include <X11/...>' and `-lX...' work. +# This matches web2c (needed only for Metafont). +x_cppflags = @X_CFLAGS@ + +# Extra xdvi-specific compiler options. +ps_def = @PS_DEF@ -DXSERVER_INFO +prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBKPATHSEACPPFLAGS) -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) + +# Note: to be able to use one depend.mk file for both Motif/Xaw (which +# is needed since only maintainers are supposed to invoke `make depend') +# we include *all* object files and have tests for #ifdef MOTIF/XAW inside +# the files. +objects = \ + help-window.o \ + message-window.o \ + mag.o \ + menu.o \ + Panner.o \ + pagesel.o \ + print-dialog.o \ + print-log.o \ + search-dialog.o \ + selection.o \ + sfDir.o \ + sfDraw.o \ + sfPath.o \ + sfSelFile.o \ + statusline.o \ + Tip.o \ + topic-window.o \ + xaw_bitmaps.o \ + xaw_menu.o \ + xicon.o \ + xlwradio.o \ + xm_colorsel.o \ + xm_filesel.o \ + xm_menu.o \ + xm_prefs.o \ + xm_prefs_appearance.o \ + xm_prefs_fonts.o \ + xm_prefs_page.o \ + xm_prefs_scroll.o \ + xm_prefs_helpers.o \ + xm_toolbar.o + +libgui.a: $(objects) +### hmm, I don't understand ar ... sometimes objects were NOT replaced. +### Play it safe and always remove the archive before creating new one. + rm -f $@ + $(AR) $(ARFLAGS) $@ $(objects) + $(RANLIB) $@ + +ac_include ../make/dist.mk +ac_include ../make/clean.mk + +clean:: + rm -f *.o *.a + +c_auto_h_dir = .. +ac_include ../make/rdepend.mk +ac_include ./gui/depend.mk diff --git a/Build/source/texk/xdvik/gui/Panner.c b/Build/source/texk/xdvik/gui/Panner.c index 1ff157b6242..9acca69ac14 100644 --- a/Build/source/texk/xdvik/gui/Panner.c +++ b/Build/source/texk/xdvik/gui/Panner.c @@ -1,28 +1,28 @@ /* * $XConsortium: Panner.c,v 1.52 95/01/10 14:31:26 kaleb Exp $ * -Copyright (c) 1989, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. + Copyright (c) 1989, 1994 X Consortium + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from the X Consortium. * * Author: Jim Fulton, MIT X Consortium */ @@ -57,17 +57,17 @@ extern Bool XmuDistinguishablePixels(); /* not defined in any Xmu headers */ #define offset(field) XtOffsetOf(SimpleRec, simple.field) static XtResource resources[] = { - {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), offset(cursor), XtRImmediate, (XtPointer) None}, - {XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), + {XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), offset(insensitive_border), XtRImmediate, (XtPointer) NULL}, - {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel), + {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel), offset(pointer_fg), XtRString, XtDefaultForeground}, - {XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel), + {XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel), offset(pointer_bg), XtRString, XtDefaultBackground}, - {XtNcursorName, XtCCursor, XtRString, sizeof(String), + {XtNcursorName, XtCCursor, XtRString, sizeof(String), offset(cursor_name), XtRString, NULL}, - {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), + {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), offset(international), XtRImmediate, (XtPointer) FALSE}, #undef offset }; @@ -77,47 +77,47 @@ static Bool SetValues(Widget current, Widget request, Widget new, ArgList args, static Bool ChangeSensitive(Widget w); SimpleClassRec simpleClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &widgetClassRec, - /* class_name */ "Simple", - /* widget_size */ sizeof(SimpleRec), - /* class_initialize */ ClassInitialize, - /* class_part_initialize */ ClassPartInitialize, - /* class_inited */ FALSE, - /* initialize */ NULL, - /* initialize_hook */ NULL, - /* realize */ Realize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ NULL, - /* resize */ NULL, - /* expose */ NULL, + { /* core fields */ + /* superclass */ (WidgetClass) &widgetClassRec, + /* class_name */ "Simple", + /* widget_size */ sizeof(SimpleRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ NULL, + /* expose */ NULL, #warning FIXME: incompatible pointer type - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ NULL, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple fields */ - /* change_sensitive */ ChangeSensitive + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ ChangeSensitive #ifndef HAVE_OLD_XAW - , NULL + , NULL #endif - } + } }; WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec; @@ -126,18 +126,18 @@ static void ClassInitialize() { static XtConvertArgRec convertArg[] = { {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), - sizeof(Screen *)}, + sizeof(Screen *)}, {XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)}, {XtResourceString, (XtPointer) XtNpointerColorBackground, - sizeof(Pixel)}, + sizeof(Pixel)}, {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap), - sizeof(Colormap)} + sizeof(Colormap)} }; XawInitializeWidgetSet(); XtSetTypeConverter( XtRString, XtRColorCursor, XmuCvtStringToColorCursor, - convertArg, XtNumber(convertArg), - XtCacheByDisplay, (XtDestructor)NULL); + convertArg, XtNumber(convertArg), + XtCacheByDisplay, (XtDestructor)NULL); } static void ClassPartInitialize(class) @@ -145,14 +145,14 @@ static void ClassPartInitialize(class) { SimpleWidgetClass c = (SimpleWidgetClass) class; SimpleWidgetClass super = (SimpleWidgetClass) - c->core_class.superclass; + c->core_class.superclass; if (c->simple_class.change_sensitive == NULL) { char buf[BUFSIZ]; (void) sprintf(buf, - "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", - c->core_class.class_name); + "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", + c->core_class.class_name); XtWarning(buf); c->simple_class.change_sensitive = ChangeSensitive; } @@ -178,7 +178,7 @@ static void Realize(w, valueMask, attributes) w->core.depth); border_pixmap = w->core.border_pixmap; attributes->border_pixmap = - w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; + w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; *valueMask |= CWBorderPixmap; *valueMask &= ~CWBorderPixel; @@ -204,7 +204,7 @@ static void Realize(w, valueMask, attributes) static void ConvertCursor(w) -Widget w; + Widget w; { SimpleWidget simple = (SimpleWidget) w; XrmValue from, to; @@ -248,19 +248,19 @@ SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *nu if ( XtIsSensitive(current) != XtIsSensitive(new) ) (*((SimpleWidgetClass)XtClass(new))-> - simple_class.change_sensitive) ( new ); + simple_class.change_sensitive) ( new ); if (s_old->simple.cursor != s_new->simple.cursor) { new_cursor = TRUE; } -/* - * We are not handling the string cursor_name correctly here. - */ + /* + * We are not handling the string cursor_name correctly here. + */ if ( (s_old->simple.pointer_fg != s_new->simple.pointer_fg) || - (s_old->simple.pointer_bg != s_new->simple.pointer_bg) || - (s_old->simple.cursor_name != s_new->simple.cursor_name) ) { + (s_old->simple.pointer_bg != s_new->simple.pointer_bg) || + (s_old->simple.cursor_name != s_new->simple.cursor_name) ) { ConvertCursor(new); new_cursor = TRUE; } @@ -291,7 +291,7 @@ static Bool ChangeSensitive(Widget w) w->core.depth); XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), ((SimpleWidget)w)-> - simple.insensitive_border ); + simple.insensitive_border ); } } return False; @@ -316,7 +316,7 @@ void XawInitializeWidgetSet () } static char defaultTranslations[] = - "<Btn1Down>: start() \n\ +"<Btn1Down>: start() \n\ <Btn1Motion>: move() \n\ <Btn1Up>: notify() stop() \n\ <Btn2Down>: abort() \n\ @@ -357,39 +357,39 @@ static XtActionsRec actions[] = { static XtResource panner_resources[] = { #define poff(field) XtOffsetOf(PannerRec, panner.field) { XtNallowOff, XtCAllowOff, XtRBoolean, sizeof(Boolean), - poff(allow_off), XtRImmediate, (XtPointer) FALSE }, + poff(allow_off), XtRImmediate, (XtPointer) FALSE }, { XtNresize, XtCResize, XtRBoolean, sizeof(Boolean), - poff(resize_to_pref), XtRImmediate, (XtPointer) TRUE }, + poff(resize_to_pref), XtRImmediate, (XtPointer) TRUE }, { XtNreportCallback, XtCReportCallback, XtRCallback, sizeof(XtPointer), - poff(report_callbacks), XtRCallback, (XtPointer) NULL }, + poff(report_callbacks), XtRCallback, (XtPointer) NULL }, { XtNdefaultScale, XtCDefaultScale, XtRDimension, sizeof(Dimension), - poff(default_scale), XtRImmediate, (XtPointer) PANNER_DEFAULT_SCALE }, + poff(default_scale), XtRImmediate, (XtPointer) PANNER_DEFAULT_SCALE }, { XtNrubberBand, XtCRubberBand, XtRBoolean, sizeof(Boolean), - poff(rubber_band), XtRImmediate, (XtPointer) FALSE }, + poff(rubber_band), XtRImmediate, (XtPointer) FALSE }, { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - poff(foreground), XtRString, (XtPointer) XtDefaultBackground }, + poff(foreground), XtRString, (XtPointer) XtDefaultBackground }, { XtNinternalSpace, XtCInternalSpace, XtRDimension, sizeof(Dimension), - poff(internal_border), XtRImmediate, (XtPointer) 4 }, + poff(internal_border), XtRImmediate, (XtPointer) 4 }, { XtNlineWidth, XtCLineWidth, XtRDimension, sizeof(Dimension), - poff(line_width), XtRImmediate, (XtPointer) 0 }, + poff(line_width), XtRImmediate, (XtPointer) 0 }, { XtNcanvasWidth, XtCCanvasWidth, XtRDimension, sizeof(Dimension), - poff(canvas_width), XtRImmediate, (XtPointer) 0 }, + poff(canvas_width), XtRImmediate, (XtPointer) 0 }, { XtNcanvasHeight, XtCCanvasHeight, XtRDimension, sizeof(Dimension), - poff(canvas_height), XtRImmediate, (XtPointer) 0 }, + poff(canvas_height), XtRImmediate, (XtPointer) 0 }, { XtNsliderX, XtCSliderX, XtRPosition, sizeof(Position), - poff(slider_x), XtRImmediate, (XtPointer) 0 }, + poff(slider_x), XtRImmediate, (XtPointer) 0 }, { XtNsliderY, XtCSliderY, XtRPosition, sizeof(Position), - poff(slider_y), XtRImmediate, (XtPointer) 0 }, + poff(slider_y), XtRImmediate, (XtPointer) 0 }, { XtNsliderWidth, XtCSliderWidth, XtRDimension, sizeof(Dimension), - poff(slider_width), XtRImmediate, (XtPointer) 0 }, + poff(slider_width), XtRImmediate, (XtPointer) 0 }, { XtNsliderHeight, XtCSliderHeight, XtRDimension, sizeof(Dimension), - poff(slider_height), XtRImmediate, (XtPointer) 0 }, + poff(slider_height), XtRImmediate, (XtPointer) 0 }, { XtNshadowColor, XtCShadowColor, XtRPixel, sizeof(Pixel), - poff(shadow_color), XtRString, (XtPointer) XtDefaultForeground }, + poff(shadow_color), XtRString, (XtPointer) XtDefaultForeground }, { XtNshadowThickness, XtCShadowThickness, XtRDimension, sizeof(Dimension), - poff(shadow_thickness), XtRImmediate, (XtPointer) 2 }, + poff(shadow_thickness), XtRImmediate, (XtPointer) 2 }, { XtNbackgroundStipple, XtCBackgroundStipple, XtRString, sizeof(String), - poff(stipple_name), XtRImmediate, (XtPointer) NULL }, + poff(stipple_name), XtRImmediate, (XtPointer) NULL }, #undef poff }; @@ -407,49 +407,49 @@ static void SetValuesAlmost(); /* deal with failed setval geom req */ static XtGeometryResult QueryGeometry(); /* say how big we would like to be */ PannerClassRec pannerClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &simpleClassRec, - /* class_name */ "Panner", - /* widget_size */ sizeof(PannerRec), - /* class_initialize */ XawInitializeWidgetSet, - /* class_part_initialize */ NULL, - /* class_inited */ FALSE, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ PannerRealize, - /* actions */ actions, - /* num_actions */ XtNumber(actions), - /* resources */ panner_resources, - /* num_resources */ XtNumber(panner_resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ Destroy, - /* resize */ Resize, - /* expose */ Redisplay, - /* set_values */ PannerSetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ SetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ defaultTranslations, - /* query_geometry */ QueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple fields */ - /* change_sensitive */ XtInheritChangeSensitive + { /* core fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "Panner", + /* widget_size */ sizeof(PannerRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ PannerRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ panner_resources, + /* num_resources */ XtNumber(panner_resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ PannerSetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ SetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ XtInheritChangeSensitive #ifndef HAVE_OLD_XAW - , NULL + , NULL #endif - }, - { /* panner fields */ - /* ignore */ 0 - } + }, + { /* panner fields */ + /* ignore */ 0 + } }; WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec; @@ -475,9 +475,9 @@ static void reset_shadow_gc (pw) /* used when resources change */ pixels[2] = pw->panner.shadow_color; if (!pw->panner.stipple_name && !XmuDistinguishablePixels (XtDisplay (pw), pw->core.colormap, - pixels, 3) && + pixels, 3) && XmuDistinguishablePixels (XtDisplay (pw), pw->core.colormap, - pixels, 2)) + pixels, 2)) { valuemask = GCTile | GCFillStyle; values.fill_style = FillTiled; @@ -633,17 +633,17 @@ static void rescale (pw) int vpad = hpad; if (pw->panner.canvas_width < 1) - pw->panner.canvas_width = pw->core.width; + pw->panner.canvas_width = pw->core.width; if (pw->panner.canvas_height < 1) - pw->panner.canvas_height = pw->core.height; + pw->panner.canvas_height = pw->core.height; if ((int)pw->core.width <= hpad) hpad = 0; if ((int)pw->core.height <= vpad) vpad = 0; pw->panner.haspect = ((double) pw->core.width - hpad) / - (double) pw->panner.canvas_width; + (double) pw->panner.canvas_width; pw->panner.vaspect = ((double) pw->core.height - vpad) / - (double) pw->panner.canvas_height; + (double) pw->panner.canvas_height; scale_knob (pw, TRUE, TRUE); } @@ -665,25 +665,25 @@ static Boolean get_event_xy (pw, event, x, y) int pad = pw->panner.internal_border; switch (event->type) { - case ButtonPress: - case ButtonRelease: + case ButtonPress: + case ButtonRelease: *x = event->xbutton.x - pad; *y = event->xbutton.y - pad; return TRUE; - case KeyPress: - case KeyRelease: + case KeyPress: + case KeyRelease: *x = event->xkey.x - pad; *y = event->xkey.y - pad; return TRUE; - case EnterNotify: - case LeaveNotify: + case EnterNotify: + case LeaveNotify: *x = event->xcrossing.x - pad; *y = event->xcrossing.y - pad; return TRUE; - case MotionNotify: + case MotionNotify: *x = event->xmotion.x - pad; *y = event->xmotion.y - pad; return TRUE; @@ -717,20 +717,20 @@ static int parse_page_string (s, pagesize, canvassize, relative) return 0; } - /* skip over numbers */ + /* skip over numbers */ for (cp = s; isascii(*s) && (isdigit(*s) || *s == '.'); s++) ; val *= atof(cp); - /* skip blanks */ + /* skip blanks */ for (; isascii(*s) && isspace(*s); s++) ; if (*s) { /* if units */ switch (s[0]) { - case 'p': case 'P': + case 'p': case 'P': val *= (double) pagesize; break; - case 'c': case 'C': + case 'c': case 'C': val *= (double) canvassize; break; } @@ -786,7 +786,7 @@ static void Initialize (greq, gnew, args, num_args) if (req->panner.canvas_width < 1) new->panner.canvas_width = 1; if (req->panner.canvas_height < 1) new->panner.canvas_height = 1; if (req->panner.default_scale < 1) - new->panner.default_scale = PANNER_DEFAULT_SCALE; + new->panner.default_scale = PANNER_DEFAULT_SCALE; get_default_size (req, &defwidth, &defheight); if (req->core.width < 1) new->core.width = defwidth; @@ -826,7 +826,7 @@ static void PannerRealize (gw, valuemaskp, attr) } } (*pannerWidgetClass->core_class.superclass->core_class.realize) - (gw, valuemaskp, attr); + (gw, valuemaskp, attr); if (gotpm) XFreePixmap (XtDisplay(gw), pm); } @@ -906,7 +906,7 @@ static Boolean PannerSetValues (Widget gcur, Widget greq, Widget gnew, ArgList a if (cur->panner.foreground != new->panner.foreground) { reset_slider_gc (new); if (cur->panner.foreground != cur->core.background_pixel) - reset_xor_gc (new); + reset_xor_gc (new); redisplay = TRUE; } else if (cur->panner.line_width != new->panner.line_width || cur->core.background_pixel != new->core.background_pixel) { @@ -916,7 +916,7 @@ static Boolean PannerSetValues (Widget gcur, Widget greq, Widget gnew, ArgList a if (cur->panner.shadow_color != new->panner.shadow_color) { reset_shadow_gc (new); if (cur->panner.foreground == cur->core.background_pixel) - reset_xor_gc (new); + reset_xor_gc (new); redisplay = TRUE; } if (cur->panner.shadow_thickness != new->panner.shadow_thickness) { @@ -952,8 +952,8 @@ static Boolean PannerSetValues (Widget gcur, Widget greq, Widget gnew, ArgList a get_default_size (new, &new->core.width, &new->core.height); redisplay = TRUE; } else if (cur->panner.canvas_width != new->panner.canvas_width || - cur->panner.canvas_height != new->panner.canvas_height || - cur->panner.internal_border != new->panner.internal_border) { + cur->panner.canvas_height != new->panner.canvas_height || + cur->panner.internal_border != new->panner.internal_border) { rescale (new); /* does a scale_knob as well */ redisplay = TRUE; } else { @@ -996,11 +996,11 @@ static XtGeometryResult QueryGeometry (gw, intended, pref) (CWWidth | CWHeight)) && intended->width == pref->width && intended->height == pref->height) - return XtGeometryYes; + return XtGeometryYes; else if (pref->width == pw->core.width && pref->height == pw->core.height) - return XtGeometryNo; + return XtGeometryNo; else - return XtGeometryAlmost; + return XtGeometryAlmost; } @@ -1170,12 +1170,12 @@ static void ActionNotify (Widget gw, XEvent *event, String *params, Cardinal *nu if (pw->panner.slider_x > (tmp = (((Position) pw->panner.canvas_width) - ((Position) pw->panner.slider_width)))) - pw->panner.slider_x = tmp; + pw->panner.slider_x = tmp; if (pw->panner.slider_x < 0) pw->panner.slider_x = 0; if (pw->panner.slider_y > (tmp = (((Position) pw->panner.canvas_height) - ((Position) pw->panner.slider_height)))) - pw->panner.slider_y = tmp; + pw->panner.slider_y = tmp; if (pw->panner.slider_y < 0) pw->panner.slider_y = 0; } diff --git a/Build/source/texk/xdvik/gui/Tip.c b/Build/source/texk/xdvik/gui/Tip.c index 76a83f188b9..1033a54cc29 100644 --- a/Build/source/texk/xdvik/gui/Tip.c +++ b/Build/source/texk/xdvik/gui/Tip.c @@ -140,59 +140,59 @@ static XtResource resources[] = { TipClassRec tipClassRec = { { - /* superclass */ (WidgetClass) & overrideShellClassRec, - /* class_name */ "Tip", - /* widget size */ (Cardinal) sizeof(TipRec), - /* class_init */ NULL, - /* class_part_init */ (XtWidgetClassProc) NULL, - /* class_inited */ (XtEnum) FALSE, - /* initialize */ (XtInitProc) initialize, - /* init_hook */ (XtArgsProc) NULL, - /* realize */ XtInheritRealize, - /* actions */ (XtActionList) 0, - /* num_actions */ (Cardinal) 0, - /* resources */ (XtResourceList) resources, - /* num_resources */ (Cardinal) XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposur */ (XtEnum) FALSE, - /* compress enterleave */ TRUE, - /* visibility_interest */ FALSE, - /* destroy */ destroy, - /* resize */ XtInheritResize, - /* expose, */ XtInheritExpose, - /* set_values */ (XtSetValuesFunc) set_values, - /* set_values_hook */ (XtArgsFunc) NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ (XtArgsProc) NULL, - /* accept_focus */ XtInheritAcceptFocus, - /* version */ XtVersion, - /* callback_private */ (XtPointer) NULL, - /* translations */ XtInheritTranslations, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ (XtPointer) 0, - }, + /* superclass */ (WidgetClass) & overrideShellClassRec, + /* class_name */ "Tip", + /* widget size */ (Cardinal) sizeof(TipRec), + /* class_init */ NULL, + /* class_part_init */ (XtWidgetClassProc) NULL, + /* class_inited */ (XtEnum) FALSE, + /* initialize */ (XtInitProc) initialize, + /* init_hook */ (XtArgsProc) NULL, + /* realize */ XtInheritRealize, + /* actions */ (XtActionList) 0, + /* num_actions */ (Cardinal) 0, + /* resources */ (XtResourceList) resources, + /* num_resources */ (Cardinal) XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposur */ (XtEnum) FALSE, + /* compress enterleave */ TRUE, + /* visibility_interest */ FALSE, + /* destroy */ destroy, + /* resize */ XtInheritResize, + /* expose, */ XtInheritExpose, + /* set_values */ (XtSetValuesFunc) set_values, + /* set_values_hook */ (XtArgsFunc) NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ (XtArgsProc) NULL, + /* accept_focus */ XtInheritAcceptFocus, + /* version */ XtVersion, + /* callback_private */ (XtPointer) NULL, + /* translations */ XtInheritTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ (XtPointer) 0, + }, /* composite part */ { - /* geometry_manager */ XtInheritGeometryManager, - /* change_managed */ XtInheritChangeManaged, - /* insert_child */ XtInheritInsertChild, - /* delete_child */ XtInheritDeleteChild, - /* extension */ NULL - }, + /* geometry_manager */ XtInheritGeometryManager, + /* change_managed */ XtInheritChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, /* Shell */ { - (XtPointer) NULL, - }, + (XtPointer) NULL, + }, /* Override Shell */ { - 0, - }, + 0, + }, /* tip */ { - 0, - } + 0, + } }; WidgetClass tipWidgetClass = (WidgetClass) & tipClassRec; @@ -372,7 +372,7 @@ static void timeout_event(XtPointer client_data, XtIntervalId *id) event before (for some reason, not all Enters are followed by Leaves). This is especially apparent when running xdvi from a remote display over a slow connection. - */ + */ Window root, child; int root_x, root_y; unsigned int keys_buttons; @@ -399,8 +399,8 @@ static void timeout_event(XtPointer client_data, XtIntervalId *id) * (NOT the widget, in case the widget is large!) */ ptr_y += 20; -/* abs_x += w_width / 2; */ -/* abs_y += w_height; */ + /* abs_x += w_width / 2; */ + /* abs_y += w_height; */ XmbTextExtents(tw->tip.fontset, obj->text, obj->size, &ink, &logical); @@ -460,12 +460,12 @@ static void enter(struct tip_context *obj, XEvent * xevent, /* it seems that this makes the tooltips somewhat unpredictable (they don't show when hovering fast over several buttons, then staying on one button); disabled this for the time being. */ -/* if ((event->time - tw->tip.HelpPopDownTime) > tw->tip.cwp) */ -/* current_waitPeriod = tw->tip.waitPeriod; */ -/* else */ -/* current_waitPeriod = 0; */ + /* if ((event->time - tw->tip.HelpPopDownTime) > tw->tip.cwp) */ + /* current_waitPeriod = tw->tip.waitPeriod; */ + /* else */ + /* current_waitPeriod = 0; */ -/* current_waitPeriod = tw->tip.waitPeriod; */ + /* current_waitPeriod = tw->tip.waitPeriod; */ current_waitPeriod = resource.tooltips_wait_period; if (current_waitPeriod >= 0) { tw->tip.tid = XtAppAddTimeOut(app, current_waitPeriod, timeout_event, diff --git a/Build/source/texk/xdvik/gui/depend.mk b/Build/source/texk/xdvik/gui/depend.mk index 2f62ce49923..29339a59251 100644 --- a/Build/source/texk/xdvik/gui/depend.mk +++ b/Build/source/texk/xdvik/gui/depend.mk @@ -1,528 +1,1286 @@ -help-window.o: help-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +Panner.o: Panner.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - message-window.h ../util.h \ - $(kpathsea_srcdir)/c-stat.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h ../string-utils.h ../my-vsnprintf.h \ - topic-window.h help-window.h -mag.o: mag.c \ - ../xdvi-config.h ../c-auto.h \ - ../c-openmx.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h +Tip.o: Tip.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ $(kpathsea_srcdir)/systypes.h \ - ../xdvi.h ../xdvi-debug.h ../version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + Tip.h \ + ../xdvi-debug.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h +help-window.o: help-window.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h \ - $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h ../dvi-draw.h ../dvi-init.h \ - statusline.h ../hypertex.h mag.h xm_toolbar.h xm_menu.h menu.h \ - xaw_menu.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../version.h \ + message-window.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - pagesel.h -menu.o: menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../x_util.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + topic-window.h \ + help-window.h +mag.o: mag.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../c-openmx.h \ + $(kpathsea_srcdir)/c-limits.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h menu.h xm_menu.h xaw_menu.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + ../dvi-draw.h \ + ../dvi-init.h \ + statusline.h \ + ../hypertex.h \ + mag.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ - $(kpathsea_srcdir)/tex-file.h -message-window.o: message-window.c \ - ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + pagesel.h +menu.o: menu.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../string-utils.h ../my-vsnprintf.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + menu.h \ + xm_menu.h \ + xaw_menu.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h message-window.h -pagesel.o: pagesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h +message-window.o: \ + message-window.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - xm_toolbar.h xm_menu.h menu.h ../events.h \ - xaw_menu.h ../x_util.h \ - message-window.h pagesel.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../string-utils.h ../my-vsnprintf.h \ - ../dvi-init.h statusline.h print-dialog.h ../search-internal.h \ - search-dialog.h ../dvisel.h ../print-internal.h ../pagehist.h -Panner.o: Panner.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + ../x_util.h \ + message-window.h +pagesel.o: pagesel.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../string-utils.h ../my-vsnprintf.h + $(kpathsea_srcdir)/c-fopen.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + ../events.h \ + xaw_menu.h \ + ../x_util.h \ + message-window.h \ + pagesel.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../dvi-init.h \ + statusline.h \ + print-dialog.h \ + ../print-internal.h \ + ../dvi-init.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../print-internal.h \ + ../pagehist.h print-dialog.o: print-dialog.c \ - ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ ../my-vsnprintf.h \ - print-dialog.h print-log.h ../print-internal.h ../dvi-init.h \ - ../events.h ../string-utils.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../x_util.h message-window.h pagesel.h \ - ../my-snprintf.h sfSelFile.h ../dvisel.h xlwradio.h statusline.h \ - search-dialog.h ../search-internal.h ../special.h + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + print-dialog.h \ + ../print-internal.h \ + ../dvi-init.h \ + print-log.h \ + ../events.h \ + ../dvi-init.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../x_util.h \ + message-window.h \ + pagesel.h \ + ../my-snprintf.h \ + sfSelFile.h \ + ../dvisel.h \ + ../print-internal.h \ + xlwradio.h \ + statusline.h \ + search-dialog.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../special.h print-log.o: print-log.c \ - ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - print-dialog.h print-log.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../xdvi-debug.h \ + print-dialog.h \ + ../print-internal.h \ + ../dvi-init.h \ + print-log.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h xlwradio.h -search-dialog.o: search-dialog.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../x_util.h \ + xlwradio.h +search-dialog.o: search-dialog.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h ../dvi-init.h search-dialog.h \ - ../search-internal.h ../dvisel.h ../print-internal.h print-dialog.h \ - xlwradio.h statusline.h ../string-utils.h ../my-vsnprintf.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + ../dvi-init.h \ + search-dialog.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../dvi-init.h \ + ../print-internal.h \ + xlwradio.h \ + statusline.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - message-window.h ../x_util.h -selection.o: selection.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string_list.h \ + ../util.h \ + message-window.h \ + ../x_util.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h +selection.o: selection.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../encodings.h message-window.h selection.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../encodings.h \ + message-window.h \ + selection.h \ statusline.h -sfDir.o: sfDir.c ../xdvi-config.h ../c-auto.h sfDir.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +sfDir.o: sfDir.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h sfDir.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-stat.h -sfDraw.o: sfDraw.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +sfDraw.o: sfDraw.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-stat.h \ - ../xdvi.h ../xdvi-debug.h ../version.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - sfDraw.h sfDir.h sfPath.h -sfPath.o: sfPath.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-fopen.h \ + sfDraw.h \ + sfDir.h \ + $(kpathsea_srcdir)/c-dir.h \ + sfPath.h +sfPath.o: sfPath.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-stat.h \ - ../xdvi.h ../xdvi-debug.h ../version.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - sfDir.h sfDraw.h sfPath.h sfSelFile.h -sfSelFile.o: sfSelFile.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-fopen.h \ + sfDir.h \ + $(kpathsea_srcdir)/c-dir.h \ + sfDraw.h \ + sfPath.h \ + sfSelFile.h +sfSelFile.o: sfSelFile.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../dvi-init.h message-window.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../dvi-init.h \ + message-window.h \ $(kpathsea_srcdir)/c-stat.h \ - sfDir.h sfPath.h sfDraw.h sfSelFile.h \ - ../util.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - ../events.h $(kpathsea_srcdir)/c-fopen.h -statusline.o: statusline.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/c-memstr.h \ - $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ - $(kpathsea_srcdir)/c-pathmx.h \ + sfDir.h \ + $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-dir.h \ - $(kpathsea_srcdir)/c-vararg.h \ - statusline.h xm_menu.h menu.h ../events.h \ - xaw_menu.h ../x_util.h ../pagehist.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + sfPath.h \ + sfDraw.h \ + sfSelFile.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../my-vsnprintf.h -Tip.o: Tip.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + xlwradio.h \ + ../x_util.h \ + $(kpathsea_srcdir)/c-fopen.h +statusline.o: statusline.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - Tip.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../version.h \ + statusline.h \ + xm_menu.h \ + menu.h \ + ../events.h \ + xaw_menu.h \ + ../x_util.h \ + ../pagehist.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h -topic-window.o: topic-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../my-vsnprintf.h \ + ../util.h +topic-window.o: topic-window.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - topic-window.h ../string-utils.h ../my-vsnprintf.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../version.h \ + topic-window.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h -xaw_bitmaps.o: xaw_bitmaps.c xaw_bitmaps.h -xaw_menu.o: xaw_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + ../x_util.h +xaw_bitmaps.o: xaw_bitmaps.c \ + xaw_bitmaps.h +xaw_menu.o: xaw_menu.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../c-openmx.h ../events.h ../dvi-draw.h \ - ../dvi-init.h statusline.h pagesel.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../c-openmx.h \ + ../events.h \ + ../dvi-draw.h \ + ../dvi-init.h \ + statusline.h \ + pagesel.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../x_util.h xaw_menu.h message-window.h \ - ../my-snprintf.h ../filehist.h -xicon.o: xicon.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../x_util.h \ + xaw_menu.h \ + menu.h \ + xm_menu.h \ + message-window.h \ + ../my-snprintf.h \ + ../filehist.h \ + xaw_bitmaps.h +xicon.o: xicon.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - xicon.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + xicon.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ ../events.h \ - ../xdvi.icon ../pixmaps/xdvi32x32.xpm ../pixmaps/xdvi16x16.xpm \ + ../xdvi-debug.h \ + ../xdvi.icon \ + ../pixmaps/xdvi32x32.xpm \ + ../pixmaps/xdvi16x16.xpm \ ../pixmaps/xdvi48x48.xpm -xlwradio.o: xlwradio.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +xlwradio.o: xlwradio.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../xdvi-debug.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h xaw_bitmaps.h xlwradioP.h \ - xlwradio.h -xm_colorsel.o: xm_colorsel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + xaw_bitmaps.h \ + xlwradioP.h \ + xlwradio.h +xm_colorsel.o: xm_colorsel.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ Tip.h \ - ../x_util.h xm_colorsel.h xm_prefsP.h \ - xm_prefs.h ../events.h ../dvi-draw.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + ../x_util.h \ + xm_colorsel.h \ + xm_prefsP.h \ + xm_prefs.h \ + ../events.h \ + ../dvi-draw.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - topic-window.h ../search-internal.h \ - search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h \ - print-dialog.h -xm_filesel.o: xm_filesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + topic-window.h \ + ../version.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../dvi-init.h \ + ../print-internal.h +xm_filesel.o: xm_filesel.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - sfSelFile.h ../dvi.h ../string-utils.h \ - ../my-vsnprintf.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + sfSelFile.h \ + ../dvi.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h message-window.h ../dvi-init.h -xm_menu.o: xm_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + ../events.h \ + message-window.h \ + ../dvi-init.h \ + ../x_util.h +xm_menu.o: xm_menu.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - xm_menu.h menu.h ../events.h xaw_menu.h \ - xm_toolbar.h ../my-snprintf.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + xm_menu.h \ + menu.h \ + ../events.h \ + xaw_menu.h \ + xm_toolbar.h \ + ../my-snprintf.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../x_util.h statusline.h ../pagehist.h \ - ../dvi-init.h ../filehist.h ../c-openmx.h message-window.h -xm_prefs_appearance.o: xm_prefs_appearance.c ../xdvi-config.h ../c-auto.h \ - ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../x_util.h \ + ../version.h \ + statusline.h \ + ../pagehist.h \ + ../dvi-init.h \ + ../filehist.h \ + ../c-openmx.h \ + message-window.h +xm_prefs.o: xm_prefs.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h ../my-snprintf.h xm_colorsel.h \ - topic-window.h message-window.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + message-window.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h xm_toolbar.h xm_menu.h menu.h \ - xaw_menu.h statusline.h pagesel.h xm_prefsP.h xm_prefs_appearance.h -xm_prefs.o: xm_prefs.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + xm_prefsP.h \ + xm_prefs.h \ + xm_prefs_appearance.h \ + xm_prefs_fonts.h \ + xm_prefs_helpers.h \ + xm_prefs_page.h \ + xm_prefs_scroll.h \ + ../dvi-draw.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../dvi-init.h \ + ../print-internal.h \ + statusline.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + pagesel.h +xm_prefs_appearance.o: \ + xm_prefs_appearance.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - message-window.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + ../my-snprintf.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + message-window.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h xm_prefsP.h xm_prefs.h \ - xm_prefs_appearance.h xm_prefs_fonts.h xm_prefs_helpers.h \ - xm_prefs_page.h xm_prefs_scroll.h ../dvi-draw.h ../search-internal.h \ - search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h \ - print-dialog.h statusline.h xm_toolbar.h xm_menu.h menu.h xaw_menu.h \ - pagesel.h -xm_prefs_fonts.o: xm_prefs_fonts.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + statusline.h \ + pagesel.h \ + xm_prefsP.h \ + xm_prefs_appearance.h +xm_prefs_fonts.o: \ + xm_prefs_fonts.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../hypertex.h ../my-snprintf.h \ - xm_prefsP.h xm_prefs_fonts.h -xm_prefs_helpers.o: xm_prefs_helpers.c ../xdvi-config.h ../c-auto.h \ - ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + ../hypertex.h \ + ../my-snprintf.h \ + xm_prefsP.h \ + xm_prefs_fonts.h +xm_prefs_helpers.o: \ + xm_prefs_helpers.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../string-utils.h \ - ../my-vsnprintf.h message-window.h xm_menu.h menu.h xaw_menu.h \ - xm_prefsP.h xm_prefs.h xm_prefs_helpers.h -xm_prefs_page.o: xm_prefs_page.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../string_list.h \ + message-window.h \ + ../events.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + xm_prefsP.h \ + xm_prefs.h \ + xm_prefs_helpers.h +xm_prefs_page.o: xm_prefs_page.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h statusline.h xm_prefsP.h \ - xm_prefs_page.h ../my-snprintf.h -xm_prefs_scroll.o: xm_prefs_scroll.c ../xdvi-config.h ../c-auto.h \ - ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + statusline.h \ + xm_prefsP.h \ + xm_prefs_page.h \ + ../my-snprintf.h +xm_prefs_scroll.o: \ + xm_prefs_scroll.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../dvi-init.h statusline.h \ - xm_prefsP.h xm_prefs_scroll.h ../my-snprintf.h -xm_toolbar.o: xm_toolbar.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + ../dvi-init.h \ + statusline.h \ + xm_prefsP.h \ + xm_prefs_scroll.h \ + ../my-snprintf.h +xm_toolbar.o: xm_toolbar.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - pagesel.h help-window.h message-window.h \ - $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/expand.h statusline.h \ - ../dvi-init.h ../events.h ../dvi-draw.h xm_menu.h menu.h xaw_menu.h \ - xm_toolbar.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + pagesel.h \ + help-window.h \ + message-window.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/expand.h \ + statusline.h \ + ../dvi-init.h \ + ../events.h \ + ../dvi-draw.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + xm_toolbar.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ - ../x_util.h Tip.h \ - ../c-openmx.h ../pixmaps/toolbar.xpm + $(kpathsea_srcdir)/tex-file.h \ + ../events.h \ + ../x_util.h \ + Tip.h \ + ../c-openmx.h \ + ../pixmaps/toolbar.xpm diff --git a/Build/source/texk/xdvik/gui/depend.mk.orig b/Build/source/texk/xdvik/gui/depend.mk.orig new file mode 100644 index 00000000000..7b968b7c351 --- /dev/null +++ b/Build/source/texk/xdvik/gui/depend.mk.orig @@ -0,0 +1,559 @@ +Panner.o: Panner.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h ../my-vsnprintf.h +Tip.o: Tip.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + Tip.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h +help-window.o: help-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + message-window.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../x_util.h ../string-utils.h \ + ../my-vsnprintf.h topic-window.h help-window.h +mag.o: mag.c \ + ../xdvi-config.h ../c-auto.h \ + ../c-openmx.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/systypes.h \ + ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h ../dvi-draw.h ../dvi-init.h statusline.h ../hypertex.h \ + mag.h xm_toolbar.h xm_menu.h menu.h xaw_menu.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + pagesel.h +menu.o: menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h menu.h xm_menu.h xaw_menu.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h +message-window.o: message-window.c \ + ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h ../my-vsnprintf.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../x_util.h message-window.h +pagesel.o: pagesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + xm_toolbar.h xm_menu.h menu.h ../events.h xaw_menu.h ../x_util.h \ + message-window.h pagesel.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../string-utils.h ../my-vsnprintf.h \ + ../dvi-init.h statusline.h print-dialog.h ../print-internal.h \ + ../search-internal.h search-dialog.h ../dvisel.h ../pagehist.h +print-dialog.o: print-dialog.c \ + ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../my-vsnprintf.h print-dialog.h \ + ../print-internal.h ../dvi-init.h print-log.h ../events.h \ + ../string-utils.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../x_util.h message-window.h pagesel.h \ + ../my-snprintf.h sfSelFile.h ../dvisel.h xlwradio.h statusline.h \ + search-dialog.h ../search-internal.h ../special.h +print-log.o: print-log.c \ + ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + print-dialog.h ../print-internal.h ../dvi-init.h print-log.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../string-utils.h \ + ../my-vsnprintf.h ../x_util.h xlwradio.h +search-dialog.o: search-dialog.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h ../dvi-init.h search-dialog.h ../search-internal.h \ + ../dvisel.h ../print-internal.h xlwradio.h statusline.h \ + ../string-utils.h ../my-vsnprintf.h ../string_list.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + message-window.h ../x_util.h xm_menu.h menu.h \ + xaw_menu.h +selection.o: selection.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../encodings.h message-window.h selection.h \ + statusline.h +sfDir.o: sfDir.c ../xdvi-config.h ../c-auto.h sfDir.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-stat.h +sfDraw.o: sfDraw.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-stat.h \ + ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + sfDraw.h \ + sfDir.h sfPath.h +sfPath.o: sfPath.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-stat.h \ + ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + sfDir.h \ + sfDraw.h sfPath.h sfSelFile.h +sfSelFile.o: sfSelFile.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../dvi-init.h message-window.h $(kpathsea_srcdir)/c-stat.h \ + sfDir.h sfPath.h \ + sfDraw.h sfSelFile.h ../util.h $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xlwradio.h ../x_util.h +statusline.o: statusline.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + statusline.h xm_menu.h menu.h ../events.h xaw_menu.h ../x_util.h \ + ../pagehist.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../my-vsnprintf.h +topic-window.o: topic-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + topic-window.h ../string-utils.h \ + ../my-vsnprintf.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../x_util.h +xaw_bitmaps.o: xaw_bitmaps.c xaw_bitmaps.h +xaw_menu.o: xaw_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../c-openmx.h ../events.h ../dvi-draw.h ../dvi-init.h statusline.h \ + pagesel.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../x_util.h xaw_menu.h menu.h xm_menu.h \ + message-window.h ../my-snprintf.h ../filehist.h +xicon.o: xicon.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + xicon.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h \ + ../xdvi.icon ../pixmaps/xdvi32x32.xpm ../pixmaps/xdvi16x16.xpm \ + ../pixmaps/xdvi48x48.xpm +xlwradio.o: xlwradio.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xaw_bitmaps.h xlwradioP.h \ + xlwradio.h +xm_colorsel.o: xm_colorsel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + Tip.h \ + ../x_util.h xm_colorsel.h xm_prefsP.h xm_prefs.h ../events.h \ + ../dvi-draw.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + topic-window.h ../search-internal.h \ + search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h +xm_filesel.o: xm_filesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + sfSelFile.h ../dvi.h ../string-utils.h ../my-vsnprintf.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h message-window.h ../dvi-init.h \ + ../x_util.h +xm_menu.o: xm_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + xm_menu.h \ + menu.h ../events.h xaw_menu.h xm_toolbar.h ../my-snprintf.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../x_util.h statusline.h ../pagehist.h \ + ../dvi-init.h ../filehist.h ../c-openmx.h message-window.h +xm_prefs.o: xm_prefs.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h message-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xm_prefsP.h xm_prefs.h \ + xm_prefs_appearance.h xm_prefs_fonts.h xm_prefs_helpers.h \ + xm_prefs_page.h xm_prefs_scroll.h ../dvi-draw.h ../search-internal.h \ + search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h \ + statusline.h xm_toolbar.h xm_menu.h menu.h xaw_menu.h pagesel.h +xm_prefs_appearance.o: xm_prefs_appearance.c ../xdvi-config.h ../c-auto.h \ + ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h ../my-snprintf.h xm_colorsel.h topic-window.h \ + message-window.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xm_toolbar.h xm_menu.h menu.h \ + xaw_menu.h statusline.h pagesel.h xm_prefsP.h xm_prefs_appearance.h +xm_prefs_fonts.o: xm_prefs_fonts.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../hypertex.h ../my-snprintf.h \ + xm_prefsP.h xm_prefs_fonts.h +xm_prefs_helpers.o: xm_prefs_helpers.c ../xdvi-config.h ../c-auto.h \ + ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../string-utils.h \ + ../my-vsnprintf.h ../string_list.h message-window.h xm_menu.h menu.h \ + xaw_menu.h xm_prefsP.h xm_prefs.h xm_prefs_helpers.h +xm_prefs_page.o: xm_prefs_page.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h statusline.h xm_prefsP.h \ + xm_prefs_page.h ../my-snprintf.h +xm_prefs_scroll.o: xm_prefs_scroll.c ../xdvi-config.h ../c-auto.h \ + ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../dvi-init.h statusline.h \ + xm_prefsP.h xm_prefs_scroll.h ../my-snprintf.h +xm_toolbar.o: xm_toolbar.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + pagesel.h \ + help-window.h message-window.h $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/expand.h statusline.h ../dvi-init.h ../events.h \ + ../dvi-draw.h xm_menu.h menu.h xaw_menu.h xm_toolbar.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + ../x_util.h Tip.h \ + ../c-openmx.h ../pixmaps/toolbar.xpm diff --git a/Build/source/texk/xdvik/gui/help-window.c b/Build/source/texk/xdvik/gui/help-window.c index 8f7e6612a0e..a69f2cfb393 100644 --- a/Build/source/texk/xdvik/gui/help-window.c +++ b/Build/source/texk/xdvik/gui/help-window.c @@ -89,8 +89,8 @@ create_help_text(Widget parent, const char *name, const char *value) XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; XtSetArg(args[n], XmNwordWrap, True); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; -/* XtSetArg(args[n], XmNtopWidget, top_widget); n++; */ -/* XtSetArg(args[n], XmNtopOffset, 10); n++; */ + /* XtSetArg(args[n], XmNtopWidget, top_widget); n++; */ + /* XtSetArg(args[n], XmNtopOffset, 10); n++; */ XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; @@ -356,19 +356,9 @@ initialize_items(struct topic_info *info) " Open a new xdvi window displaying the link\n", " at the cursor position if the link is a DVI file;\n", " else, try to launch an application to view the file.\n", - "B", -#if MOTIF - ", toolbar button 9\n", -#else - "\n", -#endif + "B\n", " Go back to the previous hyperlink in the history.\n", - "F", -#if MOTIF - ", toolbar button 10\n", -#else - "\n", -#endif + "F\n", " Go forward to the next hyperlink in the history.\n", "\n", "By default, the hyperlinks are displayed in the colors \n", @@ -385,7 +375,12 @@ initialize_items(struct topic_info *info) static const char *default_help_othercommands[] = { "Other Commands\tMiscellaneous other commands\n", - "Ctrl-f\n", + "Ctrl-f", +#if MOTIF + ", toolbar button 12\n", +#else + "\n", +#endif " Opens a dialog window to search for a text string\n", " in the DVI file.\n", "\n", @@ -504,15 +499,15 @@ initialize_items(struct topic_info *info) "\n", "Ctrl-+", #if MOTIF - ", toolbar button 7\n", + ", toolbar button 9\n", #else "\n", #endif " Makes the display of the page larger (zooms in).\n", "\n", - "Ctrl-+", + "Ctrl--", #if MOTIF - ", toolbar button 8\n", + ", toolbar button 10\n", #else "\n", #endif @@ -520,7 +515,7 @@ initialize_items(struct topic_info *info) "\n", "Alt-Ctrl-+", #if MOTIF - ", toolbar button 16\n", + ", toolbar button 17\n", #else "\n", #endif @@ -528,11 +523,11 @@ initialize_items(struct topic_info *info) "\n", "Alt-Ctrl--", #if MOTIF - ", toolbar button 17\n", + ", toolbar button 18\n", #else "\n", #endif - " Makes the fonts lighter (by substracting from the gamma\n", + " Makes the fonts lighter (by subtracting from the gamma\n", " value).\n", "\n", NULL @@ -560,7 +555,7 @@ initialize_items(struct topic_info *info) " Ctrl-n: toggle mark of current page, then move one page forward,\n", " Ctrl-u: move one page back, then toggle mark of that page.\n", #if MOTIF - "- Use one of the toobar buttons 12 to 15 to toggle the marks\n", + "- Use the toobar buttons 13 to 16 to toggle the marks\n", " of odd pages, toggle the marks of even pages, toggle the mark\n", " of the current page, or unmark all pages, respectively.\n", #endif @@ -579,11 +574,21 @@ initialize_items(struct topic_info *info) static const char *default_help_pagemotion[] = { "Page Motion\tMoving around in the document\n", "\n", - "[\n", + "[", +#if MOTIF + ", toolbar button 7\n", +#else + "\n", +#endif " Moves back one item in the page history. With a prefix\n", " argument n, move back n history items.\n" "\n", - "]\n", + "]", +#if MOTIF + ", toolbar button 8\n", +#else + "\n", +#endif " Moves forward one item in the page history. With a prefix\n", " argument n, move forward n history items.\n" "\n", @@ -597,7 +602,7 @@ initialize_items(struct topic_info *info) " to the history item after the deleted one. With a prefix\n", " argument n, delete n next history items.\n", "\n", - "n or f or Space or Return or LineFeed or PgDn", + "n or f or Return or LineFeed or PgDn", #if MOTIF ", toolbar button 5\n", #else @@ -606,7 +611,10 @@ initialize_items(struct topic_info *info) " Moves to the next page (or to the nth next page if a\n", " number is given).\n", "\n", - "p or b or Ctrl-h or BackSpace or Del or PgUp", + "Space key\n", + " Moves down or to the next page.", + "\n", + "p or b or Ctrl-h or BackSpace or PgUp", #if MOTIF ", toolbar button 4\n", #else @@ -614,6 +622,9 @@ initialize_items(struct topic_info *info) #endif " Moves to the previous page (or back n pages).\n", "\n", + "Del key\n", + " Moves up on the page or to the previous page.", + "\n", "Up-arrow\n", " Scrolls page up.\n", "\n", @@ -1039,7 +1050,7 @@ show_help(Widget toplevel, const char *topic) info.ok_callback = NULL; info.cancel_callback = NULL; info.items = items; -/* info.items_size = NUM_HELP_TOPICS; */ + /* info.items_size = NUM_HELP_TOPICS; */ help_shell = create_topic_window(toplevel, "xdvik: Help", diff --git a/Build/source/texk/xdvik/gui/mag.c b/Build/source/texk/xdvik/gui/mag.c index 1df6cd92cab..21526269c6d 100644 --- a/Build/source/texk/xdvik/gui/mag.c +++ b/Build/source/texk/xdvik/gui/mag.c @@ -83,6 +83,36 @@ static int mag_conv_y = 0; static Position new_mag_x = 0; static Position new_mag_y = 0; + +/* default magnifier dimensions */ +static struct mg_size_rec { + int w; + int h; +} mg_size[] = { + {200, 150}, {400, 250}, {700, 500}, {1000, 800}, {1200, 1200} +}; + +size_t get_magglass_items(void) { + return XtNumber(mg_size); +} + +int get_magglass_width(int idx) { + return mg_size[idx].w; +} + +int get_magglass_height(int idx) { + return mg_size[idx].h; +} + +void set_magglass_widht(int idx, int w) { + mg_size[idx].w = w; +} + +void set_magglass_height(int idx, int h) { + mg_size[idx].h = h; +} + + static void can_exposures(struct WindowRec *windowrec) { @@ -134,20 +164,20 @@ mag_release(XEvent * event) over a hyperlink). Forcing a redraw with - redraw(&mane); + redraw(&mane); may cause a `BadDrawable' X error with color material (e.g. from #702288), or a `draw_part: shouldn't happen: POST encountered' error. Neither do the following work: - globals.ev.flags |= EV_EXPOSE; (doesn't fix the bug) - draw_page(); (same effect as redraw(&mane)) - globals.ev.flags |= EV_NEWPAGE; (works, but is crude and causes flicker) + globals.ev.flags |= EV_EXPOSE; (doesn't fix the bug) + draw_page(); (same effect as redraw(&mane)) + globals.ev.flags |= EV_NEWPAGE; (works, but is crude and causes flicker) So I decided to use expose() for the time being, which sets mane.min_x to the current x point (which doesn't happen with EV_EXPOSE; this causes the test for `mane.min_x < MAXDIM' to fail in events.c; look for `see comment in mag.c'). */ -/* fprintf(stderr, "========triggering expose!\n"); */ + /* fprintf(stderr, "========triggering expose!\n"); */ expose(&mane, event->xbutton.x_root, event->xbutton.y_root, 10, 10); } } @@ -220,10 +250,8 @@ draw_ticks(unsigned int width, unsigned int height, GC ourGC) The user can select the units via a resource (e.g. XDvi*tickUnits: bp), or a command-line option (e.g. -xrm '*tickUnits: cm'). The length of the ticks can be controlled by a resource (e.g. XDvi*tickLength: 10), or - a command-line option (e.g. -xrm '*tickLength: 10000'). If the tick - length exceeds the popup window size, then a graph-paper grid is drawn - over the whole window. Zero, or negative, tick length completely - suppresses rulers. */ + a command-line option (e.g. -xrm '*tickLength: 10000'). Zero, or negative, + tick length completely suppresses rulers. */ pixels_per_tick = (double)resource.pixels_per_inch; if (strcmp(resource.tick_units, "pt") == 0) @@ -395,8 +423,8 @@ do_movemag(int x, int y) compute_mag_pos(&xx, &yy); XMoveWindow(DISP, magnifier.win, xx, yy); scroll_window(&magnifier, - (x + mane_base_x) * mane.shrinkfactor - (int)magnifier.width / 2, - (y + mane_base_y) * mane.shrinkfactor - (int)magnifier.height / 2); + (x + mane_base_x) * mane.shrinkfactor - (int)magnifier.width / 2, + (y + mane_base_y) * mane.shrinkfactor - (int)magnifier.height / 2); draw_ticks(magnifier.width, magnifier.height, globals.gc.ruler); } @@ -479,7 +507,7 @@ show_distance_from_ruler(XEvent *event, Boolean to_stdout) precision, 0.000, resource.tick_units)); } else { - statusline_print(STATUS_FOREVER, + statusline_info(STATUS_FOREVER, "Ruler/Point: %d,%d, dx: %.*f %s, dy: %.*f %s, dt: %.*f %s", loc_x, loc_y, precision, 0.000, resource.tick_units, @@ -502,7 +530,7 @@ show_distance_from_ruler(XEvent *event, Boolean to_stdout) precision, unit_z, resource.tick_units)); } else { - statusline_print(STATUS_FOREVER, + statusline_info(STATUS_FOREVER, "Ruler: %d,%d, Point: %d,%d, dx: %.*f %s, dy: %.*f %s, dr: %.*f %s", g_ruler_pos_x, g_ruler_pos_y, loc_x, loc_y, precision, unit_x, resource.tick_units, @@ -525,47 +553,6 @@ move_magnifier(void) do_movemag(new_mag_x, new_mag_y); } -static void -Act_href(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - int x, y; - Window dummy; - - UNUSED(w); - UNUSED(num_params); - UNUSED(params); - - if (resource.mouse_mode == MOUSE_RULER_MODE) - return; - - (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, - event->xkey.x, event->xkey.y, &x, &y, &dummy); - if (htex_handleref(x, y, False)) { - block_next_mouse_event(); - } -} - -static void -Act_href_newwindow(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - int x, y; - Window dummy; - - UNUSED(w); - UNUSED(num_params); - UNUSED(params); - - if (resource.mouse_mode == MOUSE_RULER_MODE) - return; - - (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, - event->xkey.x, event->xkey.y, &x, &y, &dummy); - if (htex_handleref(x, y, True)) { - block_next_mouse_event(); - } -} void clear_ruler(void) @@ -627,114 +614,15 @@ redraw_ruler(void) draw_ruler(g_ruler_pos_x, g_ruler_pos_y); } -void -drag_ruler_motion(XEvent *event) -{ - int loc_x, loc_y; - if (event == NULL) { /* toggled via menu */ - /* hack to avoid redrawing ruler at last g_* positions when mode is - toggled on via menu, then off via keystroke */ - g_ruler_pos_x = g_ruler_pos_y = 0; - return; - } - - loc_x = event->xbutton.x; - loc_y = event->xbutton.y; - - if (event->xbutton.window != mane.win) { - Window dummy; - (void)XTranslateCoordinates(DISP, - RootWindowOfScreen(SCRN), mane.win, - event->xbutton.x_root, - event->xbutton.y_root, - &loc_x, - &loc_y, - &dummy); - } - - /* map everything below 0 to the origin */ - if (loc_x < 0) - loc_x = 0; - if (loc_y < 0) - loc_y = 0; - - clear_ruler(); - draw_ruler(loc_x, loc_y); - g_ruler_pos_x = loc_x; - g_ruler_pos_y = loc_y; -} - -void -drag_ruler_release(XEvent *event) -{ - UNUSED(event); - mouse_motion = mouse_release = null_mouse; -} - -/**************************************************************************** - * Actions specific to the handling of the magnifier - */ - -static void -Act_magnifier(Widget w, XEvent *event, - String *params, Cardinal *num_params) +void magnifier_move(String params, XEvent *event) { - const char *p; int x, y; XSetWindowAttributes attr; #ifndef MOTIF Window throwaway; #endif - UNUSED(w); - - MYTRACE((stderr, "magnifier!\n")); - - if (block_this_mouse_event()) - return; - else if (dvi_file_changed()) { - globals.ev.flags |= EV_RELOAD; - return; - } - -#ifdef MOTIF - /* see xm_menu.c for an explanation of this */ - if (pulldown_menu_active(event->xany.serial)) { - return; - } -#endif - - if (bg_current == NULL) { - /* - HACK ALERT: we can arrive here after loading a new file via the file selector - for which not all fonts have been generated. In that case, dereferencing - bg_current would bomb. Try to recover by simply returning here. - */ - return; - } - - if (resource.mouse_mode == MOUSE_RULER_MODE && event->xbutton.button == 1) { - show_ruler(event); - XDefineCursor(DISP, CURSORWIN, globals.cursor.rule); - show_distance_from_ruler(event, False); - return; - } - else if (resource.mouse_mode == MOUSE_TEXT_MODE && event->xbutton.button == 1) { - text_selection_start(event); - text_motion(event); - return; - } + const char *p = params; - if (event->type != ButtonPress || mouse_release != null_mouse - || magnifier.win != (Window)0 || mane.shrinkfactor == 1 || *num_params != 1) { - XBell(DISP, 0); - if (mane.shrinkfactor == 1) { - statusline_print(STATUS_SHORT, - "No magnification available at shrink factor 1"); - } - return; - } - - p = *params; if (*p == '*') { int n = atoi(p + 1) - 1; @@ -763,9 +651,6 @@ Act_magnifier(Widget w, XEvent *event, 0, 0, &mag_conv_x, &mag_conv_y, &throwaway); #endif - globals.cursor.flags |= CURSOR_MAG; - globals.ev.flags |= EV_CURSOR; - mag_x = event->xbutton.x + mag_conv_x; mag_y = event->xbutton.y + mag_conv_y; main_x = event->xbutton.x_root - mag_x; @@ -806,46 +691,64 @@ Act_magnifier(Widget w, XEvent *event, if (!resource.delay_rulers) draw_ticks(magnifier.width, magnifier.height, globals.gc.ruler); + globals.cursor.flags |= CURSOR_MAG; + globals.ev.flags |= EV_CURSOR; + magnifier_stat = 1; /* waiting for exposure */ mouse_motion = mag_motion; mouse_release = mag_release; } -static void -Act_switch_magnifier_units(Widget w, XEvent *event, - String *params, Cardinal *num_params) +void +drag_ruler_motion(XEvent *event) { - size_t k = 0; - static char *TeX_units[] = { - "mm", "pt", "in", "sp", "bp", "cc", "dd", "pc", "px", - }; - - UNUSED(w); - UNUSED(event); - UNUSED(params); - UNUSED(num_params); - - for (k = 0; k < XtNumber(TeX_units); ++k) - if (strcmp(resource.tick_units, TeX_units[k]) == 0) - break; - k++; - if (k >= XtNumber(TeX_units)) - k = 0; - resource.tick_units = TeX_units[k]; - if (resource.mouse_mode != MOUSE_RULER_MODE) { - statusline_print(STATUS_SHORT, "Ruler units: %s\n", resource.tick_units); + int loc_x, loc_y; + if (event == NULL) { /* toggled via menu */ + /* hack to avoid redrawing ruler at last g_* positions when mode is + toggled on via menu, then off via keystroke */ + g_ruler_pos_x = g_ruler_pos_y = 0; + return; } - else { - show_distance_from_ruler(event, False); + + loc_x = event->xbutton.x; + loc_y = event->xbutton.y; + + if (event->xbutton.window != mane.win) { + Window dummy; + (void)XTranslateCoordinates(DISP, + RootWindowOfScreen(SCRN), mane.win, + event->xbutton.x_root, + event->xbutton.y_root, + &loc_x, + &loc_y, + &dummy); } + + /* map everything below 0 to the origin */ + if (loc_x < 0) + loc_x = 0; + if (loc_y < 0) + loc_y = 0; + + clear_ruler(); + draw_ruler(loc_x, loc_y); + g_ruler_pos_x = loc_x; + g_ruler_pos_y = loc_y; } -XtActionsRec mag_actions[] = { - {"magnifier", Act_magnifier}, - {"do-href", Act_href}, - {"do-href-newwindow", Act_href_newwindow}, - {"switch-magnifier-units", Act_switch_magnifier_units}, -}; +void +drag_ruler_release(XEvent *event) +{ + UNUSED(event); + mouse_motion = mouse_release = null_mouse; +} + +/* XtActionsRec mag_actions[] = { */ +/* {"magnifier", Act_magnifier}, */ +/* {"do-href", Act_href}, */ +/* {"do-href-newwindow", Act_href_newwindow}, */ +/* {"switch-magnifier-units", Act_switch_magnifier_units}, */ +/* }; */ /* * This isn't creating the actual magnifier. It is created lazily on demand @@ -854,8 +757,8 @@ XtActionsRec mag_actions[] = { * application. */ -void -create_magnifier(void) -{ - XtAppAddActions(app, mag_actions, XtNumber(mag_actions)); -} +/* void */ +/* create_magnifier(void) */ +/* { */ +/* XtAppAddActions(globals.app, mag_actions, XtNumber(mag_actions)); */ +/* } */ diff --git a/Build/source/texk/xdvik/gui/mag.h b/Build/source/texk/xdvik/gui/mag.h index 608019f3ac2..f09ea35f9c6 100644 --- a/Build/source/texk/xdvik/gui/mag.h +++ b/Build/source/texk/xdvik/gui/mag.h @@ -29,6 +29,13 @@ #define MAGBORD 1 /* border size for magnifier */ + +extern size_t get_magglass_items(void); +extern int get_magglass_width(int idx); +extern int get_magglass_height(int idx); +extern void set_magglass_widht(int idx, int w); +extern void set_magglass_height(int idx, int h); + extern void show_distance_from_ruler(XEvent *event, Boolean to_stdout); extern void drag_ruler_motion(XEvent *event); extern void drag_ruler_release(XEvent *event); @@ -37,6 +44,7 @@ extern void show_ruler(XEvent *event); extern void redraw_ruler(void); extern void ruler_snap_origin(XEvent *event); +extern void magnifier_move(String params, XEvent *event); extern void mag_release(XEvent * event); extern void move_magnifier(void); extern void create_magnifier(void); diff --git a/Build/source/texk/xdvik/gui/menu.c b/Build/source/texk/xdvik/gui/menu.c index 575ef162f9b..b78210d7658 100644 --- a/Build/source/texk/xdvik/gui/menu.c +++ b/Build/source/texk/xdvik/gui/menu.c @@ -31,8 +31,6 @@ #include "menu.h" #include "util.h" -#if defined(NEW_MENU_CREATION) || defined(MOTIF) - #ifdef MOTIF # include <Xm/RowColumn.h> # include <Xm/ToggleB.h> @@ -74,24 +72,18 @@ set_menu_info(void *val, XtActionProc proc, Boolean (*cmp)(), struct button_info && item->elems[i].action->proc != NULL && item->elems[i].action->proc == proc && item->elems[i].action->param != NULL) { - Boolean on; + Boolean state; ASSERT(cmp != NULL, "comparison function musn't be NULL!"); - on = cmp(val, item->elems[i].action->param); + state = cmp(val, item->elems[i].action->param); #ifdef MOTIF ASSERT(item->elems[i].widget != 0, "Widget musn't be NULL!"); - XmToggleButtonSetState(item->elems[i].widget, on, False); -#else -#ifdef NEW_MENU_CREATION - ASSERT(item->elems[i].widget != 0, "Widget musn't be NULL!"); - xaw_set_button_state(item->elems + i, on); + XmToggleButtonSetState(item->elems[i].widget, state, False); #else - static Arg args = { XtNleftBitmap, (XtArgVal) 0 }; - if (on) - args.value = (XtArgVal) menu_check_bitmap; - else - args.value = (XtArgVal) menu_uncheck_bitmap; - XtSetValues(item->elems[i].widget, &args, 1); -#endif /* NEW_MENU_CREATION */ + if (item->elems[i].widget == 0) { + XDVI_WARNING((stderr, "Widget for menu `%s' is null!", item->elems[i].title)); + continue; + } + xaw_set_button_state(item->elems + i, state); #endif } if (item->elems[i].submenu != NULL) { /* invoke it recursively */ @@ -105,7 +97,7 @@ set_menu_info(void *val, XtActionProc proc, Boolean (*cmp)(), struct button_info void set_menu(void *val, XtActionProc proc, Boolean (*cmp)()) { - /* non-standard cast function ptr -> void ptr */ + /* removed following since cast from function pointer to void pointer is not supported by ANSI C */ /* TRACE_GUI((stderr, "set_menu_info: %d, %p, %p", *(int *)val, (void *)proc, (void *)cmp)); */ set_menu_info(val, proc, cmp, m_button_info); } @@ -124,14 +116,18 @@ initialize_menus(void) #endif set_menu(&use_gs, Act_set_ps, check_int); +#ifdef PS_GS set_menu(&resource.gs_alpha, Act_set_gs_alpha, check_toggle); +#endif set_menu(&resource.keep_flag, Act_set_keep_flag, check_toggle); shrinkval = resource.pixels_per_inch / mane.shrinkfactor; set_menu(&shrinkval, Act_shrink_to_dpi, check_int); set_menu(&mane.shrinkfactor, Act_set_shrink_factor, check_int); set_menu(&resource.use_tex_pages, Act_use_tex_pages, check_toggle); +#if 0 set_menu((char *)resource.paper, Act_set_paper_landscape, check_paper_landscape); set_menu((char *)resource.paper, Act_set_papersize, check_papersize); +#endif /* 0 */ set_menu(&resource.mouse_mode, Act_switch_mode, check_int); set_menu(&resource.expert_mode, Act_set_expert_mode, check_resource_expert); } @@ -162,7 +158,6 @@ add_info(struct button_info **info, buttonTypeT bt_type, char mnemonic, const char *title, const char *accelerator, struct xdvi_action *action) { -/* fprintf(stderr, "creating new item for info %p: |%s|\n", *info, title); */ size_t idx = (*info)->size++; (*info)->elems = xrealloc((*info)->elems, (*info)->size * sizeof *((*info)->elems)); (*info)->elems[idx].title = xstrdup(title); @@ -191,8 +186,6 @@ insert_items(struct button_info **info, char **items, size_t num_items, Boolean found = False; Boolean have_error = False; -/* fprintf(stderr, "------ insert_items called for |%s|, %p, |%s|\n", *items, *info, action); */ - if (*items == NULL) { /* should be a separator, which is treated as a special case since there's no menu title: */ @@ -207,7 +200,7 @@ insert_items(struct button_info **info, char **items, size_t num_items, entry_items = split_line(items[0], ENTRY_SEP, 0, entry_len, &entry_count); if (entry_count < 2) { - XDVI_WARNING((stderr, "Missing Mnemonic in button info `%s'\n", items[0])); + XDVI_WARNING((stderr, "Missing Mnemonic in button info `%s'", items[0])); entry_count++; entry_items = xrealloc(entry_items, entry_count * sizeof *entry_items); entry_items[1] = xstrdup(""); @@ -229,8 +222,6 @@ insert_items(struct button_info **info, char **items, size_t num_items, /* if it's a `leaf' in the menu hierarchy, compile the action and set the button type */ if (num_items == 1) { -/* fprintf(stderr, "button_type: |%s|\n", button_type); */ - char *fmt = strchr(entry_items[0], '$'); if (fmt != NULL && (fmt == entry_items[0] || (fmt > entry_items[0] && *(fmt - 1) != '\\')) @@ -261,7 +252,6 @@ insert_items(struct button_info **info, char **items, size_t num_items, free_items(entry_items, entry_count); if (num_items > 1 || (num_items == 1 && strcmp(button_type, "SEP") == 0)) { /* not a leaf, invoke recursivly for next level */ -/* fprintf(stderr, "invoking recursively for %d, %p\n", idx, (*info)->elems[idx].submenu); */ if ((*info)->elems[idx].submenu == NULL) { /* submenu didn't exist yet, create it */ struct button_info *new_submenu = xmalloc(sizeof *new_submenu); new_submenu->elems = NULL; @@ -309,8 +299,8 @@ parse_button_translations(struct button_info **info) size_t line_count = 0; char **line_items; line_items = split_line(curr_p, LINE_SEP, 0, line_len, &line_count); -/* fprintf(stderr, "length of line: %d; %d items\n", line_len, line_count); */ -/* show_items("LINE", line_items, line_count); */ + /* fprintf(stderr, "length of line: %d; %d items\n", line_len, line_count); */ + /* show_items("LINE", line_items, line_count); */ if (line_count != 4) { /* error */ XDVI_WARNING((stderr, "Wrong number of items (%lu) in translations line:\n\"%.*s\" " "(skipping this line).\n", @@ -323,14 +313,14 @@ parse_button_translations(struct button_info **info) size_t menu_count = 0; char **menu_items; if (menu_len == 0) { /* error */ - XDVI_WARNING((stderr, "Menu description (1st item) mustn't be empty:\n\"%.*s\" " + XDVI_WARNING((stderr, "Menu description (first item) mustn't be empty:\n\"%.*s\" " "(skipping this line).\n", (int)line_len, curr_p)); free_items(line_items, line_count); continue; } menu_items = split_line(line_items[0], MENU_SEP, 0, menu_len, &menu_count); -/* show_items(" MENU", menu_items, menu_count); */ + /* show_items(" MENU", menu_items, menu_count); */ insert_items(info, menu_items, menu_count, line_items[1], line_items[2], line_items[3]); free_items(menu_items, menu_count); @@ -343,7 +333,7 @@ parse_button_translations(struct button_info **info) /* Top-level routine: creates the pulldown menu buttons for Motif and Xaw. - For Motif, sets *globals.widgets.menu_bar to the address of the new widget created, + For Motif, sets `*menu_bar' to the address of the new widget created, for Xaw, sets *width to the width of the button panel created. */ void @@ -357,12 +347,10 @@ create_menu_buttons(Widget parent, { #ifdef MOTIF Widget menu = 0; + size_t i; #else /* MOTIF */ Widget panel = 0; - Boolean first_time = True; - int menu_depth = 0; #endif - size_t i; m_button_info = xmalloc(sizeof *m_button_info); m_button_info->elems = NULL; @@ -371,7 +359,7 @@ create_menu_buttons(Widget parent, #ifdef MOTIF *menu_bar = XmCreateMenuBar(parent, "menuBar", NULL, 0); parse_button_translations(&m_button_info); -/* menu = xm_create_menu(*menu_bar, m_button_info); */ + for (i = 0; i < m_button_info->size; i++) { menu = xm_create_menu(*menu_bar, m_button_info->elems[i].title, @@ -382,14 +370,11 @@ create_menu_buttons(Widget parent, XtVaSetValues(*menu_bar, XmNmenuHelpWidget, menu, NULL); } #else /* MOTIF */ - if (first_time) { - first_time = False; - xaw_initialize_menu_bitmaps(); - panel = xaw_create_menu_widgets(parent); - parse_button_translations(&m_button_info); - } - xaw_create_menu(m_button_info, panel, menu_depth, width); + xaw_initialize_menu_bitmaps(); + panel = xaw_create_menu_widgets(parent); + parse_button_translations(&m_button_info); + xaw_create_menu(m_button_info, panel, width); #endif /* MOTIF */ initialize_menus(); } -#endif /* NEW_MENU_CREATION || MOTIF */ + diff --git a/Build/source/texk/xdvik/gui/message-window.c b/Build/source/texk/xdvik/gui/message-window.c index 55e148daa1b..832bc80dbc7 100644 --- a/Build/source/texk/xdvik/gui/message-window.c +++ b/Build/source/texk/xdvik/gui/message-window.c @@ -1,25 +1,25 @@ /*------------------------------------------------------------ -message-window.c: message popups for xdvi. + message-window.c: message popups for xdvi. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------*/ + ------------------------------------------------------------*/ @@ -30,22 +30,22 @@ Suggested Policy for using the GUI messages: ============================================ - Use the statusline for shorter messages, a message window for more - important messages or such where you'd like to give further help info - (see the `helptext' argument of popup_message()). When in doubt, - prefer the statusline (excessive use of popup windows is a nuisance - for the user). +important messages or such where you'd like to give further help info +(see the `helptext' argument of popup_message()). When in doubt, +prefer the statusline (excessive use of popup windows is a nuisance +for the user). - Don't use any of the GUI messages to report internal workings of - the program; for important internal information, there should be a - debugging setting to print it to stderr. Use the GUI messages - only in situations such as the following: +the program; for important internal information, there should be a +debugging setting to print it to stderr. Use the GUI messages +only in situations such as the following: - - to give the user feedback on actions that (s)he initiated +- to give the user feedback on actions that (s)he initiated - - to indicate that an internal action causes a delay perceptible - by the user (as a rough guide: a delay of more than half a second) +- to indicate that an internal action causes a delay perceptible +by the user (as a rough guide: a delay of more than half a second) - - to report situations that might require new actions by the user. +- to report situations that might require new actions by the user. */ @@ -55,7 +55,7 @@ Suggested Policy for using the GUI messages: #include "xdvi.h" #include "string-utils.h" -/* Xaw specific stuff */ + /* Xaw specific stuff */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #ifdef MOTIF @@ -85,19 +85,19 @@ Suggested Policy for using the GUI messages: #include "x_util.h" #include "message-window.h" -/* have no more than MAX_POPUPS open simultaneously */ + /* have no more than MAX_POPUPS open simultaneously */ #define MAX_POPUPS 10 -/* offset for cascading popups */ + /* offset for cascading popups */ #define POPUP_OFFSET ((my_popup_num * 20)) #ifdef MOTIF -/* wrap messages after MSG_WRAP_LEN characters at whitespace */ + /* wrap messages after MSG_WRAP_LEN characters at whitespace */ #define MSG_WRAP_LEN 60 #endif -/* array of active popups: */ -static int g_popup_array[MAX_POPUPS]; + /* array of active popups: */ + static int g_popup_array[MAX_POPUPS]; static Atom WM_DELETE_WINDOW; @@ -123,27 +123,27 @@ static struct message_map { #ifdef MOTIF , XmDIALOG_QUESTION #endif - }, /* MSG_QUESTION */ + }, { "Xdvi Help" #ifdef MOTIF , XmDIALOG_INFORMATION #endif - }, /* MSG_HELP */ + }, { "Xdvi Info" #ifdef MOTIF , XmDIALOG_INFORMATION #endif - }, /* MSG_INFO */ + }, { "Xdvi Warning" #ifdef MOTIF , XmDIALOG_WARNING #endif - }, /* MSG_WARN */ + }, { "Xdvi Error" #ifdef MOTIF , XmDIALOG_ERROR #endif - }, /* MSG_ERR */ + }, }; struct ok_or_cancel_cb { @@ -304,7 +304,7 @@ help_action(Widget w, XtPointer client_data, XtPointer call_data) /* * Callback for cancel button in choice_dialog. -*/ + */ static void cancel_action(Widget w, XtPointer client_data, XtPointer call_data) { @@ -487,13 +487,13 @@ create_dialogs(popupMessageSizeHintT size, /* We also need to override the default ESC binding to use our internal housekeeping functions */ translations_str = get_string_va("#override\n<Key>osfCancel:close-popup-cancel(%d)", cnt); -/* { */ -/* XtTranslations xlats; */ -/* char *translation_str = get_string_va("<Key>osfCancel:close-popup-cancel(%d)", cnt); */ -/* xlats = XtParseTranslationTable(translation_str); */ -/* free(translation_str); */ -/* XtOverrideTranslations(new_dialog, xlats); */ -/* } */ + /* { */ + /* XtTranslations xlats; */ + /* char *translation_str = get_string_va("<Key>osfCancel:close-popup-cancel(%d)", cnt); */ + /* xlats = XtParseTranslationTable(translation_str); */ + /* free(translation_str); */ + /* XtOverrideTranslations(new_dialog, xlats); */ + /* } */ new_dialog = XtVaCreateWidget(Xdvi_MESSAGE_DIALOG_NAME, xmMessageBoxWidgetClass, new_popup_window, XmNdialogType, XmDIALOG_WARNING, /* default */ @@ -568,8 +568,8 @@ create_dialogs(popupMessageSizeHintT size, NULL); new_message_text = XtVaCreateManagedWidget("message_text", asciiTextWidgetClass, new_message_paned, -/* XtNheight, 100, */ -/* XtNwidth, 400, */ + /* XtNheight, 100, */ + /* XtNwidth, 400, */ XtNwidth, msg_w, XtNheight, msg_h, /* wrap horizontally instead of scrolling @@ -647,21 +647,8 @@ create_dialogs(popupMessageSizeHintT size, ASSERT(0, "third button not yet implemented in Xaw!!!"); } + adjust_width_to_max(new_message_ok, new_message_help, new_message_not_ok, NULL); - { /* set all buttons to same size */ - Dimension w1, w2, w3, max; - XtVaGetValues(new_message_ok, XtNwidth, &w1, NULL); - XtVaGetValues(new_message_help, XtNwidth, &w2, NULL); - XtVaGetValues(new_message_not_ok, XtNwidth, &w3, NULL); - max = w1; - if (w2 > max) - max = w2; - if (w3 > max) - max = w3; - XtVaSetValues(new_message_ok, XtNwidth, max, NULL); - XtVaSetValues(new_message_help, XtNwidth, max, NULL); - XtVaSetValues(new_message_not_ok, XtNwidth, max, NULL); - } /* if helptext argument is not-NULL, add help_action callback, else unmanage help button */ if (helptext != NULL) { @@ -744,8 +731,9 @@ internal_popup_window(Widget parent, } if (my_popup_num == MAX_POPUPS) { /* already enough popups on screen, just dump it to stderr */ - fprintf(stderr, "%s:\n", win_title); + fprintf(stderr, "%s: ", win_title); fprintf(stderr, msg_buf); + fputc('\n', stderr); /* Note: If a mad function continues to open popups, this will * stop after MAX_POPUPS, but open a new window for each * window the user pops down. Maybe we ought to do something @@ -789,7 +777,7 @@ internal_popup_window(Widget parent, before_ptr = after_ptr = testwrap; /* try to find shortest sequence before or after point to wrap at; this seems to give the most pleasing results. - */ + */ while (before_ptr > msg_buf && !isspace((int)*--before_ptr)) { before_len++; } @@ -829,7 +817,7 @@ internal_popup_window(Widget parent, } XtPopup(XtParent(dialog[my_popup_num]), XtGrabNone); -/* XtPopup(XtParent(dialog[my_popup_num]), XtGrabExclusive); */ + /* XtPopup(XtParent(dialog[my_popup_num]), XtGrabExclusive); */ #else /* MOTIF */ @@ -877,7 +865,7 @@ internal_popup_window(Widget parent, } XtPopup(popup_window[my_popup_num], XtGrabNone); -/* XtPopup(XtParent(popup_window[my_popup_num]), XtGrabExclusive); */ + /* XtPopup(XtParent(popup_window[my_popup_num]), XtGrabExclusive); */ if (XtIsManaged(message_not_ok[my_popup_num]) && XtIsManaged(message_help[my_popup_num])) { /* center the help button. This is something of a sham, since it won't survive resizing; but in general most users won't resize dialogs ;-) */ diff --git a/Build/source/texk/xdvik/gui/message-window.h b/Build/source/texk/xdvik/gui/message-window.h index 7e38197abbc..98d5815677f 100644 --- a/Build/source/texk/xdvik/gui/message-window.h +++ b/Build/source/texk/xdvik/gui/message-window.h @@ -111,24 +111,4 @@ extern Boolean raise_message_windows(void); extern Boolean is_message_window(Widget w); extern Boolean kill_message_window(Widget w); -/* XawtextScrollWhenNeeded has been ditched in Xaw7 - (e.g. Xfree >= 4.x); from the man page: - - The value XawtextScrollWhenNeeded (and whenNeeded, recognized by - the converter), is accepted for backwards compatibilty with - resource specifications written for the Xaw6 Text widget, but - ignored (effectively treated as XawtextScrollNever). - - So we're forced to use `scrollAlways' here. -*/ -#define XAW_SCROLL_ALWAYS XawtextScrollAlways - -/* the reconfig stuff has been fixed - in XFree 4.1.0, vendor release 6510 (Slackware 8.0) */ -#define BROKEN_RECONFIG (( \ - (strstr(ServerVendor(DISP), "XFree") != NULL) \ - && VendorRelease(DISP) >= 4000 \ - && VendorRelease(DISP) < 4002 \ - )) - #endif /* MESSAGE_WINDOW_H_ */ diff --git a/Build/source/texk/xdvik/gui/pagesel.c b/Build/source/texk/xdvik/gui/pagesel.c index b3db730e481..3d14e3a8426 100644 --- a/Build/source/texk/xdvik/gui/pagesel.c +++ b/Build/source/texk/xdvik/gui/pagesel.c @@ -47,22 +47,22 @@ /* BUGS: - - with Xaw, the highlighting for the selected page (XawListHighlight) - vanishes when mouse is dragged outside the widget and then released - (but the respective page is selected, which is IMHO the desired behaviour). + - with Xaw, the highlighting for the selected page (XawListHighlight) + vanishes when mouse is dragged outside the widget and then released + (but the respective page is selected, which is IMHO the desired behaviour). - - with Xaw, scrolling the list with PgUp/PgDown until the current page - gets `out of focus' should un-highlight the current page number + - with Xaw, scrolling the list with PgUp/PgDown until the current page + gets `out of focus' should un-highlight the current page number - - The ASCII-based marks are *ugly*. Pixmaps (for the marked state) - would be better. The viewer gv has one (but it's Xaw only). Some - file directory widgets like - e.g. http://ftp.xfree86.org/pub/X.Org/contrib/widgets/ListTree-3.0b3.tar.gz - also have facilities for that, but most suffer from other - inadequacies (e.g. no such ting as browseSelection) and all kinds - of bitrot ... Another alternative would be using XmContainer - (see e.g. the `filemanager' example in demos/programs/filemanagers - in the openmotif distribution), but that's available for Motif >= 2.1 only. + - The ASCII-based marks are *ugly*. Pixmaps (for the marked state) + would be better. The viewer gv has one (but it's Xaw only). Some + file directory widgets like + e.g. http://ftp.xfree86.org/pub/X.Org/contrib/widgets/ListTree-3.0b3.tar.gz + also have facilities for that, but most suffer from other + inadequacies (e.g. no such ting as browseSelection) and all kinds + of bitrot ... Another alternative would be using XmContainer + (see e.g. the `filemanager' example in demos/programs/filemanagers + in the openmotif distribution), but that's available for Motif >= 2.1 only. */ @@ -142,11 +142,11 @@ static XtActionsRec CustomListActions[] = { { "ListDragMark", xm_list_drag_mark }, }; static char *motif_custom_translations = - "#override \n" - "s <Btn2Down>: ListDragMark(ListButtonMotion)\n" - "<Btn2Motion>: ListSetMark(ListButtonMotion)\n" - "<Btn2Up>: ListSetMark(ListButtonMotion)\n" - "<Btn2Down>: ListSetMark(ListButtonMotion)\n" +"#override \n" +"s <Btn2Down>: ListDragMark(ListButtonMotion)\n" +"<Btn2Motion>: ListSetMark(ListButtonMotion)\n" +"<Btn2Up>: ListSetMark(ListButtonMotion)\n" +"<Btn2Down>: ListSetMark(ListButtonMotion)\n" /* /\* "s ~m ~a <Btn2Down>: ListMyProcessBtn2(ListBeginExtend)\n" *\/ */ /* /\* "s ~m ~a <Btn2Up>: ListMyProcessBtn2(ListEndExtend)\n" *\/ */ /* /\* "~c ~s ~m ~a <Btn2Down>: ListMyProcessBtn2(ListBeginSelect)\n" *\/ */ @@ -181,12 +181,12 @@ static int xaw_maybe_scroll_pagelist(int new_page, Boolean force_recenter, int o self-made page highlighting marker: - the marker overlaps with the ordinary XawListHighlight marker; - when un-highlighting a page, 1 pixel (vertically) at the edge of - the ordinary marker is overdrawn. + when un-highlighting a page, 1 pixel (vertically) at the edge of + the ordinary marker is overdrawn. - When the XawListHighlight crosses the self-drawn rectangle, - the vertical bars remain visible, but the horizontal bars - are erased. + the vertical bars remain visible, but the horizontal bars + are erased. The hack just redraws the appropriate items whenever one of the above can happen, i.e. when the two markers are 2 or less @@ -223,8 +223,8 @@ xaw_maybe_redraw_current_marker(int idx) Position x, y; Dimension w, h; -/* fprintf(stderr, "idx: %d, high: %d; diff: %d\n", idx + MOTIF_IDX_OFFSET, g_current_highlighted, */ -/* abs(idx + MOTIF_IDX_OFFSET - g_current_highlighted)); */ + /* fprintf(stderr, "idx: %d, high: %d; diff: %d\n", idx + MOTIF_IDX_OFFSET, g_current_highlighted, */ + /* abs(idx + MOTIF_IDX_OFFSET - g_current_highlighted)); */ if (abs((idx + MOTIF_IDX_OFFSET) - g_current_highlighted) <= 2 && my_list_pos_to_bounds(LIST_WIDGET, g_current_highlighted, &x, &y, &w, &h)) { refresh_highlight_marker(LIST_WIDGET, m_page_gc.fore, x, y, w, h); @@ -260,7 +260,7 @@ long pageinfo_get_offset(int page) { ASSERT(page >= 0 && page < (int)page_info.index_size, "Page number out of range"); -/* fprintf(stderr, "offset for page %d is %ld\n", page, page_info.index[page].offset); */ + /* fprintf(stderr, "offset for page %d is %ld\n", page, page_info.index[page].offset); */ return page_info.index[page].offset; } @@ -416,11 +416,7 @@ toggle_pagelist(void) NULL); } -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.expert_mode, Act_set_expert_mode, check_resource_expert); -#else - set_show_pagelist_option(); -#endif } #endif @@ -490,14 +486,14 @@ get_page_size(void) max_page /= 10, max_pageno_len++); return MAX(min_pageno_len, max_pageno_len); - /* Plus 1 for minus symbol */ + /* Plus 1 for minus symbol */ } #if !defined(LESSTIF_VERSION) /* draw or erase highlight marker at position x, y with widht w an height h, using suitable offsets (for sake of consistency of the latter, and because of the differences Xaw/Motif, this is a separate function). - */ +*/ static void refresh_highlight_marker(Widget widget, GC gc, Position x, Position y, Dimension w, Dimension h) @@ -618,12 +614,12 @@ xaw_drag_page_callback(Widget widget, XtPointer data, XEvent *event, Boolean *co actual_idx = xaw_maybe_scroll_pagelist(idx, False, actual_idx); XawListHighlight(LIST_WIDGET, idx - MOTIF_IDX_OFFSET); -/* if (event->xany.type == ButtonRelease) { */ -/* fprintf(stderr, "1\n"); */ -/* page_history_insert(idx - MOTIF_IDX_OFFSET); */ -/* goto_page(idx - MOTIF_IDX_OFFSET, resource.keep_flag ? NULL : home); */ -/* search_signal_page_changed(); */ -/* } */ + /* if (event->xany.type == ButtonRelease) { */ + /* fprintf(stderr, "1\n"); */ + /* page_history_insert(idx - MOTIF_IDX_OFFSET); */ + /* goto_page(idx - MOTIF_IDX_OFFSET, resource.keep_flag ? NULL : home); */ + /* search_signal_page_changed(); */ + /* } */ } static void @@ -698,7 +694,7 @@ my_list_pos_to_bounds(Widget widget, int idx, Position *x, Position *y, Dimensio /* it seems that in order to support scrolling of the page list with wheel mice, we need to program this explicitly. - */ +*/ static void wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean *cont) { @@ -733,7 +729,7 @@ wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean if (button == 5) { if (current_page >= total_pages - 1) { XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Last page of DVI file"); +/* statusline_info(STATUS_SHORT, "Last page of DVI file"); */ return; } pageno++; @@ -741,22 +737,23 @@ wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean else { if (current_page == 0) { XBell(DISP, 0); - statusline_print(STATUS_SHORT, "First page of DVI file"); +/* statusline_info(STATUS_SHORT, "First page of DVI file"); */ return; } pageno--; } - goto_page(check_goto_page(pageno), resource.keep_flag ? NULL : home, False); + goto_page(check_goto_page(pageno, True), resource.keep_flag ? NULL : home, False); search_signal_page_changed(); #endif } + statusline_erase("Page history:"); } #if !defined(LESSTIF_VERSION) /* draw a hightlight rectangle around the page the mouse is currently over, to make e.g. marking easier. - */ +*/ static void highlight_page_callback(Widget widget, XtPointer data, XEvent *event, Boolean *cont) { @@ -775,7 +772,7 @@ highlight_page_callback(Widget widget, XtPointer data, XEvent *event, Boolean *c /* might need to un-highlight previous one */ if (idx_bak >= 0 && idx_bak != curr_idx && my_list_pos_to_bounds(widget, idx_bak, &x, &y, &w, &h)) { -/* fprintf(stderr, "index: %d, %d, h: %d, w: %d\n", x, y, h, w); */ + /* fprintf(stderr, "index: %d, %d, h: %d, w: %d\n", x, y, h, w); */ refresh_highlight_marker(widget, m_page_gc.back, x, y, w, h); #if REDRAW_CURRENT_MARKER_HACK xaw_maybe_redraw_highlight(curr_idx); @@ -840,6 +837,7 @@ select_page_callback(Widget w, XtPointer closure, XtPointer call_data) maybe_scroll_pagelist(new, False); page_history_insert(new); goto_page(new, resource.keep_flag ? NULL : home, False); + statusline_erase("Page history:"); #endif search_signal_page_changed(); } @@ -896,7 +894,7 @@ xm_get_bottom_visible(int start) bot_visible. List is always scrolled so that 1 element is still visible below or above pointer, to make it possible to flip through document by repeatedly clicking on first/last. - */ +*/ static void xm_maybe_scroll_pagelist(int current, saveCmdT curr_cmd, int *top_visible, int *bot_visible) { @@ -957,7 +955,7 @@ xm_toggle_label(Widget widget, int idx, Boolean update) UNUSED(update); -/* ensure_labelinfo_size(idx); */ + /* ensure_labelinfo_size(idx); */ ASSERT(idx < (int)page_info.index_size, ""); if (!page_info.index[idx].marked) { sprintf(buf, pageno_format, '*', page_info.page_labels[idx]); @@ -969,7 +967,7 @@ xm_toggle_label(Widget widget, int idx, Boolean update) mark_font = "UNMARKED"; page_info.index[idx].marked = False; } -/* str = XmStringCreateLocalized(buf); */ + /* str = XmStringCreateLocalized(buf); */ str = XmStringCreateLtoR(buf, mark_font); XmListReplaceItemsPos(widget, &str, 1, idx + MOTIF_IDX_OFFSET); XmStringFree(str); @@ -988,13 +986,8 @@ mark_page_callback(Widget w, XtPointer data, XEvent *event, Boolean *cont) if (event->type == MotionNotify || event->xbutton.button == Button2) internal_process_button2(w, event); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } - + if (event->type != ButtonPress) + notify_print_dialog_have_marked(); } void @@ -1060,10 +1053,10 @@ xaw_toggle_label(Widget w, int idx, Boolean update) if (w == NULL) return; -/* ensure_labelinfo_size(idx); */ + /* ensure_labelinfo_size(idx); */ ASSERT(idx < (int)page_info.index_size, ""); if (!page_info.index[idx].marked) { -/* sprintf(toc[idx], "* %*d ", get_page_size(), page_index[idx].number); */ + /* sprintf(toc[idx], "* %*d ", get_page_size(), page_index[idx].number); */ sprintf(page_info.page_labels[idx], pageno_format, '*', get_page_size(), resource.use_tex_pages ? page_info.index[idx].number : idx + 1); page_info.index[idx].marked = True; @@ -1071,7 +1064,7 @@ xaw_toggle_label(Widget w, int idx, Boolean update) else { sprintf(page_info.page_labels[idx], pageno_format, ' ', get_page_size(), resource.use_tex_pages ? page_info.index[idx].number : idx + 1); -/* sprintf(toc[idx], " %*d ", get_page_size(), page_index[idx].number); */ + /* sprintf(toc[idx], " %*d ", get_page_size(), page_index[idx].number); */ page_info.index[idx].marked = False; } @@ -1091,14 +1084,14 @@ xaw_maybe_scroll_pagelist(int new_page, Boolean force_recenter, int idx_bak) if (LIST_WIDGET == NULL || (resource.expert_mode & XPRT_SHOW_BUTTONS) == 0) return idx_bak; -/* if (list_clip == 0) { */ -/* list_clip = XtNameToWidget(viewport, "clip"); */ -/* } */ -/* if (XtIsRealized(list_clip)) */ -/* XtVaGetValues(list_clip, XtNheight, &clip_height, XtNx, &cx, XtNy, &y1, NULL); */ + /* if (list_clip == 0) { */ + /* list_clip = XtNameToWidget(viewport, "clip"); */ + /* } */ + /* if (XtIsRealized(list_clip)) */ + /* XtVaGetValues(list_clip, XtNheight, &clip_height, XtNx, &cx, XtNy, &y1, NULL); */ if (viewport != NULL && XtIsRealized(viewport)) XtVaGetValues(viewport, XtNheight, &view_height, XtNx, &x, NULL); -/* fprintf(stderr, "diff: %d, %d, %d, %d, %d\n", cx - x, clip_height, view_height, y1, (int)y2); */ + /* fprintf(stderr, "diff: %d, %d, %d, %d, %d\n", cx - x, clip_height, view_height, y1, (int)y2); */ xaw_get_row_height(LIST_WIDGET, &row_height, &internal_height); y = row_height * new_page; @@ -1150,13 +1143,12 @@ toggle_label(Widget widget, int idx, Boolean update) void list_toggle_marks(int arg) { - int i; if (arg < 0) { /* mark all */ for (i = 0; i < total_pages; i++) { ASSERT(i < (int)page_info.index_size, ""); -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (!page_info.index[i].marked) { toggle_label(LIST_WIDGET, i, False); } @@ -1165,7 +1157,7 @@ list_toggle_marks(int arg) else if (arg == 0) { /* unmark all */ for (i = 0; i < total_pages; i++) { ASSERT(i < (int)page_info.index_size, ""); -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (page_info.index[i].marked) { toggle_label(LIST_WIDGET, i, False); } @@ -1184,6 +1176,7 @@ list_toggle_marks(int arg) #ifndef MOTIF xaw_update_list(); #endif + notify_print_dialog_have_marked(); } static Boolean PagelistInitialized = False; @@ -1194,20 +1187,20 @@ handle_pagelist_resize(void) { /* TODO: the following will mess up the geometry of the list (doesn't increase height, and incrementally decreases width): - if (list_widget) { - Dimension height; - --- without the (un)manage, I get an X Error: - XtMakeGeometryRequest - parent has no geometry manager - --- - XtUnmanageChild(viewport); - XtUnmanageChild(LIST_WIDGET); - XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); - height -= resource.btn_top_spacing + resource.btn_border_width + global_y_pos; - XtVaSetValues(viewport, XtNheight, height, NULL); - XtManageChild(LIST_WIDGET); - XtManageChild(viewport); - } - ... so we use brute force instead: */ + if (list_widget) { + Dimension height; + --- without the (un)manage, I get an X Error: + XtMakeGeometryRequest - parent has no geometry manager + --- + XtUnmanageChild(viewport); + XtUnmanageChild(LIST_WIDGET); + XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); + height -= resource.btn_top_spacing + resource.btn_border_width + global_y_pos; + XtVaSetValues(viewport, XtNheight, height, NULL); + XtManageChild(LIST_WIDGET); + XtManageChild(viewport); + } + ... so we use brute force instead: */ handle_destroy_pagelist(LIST_WIDGET, NULL, NULL); create_pagelist(); } @@ -1234,7 +1227,7 @@ create_pagelist(void) Pixel background, foreground; #ifdef MOTIF -/* items = xrealloc(items, sizeof *items * (total_pages + 2)); */ + /* items = xrealloc(items, sizeof *items * (total_pages + 2)); */ init_pagelabels(0, total_pages); xm_set_page_labels(); if (!PagelistInitialized) { @@ -1251,7 +1244,7 @@ create_pagelist(void) Don't use the highlighting hack with LessTif, since its XmListPosToBounds() is too broken to be usable (as of 0.93.36): - it returns generally too low values, apparently it doesn't take - XmNlistSpacing into account; + XmNlistSpacing into account; - it doesn't take scrollbar position into account. */ if (resource.pagelist_highlight_current) @@ -1317,7 +1310,7 @@ refresh_pagelist(int newsize, int newpage) fprintf(stderr, "=== refresh_pagelist: newsize %d, newpage %d\n", newsize, newpage); #endif #ifdef MOTIF -/* items = xrealloc(items, sizeof *items * (newsize + 2)); */ + /* items = xrealloc(items, sizeof *items * (newsize + 2)); */ init_pagelabels(0, newsize); xm_set_page_labels(); #else /* MOTIF */ @@ -1325,7 +1318,7 @@ refresh_pagelist(int newsize, int newpage) return; /* FIXME - is this really neccessary?? The alternative: - XawListChange(LIST_WIDGET, page_info.page_labels, newsize, 0, True); + XawListChange(LIST_WIDGET, page_info.page_labels, newsize, 0, True); has problems when freeing the page labels afterwards. */ handle_destroy_pagelist(LIST_WIDGET, NULL, NULL); @@ -1377,7 +1370,7 @@ maybe_scroll_pagelist(int newpage, Boolean force_recenter) last highlighted with our home-made `current selected' rectangle, it might overdraw that rectangle. In this case, restore it: - */ + */ xaw_maybe_redraw_current_marker(newpage); #endif #endif @@ -1389,7 +1382,7 @@ set_all_marks(int from, int to) { int i; for (i = from; i < to; i++) { -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ page_info.index[i].marked = True; toggle_label(LIST_WIDGET, i, False); } @@ -1402,12 +1395,12 @@ internal_process_button2_drag(Widget widget, XEvent *event) idx = get_item_index(widget, event->xbutton.y); for (i = 0; i < total_pages; i++) { -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (page_info.index[i].marked && i > max) max = i; } for (i = total_pages; i > 0; i--) { -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (page_info.index[i].marked && i < min) min = i; } @@ -1536,21 +1529,16 @@ list_toggle_current(int arg) { toggle_label(LIST_WIDGET, arg, True); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } + notify_print_dialog_have_marked(); } #ifdef MOTIF static void xm_list_set_mark(Widget widget, - XEvent *event, - String *params, - Cardinal *num_params) + XEvent *event, + String *params, + Cardinal *num_params) { UNUSED(params); @@ -1559,12 +1547,8 @@ xm_list_set_mark(Widget widget, internal_process_button2(widget, event); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } + if (event->type != ButtonPress) + notify_print_dialog_have_marked(); } static void @@ -1580,12 +1564,8 @@ xm_list_drag_mark(Widget widget, internal_process_button2_drag(widget, event); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } + if (event->type != ButtonPress) + notify_print_dialog_have_marked(); } #endif /* MOTIF */ diff --git a/Build/source/texk/xdvik/gui/print-dialog.c b/Build/source/texk/xdvik/gui/print-dialog.c index c7187be6100..87e70a99cc1 100644 --- a/Build/source/texk/xdvik/gui/print-dialog.c +++ b/Build/source/texk/xdvik/gui/print-dialog.c @@ -21,26 +21,7 @@ */ /* - SU: Adapted from non-k xdvi's popups.c - - This implements a print popup (and a `save to file' popup). My idea - was to use the same window layout framework for both tasks, since - there's a big overlap in the widgets needed. However after looking - at the mess I've created, I'm no longer convinced this was a good - idea. (I reckon it's slightly better than the code duplication when - doing it in separate files, but only *slightly* ...) - - We need a more intelligent approach that bans this ugly kind of - `data proliferation' (those global arrays of widgets and helper - structures). Custom Widgets? Factory methods? Needs investigation. - - Also, in the long run, I guess we want the `Save' window to be more - similar to the file browser (i.e. to contain a file browser e.g. - in the upper part); in that case, the code will be moved into another - module anyway. - - Moreover, the GUI code should be completely separated from the backend - code. + SU: Adapted from non-k xdvi's popups.c and added saving functionality. */ #include <string.h> @@ -50,6 +31,7 @@ #include <ctype.h> #include "print-dialog.h" +#include "print-internal.h" #include "print-log.h" #include "print-internal.h" #include "events.h" @@ -122,141 +104,50 @@ struct output_format_mapping { { NULL, FMT_NONE, NULL } }; -typedef enum printRadioT_ { - NO_PRINT_VAL = -1, - PRINT_TO_PRINTER = 1, - PRINT_TO_FILE, - SAVE_TO_FILE -} printRadioT; - - -typedef enum pageRadioT_ { - NO_PAGE_VAL = -1, - PRINT_ALL = 1, - PRINT_MARKED, - PRINT_RANGE, - SAVE_ALL, - SAVE_MARKED, - SAVE_RANGE -} pageRadioT; - -static Boolean is_print_button(pageRadioT flag) { - return (flag <= PRINT_RANGE); -} +/* Widget names that are used in callbacks ... */ +#define Xdvi_SAVE_SHELL_NAME "save_popup" +#define Xdvi_PRINT_SHELL_NAME "print_popup" -struct dialog_info { - char *printer_name; - char *file_name; - /* fully canonicalized filename, not visible in window, but used in error messages. - It is either NULL, or a malloc()ed buffer (which is free()d immediately before use). */ - char *expanded_filename; - char *dvips_options; - char *from_page; - char *to_page; - printRadioT print_radio; - pageRadioT range_radio; - outputFormatT output_format; -}; +#define Xdvi_PAGE_RANGE_FORM_NAME "page_range_form" -/* - global widgets, and arrays of global widgets (mosly, one - for the printing and one for the saving dialog). Needs - cleanup! -*/ +#define Xdvi_PAGES_ALL_RADIO_NAME "pages_all" +#define Xdvi_PAGES_MARKED_RADIO_NAME "pages_marked" +#define Xdvi_PAGES_RANGE_RADIO_NAME "pages_range" -#define FORMAT_SEL_CNT 5 +#define Xdvi_PAGES_RANGE_FROM_LABEL_NAME "range_from_lab" +#define Xdvi_PAGES_RANGE_FROM_TEXT_NAME "range_from_text" +#define Xdvi_PAGES_RANGE_TO_LABEL_NAME "range_to_lab" +#define Xdvi_PAGES_RANGE_TO_TEXT_NAME "range_to_text" +#define Xdvi_PAGES_RANGE_OF_LABEL_NAME "range_of_lab" -/* top-level widgets: one for printing, one for saving to file */ -static Widget print_shell = NULL; -static Widget save_shell = NULL; +#define Xdvi_TO_PRINTER_NAME "to_printer" +#define Xdvi_TO_PRINTER_TEXT "printer_text" +#define Xdvi_TO_FILE_NAME "to_file" +#define Xdvi_TO_FILE_TEXT "file_text" +#define Xdvi_BROWSE_BUTTON "file_button" -/* global structures for saving print info between invocations */ -static struct dialog_info save_pr_info = { - NULL, NULL, NULL, NULL, NULL, NULL, NO_PRINT_VAL, NO_PAGE_VAL, FMT_NONE -}; -static struct dialog_info save_save_info = { - NULL, NULL, NULL, NULL, NULL, NULL, NO_PRINT_VAL, NO_PAGE_VAL, FMT_NONE -}; +#define Xdvi_DVIPS_OPTIONS_NAME "dvips_options_name" +#define Xdvi_DVIPS_OPTIONS_TEXT "dvips_options_text" +#define Xdvi_FORMAT_SELECTION_BUTTON_NAME "format_selection_button" -/* - these contain the currently selected values, or defaults; - used in communication between callbacks -*/ -static struct dialog_info curr_pr_info = { - NULL, NULL, NULL, NULL, NULL, NULL, PRINT_TO_PRINTER, PRINT_ALL, FMT_NONE -}; -static struct dialog_info curr_save_info = { - NULL, NULL, NULL, NULL, NULL, NULL, SAVE_TO_FILE, SAVE_ALL, FMT_NONE -}; - -static void print_precheck1(XtPointer info); -static void print_precheck2(XtPointer info); - -/* access methods ... */ -const char * -get_printer_options(void) -{ - return save_pr_info.printer_name; -} - -char * -get_dvips_options(printOrSaveActionT act) -{ - if (act == FILE_PRINT) - return save_pr_info.dvips_options; - else - return save_save_info.dvips_options; -} - -#ifdef MOTIF -static Widget from_label[FILE_ALL] = { None, None }; -static Widget format_selection_option; -XmString format_selection_texts[FORMAT_SEL_CNT]; - -#else /* MOTIF */ +/* number of items in `format' pulldown menu */ +#define FORMAT_SEL_CNT 5 -static Widget format_selection_label; -static Widget format_selection_button; -#if 0 -static Widget format_selection_b1; -#endif -static Widget format_selection_popup; -static Widget format_selection_menu[FORMAT_SEL_CNT]; +static void print_check_page_values(struct save_or_print_info *info); +static void print_check_dvi_file(struct save_or_print_info *info); +static void print_check_target_file(XtPointer info); +#ifndef MOTIF static void xaw_print_save_act_go(Widget, XEvent *, String *, Cardinal *); +#endif /* not MOTIF */ -#endif /* MOTIF */ - -static void print_cancel(Widget, XEvent *, String *, Cardinal *); -static void save_cancel(Widget, XEvent *, String *, Cardinal *); - -static Widget to_printer_radio; -static Widget to_file_radio_or_label[FILE_ALL] = { None, None }; -static Widget to_label[FILE_ALL] = { None, None }; -static Widget of_label[FILE_ALL] = { None, None }; -static Widget range_all_radio[FILE_ALL] = { None, None }; -static Widget range_marked_radio[FILE_ALL] = { None, None }; -static Widget range_from_to_radio[FILE_ALL] = { None, None }; -static Widget cancel_button[FILE_ALL] = { None, None }; -static Widget ok_button[FILE_ALL] = { None, None }; -static Widget print_to_printer_text; -static Widget print_to_file_text[FILE_ALL] = { None, None }; -static Widget print_to_file_button[FILE_ALL] = { None, None }; -static Widget dvips_options_text[FILE_ALL] = { None, None }; -static Widget page_from_text[FILE_ALL] = { None, None }; -static Widget page_to_text[FILE_ALL] = { None, None }; - -static int print_is_active = False; /* False if window is unmanaged or not created yet, True if managed */ -static int save_is_active = False; /* False if window is unmanaged or not created yet, True if managed */ - +static void wm_cancel(Widget, XEvent *, String *, Cardinal *); static XtActionsRec print_actions[] = { #ifndef MOTIF - {"saveInternal", xaw_print_save_act_go }, - {"printInternal", xaw_print_save_act_go}, + {"xaw_print_or_save", xaw_print_save_act_go }, #endif - {"WM_print_cancel", print_cancel }, - {"WM_save_cancel", save_cancel }, + {"WM_cancel", wm_cancel }, }; /* @@ -265,27 +156,6 @@ static XtActionsRec print_actions[] = { ============================================================ */ -/* - Return the printer name, eventually followed by `-P$PRINTER', - since the `-o' option of dvips doesn't evaluate the environment - variable. -*/ -static char * -get_printer_name(void) -{ - char *printcmd, *printer; - - if (resource.dvips_printer_str != NULL && strlen(resource.dvips_printer_str) > 0) { - return xstrdup(resource.dvips_printer_str); - } - printcmd = xstrdup("lpr"); - printer = getenv("PRINTER"); - if (printer != NULL) { - printcmd = xstrcat(printcmd, " -P"); - printcmd = xstrcat(printcmd, printer); - } - return printcmd; -} /* return basename of `old_name' with `old_ext' replaced by `new_ext', in fresh memory */ static char * @@ -294,7 +164,7 @@ get_new_file_name(const char *old_name, const char *old_ext, const char *new_ext /* old_name contains the normalized DVI file name, with path and extension */ char *basename, *new_name; size_t len; - + basename = strrchr(old_name, DIR_SEPARATOR); if (basename != NULL) { @@ -308,7 +178,12 @@ get_new_file_name(const char *old_name, const char *old_ext, const char *new_ext } len = strlen(new_name); - strcpy(new_name + len - strlen(old_ext), new_ext); + if (old_ext == NULL) { + strcpy(new_name + len, new_ext); + } + else { + strcpy(new_name + len - strlen(old_ext), new_ext); + } return new_name; } @@ -334,6 +209,7 @@ get_dvips_papersize(Boolean *landscape) return NULL; papersize = xstrdup(resource.paper); + /* fprintf(stderr, "PAPERSIZE: |%s|\n", papersize); */ *landscape = False; if (papersize[strlen(papersize) - 1] == 'r') { /* landscape size */ papersize[strlen(papersize) - 1] = '\0'; @@ -344,92 +220,6 @@ get_dvips_papersize(Boolean *landscape) } static void -set_outfile_name(struct dialog_info *info, struct dialog_info *save_info, printOrSaveActionT act) -{ - free(info->file_name); - if (act == FILE_PRINT) { - info->file_name = get_new_file_name(globals.dvi_name, ".dvi", ".ps"); - } - else { /* saving to file */ - if (save_info->range_radio == SAVE_ALL) { - info->file_name = get_new_file_name(globals.dvi_name, ".dvi", - output_format_mapping[resource.default_saving_format].extension); - } - else { - char *tmp = xstrdup("_pp"); - tmp = xstrcat(tmp, output_format_mapping[resource.default_saving_format].extension); - - info->file_name = get_new_file_name(globals.dvi_name, ".dvi", tmp); - free(tmp); - } - } -} - -/* get initial values for dialog texts */ -static void -get_initial_dialog_values(struct dialog_info *info, printOrSaveActionT act) -{ - if (act == FILE_PRINT && info->printer_name == NULL) - info->printer_name = get_printer_name(); - - if (info->dvips_options == NULL) { - info->dvips_options = xstrdup(""); - - /* add -t option if not already present */ - if (resource.dvips_options_str != NULL - && strstr(resource.dvips_options_str, "-t ") == NULL) { - Boolean dvips_landscape = False; - char *dvips_paper_size = get_dvips_papersize(&dvips_landscape); - if (dvips_paper_size != NULL) { - info->dvips_options = xstrdup("-t "); - info->dvips_options = xstrcat(info->dvips_options, dvips_paper_size); - free(dvips_paper_size); - if (dvips_landscape) { - info->dvips_options = xstrcat(info->dvips_options, " -t landscape"); - } - } - } - - if (resource.dvips_options_str != NULL) { - if (strlen(info->dvips_options) > 0) - info->dvips_options = xstrcat(info->dvips_options, " "); - info->dvips_options = xstrcat(info->dvips_options, resource.dvips_options_str); - } - } - - if (info->from_page == NULL) { - info->from_page = xmalloc(LENGTH_OF_INT + 1); - sprintf(info->from_page, "%d", current_page + globals.pageno_correct); - } - - if (info->to_page == NULL) { - info->to_page = xmalloc(LENGTH_OF_INT + 1); - sprintf(info->to_page, "%d", current_page + globals.pageno_correct); - } -} - - -#if MOTIF -static void -set_sensitivity(int i) -{ - Boolean sensitivity; - -/* if (i == curr_pr_info.print_radio) /\* if no change *\/ */ -/* return; */ - - curr_pr_info.print_radio = i; - - sensitivity = (i == PRINT_TO_PRINTER); - XtSetSensitive(print_to_printer_text, sensitivity); - -/* sensitivity ^= (True ^ False); */ - XtSetSensitive(print_to_file_text[FILE_PRINT], !sensitivity); - XtSetSensitive(print_to_file_button[FILE_PRINT], !sensitivity); -} -#endif /* MOTIF */ - -static void update_dvips_options_sensitivity(int idx, Widget top) { Widget dvips_label; @@ -437,8 +227,8 @@ update_dvips_options_sensitivity(int idx, Widget top) #if MOTIF Widget dvips_options; - if (get_widget_by_name(&dvips_label, top, "dvips_options_name", True) && - get_widget_by_name(&dvips_options, top, "dvips_options_text", True)) { + if (get_widget_by_name(&dvips_label, top, Xdvi_DVIPS_OPTIONS_NAME, True) && + get_widget_by_name(&dvips_options, top, Xdvi_DVIPS_OPTIONS_TEXT, True)) { if (output_format_mapping[idx].fmt == FMT_PS || output_format_mapping[idx].fmt == FMT_PS2PDF) { XtSetSensitive(dvips_label, True); @@ -450,7 +240,7 @@ update_dvips_options_sensitivity(int idx, Widget top) } } #else - if (get_widget_by_name(&dvips_label, top, "dvips_options_name", True)) { + if (get_widget_by_name(&dvips_label, top, Xdvi_DVIPS_OPTIONS_NAME, True)) { XtSetSensitive(XtParent(dvips_label), output_format_mapping[idx].fmt == FMT_PS || output_format_mapping[idx].fmt == FMT_PS2PDF); @@ -461,118 +251,88 @@ update_dvips_options_sensitivity(int idx, Widget top) /* callbacks */ static void -select_format_cb(Widget w, XtPointer client_data, XtPointer call_data) +cb_select_format(Widget w, XtPointer client_data, XtPointer call_data) { - Widget file_text, top; - + struct save_or_print_info *info = NULL; + Widget file_text; char *filename; - int i; -#ifdef MOTIF - Widget f1, f2; - char *ptr; + int i = 0; + +#ifndef MOTIF + Widget button; + char *old_label, *new_label; + char tmp_label[1024]; +#endif - i = (int)client_data; UNUSED(call_data); - f1 = XtParent(w); - ASSERT(f1 != 0, "Parent of widget musn't be NULL!\n"); - f2 = XtParent(f1); - ASSERT(f2 != 0, "Parent of f1 musn't be NULL!\n"); - top = XtParent(f2); - ASSERT(top != 0, "Parent of f2 musn't be NULL!\n"); - - if ((file_text = XtNameToWidget(top, "*file_text")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"file_text\" widget!")); - return; - } - XtVaGetValues(file_text, XmNvalue, &filename, NULL); - if ((ptr = strrchr(filename, '.')) != NULL) { - char buf[1024]; - replace_extension(filename, output_format_mapping[i].extension, buf, sizeof buf); - XtVaSetValues(file_text, XmNvalue, buf, NULL); + +#ifdef MOTIF + i = (int)client_data; + XtVaGetValues(XtParent(w), XmNuserData, &info, NULL); + ASSERT(info != NULL, "Expected struct save_or_print_info * in XmNuserData of button!"); + + if (get_widget_by_name(&file_text, info->shell, Xdvi_TO_FILE_TEXT, True)) { + XtVaGetValues(file_text, XmNvalue, &filename, NULL); + if (strrchr(filename, '.') != NULL) { + char buf[1024]; + replace_extension(filename, output_format_mapping[i].extension, buf, sizeof buf); + XtVaSetValues(file_text, XmNvalue, buf, XmNcursorPosition, strlen(buf), NULL); + } } #else /* MOTIF */ + info = (struct save_or_print_info *)client_data; - Widget popup, button; - char *ptr1, *ptr2; - char buf[1024]; - - UNUSED(call_data); - popup = XtParent(w); - ASSERT(popup != 0, "Parent of menu musn't be NULL!\n"); - button = XtParent(popup); - ASSERT(button != 0, "Parent of popup musn't be NULL!\n"); - - top = (Widget)client_data; - - if ((file_text = XtNameToWidget(top, "*file_text")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"file_text\" widget!")); - return; - } + if (get_widget_by_name(&file_text, info->shell, Xdvi_TO_FILE_TEXT, True) + && get_widget_by_name(&button, info->shell, Xdvi_FORMAT_SELECTION_BUTTON_NAME, True)) { - XtVaGetValues(file_text, XtNstring, &filename, NULL); -/* fprintf(stderr, "file text: |%s|\n", filename); */ + XtVaGetValues(file_text, XtNstring, &filename, NULL); - /* swap title strings */ - XtVaGetValues(button, XtNlabel, &ptr1, NULL); - XtVaGetValues(w, XtNlabel, &ptr2, NULL); - strncpy(buf, ptr1, sizeof buf); + /* swap title strings */ + XtVaGetValues(button, XtNlabel, &old_label, NULL); + XtVaGetValues(w, XtNlabel, &new_label, NULL); + strncpy(tmp_label, old_label, sizeof tmp_label); - for (i = 0; output_format_mapping[i].fmt_string != NULL; i++) { - if (strcmp(ptr2, output_format_mapping[i].fmt_string) == 0) { - char buf2[1024]; - replace_extension(filename, output_format_mapping[i].extension, buf2, sizeof buf2); - XtVaSetValues(file_text, XtNstring, buf2, NULL); + /* update the filename with new format */ + for (i = 0; output_format_mapping[i].fmt_string != NULL; i++) { + if (strcmp(new_label, output_format_mapping[i].fmt_string) == 0) { + char buf[1024]; + replace_extension(filename, output_format_mapping[i].extension, buf, sizeof buf); + XtVaSetValues(file_text, XtNstring, buf, NULL); + XawTextSetInsertionPoint(file_text, strlen(buf)); - break; + break; + } } + /* format not found, complain: */ + if (output_format_mapping[i].fmt_string == NULL) { + popup_message(info->shell, + MSG_WARN, + REPORT_XDVI_BUG_TEMPLATE, + "Unrecognized string in format selector: |%s|", new_label); + } + XtVaSetValues(button, XtNlabel, new_label, NULL); + XtVaSetValues(w, XtNlabel, tmp_label, NULL); } - if (output_format_mapping[i].fmt_string == NULL) { - popup_message(get_matching_parent(w, globals.widgets.top_level, "print_popup", "save_popup", NULL), - MSG_WARN, - REPORT_XDVI_BUG_TEMPLATE, - "Unrecognized string in format selector: |%s|", ptr2); - } - XtVaSetValues(button, XtNlabel, ptr2, NULL); - XtVaSetValues(w, XtNlabel, buf, NULL); - #endif /* MOTIF */ - save_save_info.output_format = curr_save_info.output_format = output_format_mapping[i].fmt; - - update_dvips_options_sensitivity(i, save_shell); - - resource.default_saving_format = save_save_info.output_format; - set_outfile_name(&save_save_info, &curr_save_info, FILE_SAVE); -} - -static void -cb_print_cancel(Widget w, XtPointer client_data, XtPointer call_data) -{ - struct save_or_print_info *info = (struct save_or_print_info *)client_data; - UNUSED(w); - UNUSED(call_data); + update_dvips_options_sensitivity(i, info->shell); - ASSERT(info != NULL, "client_data in cb_print_cancel musn't be NULL!"); - if (info->message_popup != 0) { - kill_message_window(info->message_popup); - } - XtPopdown(print_shell); - print_is_active = False; + info->fmt = resource.default_saving_format = output_format_mapping[i].fmt; } static void -cb_save_cancel(Widget w, XtPointer client_data, XtPointer call_data) +cb_popdown(Widget w, XtPointer client_data, XtPointer call_data) { struct save_or_print_info *info = (struct save_or_print_info *)client_data; UNUSED(w); UNUSED(call_data); - ASSERT(info != NULL, "client_data in cb_save_cancel musn't be NULL!"); + ASSERT(info != NULL, "client_data in cb_popdown musn't be NULL!"); if (info->message_popup != 0) { kill_message_window(info->message_popup); } - XtPopdown(save_shell); - save_is_active = False; + /* fprintf(stderr, "Popping down shell: %p\n", (void *)info->shell); */ + XtPopdown(info->shell); } static void @@ -582,19 +342,19 @@ cb_print_or_save(Widget w, XtPointer client_data, XtPointer call_data) UNUSED(w); UNUSED(call_data); - print_precheck1((XtPointer)info); + print_check_page_values(info); } /* access from outside the module */ void cancel_saving(struct save_or_print_info *info) { - cb_save_cancel(NULL, info, NULL); + cb_popdown(NULL, info, NULL); } static void -print_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) +wm_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) { struct save_or_print_info *info = NULL; void *ptr; @@ -602,85 +362,89 @@ print_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) UNUSED(w); UNUSED(event); - ASSERT(*num_params > 0, "params in print_cancel must be > 0!"); - ASSERT(*params != NULL, "params in print_cancel mustn't be NULL!"); + ASSERT(*num_params > 0, "params in wm_cancel must be > 0!"); + ASSERT(*params != NULL, "params in wm_cancel mustn't be NULL!"); TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); sscanf(*params, "%p", &ptr); info = (struct save_or_print_info *)ptr; - cb_print_cancel(NULL, info, NULL); + cb_popdown(NULL, info, NULL); } +/* + * Callbacks to enable the corresponding radio button if the user clicks on a text field to + * edit it. This is more user-friendly than making the text field insensitive + * until the radio button has been clicked. There are 2 separate callbacks, one for + * printing vs. saving (only used when actually printing), and one for the page range. + */ static void -save_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) +text_print_vs_save_callback(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) { - struct save_or_print_info *info = NULL; - void *ptr; - - UNUSED(w); - UNUSED(event); + struct save_or_print_info *info = (struct save_or_print_info *)closure; + Widget to_printer; /* used to check where we have been called from */ + Widget radio_printer, radio_file; - ASSERT(*num_params > 0, "params in save_cancel must be > 0!"); - ASSERT(*params != NULL, "params in save_cancel mustn't be NULL!"); - - TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); - sscanf(*params, "%p", &ptr); - info = (struct save_or_print_info *)ptr; + UNUSED(ev); + UNUSED(cont); - cb_save_cancel(NULL, info, NULL); + if (get_widget_by_name(&to_printer, info->shell, Xdvi_TO_PRINTER_TEXT, True) + && get_widget_by_name(&radio_printer, info->shell, Xdvi_TO_PRINTER_NAME, True) + && get_widget_by_name(&radio_file, info->shell, Xdvi_TO_FILE_NAME, True)) { +#ifdef MOTIF + XmToggleButtonGadgetSetState(radio_printer, widget == to_printer, True); + XmToggleButtonGadgetSetState(radio_file, widget != to_printer, True); +#else + XawToggleSetCurrent(radio_printer, widget == to_printer ? (XtPointer)TO_PRINTER : (XtPointer)TO_FILE); +#endif + } } -#ifndef MOTIF - -/* - enable the `print to' button if user presses key or mouse button - inside that input field -*/ +/* This case is slightly simpler, since the callback only needs to enable + * the radio button for the page range, never disable it. + */ static void -xaw_print_handle_key(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) +text_page_range_callback(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) { - char *number; - int i; + struct save_or_print_info *info = (struct save_or_print_info *)closure; + Widget radio_all, radio_selected, radio_range; - number = (char *)closure; - i = atoi(number); - ASSERT(i == 2 || i == 3, "Button index should be 2 or 3"); - UNUSED(widget); UNUSED(ev); UNUSED(cont); + UNUSED(widget); - if (i == 2) { - XawToggleSetCurrent(to_printer_radio, (XtPointer)PRINT_TO_PRINTER); - } - else { - ASSERT(to_file_radio_or_label[FILE_PRINT] != NULL, ""); - XawToggleSetCurrent(to_file_radio_or_label[FILE_PRINT], (XtPointer)PRINT_TO_FILE); + if (get_widget_by_name(&radio_all, info->shell, Xdvi_PAGES_ALL_RADIO_NAME, True) + && get_widget_by_name(&radio_selected, info->shell, Xdvi_PAGES_MARKED_RADIO_NAME, True) + && get_widget_by_name(&radio_range, info->shell, Xdvi_PAGES_RANGE_RADIO_NAME, True)) { +#ifdef MOTIF + XmToggleButtonGadgetSetState(radio_all, False, True); + XmToggleButtonGadgetSetState(radio_selected, False, True); + XmToggleButtonGadgetSetState(radio_range, True, True); +#else + XawToggleSetCurrent(radio_all, (XtPointer)PAGE_RANGE); +#endif } } -/* - enable the `print range' button if user presses key or mouse button - inside that input field -*/ +#ifdef MOTIF + +/* Motif type callbacks for the above. */ static void -xaw_range_handle_key(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) +cb_text_print_vs_save(Widget w, XtPointer client_data, XtPointer call_data) { - printOrSaveActionT act = (printOrSaveActionT)closure; - UNUSED(widget); - UNUSED(ev); - UNUSED(cont); - - if (act == FILE_PRINT && curr_pr_info.range_radio != PRINT_RANGE) { - ASSERT(range_all_radio[act] != NULL, "button should have been initialized"); - XawToggleSetCurrent(range_all_radio[act], (XtPointer)PRINT_RANGE); - } - else if (act == FILE_SAVE && curr_save_info.range_radio != SAVE_RANGE) { - ASSERT(range_all_radio[act] != NULL, "button should have been initialized"); - XawToggleSetCurrent(range_all_radio[act], (XtPointer)SAVE_RANGE); - } + UNUSED(call_data); + /* fprintf(stderr, "************ cb_text_print_vs_save!\n"); */ + text_print_vs_save_callback(w, client_data, NULL, NULL); } +static void +cb_text_page_range(Widget w, XtPointer client_data, XtPointer call_data) +{ + UNUSED(call_data); + text_page_range_callback(w, client_data, NULL, NULL); +} + +#else /* MOTIF */ static void xaw_print_save_act_go(Widget w, XEvent *event, String *params, Cardinal *num_params) @@ -691,167 +455,89 @@ xaw_print_save_act_go(Widget w, XEvent *event, String *params, Cardinal *num_par UNUSED(w); UNUSED(event); - ASSERT(*num_params > 0, "params in search_cancel must be > 0!"); - ASSERT(*params != NULL, "params in search_cancel mustn't be NULL!"); + ASSERT(*num_params > 0, "params in xaw_print_save_act_go must be > 0!"); + ASSERT(*params != NULL, "params in xaw_print_save_act_go mustn't be NULL!"); TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); sscanf(*params, "%p", &ptr); info = (struct save_or_print_info *)ptr; - print_precheck1((XtPointer)info); + print_check_page_values(info); } -#if 0 +#endif /* MOTIF */ + static void -xaw_popup_menu_cb(Widget w, XtPointer client_data, XtPointer call_data) +cb_print_vs_save(Widget w, XtPointer client_data, XtPointer call_data) { - Position x, y; - Dimension h; - int pos_x, pos_y; - Window dummy; - - Widget popup = (Widget)client_data; - fprintf(stderr, "popup: %p\n", popup); - XtVaGetValues(w, XtNx, &x, XtNy, &y, XtNheight, &h, NULL); - fprintf(stderr, "x: %d, y: %d, h: %d\n", x, y, h); - XTranslateCoordinates(DISP, XtWindow(w), RootWindowOfScreen(SCRN), - x, y, &pos_x, &pos_y, &dummy); - XtRealizeWidget(popup); - /* WRONG - would need to use x position of its left widget ... */ - XtVaSetValues(popup, XtNx, pos_x, XtNy, pos_y + h + 1, NULL); - XtPopup(popup, XtGrabNone); -} -#endif /* 0 */ + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + Widget radio_printer, radio_file; + /* Widget file_button; */ -#endif /* not MOTIF */ + UNUSED(call_data); -static void -cb_print_vs_file(Widget w, XtPointer client_data, XtPointer call_data) -{ + if (get_widget_by_name(&radio_printer, info->shell, Xdvi_TO_PRINTER_NAME, True) + && get_widget_by_name(&radio_file, info->shell, Xdvi_TO_FILE_NAME, True)) { #ifdef MOTIF - Boolean to_printer = False, to_file = False; - if (((XmToggleButtonCallbackStruct *)call_data)->set) { - if (w == to_printer_radio) - to_printer = True; - else - to_file = True; + Widget text; - } - else { - if (w == to_printer_radio) - to_file = True; + if (radio_printer == w) { + XmToggleButtonGadgetSetState(radio_printer, True, False); + XmToggleButtonGadgetSetState(radio_file, False, False); + if (get_widget_by_name(&text, info->shell, Xdvi_TO_PRINTER_TEXT, True)) + XmProcessTraversal(text, XmTRAVERSE_CURRENT); + } + else { + XmToggleButtonGadgetSetState(radio_printer, False, False); + XmToggleButtonGadgetSetState(radio_file, True, False); + if (get_widget_by_name(&text, info->shell, Xdvi_TO_FILE_TEXT, True)) + XmProcessTraversal(text, XmTRAVERSE_CURRENT); + } +#endif + if (radio_printer == w) + info->print_target = TO_PRINTER; else - to_printer = True; + info->print_target = TO_FILE; } - - XmToggleButtonGadgetSetState(to_file_radio_or_label[FILE_PRINT], to_file, False); - XmToggleButtonGadgetSetState(to_printer_radio, to_printer, False); - - set_sensitivity((int)client_data); - XmProcessTraversal(curr_pr_info.print_radio == PRINT_TO_PRINTER - ? print_to_printer_text - : print_to_file_text[FILE_PRINT], - XmTRAVERSE_CURRENT); -#else /* MOTIF */ - int i = (int) XawToggleGetCurrent(to_printer_radio); - - UNUSED(w); - UNUSED(client_data); - UNUSED(call_data); - - /* - NOTE: Unlike non-k xdvi, we don't use set_sensitivity for the - Xaw version, since the text inside the textfield cannot be made - insensitive, so it won't be obvious to users why they cannot - change the text. Also, the page range isn't set insensitive - either. - */ - if (i != 0) - curr_pr_info.print_radio = i; -#endif /* MOTIF */ - } - - static void cb_range(Widget w, XtPointer client_data, XtPointer call_data) { - pageRadioT flag = (pageRadioT)client_data; - printOrSaveActionT act; - -#ifdef MOTIF - - Boolean sensitivity; - UNUSED(call_data); - ASSERT(flag != PRINT_MARKED || flag != SAVE_MARKED || pageinfo_have_marked_pages(), - "PRINT_MARKED or SAVE_MARKED shouldn't be togglable if there are no marked pages!"); - - if (is_print_button(flag)) { - curr_pr_info.range_radio = (int)client_data; - sensitivity = (curr_pr_info.range_radio == PRINT_RANGE); - act = FILE_PRINT; - } - else { - curr_save_info.range_radio = (int)client_data; - sensitivity = (curr_save_info.range_radio == SAVE_RANGE); - act = FILE_SAVE; - } - - /* switch off other radio buttons, switch on current one */ - XmToggleButtonGadgetSetState(range_all_radio[act], False, False); - XmToggleButtonGadgetSetState(range_marked_radio[act], False, False); - XmToggleButtonGadgetSetState(range_from_to_radio[act], False, False); - XmToggleButtonGadgetSetState(w, True, False); - - /* set from-to range to sensitive if appropriate */ - XtSetSensitive(from_label[act], sensitivity); - XtSetSensitive(page_from_text[act], sensitivity); - XtSetSensitive(to_label[act], sensitivity); - XtSetSensitive(page_to_text[act], sensitivity); - XtSetSensitive(of_label[act], sensitivity); - -#else /* MOTIF */ + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + Widget radio_all, radio_selected, radio_range; - int i; UNUSED(call_data); - if (is_print_button(flag)) { - act = FILE_PRINT; - } - else { - act = FILE_SAVE; - } - +#ifndef MOTIF UNUSED(w); +#endif - i = (int) XawToggleGetCurrent(range_all_radio[act]); - - if (i != 0) { - ASSERT(i != PRINT_MARKED || i != SAVE_MARKED || pageinfo_have_marked_pages(), - "PRINT_MARKED or SAVE_MARKED shouldn't be togglable if there are no marked pages!"); + if (get_widget_by_name(&radio_all, info->shell, Xdvi_PAGES_ALL_RADIO_NAME, True) + && get_widget_by_name(&radio_selected, info->shell, Xdvi_PAGES_MARKED_RADIO_NAME, True) + && get_widget_by_name(&radio_range, info->shell, Xdvi_PAGES_RANGE_RADIO_NAME, True)) { - if (act == FILE_PRINT) - curr_pr_info.range_radio = i; - else - curr_save_info.range_radio = i; +#ifdef MOTIF + XmToggleButtonGadgetSetState(radio_all, radio_all == w, False); + XmToggleButtonGadgetSetState(radio_selected, radio_selected == w, False); + XmToggleButtonGadgetSetState(radio_range, radio_range == w, False); +#endif } -#endif /* MOTIF */ + /* update_page_range_sensitivity(info->shell, radio_range == w); */ } static void set_filename_callback(const char *fname, void *data) { + /* fprintf(stderr, "Filename: |%s|; widget: %p\n", fname, data); */ if (fname != NULL) { Widget w = (Widget)data; - XtVaSetValues(w, #ifdef MOTIF - XmNvalue, fname, - XmNcursorPosition, strlen(fname), + XtVaSetValues(w, XmNvalue, fname, XmNcursorPosition, strlen(fname), NULL); #else - XtNstring, fname, + XtVaSetValues(w, XtNstring, fname, NULL); + XawTextSetInsertionPoint(w, strlen(fname)); #endif - NULL); } } @@ -859,735 +545,122 @@ set_filename_callback(const char *fname, void *data) static void cb_browse(Widget w, XtPointer client_data, XtPointer call_data) { -/* char *fname; */ struct save_or_print_info *info = (struct save_or_print_info *)client_data; printOrSaveActionT act = info->act; -/* Widget ret_widget; */ - Widget parent; + Widget file_text; + /* static so that we can pass its address */ + static struct filesel_callback cb[2] = { + { NULL, NULL, + "xdvik: Save to file", "Save to file:", "OK", "Cancel", + NULL, NULL, False, False, NULL, NULL }, + { NULL, NULL, + "xdvik: Print to file", "Print to file:", "OK", "Cancel", + NULL, "*.ps", False, False, NULL, NULL } + }; UNUSED(call_data); -#ifdef MOTIF - UNUSED(w); -#else + + /* switch on `to file' radio button */ if (act == FILE_PRINT) - xaw_print_handle_key(w, (XtPointer)"3", NULL, NULL); -#endif + text_print_vs_save_callback(w, (XtPointer)info, NULL, NULL); + + if (!get_widget_by_name(&file_text, info->shell, Xdvi_TO_FILE_TEXT, True)) + return; if (act == FILE_SAVE) { - static struct filesel_callback cb; /* static so that we can pass its address */ - cb.title = "Xdvi: Save to file"; - cb.prompt = "Save to file:"; - cb.ok = "OK"; - cb.cancel = "Cancel"; - cb.init_path = NULL; - cb.filemask = "*.dvi"; - cb.must_exist = False; - cb.exit_on_cancel = False; - cb.func_ptr = set_filename_callback; - cb.data = print_to_file_text[act]; - - if (!get_widget_by_name(&parent, globals.widgets.top_level, Xdvi_SAVE_SHELL_NAME, True)) - parent = globals.widgets.top_level; - XsraSelFile(parent, &cb); -/* fprintf(stderr, "done saving: return widget = %p\n", ret_widget); */ + if (resource.default_saving_format == FMT_PS) + cb[0].filemask = "*.ps"; + else if (resource.default_saving_format == FMT_PS2PDF) + cb[0].filemask = "*.pdf"; + else if (resource.default_saving_format == FMT_DVI) + cb[0].filemask = "*.dvi"; + else + cb[0].filemask = "*.txt"; + cb[0].func_ptr = set_filename_callback; + cb[0].data = file_text; + cb[0].browse_fname = xt_strdup(globals.cwd); + + /* fprintf(stderr, "==== text widget save: %p; shell: %p\n", (void *)file_text, (void *)info->shell); */ + if (cb[0].shell == NULL) + cb[0].shell = XsraSelFile(info->shell, &cb[0]); + XsraSelFilePopup(&cb[0]); + /* fprintf(stderr, "done saving: return widget = %p\n", ret_widget); */ } else { - static struct filesel_callback cb; /* static so that we can pass its address */ - cb.title = "Xdvi: Print to file"; - cb.prompt = "Print to file:"; - cb.ok = "OK"; - cb.cancel = "Cancel"; - cb.init_path = NULL; - cb.filemask = "*.ps"; - cb.must_exist = False; - cb.exit_on_cancel = False; - cb.func_ptr = set_filename_callback; - cb.data = print_to_file_text[act]; + cb[1].func_ptr = set_filename_callback; + cb[1].data = file_text; + cb[1].init_path = globals.cwd; - if (!get_widget_by_name(&parent, globals.widgets.top_level, Xdvi_PRINT_SHELL_NAME, True)) - parent = globals.widgets.top_level; - XsraSelFile(parent, &cb); -/* fname = XsraSelFile(parent, "Xdvi: Print to file", "Print to file:", */ -/* "OK", "Cancel", */ -/* NULL, */ -/* "*.ps", False, &ret_widget); */ -/* fprintf(stderr, "done printing: return widget = %p\n", ret_widget); */ + /* fprintf(stderr, "==== text widget print: %p; shell: %p\n", (void *)file_text, (void *)info->shell); */ + /* if (!get_widget_by_name(&parent, globals.widgets.top_level, Xdvi_PRINT_SHELL_NAME, True)) */ + /* parent = globals.widgets.top_level; */ + if (cb[1].shell == NULL) + cb[1].shell = XsraSelFile(info->shell, &cb[1]); + XsraSelFilePopup(&cb[1]); } - -/* if (fname != NULL) { */ -/* XtVaSetValues(print_to_file_text[act], */ -/* #ifdef MOTIF */ -/* XmNvalue, fname, XmNcursorPosition, strlen(fname), */ -/* #else */ -/* XtNstring, fname, */ -/* #endif */ -/* NULL); */ -/* } */ -/* free(fname); */ } -/* create a popup dialog for printing a DVI file OR saving pages from a DVI file */ -static Widget -create_print_or_save_window(struct save_or_print_info *info, char *ofstring) +/* create a dialog for printing OR saving */ +#ifdef MOTIF + +static void +motif_create_dialog(struct save_or_print_info *info) { printOrSaveActionT act = info->act; - Widget top_level_shell; Atom WM_DELETE_WINDOW; -#ifndef MOTIF - Widget form, paned, box; - Widget f01form, f02form; /* dummy forms to get indentation consistent */ - Widget r1form; - Widget r1label; - Widget r2form, r3form, r4form = 0; - Widget r4label; - Widget r5label; - Widget r6form; - Widget r61form; - Widget r7form; - char *str; - - XtTranslations xlats, xlats2, wm_translations; - XtAccelerators accels2; - int ddist; - - static Dimension w_avg = 220; - Dimension w_curr; - - /* handy abbrevs */ -#define HORIZONTAL_RESIZING_NO XtNleft, XtChainLeft, XtNright, XtChainLeft -#define HORIZONTAL_RESIZING_YES XtNleft, XtChainLeft, XtNright, XtChainRight -#define VERTICAL_RESIZING_NO XtNtop, XtChainTop, XtNbottom, XtChainTop - - XtAddActions(print_actions, XtNumber(print_actions)); - - if (act == FILE_SAVE) { - str = get_string_va("<Message>WM_PROTOCOLS: WM_save_cancel(%p)\n" - "<Key>Escape:WM_save_cancel(%p)\n" - "<Key>q:WM_save_cancel(%p)", - info, info, info); - wm_translations = XtParseTranslationTable(str); - free(str); - } - else { - str = get_string_va("<Message>WM_PROTOCOLS: WM_print_cancel(%p)\n" - "<Key>Escape:WM_print_cancel(%p)\n" - "<Key>q:WM_print_cancel(%p)", - info, info, info); - wm_translations = XtParseTranslationTable(str); - free(str); - } - - top_level_shell = XtVaCreatePopupShell(act == FILE_SAVE ? Xdvi_SAVE_SHELL_NAME : Xdvi_PRINT_SHELL_NAME, - transientShellWidgetClass, - globals.widgets.top_level, - XtNtitle, act == FILE_SAVE ? "xdvik: Save file" : "xdvik: Print DVI file", - XtNmappedWhenManaged, False, - XtNtransientFor, globals.widgets.top_level, - XtNallowShellResize, True, - XtNtranslations, wm_translations, - NULL); - - WM_DELETE_WINDOW = XInternAtom(XtDisplay(top_level_shell), "WM_DELETE_WINDOW", False); - - paned = XtVaCreateManagedWidget(act == FILE_SAVE ? "save_paned" : "print_paned", - panedWidgetClass, top_level_shell, NULL); - - form = XtVaCreateManagedWidget("form", formWidgetClass, - paned, - XtNallowResize, True, - NULL); - XtVaGetValues(form, XtNdefaultDistance, &ddist, NULL); -/* fprintf(stderr, "form1: %ld\n", (long)form); */ - - xlats = XtParseTranslationTable("<EnterWindow>:highlight(Always)\n" - "<LeaveWindow>:unhighlight()\n" - "<Btn1Down>,<Btn1Up>:set()notify()"); - - if (act == FILE_PRINT) { - str = get_string_va("<Key>Return:printInternal(%p)", info); - xlats2 = XtParseTranslationTable(str); - } - else { - str = get_string_va("<Key>Return:saveInternal(%p)", info); - xlats2 = XtParseTranslationTable(str); - } - free(str); - - if (act == FILE_PRINT) { /* selection `to printer/to file' */ - /* FIXME: set real sizes here */ -/* Dimension w_curr; */ - f01form = XtVaCreateManagedWidget("dummy_print_to_label_form", formWidgetClass, - form, - XtNresizable, True, - XtNborderWidth, 0, - /* XtNvertDistance, 10, */ - HORIZONTAL_RESIZING_YES, - NULL); - r1label = XtVaCreateManagedWidget("print_to", labelWidgetClass, - f01form, - XtNlabel, "Print to: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - NULL); - - r2form = XtVaCreateManagedWidget("print_to_printer_form", formWidgetClass, - form, - XtNresizable, True, - XtNborderWidth, 0, - XtNvertDistance, 0, - XtNfromVert, f01form, - HORIZONTAL_RESIZING_YES, - XtNallowResize, True, - NULL); - - accels2 = XtParseAcceleratorTable("<Btn1Down>,<Btn1Up>:set()notify()"); - - to_printer_radio = XtVaCreateManagedWidget("to_printer", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r2form, - XtNlabel, "Printer: ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioData, PRINT_TO_PRINTER, - XtNstate, resource.default_printing_target == PRINT_TO_PRINTER, - XtNtranslations, xlats, - XtNaccelerators, accels2, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - - XtAddCallback(to_printer_radio, XtNcallback, cb_print_vs_file, NULL); - XtInstallAccelerators(r2form, to_printer_radio); - - print_to_printer_text = XtVaCreateManagedWidget("printer_text", asciiTextWidgetClass, - r2form, - XtNwidth, w_avg, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - /* XtNresize, XawtextResizeWidth, */ - XtNfromHoriz, to_printer_radio, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - /* XtNscrollHorizontal, XawtextScrollAlways, */ - NULL); - XtOverrideTranslations(print_to_printer_text, xlats2); - XtAddEventHandler(print_to_printer_text, KeyPressMask | ButtonPressMask, False, - xaw_print_handle_key, (XtPointer)"2"); - - adjust_vertically(to_printer_radio, print_to_printer_text, ddist); - - r3form = XtVaCreateManagedWidget("print_to_file_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNvertDistance, 0, - XtNfromVert, r2form, - HORIZONTAL_RESIZING_YES, - NULL); - - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r3form, - XtNhighlightThickness, 1, - XtNborderWidth, 0, - XtNlabel, "File: ", - XtNstate, resource.default_printing_target == PRINT_TO_FILE, - XtNradioGroup, to_printer_radio, - XtNradioData, PRINT_TO_FILE, - XtNtranslations, xlats, - XtNaccelerators, accels2, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - XtAddCallback(to_file_radio_or_label[act], XtNcallback, cb_print_vs_file, NULL); - XtInstallAccelerators(r3form, to_file_radio_or_label[act]); - - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", asciiTextWidgetClass, - r3form, - XtNwidth, w_avg, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNfromHoriz, to_file_radio_or_label[act], - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(print_to_file_text[act], xlats2); - XtAddEventHandler(print_to_file_text[act], KeyPressMask | ButtonPressMask, False, - xaw_print_handle_key, (XtPointer)"3"); - } - else { /* not printing, but saving */ - int i; - Dimension max_entry_width = 0; - f01form = XtVaCreateManagedWidget("dummy_save_as_form", formWidgetClass, - form, - XtNresizable, True, - XtNborderWidth, 0, - /* XtNvertDistance, 10, */ - HORIZONTAL_RESIZING_YES, - NULL); - r1label = XtVaCreateManagedWidget("save_as", labelWidgetClass, - f01form, - XtNlabel, "Save as: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - NULL); - r1form = XtVaCreateManagedWidget("save_to_file_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, f01form, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); -/* fprintf(stderr, "formr1: %ld\n", (long)r1form); */ -#if 0 - menu_double_arrow_bitmap - = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), - RootWindowOfScreen(XtScreen(globals.widgets.top_level)), - (char *)menu_double_arrow_bits, MENU_DOUBLE_ARROW_W, MENU_DOUBLE_ARROW_H); -#endif - format_selection_label = XtVaCreateManagedWidget("format_selection_label", labelWidgetClass, - r1form, - XtNlabel, "Format: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - format_selection_button = XtVaCreateManagedWidget("format_selection_button", menuButtonWidgetClass, - r1form, - XtNmenuName, "format_selection_popup", - XtNlabel, output_format_mapping[resource.default_saving_format].fmt_string, - XtNjustify, XtJustifyLeft, - XtNborderWidth, resource.btn_border_width, - XtNfromHoriz, format_selection_label, -#if 0 - XtNhighlightThickness, 0, -#endif - NULL); -#if 0 /* Hack for arrow - menuButtonWidget cannot have a XtNrightBitmap!!! */ - format_selection_b1 = XtVaCreateManagedWidget("format_selection_b1", commandWidgetClass, - r1form, - XtNborderWidth, resource.btn_border_width, - XtNfromHoriz, format_selection_button, - XtNhorizDistance, -1, - XtNhighlightThickness, 0, - XtNbitmap, menu_double_arrow_bitmap, - NULL); - adjust_heights(format_selection_button, format_selection_b1, NULL); -#endif - format_selection_popup = XtCreatePopupShell("format_selection_popup", simpleMenuWidgetClass, - format_selection_button, -/* globals.widgets.top_level, */ - NULL, 0); -#if 0 - XtAddCallback(format_selection_b1, XtNcallback, xaw_popup_menu_cb, format_selection_popup); -#endif - for (i = 1; i < FORMAT_SEL_CNT; i++) { - char name[1024]; - Dimension curr_entry_width; - SNPRINTF(name, sizeof name, "format_selection_pulldown_%d", i); - format_selection_menu[i] = XtVaCreateManagedWidget(name, smeBSBObjectClass, - format_selection_popup, - XtNjustify, XtJustifyLeft, - XtNlabel, - i == resource.default_saving_format - ? output_format_mapping[0].fmt_string - : output_format_mapping[i].fmt_string, - NULL); - XtVaGetValues(format_selection_menu[i], XtNwidth, &curr_entry_width, NULL); - if (curr_entry_width > max_entry_width) - max_entry_width = curr_entry_width; - XtAddCallback(format_selection_menu[i], XtNcallback, select_format_cb, form); - } - XtVaSetValues(format_selection_button, XtNwidth, max_entry_width, NULL); - - r3form = XtVaCreateManagedWidget("to_file_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r1form, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", labelWidgetClass, - r3form, - XtNlabel, "File name: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", asciiTextWidgetClass, - r3form, - XtNwidth, w_avg, - XtNdataCompression, False, - /* XtNvertDistance, ddist + 5, */ - XtNeditType, XawtextEdit, - XtNfromHoriz, to_file_radio_or_label[act], - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(print_to_file_text[act], xlats2); - - - { /* align left edges of format selection pulldown and filename field */ - Dimension w1, w2, w_max; - XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); - XtVaGetValues(to_file_radio_or_label[act], XtNwidth, &w2, NULL); - w_max = MAX(w1, w2); - XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); - XtVaSetValues(print_to_file_text[act], XtNhorizDistance, ddist + (w_max - w2), NULL); - } - } - -#define DIST_1 8 /* FIXME */ - print_to_file_button[act] = XtVaCreateManagedWidget("file_button", commandWidgetClass, - r3form, - XtNlabel, "Browse ...", - XtNfromHoriz, print_to_file_text[act], - XtNhorizDistance, DIST_1, - /* attach to right of form, no resizing: */ - XtNleft, XtChainRight, XtNright, XtChainRight, - VERTICAL_RESIZING_NO, - NULL); - - XtVaGetValues(print_to_file_button[act], XtNwidth, &w_curr, NULL); - XtVaSetValues(print_to_file_text[act], XtNwidth, w_avg - w_curr - DIST_1 - 2, NULL); -#undef DIST_1 - - adjust_vertically(to_file_radio_or_label[act], print_to_file_text[act], ddist + 5); - adjust_vertically(print_to_file_text[act], to_file_radio_or_label[act], ddist + 5); - adjust_vertically(print_to_file_button[act], to_file_radio_or_label[act], ddist + 5); - - XtAddCallback(print_to_file_button[act], XtNcallback, cb_browse, (XtPointer)info); - - /* other dvips options */ - r4form = XtVaCreateManagedWidget("dvips_options_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r3form, - XtNvertDistance, 0, - HORIZONTAL_RESIZING_YES, - NULL); - - r4label = XtVaCreateManagedWidget("dvips_options_name", labelWidgetClass, - r4form, - XtNlabel, "Dvips Options:", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - - dvips_options_text[act] = XtVaCreateManagedWidget("dvips_options_text", asciiTextWidgetClass, - r4form, - XtNwidth, w_avg, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNfromHoriz, r4label, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(dvips_options_text[act], xlats2); - - { /* align left edges of input fields */ - Dimension w1, w2, w3, w_max; - - if (act == FILE_PRINT) - XtVaGetValues(to_printer_radio, XtNwidth, &w1, NULL); - else - XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); - - XtVaGetValues(to_file_radio_or_label[act], XtNwidth, &w2, NULL); - XtVaGetValues(r4label, XtNwidth, &w3, NULL); - - w_max = MAX(MAX(w1, w2), w3); - - if (act == FILE_PRINT) - XtVaSetValues(print_to_printer_text, XtNhorizDistance, ddist + (w_max - w1), NULL); - else - XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); - - XtVaSetValues(print_to_file_text[act], XtNhorizDistance, ddist + (w_max - w2), NULL); - XtVaSetValues(dvips_options_text[act], XtNhorizDistance, ddist + (w_max - w3), NULL); - } - - /* page selection */ - - f02form = XtVaCreateManagedWidget("dummy_pages_form", formWidgetClass, - form, - XtNfromVert, r4form, - XtNresizable, True, - XtNborderWidth, 0, - /* XtNvertDistance, 10, */ - HORIZONTAL_RESIZING_NO, - NULL); - - r5label = XtVaCreateManagedWidget("range_lab", labelWidgetClass, - f02form, - XtNlabel, "Pages:", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - NULL); - - r6form = XtVaCreateManagedWidget("page_range_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, f02form, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - NULL); - - accels2 = XtParseAcceleratorTable("<Btn1Down>,<Btn1Up>:set()notify()"); - range_all_radio[act] = XtVaCreateManagedWidget("range_all", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r6form, - XtNlabel, "All ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioData, act == FILE_PRINT ? PRINT_ALL : SAVE_ALL, - XtNstate, True, /* enable this button by default */ - XtNtranslations, xlats, - XtNaccelerators, accels2, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(range_all_radio[act], XtNcallback, cb_range, (XtPointer)PRINT_ALL); - else - XtAddCallback(range_all_radio[act], XtNcallback, cb_range, (XtPointer)SAVE_ALL); - XtInstallAccelerators(r6form, range_all_radio[act]); - - r61form = XtVaCreateManagedWidget("range_marked_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r6form, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - NULL); - - range_marked_radio[act] = XtVaCreateManagedWidget("range_marked", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - - r61form, - XtNlabel, "Marked ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioGroup, range_all_radio[act], - XtNradioData, act == FILE_PRINT ? PRINT_MARKED : SAVE_MARKED, - XtNtranslations, xlats, - XtNaccelerators, accels2, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(range_marked_radio[act], XtNcallback, cb_range, (XtPointer)PRINT_RANGE); - else - XtAddCallback(range_marked_radio[act], XtNcallback, cb_range, (XtPointer)SAVE_RANGE); - XtInstallAccelerators(r61form, range_marked_radio[act]); - - r7form = XtVaCreateManagedWidget("range_from_to_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r61form, - /* XtNvertDistance, 0, */ - XtNresizable, True, - /* HORIZONTAL_RESIZING_NO, */ - NULL); - - range_from_to_radio[act] = XtVaCreateManagedWidget("range_from_to", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r7form, - XtNlabel, "From: ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioGroup, range_all_radio[act], - XtNradioData, act == FILE_PRINT ? PRINT_RANGE : SAVE_RANGE, - XtNtranslations, xlats, - XtNaccelerators, accels2, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(range_from_to_radio[act], XtNcallback, cb_range, (XtPointer)PRINT_RANGE); - else - XtAddCallback(range_from_to_radio[act], XtNcallback, cb_range, (XtPointer)SAVE_RANGE); - XtInstallAccelerators(r7form, range_from_to_radio[act]); - - page_from_text[act] = XtVaCreateManagedWidget("range_from", asciiTextWidgetClass, - r7form, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNwidth, 50, - XtNfromHoriz, range_from_to_radio[act], - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(page_from_text[act], xlats2); - XtAddEventHandler(page_from_text[act], KeyPressMask | ButtonPressMask, False, - xaw_range_handle_key, (XtPointer)act); - - to_label[act] = XtVaCreateManagedWidget("range_to_lab", labelWidgetClass, - r7form, - XtNlabel, "to: ", - XtNborderWidth, 0, - XtNfromHoriz, page_from_text[act], - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - - page_to_text[act] = XtVaCreateManagedWidget("range_to", asciiTextWidgetClass, - r7form, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNwidth, 50, - XtNfromHoriz, to_label[act], - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(page_to_text[act], xlats2); - XtAddEventHandler(page_to_text[act], KeyPressMask | ButtonPressMask, False, - xaw_range_handle_key, (XtPointer)act); - - of_label[act] = XtVaCreateManagedWidget("range_of", labelWidgetClass, - r7form, - XtNlabel, ofstring, - XtNborderWidth, 0, - XtNresizable, True, - XtNfromHoriz, page_to_text[act], - /* HORIZONTAL_RESIZING_NO, */ - XtNleft, XtChainLeft, - VERTICAL_RESIZING_NO, - NULL); - - adjust_vertically(range_from_to_radio[act], page_from_text[act], ddist); - adjust_vertically(to_label[act], page_from_text[act], ddist); - adjust_vertically(of_label[act], page_from_text[act], ddist); - - /* box for the OK/Cancel button */ - box = XtVaCreateManagedWidget("box", formWidgetClass, - paned, - /* resizing by user isn't needed */ - XtNshowGrip, False, - XtNdefaultDistance, 6, /* some padding */ - /* resizing the window shouldn't influence this box, - * but only the pane widget - */ - XtNskipAdjust, True, - XtNaccelerators, G_accels_cr, - NULL); - - ok_button[act] = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", - commandWidgetClass, box, - XtNlabel, act == FILE_PRINT ? "Print" : "Save", - XtNaccelerators, G_accels_cr, - XtNtop, XtChainTop, - XtNbottom, XtChainBottom, - HORIZONTAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(ok_button[act], XtNcallback, cb_print_or_save, (XtPointer)info); - else - XtAddCallback(ok_button[act], XtNcallback, cb_print_or_save, (XtPointer)info); - - XtInstallAccelerators(form, ok_button[act]); - if (act == FILE_PRINT) - XtInstallAccelerators(print_to_printer_text, ok_button[act]); - XtInstallAccelerators(print_to_file_text[act], ok_button[act]); - - cancel_button[act] = XtVaCreateManagedWidget("cancel", commandWidgetClass, - box, - XtNlabel, "Cancel", - XtNfromHoriz, ok_button[act], - XtNbottom, XtChainBottom, - XtNjustify, XtJustifyRight, - XtNleft, XtChainRight, - XtNright, XtChainRight, - NULL); - if (act == FILE_PRINT) - XtAddCallback(cancel_button[act], XtNcallback, cb_print_cancel, (XtPointer)info); - else - XtAddCallback(cancel_button[act], XtNcallback, cb_save_cancel, (XtPointer)info); - - XtManageChild(top_level_shell); - center_window(top_level_shell, globals.widgets.top_level); - XtMapWidget(top_level_shell); - XSetWMProtocols(XtDisplay(top_level_shell), XtWindow(top_level_shell), &WM_DELETE_WINDOW, 1); - - if (pageinfo_have_marked_pages()) { - XawToggleSetCurrent(range_all_radio[act], - act == FILE_PRINT ? (XtPointer)PRINT_MARKED : (XtPointer)SAVE_MARKED); - } - else if ((act == FILE_PRINT && save_pr_info.range_radio == PRINT_MARKED) - || (act == FILE_SAVE && save_save_info.range_radio == SAVE_MARKED)) { - XawToggleSetCurrent(range_all_radio[act], - act == FILE_PRINT ? (XtPointer)PRINT_ALL : (XtPointer)SAVE_ALL); - } + char *ptr; + char ofstring[1024]; -#else /* not MOTIF */ Widget form, pane, box; - Widget frame1, f1label, f1child; - Widget r4label; - Widget frame2, f2label, f2child; + Widget print_or_save_frame, destination_label, destination_form; + Widget dvips_options_label; + Widget pages_frame, pages_label, pages_form; + Widget print_to_file_text, to_file_radio_or_label; + Widget dvips_options_text; + Widget print_to_file_button; + Widget range_marked_radio, range_from_to_radio, to_printer_radio = NULL, + print_to_printer_text = NULL, format_selection_option = NULL, + print_or_save_range_all_radio, + page_from_text, to_label, page_to_text, of_label, ok_button, cancel_button; + Widget from_label; XmString str; + XmString format_selection_texts[FORMAT_SEL_CNT]; XtTranslations xlats; - + XtAddActions(print_actions, XtNumber(print_actions)); - if (act == FILE_SAVE) { - char *ptr = get_string_va("#override \n<Key>osfCancel:WM_save_cancel(%p)", info); - xlats = XtParseTranslationTable(ptr); - free(ptr); - } - else { - char *ptr = get_string_va("#override \n<Key>osfCancel:WM_print_cancel(%p)", info); - xlats = XtParseTranslationTable(ptr); - free(ptr); - } + ptr = get_string_va("#override \n<Key>osfCancel:WM_cancel(%p)", info); + xlats = XtParseTranslationTable(ptr); + free(ptr); + + if (globals.pageno_correct == 1) + sprintf(ofstring, "of %d physical pages", total_pages); + else + sprintf(ofstring, "of %d to %d pages", globals.pageno_correct, total_pages + globals.pageno_correct - 1); - top_level_shell = XtVaCreatePopupShell(act == FILE_SAVE ? "save_popup" : "print_popup", - xmDialogShellWidgetClass, globals.widgets.top_level, - XmNtitle, act == FILE_SAVE ? "Save file" : "Print DVI file", - XmNallowShellResize, True, - XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ - XmNmappedWhenManaged, False, /* so that we can center it first */ - NULL); + info->shell = XtVaCreatePopupShell(act == FILE_SAVE ? "save_popup" : "print_popup", + xmDialogShellWidgetClass, globals.widgets.top_level, + XmNtitle, act == FILE_SAVE ? "xdvik: Save File" : "xdvik: Print File", + XmNallowShellResize, True, + XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ + XmNmappedWhenManaged, False, /* so that we can center it first */ + NULL); /* make the window manager destroy action just pop down the dialog */ - WM_DELETE_WINDOW = XmInternAtom(XtDisplay(top_level_shell), "WM_DELETE_WINDOW", False); - if (act == FILE_SAVE) - XmAddWMProtocolCallback(top_level_shell, WM_DELETE_WINDOW, cb_save_cancel, (XtPointer)info); - else - XmAddWMProtocolCallback(top_level_shell, WM_DELETE_WINDOW, cb_print_cancel, (XtPointer)info); + WM_DELETE_WINDOW = XmInternAtom(XtDisplay(info->shell), "WM_DELETE_WINDOW", False); + XmAddWMProtocolCallback(info->shell, WM_DELETE_WINDOW, cb_popdown, (XtPointer)info); + pane = XtVaCreateWidget(act == FILE_SAVE ? "save_paned" : "print_paned", - xmPanedWindowWidgetClass, top_level_shell, + xmPanedWindowWidgetClass, info->shell, /* make sashes invisible */ XmNsashWidth, 1, XmNsashHeight, 1, /* turn separator off, since it gives visual noise with the frames */ XmNseparatorOn, False, NULL); - + form = XtVaCreateWidget("form", xmFormWidgetClass, pane, @@ -1600,137 +673,138 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) if (act == FILE_PRINT) { /* First frame: print to printer or file */ - frame1 = XtVaCreateWidget("print_to_frame", xmFrameWidgetClass, form, - XmNmarginWidth, DDIST, - XmNmarginHeight, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); - + print_or_save_frame = XtVaCreateWidget("print_to_frame", xmFrameWidgetClass, form, + XmNmarginWidth, DDIST, + XmNmarginHeight, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + str = XmStringCreateLocalized("Print to:"); - f1label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, - frame1, - XmNchildType, XmFRAME_TITLE_CHILD, - XmNlabelString, str, - NULL); + destination_label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, + print_or_save_frame, + XmNchildType, XmFRAME_TITLE_CHILD, + XmNlabelString, str, + NULL); XmStringFree(str); - - f1child = XtVaCreateWidget("form", xmFormWidgetClass, frame1, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); - + + destination_form = XtVaCreateWidget("destination_form", xmFormWidgetClass, print_or_save_frame, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + str = XmStringCreateLocalized("Printer:"); - to_printer_radio = XtVaCreateManagedWidget("to_printer", - xmToggleButtonGadgetClass, f1child, + to_printer_radio = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_NAME, xmToggleButtonGadgetClass, destination_form, XmNlabelString, str, XmNindicatorType, XmONE_OF_MANY, - XmNset, resource.default_printing_target == PRINT_TO_PRINTER, + XmNset, resource.default_printing_target == TO_PRINTER, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 0, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 0, NULL); XmStringFree(str); - XtAddCallback(to_printer_radio, XmNvalueChangedCallback, cb_print_vs_file, (XtPointer)1); - + XtAddCallback(to_printer_radio, XmNvalueChangedCallback, cb_print_vs_save, (XtPointer)info); + XtOverrideTranslations(to_printer_radio, xlats); - - print_to_printer_text = XtVaCreateManagedWidget("print_text", xmTextFieldWidgetClass, - f1child, + + print_to_printer_text = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_TEXT, xmTextFieldWidgetClass, destination_form, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 0, XmNleftAttachment, XmATTACH_WIDGET, XmNrightAttachment, XmATTACH_FORM, XmNleftWidget, to_printer_radio, + /* XmNsensitive, resource.default_printing_target == TO_PRINTER, */ XTranslations, xlats, NULL); - XtAddCallback(print_to_printer_text, XmNactivateCallback, cb_print_or_save, info); + XtAddCallback(print_to_printer_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(print_to_printer_text, XmNfocusCallback, cb_text_print_vs_save, (XtPointer)info); adjust_heights(to_printer_radio, print_to_printer_text, NULL); - str = XmStringCreateLocalized("File:"); - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", xmToggleButtonGadgetClass, - f1child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, print_to_printer_text, - XmNleftAttachment, XmATTACH_FORM, - XmNset, resource.default_printing_target == PRINT_TO_FILE, - XmNleftOffset, 0, - NULL); + str = XmStringCreateLocalized("PS File:"); + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, xmToggleButtonGadgetClass, destination_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_to_printer_text, + XmNleftAttachment, XmATTACH_FORM, + XmNset, resource.default_printing_target == TO_FILE, + XmNleftOffset, 0, + NULL); XmStringFree(str); - XtAddCallback(to_file_radio_or_label[act], XmNvalueChangedCallback, cb_print_vs_file, (XtPointer)2); - + XtAddCallback(to_file_radio_or_label, XmNvalueChangedCallback, cb_print_vs_save, (XtPointer)info); + str = XmStringCreateLocalized("Browse ..."); - print_to_file_button[act] = XtVaCreateManagedWidget("file_button", xmPushButtonWidgetClass, - f1child, - XmNlabelString, str, - XmNsensitive, resource.default_printing_target == PRINT_TO_FILE, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, print_to_printer_text, - XmNrightAttachment, XmATTACH_FORM, - NULL); + print_to_file_button = XtVaCreateManagedWidget(Xdvi_BROWSE_BUTTON, xmPushButtonWidgetClass, destination_form, + XmNlabelString, str, + /* XmNsensitive, resource.default_printing_target == TO_FILE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_to_printer_text, + XmNrightAttachment, XmATTACH_FORM, + NULL); XmStringFree(str); - - XtOverrideTranslations(to_file_radio_or_label[act], xlats); - XtOverrideTranslations(print_to_file_button[act], xlats); - - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", xmTextFieldWidgetClass, - f1child, - XmNsensitive, resource.default_printing_target == PRINT_TO_FILE, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, print_to_printer_text, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, print_to_file_button[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, to_file_radio_or_label[act], - XTranslations, xlats, - NULL); - - adjust_heights(to_file_radio_or_label[act], print_to_file_button[act], print_to_file_text[act], NULL); - - XtAddCallback(print_to_file_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - XtAddCallback(print_to_file_button[act], XmNactivateCallback, cb_browse, (XtPointer)info); - - XtManageChild(f1child); - XtManageChild(frame1); - - } /* saving, not printing */ - else { - frame1 = XtVaCreateWidget("save_as_frame", xmFrameWidgetClass, - form, - XmNmarginWidth, DDIST, - XmNmarginHeight, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - + + XtOverrideTranslations(to_file_radio_or_label, xlats); + XtOverrideTranslations(print_to_file_button, xlats); + + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, xmTextFieldWidgetClass, destination_form, + /* XmNsensitive, resource.default_printing_target == TO_FILE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_to_printer_text, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, print_to_file_button, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, to_file_radio_or_label, + XTranslations, xlats, + NULL); + + adjust_heights(to_file_radio_or_label, print_to_file_button, print_to_file_text, NULL); + + XtAddCallback(print_to_file_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(print_to_file_text, XmNfocusCallback, cb_text_print_vs_save, (XtPointer)info); + XtAddCallback(print_to_file_button, XmNactivateCallback, cb_browse, (XtPointer)info); + + XtManageChild(destination_form); + XtManageChild(print_or_save_frame); + + /* initial value for printer name */ + XtVaSetValues(print_to_printer_text, + XmNvalue, info->printer_options, + XmNcursorPosition, strlen(info->printer_options), + NULL); + } + else { /* saving, not printing */ + print_or_save_frame = XtVaCreateWidget("save_as_frame", xmFrameWidgetClass, form, + XmNmarginWidth, DDIST, + XmNmarginHeight, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + NULL); + str = XmStringCreateLocalized("Save as:"); - f1label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, - frame1, - XmNchildType, XmFRAME_TITLE_CHILD, - XmNlabelString, str, - NULL); + destination_label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, print_or_save_frame, + XmNchildType, XmFRAME_TITLE_CHILD, + XmNlabelString, str, + NULL); XmStringFree(str); - f1child = XtVaCreateWidget("form", xmFormWidgetClass, frame1, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); -/* fprintf(stderr, "CHILD: 0x%x\n", (long)f1child); */ + destination_form = XtVaCreateWidget("destination_form", xmFormWidgetClass, print_or_save_frame, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + /* fprintf(stderr, "CHILD: 0x%x\n", (long)destination_form); */ str = XmStringCreateLocalized("Format:"); format_selection_texts[0] = XmStringCreateLocalized((char *)output_format_mapping[0].fmt_string); format_selection_texts[1] = XmStringCreateLocalized((char *)output_format_mapping[1].fmt_string); @@ -1738,17 +812,18 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) format_selection_texts[3] = XmStringCreateLocalized((char *)output_format_mapping[3].fmt_string); format_selection_texts[4] = XmStringCreateLocalized((char *)output_format_mapping[4].fmt_string); format_selection_option - = XmVaCreateSimpleOptionMenu(f1child, "format_selection_option", + = XmVaCreateSimpleOptionMenu(destination_form, "format_selection_option", str, 'F', resource.default_saving_format, /*initial menu selection*/ - select_format_cb, /* callback */ + cb_select_format, /* callback */ XmVaPUSHBUTTON, format_selection_texts[0], 'P', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[1], 'F', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[2], 'D', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[3], 'T', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[4], 'U', NULL, NULL, + XmNuserData, (XtPointer)info, NULL); - + XmStringFree(str); XmStringFree(format_selection_texts[0]); XmStringFree(format_selection_texts[1]); @@ -1757,44 +832,46 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) XmStringFree(format_selection_texts[4]); str = XmStringCreateLocalized("File name:"); - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", xmLabelGadgetClass, - f1child, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, format_selection_option, - XmNleftAttachment, XmATTACH_FORM, - /* XmNchildType, XmFRAME_TITLE_CHILD, */ - XmNlabelString, str, - NULL); + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, xmLabelGadgetClass, destination_form, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, format_selection_option, + XmNleftAttachment, XmATTACH_FORM, + /* XmNchildType, XmFRAME_TITLE_CHILD, */ + XmNlabelString, str, + NULL); XmStringFree(str); str = XmStringCreateLocalized("Browse ..."); - print_to_file_button[act] = XtVaCreateManagedWidget("file_button", xmPushButtonWidgetClass, - f1child, - XmNlabelString, str, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, format_selection_option, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", xmTextFieldWidgetClass, - f1child, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, format_selection_option, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, to_file_radio_or_label[act], - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, print_to_file_button[act], - XTranslations, xlats, - NULL); - - adjust_heights(to_file_radio_or_label[act], print_to_file_button[act], print_to_file_text[act], NULL); - XtAddCallback(print_to_file_button[act], XmNactivateCallback, cb_browse, (XtPointer)info); + print_to_file_button = XtVaCreateManagedWidget(Xdvi_BROWSE_BUTTON, xmPushButtonWidgetClass, destination_form, + XmNlabelString, str, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, format_selection_option, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, xmTextFieldWidgetClass, destination_form, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, format_selection_option, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, to_file_radio_or_label, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, print_to_file_button, + XTranslations, xlats, + NULL); + + adjust_heights(to_file_radio_or_label, print_to_file_button, print_to_file_text, NULL); + XtAddCallback(print_to_file_button, XmNactivateCallback, cb_browse, (XtPointer)info); } - -#if 1 + + /* initial value for filename */ + XtVaSetValues(print_to_file_text, + XmNvalue, info->finfo->out_file, + XmNcursorPosition, strlen(info->finfo->out_file), + NULL); + { /* align left edges of widgets */ Dimension w1, w2; - - XtVaGetValues(to_file_radio_or_label[act], XmNwidth, &w2, NULL); + + XtVaGetValues(to_file_radio_or_label, XmNwidth, &w2, NULL); if (act == FILE_PRINT) XtVaGetValues(to_printer_radio, XmNwidth, &w1, NULL); else { @@ -1806,11 +883,11 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) w1 = w2; } } - + if (w1 > w2) { Dimension offset = DDIST; offset += w1 - w2; - XtVaSetValues(print_to_file_text[act], XmNleftOffset, offset, NULL); + XtVaSetValues(print_to_file_text, XmNleftOffset, offset, NULL); } else if (w2 > w1) { Dimension offset = DDIST; @@ -1824,534 +901,926 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) Dimension curr_w; XtVaGetValues(w, XmNwidth, &curr_w, NULL); XtVaSetValues(w, XmNwidth, curr_w + offset, NULL); - */ + */ /* fprintf(stderr, "Setting width from %d to: %d\n", curr_w, curr_w + offset); */ XtVaSetValues(w, XmNmarginRight, offset, XmNalignment, XmALIGNMENT_BEGINNING, NULL); } - + } } } -#endif /* 0 */ if (act == FILE_SAVE) { XtManageChild(format_selection_option); - XtManageChild(f1child); - XtManageChild(frame1); + XtManageChild(destination_form); + XtManageChild(print_or_save_frame); } - + /* additional dvips options */ str = XmStringCreateLocalized("Dvips Options:"); - r4label = XtVaCreateManagedWidget("dvips_options_name", xmLabelGadgetClass, - form, - XmNlabelString, str, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, frame1, - XmNleftAttachment, XmATTACH_FORM, - NULL); + dvips_options_label = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_NAME, xmLabelGadgetClass, form, + XmNlabelString, str, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_or_save_frame, + XmNleftAttachment, XmATTACH_FORM, + NULL); XmStringFree(str); - - dvips_options_text[act] = XtVaCreateManagedWidget("dvips_options_text", xmTextFieldWidgetClass, - form, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, frame1, - XmNleftAttachment, XmATTACH_WIDGET, - XmNrightAttachment, XmATTACH_FORM, - XmNleftWidget, r4label, - XmNcolumns, 20, - XTranslations, xlats, - NULL); - XtAddCallback(dvips_options_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - adjust_heights(r4label, dvips_options_text[act], NULL); - + + dvips_options_text = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_TEXT, xmTextFieldWidgetClass, form, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_or_save_frame, + XmNleftAttachment, XmATTACH_WIDGET, + XmNrightAttachment, XmATTACH_FORM, + XmNleftWidget, dvips_options_label, + XmNcolumns, 20, + XTranslations, xlats, + NULL); + XtAddCallback(dvips_options_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + adjust_heights(dvips_options_label, dvips_options_text, NULL); + + /* initial value for dvips options */ + XtVaSetValues(dvips_options_text, + XmNvalue, info->dvips_options, + XmNcursorPosition, strlen(info->dvips_options), + NULL); + /* page selection */ - frame2 = XtVaCreateWidget(act == FILE_PRINT ? "print_page_frame" : "save_page_frame", xmFrameWidgetClass, - form, - XmNmarginWidth, DDIST, - XmNmarginHeight, DDIST, - XmNresizable, True, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, dvips_options_text[act], - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); + pages_frame = XtVaCreateWidget(act == FILE_PRINT ? "print_page_frame" : "save_page_frame", xmFrameWidgetClass, form, + XmNmarginWidth, DDIST, + XmNmarginHeight, DDIST, + XmNresizable, True, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, dvips_options_text, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); str = XmStringCreateLocalized("Pages:"); - f2label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, - frame2, - XmNchildType, XmFRAME_TITLE_CHILD, - XmNlabelString, str, - NULL); + pages_label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, pages_frame, + XmNchildType, XmFRAME_TITLE_CHILD, + XmNlabelString, str, + NULL); XmStringFree(str); - f2child = XtVaCreateWidget("form", xmFormWidgetClass, frame2, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNresizable, True, - XTranslations, xlats, - XTranslations, xlats, - NULL); + pages_form = XtVaCreateWidget("pages_form", xmFormWidgetClass, pages_frame, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNresizable, True, + XTranslations, xlats, + NULL); str = XmStringCreateLocalized("All"); - range_all_radio[act] = XtVaCreateManagedWidget("all", - xmToggleButtonGadgetClass, f2child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNset, True, - XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, 0, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 0, - XTranslations, xlats, - NULL); + print_or_save_range_all_radio = XtVaCreateManagedWidget(Xdvi_PAGES_ALL_RADIO_NAME, xmToggleButtonGadgetClass, pages_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNset, True, + XmNtopAttachment, XmATTACH_FORM, + XmNtopOffset, 0, + XmNleftAttachment, XmATTACH_FORM, + XmNleftOffset, 0, + XTranslations, xlats, + NULL); XmStringFree(str); - if (act == FILE_PRINT) { - XtAddCallback(range_all_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)PRINT_ALL); - } - else { - XtAddCallback(range_all_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)SAVE_ALL); - } + XtAddCallback(print_or_save_range_all_radio, XmNvalueChangedCallback, cb_range, (XtPointer)info); str = XmStringCreateLocalized("Marked"); - range_marked_radio[act] = XtVaCreateManagedWidget("marked", - xmToggleButtonGadgetClass, f2child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_all_radio[act], - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 0, - XTranslations, xlats, - NULL); + range_marked_radio = XtVaCreateManagedWidget(Xdvi_PAGES_MARKED_RADIO_NAME, xmToggleButtonGadgetClass, pages_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNsensitive, pageinfo_have_marked_pages(), + XmNtopWidget, print_or_save_range_all_radio, + XmNleftAttachment, XmATTACH_FORM, + XmNleftOffset, 0, + XTranslations, xlats, + NULL); XmStringFree(str); - if (act == FILE_PRINT) { - XtAddCallback(range_marked_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)PRINT_MARKED); - } - else { - XtAddCallback(range_marked_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)SAVE_MARKED); - } - + XtAddCallback(range_marked_radio, XmNvalueChangedCallback, cb_range, (XtPointer)info); + str = XmStringCreateLocalized("Range:"); - range_from_to_radio[act] = XtVaCreateManagedWidget("range", - xmToggleButtonGadgetClass, f2child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 0, - XTranslations, xlats, - NULL); + range_from_to_radio = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_RADIO_NAME, xmToggleButtonGadgetClass, pages_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_FORM, + XmNleftOffset, 0, + XTranslations, xlats, + NULL); XmStringFree(str); - if (act == FILE_PRINT) { - XtAddCallback(range_from_to_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)PRINT_RANGE); - } - else { - XtAddCallback(range_from_to_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)SAVE_RANGE); - } + XtAddCallback(range_from_to_radio, XmNvalueChangedCallback, cb_range, (XtPointer)info); + str = XmStringCreateLocalized("From"); - from_label[act] = XtVaCreateManagedWidget("from", xmLabelGadgetClass, - f2child, - XmNlabelString, str, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, range_from_to_radio[act], - NULL); + from_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_FROM_LABEL_NAME, xmLabelGadgetClass, pages_form, + XmNlabelString, str, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, range_from_to_radio, + NULL); XmStringFree(str); - page_from_text[act] = XtVaCreateManagedWidget("from_page", - xmTextFieldWidgetClass, f2child, - XmNcolumns, 5, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, from_label[act], - XTranslations, xlats, - NULL); - XtAddCallback(page_from_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); + page_from_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_FROM_TEXT_NAME, xmTextFieldWidgetClass, pages_form, + XmNcolumns, 5, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, from_label, + XTranslations, xlats, + NULL); + XtAddCallback(page_from_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(page_from_text, XmNfocusCallback, cb_text_page_range, (XtPointer)info); str = XmStringCreateLocalized("to"); - to_label[act] = XtVaCreateManagedWidget("to", xmLabelGadgetClass, - f2child, - XmNlabelString, str, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, page_from_text[act], - NULL); + to_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_LABEL_NAME, xmLabelGadgetClass, pages_form, + XmNlabelString, str, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, page_from_text, + NULL); XmStringFree(str); - page_to_text[act] = XtVaCreateManagedWidget("to_page", xmTextFieldWidgetClass, - f2child, - XmNcolumns, 5, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, to_label[act], - XTranslations, xlats, - NULL); - XtAddCallback(page_to_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); + page_to_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_TEXT_NAME, xmTextFieldWidgetClass, pages_form, + XmNcolumns, 5, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, to_label, + XTranslations, xlats, + NULL); + XtAddCallback(page_to_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(page_to_text, XmNfocusCallback, cb_text_page_range, (XtPointer)info); str = XmStringCreateLocalized(ofstring); - of_label[act] = XtVaCreateManagedWidget("of", xmLabelGadgetClass, - f2child, - XmNlabelString, str, - XmNsensitive, False, - XmNresizable, True, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, page_to_text[act], - NULL); + of_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_OF_LABEL_NAME, xmLabelGadgetClass, pages_form, + XmNlabelString, str, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNresizable, True, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, page_to_text, + NULL); XmStringFree(str); - adjust_heights(range_from_to_radio[act], - from_label[act], page_from_text[act], - to_label[act], page_to_text[act], - of_label[act], + adjust_heights(range_from_to_radio, + from_label, page_from_text, + to_label, page_to_text, + of_label, NULL); - XtManageChild(f2child); - XtManageChild(frame2); + XtManageChild(pages_form); + XtManageChild(pages_frame); /* box for the OK/Cancel button */ - box = XtVaCreateManagedWidget("box", xmFormWidgetClass, - pane, + box = XtVaCreateManagedWidget("box", xmFormWidgetClass, pane, XmNskipAdjust, True, /* don't resize this area */ XTranslations, xlats, NULL); - - if (act == FILE_PRINT) - str = XmStringCreateLocalized("Print"); - else - str = XmStringCreateLocalized("Save"); - ok_button[act] = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNshowAsDefault, True, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNleftOffset, 10, - NULL); + + str = XmStringCreateLocalized(act == FILE_PRINT ? "Print" : "Save"); + + ok_button = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNshowAsDefault, True, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + /* to mimick appearance of native dialog buttons: */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNleftOffset, 10, + NULL); XmStringFree(str); - if (act == FILE_PRINT) - XtAddCallback(ok_button[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - else - XtAddCallback(ok_button[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - - XtOverrideTranslations(ok_button[act], XtParseTranslationTable("<Key>Return:ArmAndActivate()")); + + XtAddCallback(ok_button, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtOverrideTranslations(ok_button, XtParseTranslationTable("<Key>Return:ArmAndActivate()")); str = XmStringCreateLocalized("Cancel"); - cancel_button[act] = XtVaCreateManagedWidget("cancel", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNrightOffset, 10, - NULL); + cancel_button = XtVaCreateManagedWidget("cancel", xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + /* to mimick appearance of native dialog buttons: */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNrightOffset, 10, + NULL); XmStringFree(str); + + XtOverrideTranslations(print_or_save_range_all_radio, xlats); + XtOverrideTranslations(range_marked_radio, xlats); + XtOverrideTranslations(range_from_to_radio, xlats); + XtOverrideTranslations(ok_button, xlats); + XtOverrideTranslations(cancel_button, xlats); - XtOverrideTranslations(range_all_radio[act], xlats); - XtOverrideTranslations(range_marked_radio[act], xlats); - XtOverrideTranslations(range_from_to_radio[act], xlats); - XtOverrideTranslations(ok_button[act], xlats); - XtOverrideTranslations(cancel_button[act], xlats); - - if (act == FILE_PRINT) - XtAddCallback(cancel_button[act], XmNactivateCallback, cb_print_cancel, (XtPointer)info); - else - XtAddCallback(cancel_button[act], XmNactivateCallback, cb_save_cancel, (XtPointer)info); + XtAddCallback(cancel_button, XmNactivateCallback, cb_popdown, (XtPointer)info); { /* make the buttons the same size: */ Dimension w1, w2; - XtVaGetValues(ok_button[act], XtNwidth, &w1, NULL); - XtVaGetValues(cancel_button[act], XtNwidth, &w2, NULL); + XtVaGetValues(ok_button, XtNwidth, &w1, NULL); + XtVaGetValues(cancel_button, XtNwidth, &w2, NULL); if (w1 < w2) - XtVaSetValues(ok_button[act], XtNwidth, w2, NULL); + XtVaSetValues(ok_button, XtNwidth, w2, NULL); else if (w2 > w1) - XtVaSetValues(cancel_button[act], XtNwidth, w1, NULL); + XtVaSetValues(cancel_button, XtNwidth, w1, NULL); } - + if (pageinfo_have_marked_pages()) { - XmToggleButtonGadgetSetState(range_marked_radio[act], True, True); + XmToggleButtonGadgetSetState(range_marked_radio, True, True); } - else if (save_pr_info.range_radio == PRINT_MARKED) { - XmToggleButtonGadgetSetState(range_all_radio[act], True, True); + else if (info->page_selection == PAGE_MARKED) { + XmToggleButtonGadgetSetState(print_or_save_range_all_radio, True, True); } XtManageChild(form); XtManageChild(pane); - center_window(top_level_shell, globals.widgets.top_level); - XtMapWidget(top_level_shell); - XmProcessTraversal(ok_button[act], XmTRAVERSE_CURRENT); -#endif /* not MOTIF */ + center_window(info->shell, globals.widgets.top_level); + XtMapWidget(info->shell); + XmProcessTraversal(ok_button, XmTRAVERSE_CURRENT); + + /* if (act == FILE_PRINT) { */ + /* if (resource.default_printing_target == TO_PRINTER) */ + /* XmProcessTraversal(print_to_printer_text, XmTRAVERSE_CURRENT); */ + /* else */ + /* XmProcessTraversal(print_to_file_text, XmTRAVERSE_CURRENT); */ + /* } */ +} - /* set default output format */ - save_save_info.output_format = curr_save_info.output_format = - output_format_mapping[resource.default_saving_format].fmt; - - if (act == FILE_SAVE) - update_dvips_options_sensitivity(resource.default_saving_format, top_level_shell); - - return top_level_shell; -} -#undef HORIZONTAL_RESIZING_NO -#undef HORIZONTAL_RESIZING_YES -#undef VERTICAL_RESIZING_NO - - -static void -set_target_radio(struct dialog_info *save_info, struct dialog_info *curr_info, printOrSaveActionT act) -{ -#ifdef MOTIF - if (save_info->print_radio > 0 && save_info->print_radio != curr_info->print_radio) { - XmToggleButtonGadgetSetState(save_info->print_radio == PRINT_TO_PRINTER - ? to_printer_radio - : to_file_radio_or_label[act], True, True); - } #else /* MOTIF */ - UNUSED(act); - UNUSED(curr_info); - XawToggleSetCurrent(to_printer_radio, (XtPointer)save_info->print_radio); -#endif /* MOTIF */ -} - + static void -set_range_radio(struct dialog_info *save_info, struct dialog_info *curr_info, printOrSaveActionT act) -{ -#ifdef MOTIF - if (save_info->range_radio > 0 && save_info->range_radio != curr_info->range_radio) { - Widget selected = 0; - switch (save_info->range_radio) { - case PRINT_ALL: - case SAVE_ALL: - selected = range_all_radio[act]; - break; - case PRINT_MARKED: - case SAVE_MARKED: - selected = range_marked_radio[act]; - break; - case PRINT_RANGE: - case SAVE_RANGE: - selected = range_from_to_radio[act]; - break; - default: - ASSERT(0, "wrong button type in set_range_radio()"); - } - XmToggleButtonGadgetSetState(selected, True, True); - } -#else /* MOTIF */ - UNUSED(curr_info); - XawToggleSetCurrent(range_all_radio[act], (XtPointer)save_info->range_radio); -#endif /* MOTIF */ -} - -void -save_or_print_callback(struct save_or_print_info *info) +xaw_create_dialog(struct save_or_print_info *info) { printOrSaveActionT act = info->act; - static char ofstring[1024]; /* should be ample */ - struct dialog_info *save_info = NULL, *curr_info = NULL; - - if (act == FILE_PRINT) { - save_info = &save_pr_info; - curr_info = &curr_pr_info; - if (print_is_active) { - XBell(DISP, 0); - XRaiseWindow(DISP, XtWindow(print_shell)); - return; - } + Atom WM_DELETE_WINDOW; + char *ptr; + char ofstring[1024]; + + Widget form, paned, box; + Widget dummy_label_form, dummy_pages_form; /* dummy forms to get indentation consistent */ + Widget save_to_file_form; + Widget dest_label; + Widget print_to_printer_form, print_to_file_form, dvips_options_form; + Widget dvips_options_label; + Widget range_label; + Widget page_range_form; + Widget range_marked_form; + Widget range_from_to_form; + Widget print_to_file_text, to_file_radio_or_label; + Widget dvips_options_text; + Widget print_to_file_button; + Widget format_selection_menu[FORMAT_SEL_CNT]; + Widget format_selection_label = NULL, format_selection_button = NULL, format_selection_popup; + Widget range_marked_radio, range_from_to_radio, to_printer_radio = NULL, print_to_printer_text = NULL, + print_or_save_range_all_radio, + page_from_text, to_label, page_to_text, of_label, ok_button, cancel_button; + + XtTranslations xlats, xlats2, wm_translations; + XtAccelerators accels2; + int ddist; - if (printlog_raise_active()) { - XBell(DISP, 0); - return; - } - } - else if (act == FILE_SAVE) { - save_info = &save_save_info; - curr_info = &curr_save_info; - if (save_is_active) { - XBell(DISP, 0); - XRaiseWindow(DISP, XtWindow(save_shell)); - return; - } - } - else { - ASSERT(0, "wrong action type in save_or_print_callback()"); - } + static Dimension w_avg = 220; + Dimension w_curr; + + /* handy abbrevs */ +#define HORIZONTAL_RESIZING_NO XtNleft, XtChainLeft, XtNright, XtChainLeft +#define HORIZONTAL_RESIZING_YES XtNleft, XtChainLeft, XtNright, XtChainRight +#define VERTICAL_RESIZING_NO XtNtop, XtChainTop, XtNbottom, XtChainTop - if (globals.dvi_file.bak_fp == NULL) { - popup_message(globals.widgets.top_level, - MSG_ERR, - NULL, - "Empty or incomplete DVI file. " - "Please select a new DVI file via File -> Open."); - return; - } + XtAddActions(print_actions, XtNumber(print_actions)); if (globals.pageno_correct == 1) sprintf(ofstring, "of %d physical pages", total_pages); else sprintf(ofstring, "of %d to %d pages", globals.pageno_correct, total_pages + globals.pageno_correct - 1); + + ptr = get_string_va("<Message>WM_PROTOCOLS: WM_cancel(%p)\n" + "<Key>Escape:WM_cancel(%p)\n" + "<Key>q:WM_cancel(%p)", + info, info, info); + wm_translations = XtParseTranslationTable(ptr); + free(ptr); + + info->shell = XtVaCreatePopupShell(act == FILE_SAVE ? Xdvi_SAVE_SHELL_NAME : Xdvi_PRINT_SHELL_NAME, + transientShellWidgetClass, globals.widgets.top_level, + XtNtitle, act == FILE_SAVE ? "xdvik: Save File" : "xdvik: Print File", + XtNmappedWhenManaged, False, + XtNtransientFor, globals.widgets.top_level, + XtNallowShellResize, True, + XtNtranslations, wm_translations, + NULL); + + WM_DELETE_WINDOW = XInternAtom(XtDisplay(info->shell), "WM_DELETE_WINDOW", False); + + paned = XtVaCreateManagedWidget("paned", panedWidgetClass, info->shell, NULL); + + form = XtVaCreateManagedWidget("save_or_print_form", formWidgetClass, paned, + XtNallowResize, True, + NULL); + XtVaGetValues(form, XtNdefaultDistance, &ddist, NULL); + /* fprintf(stderr, "form1: %ld\n", (long)form); */ + + xlats = XtParseTranslationTable("<EnterWindow>:highlight(Always)\n" + "<LeaveWindow>:unhighlight()\n" + "<Btn1Down>,<Btn1Up>:set()notify()"); - if (act == FILE_PRINT && print_shell == NULL) { - curr_info->print_radio = resource.default_printing_target; - print_shell = create_print_or_save_window(info, ofstring); -#ifdef MOTIF - set_sensitivity(resource.default_printing_target); + ptr = get_string_va("<Key>Return:xaw_print_or_save(%p)", info); + xlats2 = XtParseTranslationTable(ptr); + free(ptr); + + if (act == FILE_PRINT) { /* selection `to printer/to file' */ + /* FIXME: set real sizes here */ + /* Dimension w_curr; */ + dummy_label_form = XtVaCreateManagedWidget("dummy_print_to_label_form", formWidgetClass, form, + XtNresizable, True, + XtNborderWidth, 0, + HORIZONTAL_RESIZING_YES, + NULL); + dest_label = XtVaCreateManagedWidget("print_to", labelWidgetClass, dummy_label_form, + XtNlabel, "Print to: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + NULL); + + print_to_printer_form = XtVaCreateManagedWidget("print_to_printer_form", formWidgetClass, form, + XtNresizable, True, + XtNborderWidth, 0, + XtNvertDistance, 0, + XtNfromVert, dummy_label_form, + HORIZONTAL_RESIZING_YES, + XtNallowResize, True, + NULL); + + accels2 = XtParseAcceleratorTable("<Btn1Down>,<Btn1Up>:set()notify()"); + + to_printer_radio = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + print_to_printer_form, + XtNlabel, "Printer: ", + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioData, TO_PRINTER, + XtNstate, resource.default_printing_target == TO_PRINTER, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + + XtAddCallback(to_printer_radio, XtNcallback, cb_print_vs_save, (XtPointer)info); + XtInstallAccelerators(print_to_printer_form, to_printer_radio); + + print_to_printer_text = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_TEXT, asciiTextWidgetClass, print_to_printer_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + /* XtNresize, XawtextResizeWidth, */ + XtNfromHoriz, to_printer_radio, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + /* XtNscrollHorizontal, XawtextScrollAlways, */ + NULL); + XtOverrideTranslations(print_to_printer_text, xlats2); + XtAddEventHandler(print_to_printer_text, KeyPressMask | ButtonPressMask, False, + text_print_vs_save_callback, (XtPointer)info); + + adjust_vertically(to_printer_radio, print_to_printer_text, ddist); + + print_to_file_form = XtVaCreateManagedWidget("print_to_file_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNvertDistance, -ddist, + XtNfromVert, print_to_printer_form, + HORIZONTAL_RESIZING_YES, + NULL); + + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, #endif + print_to_file_form, + XtNhighlightThickness, 1, + XtNborderWidth, 0, + XtNlabel, "PS File: ", + XtNstate, resource.default_printing_target == TO_FILE, + XtNradioGroup, to_printer_radio, + XtNradioData, TO_FILE, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(to_file_radio_or_label, XtNcallback, cb_print_vs_save, (XtPointer)info); + XtInstallAccelerators(print_to_file_form, to_file_radio_or_label); + + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, asciiTextWidgetClass, print_to_file_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNfromHoriz, to_file_radio_or_label, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(print_to_file_text, xlats2); + XtAddEventHandler(print_to_file_text, KeyPressMask | ButtonPressMask, False, + text_print_vs_save_callback, (XtPointer)info); + + /* initial value for printer name */ + XtVaSetValues(print_to_printer_text, XtNstring, info->printer_options, NULL); + XawTextSetInsertionPoint(print_to_printer_text, strlen(info->printer_options)); } - else if (act == FILE_SAVE && save_shell == NULL) - save_shell = create_print_or_save_window(info, ofstring); - else { /* if the window was already created */ -#ifdef MOTIF - XmString str; + else { /* not printing, but saving */ + int i; + Dimension max_entry_width = 0; + dummy_label_form = XtVaCreateManagedWidget("dummy_save_as_form", formWidgetClass, form, + XtNresizable, True, + XtNborderWidth, 0, + HORIZONTAL_RESIZING_YES, + NULL); + dest_label = XtVaCreateManagedWidget("save_as", labelWidgetClass, dummy_label_form, + XtNlabel, "Save as: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + NULL); + save_to_file_form = XtVaCreateManagedWidget("save_to_file_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, dummy_label_form, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + /* fprintf(stderr, "formr1: %ld\n", (long)save_to_file_form); */ +#if 0 + menu_double_arrow_bitmap + = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), + RootWindowOfScreen(XtScreen(globals.widgets.top_level)), + (char *)menu_double_arrow_bits, MENU_DOUBLE_ARROW_W, MENU_DOUBLE_ARROW_H); #endif - /* XXX: is this actually needed??? */ - /* XXX: To test, remove the following */ - if (!pageinfo_have_marked_pages()) { - if (act == FILE_PRINT && save_pr_info.range_radio == PRINT_MARKED) { - save_pr_info.range_radio = PRINT_ALL; - } - else if (act == FILE_SAVE && save_save_info.range_radio == SAVE_MARKED) { - save_save_info.range_radio = SAVE_ALL; - } + format_selection_label = XtVaCreateManagedWidget("format_selection_label", labelWidgetClass, save_to_file_form, + XtNlabel, "Format: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + format_selection_button = XtVaCreateManagedWidget(Xdvi_FORMAT_SELECTION_BUTTON_NAME, menuButtonWidgetClass, save_to_file_form, + XtNmenuName, "format_selection_popup", + XtNlabel, output_format_mapping[resource.default_saving_format].fmt_string, + XtNjustify, XtJustifyLeft, + XtNborderWidth, resource.btn_border_width, + XtNfromHoriz, format_selection_label, +#if 0 + XtNhighlightThickness, 0, +#endif + NULL); +#if 0 /* Hack for arrow - menuButtonWidget cannot have a XtNrightBitmap!!! */ + format_selection_b1 = XtVaCreateManagedWidget("format_selection_b1", commandWidgetClass, save_to_file_form, + XtNborderWidth, resource.btn_border_width, + XtNfromHoriz, format_selection_button, + XtNhorizDistance, -1, + XtNhighlightThickness, 0, + XtNbitmap, menu_double_arrow_bitmap, + NULL); + adjust_heights(format_selection_button, format_selection_b1, NULL); +#endif + format_selection_popup = XtCreatePopupShell("format_selection_popup", simpleMenuWidgetClass, format_selection_button, + /* globals.widgets.top_level, */ + NULL, 0); +#if 0 + XtAddCallback(format_selection_b1, XtNcallback, xaw_popup_menu_cb, format_selection_popup); +#endif + for (i = 1; i < FORMAT_SEL_CNT; i++) { + char name[1024]; + Dimension curr_entry_width; + SNPRINTF(name, sizeof name, "format_selection_pulldown_%d", i); + format_selection_menu[i] = XtVaCreateManagedWidget(name, smeBSBObjectClass, format_selection_popup, + XtNjustify, XtJustifyLeft, + XtNlabel, + i == resource.default_saving_format + ? output_format_mapping[0].fmt_string + : output_format_mapping[i].fmt_string, + NULL); + XtVaGetValues(format_selection_menu[i], XtNwidth, &curr_entry_width, NULL); + if (curr_entry_width > max_entry_width) + max_entry_width = curr_entry_width; + XtAddCallback(format_selection_menu[i], XtNcallback, cb_select_format, (XtPointer)info); } + XtVaSetValues(format_selection_button, XtNwidth, max_entry_width, NULL); - if (act == FILE_PRINT) - set_target_radio(save_info, curr_info, act); - set_range_radio(save_info, curr_info, act); -#ifdef MOTIF - str = XmStringCreateLocalized(ofstring); - XtVaSetValues(of_label[act], XmNlabelString, str, NULL); - XmStringFree(str); - - /* FIXME: this seems neccessary, otherwise labels are misaligned - again if window is closed and opened a second time? */ - adjust_heights(range_from_to_radio[act], - from_label[act], page_from_text[act], - to_label[act], page_to_text[act], - of_label[act], - NULL); + print_to_file_form = XtVaCreateManagedWidget("to_file_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, save_to_file_form, + XtNvertDistance, -ddist, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, labelWidgetClass, print_to_file_form, + XtNlabel, "File name: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, asciiTextWidgetClass, print_to_file_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNfromHoriz, to_file_radio_or_label, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(print_to_file_text, xlats2); - if (save_info->dvips_options != NULL) { - XtVaSetValues(dvips_options_text[act], XmNvalue, save_info->dvips_options, - XmNcursorPosition, strlen(save_info->dvips_options), NULL); - } - else { - XtVaSetValues(dvips_options_text[act], XmNvalue, "", NULL); - } -#else /* MOTIF */ - XtVaSetValues(of_label[act], XtNlabel, ofstring, NULL); - - if (save_info->dvips_options != NULL) { - XtVaSetValues(dvips_options_text[act], XtNstring, save_info->dvips_options, NULL); - XawTextSetInsertionPoint(dvips_options_text[act], strlen(save_info->dvips_options)); - } - else { - XtVaSetValues(dvips_options_text[act], XtNstring, "", NULL); + + { /* align left edges of format selection pulldown and filename field */ + Dimension w1, w2, w_max; + XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); + XtVaGetValues(to_file_radio_or_label, XtNwidth, &w2, NULL); + w_max = MAX(w1, w2); + XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); + XtVaSetValues(print_to_file_text, XtNhorizDistance, ddist + (w_max - w2), NULL); } -#endif /* MOTIF */ } - get_initial_dialog_values(save_info, act); + /* initial value for filename */ + XtVaSetValues(print_to_file_text, XtNstring, info->finfo->out_file, NULL); + XawTextSetInsertionPoint(print_to_file_text, strlen(info->finfo->out_file)); + +#define DIST_1 8 /* FIXME */ + print_to_file_button = XtVaCreateManagedWidget(Xdvi_BROWSE_BUTTON, commandWidgetClass, print_to_file_form, + XtNlabel, "Browse ...", + XtNfromHoriz, print_to_file_text, + XtNhorizDistance, DIST_1, + /* XtNsensitive, act == FILE_PRINT ? resource.default_printing_target == TO_FILE : True, */ + /* attach to right of form, no resizing: */ + XtNleft, XtChainRight, XtNright, XtChainRight, + VERTICAL_RESIZING_NO, + NULL); + + XtVaGetValues(print_to_file_button, XtNwidth, &w_curr, NULL); + XtVaSetValues(print_to_file_text, XtNwidth, w_avg - w_curr - DIST_1 - 2, NULL); +#undef DIST_1 + + adjust_vertically(to_file_radio_or_label, print_to_file_text, ddist + 5); + adjust_vertically(print_to_file_text, to_file_radio_or_label, ddist + 5); + adjust_vertically(print_to_file_button, to_file_radio_or_label, ddist + 5); + + XtAddCallback(print_to_file_button, XtNcallback, cb_browse, (XtPointer)info); + + /* other dvips options */ + dvips_options_form = XtVaCreateManagedWidget("dvips_options_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, print_to_file_form, + XtNvertDistance, 3 * ddist, + HORIZONTAL_RESIZING_YES, + NULL); + + dvips_options_label = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_NAME, labelWidgetClass, dvips_options_form, + XtNlabel, "Dvips Options:", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + + dvips_options_text = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_TEXT, asciiTextWidgetClass, dvips_options_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNfromHoriz, dvips_options_label, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(dvips_options_text, xlats2); + + { /* align left edges of input fields */ + Dimension w1, w2, w3, w_max; + + if (act == FILE_PRINT) + XtVaGetValues(to_printer_radio, XtNwidth, &w1, NULL); + else + XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); + + XtVaGetValues(to_file_radio_or_label, XtNwidth, &w2, NULL); + XtVaGetValues(dvips_options_label, XtNwidth, &w3, NULL); + + w_max = MAX(MAX(w1, w2), w3); + + if (act == FILE_PRINT) + XtVaSetValues(print_to_printer_text, XtNhorizDistance, ddist + (w_max - w1), NULL); + else + XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); -#ifdef MOTIF - if (act == FILE_PRINT) - XtVaSetValues(print_to_printer_text, XmNvalue, save_info->printer_name, - XmNcursorPosition, strlen(save_info->printer_name), NULL); + XtVaSetValues(print_to_file_text, XtNhorizDistance, ddist + (w_max - w2), NULL); + XtVaSetValues(dvips_options_text, XtNhorizDistance, ddist + (w_max - w3), NULL); + } + + /* initial value for dvips options */ + XtVaSetValues(dvips_options_text, XtNstring, info->dvips_options, NULL); + XawTextSetInsertionPoint(dvips_options_text, strlen(info->dvips_options)); + + /* page selection */ + dummy_pages_form = XtVaCreateManagedWidget("dummy_pages_form", formWidgetClass, form, + XtNfromVert, dvips_options_form, + XtNresizable, True, + XtNborderWidth, 0, + XtNvertDistance, 3 * ddist, + HORIZONTAL_RESIZING_NO, + NULL); + + range_label = XtVaCreateManagedWidget("range_lab", labelWidgetClass, dummy_pages_form, + XtNlabel, "Pages:", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + NULL); + + page_range_form = XtVaCreateManagedWidget(Xdvi_PAGE_RANGE_FORM_NAME, formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, dummy_pages_form, + XtNvertDistance, 0, + HORIZONTAL_RESIZING_NO, + NULL); + + accels2 = XtParseAcceleratorTable("<Btn1Down>,<Btn1Up>:set()notify()"); + print_or_save_range_all_radio = XtVaCreateManagedWidget(Xdvi_PAGES_ALL_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + page_range_form, + XtNlabel, "All ", + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioData, PAGE_ALL, + /* enable this button by default */ + XtNstate, True, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(print_or_save_range_all_radio, XtNcallback, cb_range, (XtPointer)info); + XtInstallAccelerators(page_range_form, print_or_save_range_all_radio); + + range_marked_form = XtVaCreateManagedWidget("range_marked_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, page_range_form, + XtNvertDistance, 0, + HORIZONTAL_RESIZING_NO, + NULL); - XtVaSetValues(dvips_options_text[act], XmNvalue, save_info->dvips_options, - XmNcursorPosition, strlen(save_info->dvips_options), NULL); + range_marked_radio = XtVaCreateManagedWidget(Xdvi_PAGES_MARKED_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif - XtVaSetValues(page_from_text[act], XmNvalue, save_info->from_page, - XmNcursorPosition, strlen(save_info->from_page), NULL); + range_marked_form, + XtNlabel, "Marked ", + XtNsensitive, pageinfo_have_marked_pages(), + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioGroup, print_or_save_range_all_radio, + XtNradioData, PAGE_MARKED, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(range_marked_radio, XtNcallback, cb_range, (XtPointer)info); + XtInstallAccelerators(range_marked_form, range_marked_radio); + + range_from_to_form = XtVaCreateManagedWidget("range_from_to_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, range_marked_form, + XtNvertDistance, 0, + XtNresizable, True, + /* HORIZONTAL_RESIZING_NO, */ + NULL); - XtVaSetValues(page_to_text[act], XmNvalue, save_info->to_page, - XmNcursorPosition, strlen(save_info->to_page), NULL); -#else /* MOTIF */ - if (act == FILE_PRINT) { - XtVaSetValues(print_to_printer_text, XtNstring, save_info->printer_name, NULL); - XawTextSetInsertionPoint(print_to_printer_text, strlen(save_info->printer_name)); + range_from_to_radio = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + range_from_to_form, + XtNlabel, "From: ", + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioGroup, print_or_save_range_all_radio, + XtNradioData, PAGE_RANGE, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(range_from_to_radio, XtNcallback, cb_range, (XtPointer)info); + XtInstallAccelerators(range_from_to_form, range_from_to_radio); + + page_from_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_FROM_TEXT_NAME, asciiTextWidgetClass, range_from_to_form, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNwidth, 50, + XtNfromHoriz, range_from_to_radio, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(page_from_text, xlats2); + XtAddEventHandler(page_from_text, KeyPressMask | ButtonPressMask, False, + text_page_range_callback, (XtPointer)info); + + to_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_LABEL_NAME, labelWidgetClass, range_from_to_form, + XtNlabel, "to: ", + XtNborderWidth, 0, + XtNfromHoriz, page_from_text, + /* XtNsensitive, info->page_selection == PAGE_RANGE, */ + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + + page_to_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_TEXT_NAME, asciiTextWidgetClass, range_from_to_form, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNwidth, 50, + XtNfromHoriz, to_label, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(page_to_text, xlats2); + XtAddEventHandler(page_to_text, KeyPressMask | ButtonPressMask, False, + text_page_range_callback, (XtPointer)info); + + of_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_OF_LABEL_NAME, labelWidgetClass, range_from_to_form, + XtNlabel, ofstring, + XtNborderWidth, 0, + /* XtNsensitive, info->page_selection == PAGE_RANGE, */ + XtNresizable, True, + XtNfromHoriz, page_to_text, + /* HORIZONTAL_RESIZING_NO, */ + XtNleft, XtChainLeft, + VERTICAL_RESIZING_NO, + NULL); + + adjust_vertically(range_from_to_radio, page_from_text, ddist); + adjust_vertically(to_label, page_from_text, ddist); + adjust_vertically(of_label, page_from_text, ddist); + + /* box for the OK/Cancel button */ + box = XtVaCreateManagedWidget("box", formWidgetClass, paned, + /* resizing by user isn't needed */ + XtNshowGrip, False, + XtNdefaultDistance, 6, /* some padding */ + /* resizing the window shouldn't influence this box, + * but only the pane widget + */ + XtNskipAdjust, True, + XtNaccelerators, G_accels_cr, + NULL); + + ok_button = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", commandWidgetClass, box, + XtNlabel, act == FILE_PRINT ? "Print" : "Save", + XtNaccelerators, G_accels_cr, + XtNtop, XtChainTop, + XtNbottom, XtChainBottom, + HORIZONTAL_RESIZING_NO, + NULL); + XtAddCallback(ok_button, XtNcallback, cb_print_or_save, (XtPointer)info); + + XtInstallAccelerators(form, ok_button); + if (act == FILE_PRINT) + XtInstallAccelerators(print_to_printer_text, ok_button); + XtInstallAccelerators(print_to_file_text, ok_button); + + cancel_button = XtVaCreateManagedWidget("cancel", commandWidgetClass, box, + XtNlabel, "Cancel", + XtNfromHoriz, ok_button, + XtNbottom, XtChainBottom, + XtNjustify, XtJustifyRight, + XtNleft, XtChainRight, + XtNright, XtChainRight, + NULL); + XtAddCallback(cancel_button, XtNcallback, cb_popdown, (XtPointer)info); + + XtManageChild(info->shell); + center_window(info->shell, globals.widgets.top_level); + XtMapWidget(info->shell); + XSetWMProtocols(XtDisplay(info->shell), XtWindow(info->shell), &WM_DELETE_WINDOW, 1); + + if (pageinfo_have_marked_pages()) { + XawToggleSetCurrent(print_or_save_range_all_radio, (XtPointer)PAGE_MARKED); } + else if (info->page_selection == PAGE_MARKED) { + XawToggleSetCurrent(print_or_save_range_all_radio, (XtPointer)PAGE_ALL); + } +#undef HORIZONTAL_RESIZING_NO +#undef HORIZONTAL_RESIZING_YES +#undef VERTICAL_RESIZING_NO +} - XtVaSetValues(dvips_options_text[act], XtNstring, save_info->dvips_options, NULL); - XawTextSetInsertionPoint(dvips_options_text[act], strlen(save_info->dvips_options)); +#endif /* MOTIF */ + +static void +get_initial_values(struct save_or_print_info *info) +{ + const char *extension = NULL; + char *tmp = NULL; + + info->finfo->tmp_dvi_file = NULL; + info->finfo->tmp_ps_file = NULL; + info->finfo->tmp_dvi_fp = NULL; + /* info->finfo->out_fp = NULL; */ - XtVaSetValues(page_from_text[act], XtNstring, save_info->from_page, NULL); - XawTextSetInsertionPoint(page_from_text[act], strlen(save_info->from_page)); + info->message_popup = NULL; - XtVaSetValues(page_to_text[act], XtNstring, save_info->to_page, NULL); - XawTextSetInsertionPoint(page_to_text[act], strlen(save_info->to_page)); -#endif /* MOTIF */ + info->dvips_options = info->printer_options = NULL; - if (act == FILE_PRINT) { - if (pageinfo_have_marked_pages()) { - XtSetSensitive(range_marked_radio[FILE_PRINT], True); - } - else { - XtSetSensitive(range_marked_radio[FILE_PRINT], False); + /* + * dvips options + */ + info->dvips_options = xstrdup(resource.dvips_options_str ? resource.dvips_options_str : ""); + + /* add -t options if needed */ + if (info->dvips_options == NULL || info->dvips_options[0] == '\0' || strstr(info->dvips_options, "-t ") == NULL) { + Boolean landscape = False; + char *paper = get_dvips_papersize(&landscape); + if (paper != NULL) { + if (info->dvips_options == NULL) + info->dvips_options = xstrdup("-t "); + else + info->dvips_options = xstrcat(info->dvips_options, " -t "); + + info->dvips_options = xstrcat(info->dvips_options, paper); + free(paper); + if (landscape) { + info->dvips_options = xstrcat(info->dvips_options, " -t landscape"); + } } - ASSERT(save_pr_info.range_radio != PRINT_MARKED || pageinfo_have_marked_pages(), - "PRINT_MARKED shouldn't be togglable if there are no marked pages!"); } - else if (act == FILE_SAVE) { - if (pageinfo_have_marked_pages()) { - XtSetSensitive(range_marked_radio[FILE_SAVE], True); - } - else { - XtSetSensitive(range_marked_radio[FILE_SAVE], False); + + /* + * printer options + */ + if (resource.dvips_printer_str != NULL) + info->printer_options = xstrdup(resource.dvips_printer_str); + else { + /* initialize with default. We add the $PRINTER environment variable + * since dvips otherwise doesn't use it. */ + char *printer = getenv("PRINTER"); + info->printer_options = xstrdup("lpr"); + if (printer != NULL) { + info->printer_options = xstrcat(info->printer_options, " -P"); + info->printer_options = xstrcat(info->printer_options, printer); } - ASSERT(save_save_info.range_radio != SAVE_MARKED || pageinfo_have_marked_pages(), - "SAVE_MARKED shouldn't be togglable if there are no marked pages!"); } - set_outfile_name(save_info, &curr_save_info, act); - -#ifdef MOTIF - XtVaSetValues(print_to_file_text[act], XmNvalue, save_info->file_name, - XmNcursorPosition, strlen(save_info->file_name), NULL); -#else /* MOTIF */ - XtVaSetValues(print_to_file_text[act], XtNstring, save_info->file_name, NULL); - XawTextSetInsertionPoint(print_to_file_text[act], strlen(save_info->file_name)); -#endif /* MOTIF */ + info->print_target = resource.default_printing_target; + info->fmt = resource.default_saving_format; - if (act == FILE_PRINT) { - XtPopup(print_shell, XtGrabNone); - print_is_active = True; + if (pageinfo_have_marked_pages()) { + info->page_selection = PAGE_MARKED; } else { - XtPopup(save_shell, XtGrabNone); - save_is_active = True; + info->page_selection = PAGE_ALL; } + + if (info->act == FILE_SAVE) + extension = output_format_mapping[resource.default_saving_format].extension; + else + extension = ".ps"; + + tmp = get_new_file_name(globals.dvi_name, + get_extension(globals.dvi_name), + extension); + info->finfo->out_file = xmalloc(strlen(globals.cwd) + strlen(tmp) + 2); /* 1 extra for dir separator */ + sprintf(info->finfo->out_file, "%s/%s", globals.cwd, tmp); + free(tmp); + TRACE_FILES((stderr, "OUTFILE: |%s|\n", info->finfo->out_file)); } static int -getpageno(Widget w) +textfield_to_int(Widget w) { char *s, *p; int pageno; @@ -2379,92 +1848,123 @@ getpageno(Widget w) return pageno; } - /* - return text value of Widget w in newly allocated memory, - free()ing old_val as appropriate. Returns NULL if - text value starts with '\0'. + Return a copy of the text value of Widget w in malloc'ed memory, + or NULL if the text is empty. */ + static char * -get_saved_command(char **old_val, Widget w) +widgets_get_textfield(Widget w) { - char *val = NULL; - - if (*old_val != NULL) { + char *ptr = NULL; + XtVaGetValues(w, #if MOTIF - XtFree((char *)*old_val); + XmNvalue, #else - free((char*)*old_val); + XtNstring, #endif - *old_val = NULL; - } -#if MOTIF - val = XmTextFieldGetString(w); - if (*val == '\0') { - XtFree((char *)val); - val = NULL; + &ptr, NULL); + + if (ptr == NULL || *ptr == '\0') + return NULL; + else + return xstrdup(ptr); +} + +static char * +widgets_get_textfield_by_name(const struct save_or_print_info *info, const char *widget_name) +{ + Widget w; + if (get_widget_by_name(&w, info->shell, widget_name, True)) { + return widgets_get_textfield(w); } + return NULL; +} + +static pageRadioT +widgets_get_page_selection(struct save_or_print_info *info) +{ + Widget radio_all; +#ifdef MOTIF + Widget radio_marked; +#endif + if (get_widget_by_name(&radio_all, info->shell, Xdvi_PAGES_ALL_RADIO_NAME, True) +#ifdef MOTIF + && get_widget_by_name(&radio_marked, info->shell, Xdvi_PAGES_MARKED_RADIO_NAME, True) +#endif + ) { +#ifdef MOTIF + if (XmToggleButtonGadgetGetState(radio_all)) + return PAGE_ALL; + else if (XmToggleButtonGadgetGetState(radio_marked)) + return PAGE_MARKED; + else + return PAGE_RANGE; #else - XtVaGetValues(w, XtNstring, &val, NULL); - if (*val == '\0') { - val = NULL; + return (pageRadioT)XawToggleGetCurrent(radio_all); +#endif } - else { - val = xstrdup(val); + return NO_PAGE_VAL; /* dummy */ +} + +static int +widgets_get_from_page(struct save_or_print_info *info) +{ + Widget w; + if (get_widget_by_name(&w, info->shell, Xdvi_PAGES_RANGE_FROM_TEXT_NAME, True)) { + return textfield_to_int(w); } -#endif - return val; + return 0; +} + +static int +widgets_get_to_page(struct save_or_print_info *info) +{ + Widget w; + if (get_widget_by_name(&w, info->shell, Xdvi_PAGES_RANGE_TO_TEXT_NAME, True)) { + return textfield_to_int(w); + } + return 0; } -/* fill curr_print_info and save_print_info with current values */ static void -get_save_window_state(struct dialog_info *save_info, struct dialog_info *curr_info, printOrSaveActionT act) +set_check_page_range(struct save_or_print_info *info, Boolean check) { - save_info->print_radio = curr_info->print_radio; - save_info->range_radio = curr_info->range_radio; + Widget text_from, text_to; - if (act == FILE_PRINT) { - save_info->printer_name = get_saved_command(&(save_info->printer_name), print_to_printer_text); - curr_info->printer_name = get_saved_command(&(curr_info->printer_name), print_to_printer_text); - } - save_info->file_name = get_saved_command(&(save_info->file_name), print_to_file_text[act]); - curr_info->file_name = get_saved_command(&(curr_info->file_name), print_to_file_text[act]); + if (get_widget_by_name(&text_from, info->shell, Xdvi_PAGES_RANGE_FROM_TEXT_NAME, True) + && get_widget_by_name(&text_to, info->shell, Xdvi_PAGES_RANGE_TO_TEXT_NAME, True)) { - save_info->dvips_options = get_saved_command(&(save_info->dvips_options), dvips_options_text[act]); - curr_info->dvips_options = get_saved_command(&(curr_info->dvips_options), dvips_options_text[act]); + char page_string[LENGTH_OF_INT]; - save_info->from_page = get_saved_command(&(save_info->from_page), page_from_text[act]); - save_info->to_page = get_saved_command(&(save_info->to_page), page_to_text[act]); - - TRACE_GUI((stderr, "saved options:\nprinter: |%s|, file: |%s|, dvips: |%s|, from: |%s|, to: |%s|\n", - save_info->printer_name ? save_info->printer_name : "<NULL>", - save_info->file_name ? save_info->file_name : "<NULL>", - save_info->dvips_options ? save_info->dvips_options : "<NULL>", - save_info->from_page ? save_info->from_page : "<NULL>", - save_info->to_page ? save_info->to_page : "<NULL>")); + if (check) { /* check validity of current values */ + int curr_from = textfield_to_int(text_from); + int curr_to = textfield_to_int(text_to); + + if (curr_from < total_pages && curr_to < total_pages) /* values are OK */ + return; + } + + sprintf(page_string, "%d", current_page + globals.pageno_correct); + +#ifdef MOTIF + XtVaSetValues(text_from, XmNvalue, page_string, XmNcursorPosition, strlen(page_string), NULL); + XtVaSetValues(text_to, XmNvalue, page_string, XmNcursorPosition, strlen(page_string), NULL); +#else + XtVaSetValues(text_from, XtNstring, page_string, NULL); + XtVaSetValues(text_to, XtNstring, page_string, NULL); + XawTextSetInsertionPoint(text_from, strlen(page_string)); + XawTextSetInsertionPoint(text_to, strlen(page_string)); +#endif + } } static void popdown_dialog_and_print_or_save(XtPointer myinfo) { struct save_or_print_info *info = (struct save_or_print_info *)myinfo; - struct select_pages_info *pinfo = (struct select_pages_info *)info->pinfo; - struct dialog_info *curr_info = NULL; - /* pop down the dialog */ - if (pinfo->act == FILE_PRINT) { - curr_info = &save_pr_info; - cb_print_cancel(NULL, info, NULL); - /* when printing to file, set ps_out.fname to non-NULL; this will - notify called routines that printing should go to the file */ - if (curr_info->print_radio == PRINT_TO_FILE) { - pinfo->finfo->ps_out.fname = xstrdup(curr_info->expanded_filename); - } - } - else { - curr_info = &save_save_info; - cb_save_cancel(NULL, info, NULL); - } + cb_popdown(NULL, info, NULL); if (globals.dvi_file.bak_fp == NULL) { /* shouldn't happen */ info->message_popup = popup_message(globals.widgets.top_level, @@ -2473,66 +1973,17 @@ popdown_dialog_and_print_or_save(XtPointer myinfo) return; } - ASSERT(pinfo->finfo->dvi_in.fp != NULL, "DVI input FILE * must have been set!"); - - /* when saving, set the final file names */ - if (curr_info->range_radio == SAVE_RANGE - || curr_info->range_radio == SAVE_MARKED - || curr_info->range_radio == SAVE_ALL) { - switch (curr_info->output_format) { - case FMT_DVI: - pinfo->finfo->dvi_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "DVI out_name: |%s|", pinfo->finfo->dvi_out.fname)); - break; - case FMT_PS: - pinfo->finfo->ps_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "PS out_name: |%s|", pinfo->finfo->ps_out.fname)); - break; - case FMT_PS2PDF: - pinfo->finfo->pdf_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "PDF out_name: |%s|", pinfo->finfo->pdf_out.fname)); - break; - case FMT_ISO_8859_1: - case FMT_UTF8: - pinfo->finfo->txt_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "TXT out_name: |%s|", pinfo->finfo->txt_out.fname)); - break; - case FMT_NONE: - break; - } - } - - /* add info about page ranges */ - switch (curr_info->range_radio) { - case SAVE_RANGE: - case PRINT_RANGE: - /* convert from 1-based to 0-based */ - pinfo->from = strtoul(curr_info->from_page, (char **)NULL, 10) - 1; - pinfo->to = strtoul(curr_info->to_page, (char **)NULL, 10) - 1; - pinfo->callback = check_pagerange; - break; - case SAVE_MARKED: - case PRINT_MARKED: - pinfo->callback = check_marked; - break; - case SAVE_ALL: - case PRINT_ALL: - pinfo->callback = NULL; - break; - case NO_PAGE_VAL: - ASSERT(0, "Shouldn't happen: NO_PAGE_VAL passed to popdown_dialog_and_print_or_save()"); - break; - } + ASSERT(info->finfo->in_fp != NULL, "DVI input FILE * must have been set!"); - store_preference(NULL, "dvipsOptionsString", "%s", save_pr_info.dvips_options ? save_pr_info.dvips_options : ""); - if (pinfo->act == FILE_PRINT) { - store_preference(NULL, "defaultPrintingTarget", "%d", save_pr_info.print_radio); - store_preference(NULL, "dvipsPrinterString", "%s", save_pr_info.printer_name ? save_pr_info.printer_name : ""); - internal_print(pinfo); + store_preference(NULL, "dvipsOptionsString", "%s", info->dvips_options ? info->dvips_options : ""); + if (info->act == FILE_PRINT) { + store_preference(NULL, "defaultPrintingTarget", "%d", info->print_target); + store_preference(NULL, "dvipsPrinterString", "%s", info->printer_options ? info->printer_options : ""); + internal_print(info); } else { - store_preference(NULL, "defaultSavingFormat", "%d", save_save_info.output_format); - internal_save(pinfo, curr_info->output_format); + store_preference(NULL, "defaultSavingFormat", "%d", info->fmt); + internal_save(info); } } @@ -2541,178 +1992,124 @@ static void do_cleanup(XtPointer arg) { struct save_or_print_info *info = (struct save_or_print_info *)arg; - struct select_pages_info *pinfo = (struct select_pages_info *)info->pinfo; - struct file_info *finfo = pinfo->finfo; cancel_saving(info); - unlink(finfo->dvi_tmp.fname); + if (info->finfo->tmp_dvi_file != NULL) { + unlink(info->finfo->tmp_dvi_file); + info->finfo->tmp_dvi_file = NULL; + } + if (info->finfo->tmp_ps_file != NULL) { + unlink(info->finfo->tmp_ps_file); + info->finfo->tmp_ps_file = NULL; + } } -/* XXX: is the save_* stuff actually *needed*??? */ -static Boolean -validate_and_save_values(struct save_or_print_info *info) + +/* + * First round of sanity checks for page range etc. + */ +static void +print_check_page_values(struct save_or_print_info *info) { - int page_range_begin, page_range_end; - printOrSaveActionT act = info->act; + struct select_pages_info *pinfo = info->pinfo; + + /* get current dvips and printer options */ + free(info->dvips_options); + free(info->printer_options); + info->dvips_options = info->printer_options = NULL; + + info->dvips_options = widgets_get_textfield_by_name(info, Xdvi_DVIPS_OPTIONS_TEXT); + if (info->act == FILE_PRINT) + info->printer_options = widgets_get_textfield_by_name(info, Xdvi_TO_PRINTER_TEXT); + info->page_selection = widgets_get_page_selection(info); - if ((act == FILE_PRINT && curr_pr_info.range_radio == PRINT_RANGE) - || (act == FILE_SAVE && curr_save_info.range_radio == SAVE_RANGE)) { - page_range_begin = getpageno(page_from_text[act]); - page_range_end = getpageno(page_to_text[act]); - if (page_range_begin + 1 < 1) { + /* fprintf(stderr, "page selection: %d\n", info->page_selection); */ + + if (info->page_selection == PAGE_ALL) { + /* fprintf(stderr, "ALL!!!\n"); */ + pinfo->callback = NULL; + } + else if (info->page_selection == PAGE_MARKED) { + /* fprintf(stderr, "MARKED!!!\n"); */ + pinfo->callback = check_marked; + } + else { /* PAGE_RANGE */ + /* fprintf(stderr, "RANGE!!!\n"); */ + pinfo->from = widgets_get_from_page(info); + pinfo->to = widgets_get_to_page(info); + pinfo->callback = check_pagerange; + if (pinfo->from + 1 < 1) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Please specify a valid page range.", "Invalid page range: start (%d) < 1.", - page_range_begin + 1); - return False; + pinfo->from + 1); + return; } - else if (page_range_begin > page_range_end) { + else if (pinfo->from > pinfo->to) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Please specify a valid page range.", "Invalid page range: start (%d) > end (%d).", - page_range_begin + 1, page_range_end + 1); - return False; + pinfo->from + 1, pinfo->to + 1); + return; } - else if (page_range_end + 1 > total_pages) { + else if (pinfo->to + 1 > total_pages) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Please specify a valid page range.", "Invalid page range: end (%d) > total_pages (%d).", - page_range_end + 1, total_pages); - return False; - } - - if (act == FILE_PRINT) { - curr_pr_info.from_page = xrealloc(curr_pr_info.from_page, LENGTH_OF_INT + 1); - curr_pr_info.to_page = xrealloc(curr_pr_info.to_page, LENGTH_OF_INT + 1); - sprintf(curr_pr_info.from_page, "%d", page_range_begin); - sprintf(curr_pr_info.to_page, "%d", page_range_end); - } - else { - curr_save_info.from_page = xrealloc(curr_save_info.from_page, LENGTH_OF_INT + 1); - curr_save_info.to_page = xrealloc(curr_save_info.to_page, LENGTH_OF_INT + 1); - sprintf(curr_save_info.from_page, "%d", page_range_begin); - sprintf(curr_save_info.to_page, "%d", page_range_end); + pinfo->to + 1, total_pages); + return; } } - - if (act == FILE_PRINT) - get_save_window_state(&save_pr_info, &curr_pr_info, act); - else - get_save_window_state(&save_save_info, &curr_save_info, act); - - return True; -} - -/* - * Routines for freeing allocated resources in file_info: - * close file pointers, and free file name memory. - */ -static void -free_file_info(struct file_IO *info) -{ - if (info->fp != NULL) { - fclose(info->fp); - info->fp = NULL; - } - free(info->fname); - info->fname = NULL; -} -static void -reset_file_info(struct file_info *finfo) -{ - free_file_info(&(finfo->dvi_in)); - free_file_info(&(finfo->dvi_tmp)); - free_file_info(&(finfo->dvi_out)); - free_file_info(&(finfo->ps_out)); - free_file_info(&(finfo->pdf_out)); - free_file_info(&(finfo->txt_out)); + print_check_dvi_file(info); } /* - First round of sanity checks. Note the use of curr_pr_info here; - this is before the values are saved to save_pr_info. + Second round of sanity checks. */ static void -print_precheck1(XtPointer myinfo) +print_check_dvi_file(struct save_or_print_info *info) { - /* Initialize structures with defaults. Note: structures are - static, so that they survive between calls, and to make memory - management with callbacks (and all the stuff in print-internal.c) - easier. - */ - struct save_or_print_info *info = (struct save_or_print_info *)myinfo; - printOrSaveActionT act = info->act; - static struct select_pages_info pinfo = { - FILE_ALL, 0, 0, NULL, check_marked, { 0, NULL }, NO_ERROR - }; - static struct file_info finfo = { - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL } - }; - char *ok_button_str = NULL; FILE *fin = NULL; /* Return if there are active popups; otherwise, the print process may get messed up */ if (raise_message_windows()) { XBell(DISP, 0); -/* popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, */ -/* MSG_WARN, NULL, */ -/* "Please close other open message windows first!"); */ +#if 0 + popup_message(info->shell, + MSG_WARN, NULL, + "Please close other open message windows first!"); +#endif return; } - /* free all pointers in case we've been called again */ - reset_file_info(&finfo); - - pinfo.finfo= &finfo; /* pass finfo in data field of pinfo to callbacks etc. */ - pinfo.act = act; - info->pinfo = &pinfo; - - /* Validate page ranges, and if they are correct, save them to the - * appropriate save_save_info/save_print_info structure. - * NOTE: From here on, always use the save_* variants to retrieve values! - */ - if (!validate_and_save_values(info)) - return; - - /* We need to create a temporary DVI file containing the selected or all pages - if we want to do one of the following: - - print the marked pages - - save to a DVI file - - print only the marked pages to a PS or a PDF file. - */ - if ((pinfo.act == FILE_PRINT && curr_pr_info.range_radio == PRINT_MARKED) - || (pinfo.act == FILE_SAVE - && (save_save_info.output_format == FMT_DVI - || ((save_save_info.output_format == FMT_PS || save_save_info.output_format == FMT_PS2PDF) - && save_save_info.range_radio == SAVE_MARKED)))) { - /* need to create a temporary DVI file containing the selected pages */ - int tmp_fd = xdvi_temp_fd(&(finfo.dvi_tmp.fname)); /* this allocates finfo.dvi_tmp.fname */ + /* If we want to print/save the marked pages, or save to a DVI file, + we need to create a temporary DVI file containing the selected or all pages. */ + if (info->page_selection == PAGE_MARKED || info->fmt == FMT_DVI) { + int tmp_fd; + free(info->finfo->tmp_dvi_file); + info->finfo->tmp_dvi_file = NULL; + tmp_fd = xdvi_temp_fd(&(info->finfo->tmp_dvi_file)); /* this allocates info->finfo->tmp_dvi_file */ if (tmp_fd == -1) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Couldn't create temporary DVI file for printing: %s", strerror(errno)); return; } /* don't use XFOPEN here, since we don't want to treat an error in opening the file as fatal. */ /* `b' in mode won't hurt ... */ - if ((finfo.dvi_tmp.fp = try_fdopen(tmp_fd, "wb+")) == NULL) { /* failure */ + if ((info->finfo->tmp_dvi_fp = try_fdopen(tmp_fd, "wb+")) == NULL) { /* failure */ info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Xdvi needs to create a temporary file containing the " "currently marked pages, but creating that file failed. " @@ -2726,7 +2123,7 @@ print_precheck1(XtPointer myinfo) /* We try to use the original DVI file unless it's corrupted, in which case we ask the user if they want to save the cached copy instead */ if ((fin = fopen(globals.dvi_name, "rb")) == NULL - || !find_postamble(fin, &(pinfo.errflag))) { + || !find_postamble(fin, &(info->pinfo->errflag))) { Boolean could_not_open = False; if (fin == NULL) could_not_open = True; @@ -2736,7 +2133,7 @@ print_precheck1(XtPointer myinfo) /* if we can't use the temporary file as source for our copy, this is a fatal error */ if (!resource.use_temp_fp) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Could not copy DVI file %s: The file %s", globals.dvi_name, could_not_open ? "doesn't exist any more" : "seems to be corrupted"); @@ -2746,56 +2143,50 @@ print_precheck1(XtPointer myinfo) /* else, we'll try to use the cached copy of the DVI file */ if ((fin = fopen(get_tmp_dvi_name(), "rb")) == NULL) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Something's very wrong here - opening of both the " "original DVI file and the cached copy failed!"); return; } - if (!find_postamble(fin, &(pinfo.errflag))) { + if (!find_postamble(fin, &(info->pinfo->errflag))) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Shouldn't happen: Cached copy of the DVI file seems corrupted!"); return; } - finfo.dvi_in.fp = fin; + info->finfo->in_fp = fin; /* tell user about it */ - if (pinfo.act == FILE_PRINT) - ok_button_str = "Print Copy"; - else - ok_button_str = "Save Copy"; - info->message_popup = - choice_dialog(pinfo.act == FILE_PRINT ? print_shell : save_shell, + choice_dialog(info->shell, MSG_QUESTION, NULL, #ifndef MOTIF NULL, /* TODO: binding for RET? */ #endif /* MOTIF */ NULL, NULL, /* no pre_callbacks */ - ok_button_str, print_precheck2, (XtPointer)info, + info->act == FILE_PRINT ? "Print Copy" : "Save Copy", + print_check_target_file, (XtPointer)info, "Cancel", do_cleanup, (XtPointer)info, "The DVI file %s %s. Do you want to %s a cached copy of the file?", globals.dvi_name, could_not_open ? "doesn't exist any more" : "seems to be corrupted", - pinfo.act == FILE_PRINT ? "print" : "save"); + info->act == FILE_PRINT ? "print" : "save"); } else { /* original DVI file is OK, copy it */ - finfo.dvi_in.fp = fin; - print_precheck2((XtPointer)info); + info->finfo->in_fp = fin; + print_check_target_file((XtPointer)info); } } static void -print_precheck2(XtPointer myinfo) +print_check_target_file(XtPointer myinfo) { struct save_or_print_info *info = (struct save_or_print_info *)myinfo; - char *expanded_filename = NULL; - struct select_pages_info *pinfo = (struct select_pages_info *)info->pinfo; - printOrSaveActionT act = pinfo->act; - const char *fname; + char *filename = widgets_get_textfield_by_name(info, Xdvi_TO_FILE_TEXT); + char *expanded_filename; /* Return if there are active popups; otherwise, the print process will be messed up. */ @@ -2804,70 +2195,61 @@ print_precheck2(XtPointer myinfo) return; } - /* expand and canonicalize path name */ - if (act == FILE_PRINT) - fname = save_pr_info.file_name; - else - fname = save_save_info.file_name; + /* if we're just printing to printer, go ahead */ + if (!(info->act == FILE_SAVE || (info->act == FILE_PRINT && info->print_target == TO_FILE))) { + popdown_dialog_and_print_or_save(info); + return; + } - if (fname == NULL) { + /* expand and canonicalize filename */ + if (filename == NULL) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_WARN, NULL, "No filename specified!"); return; } - expanded_filename = expand_homedir(fname); /* this allocates expanded_filename */ + expanded_filename = expand_homedir(filename); /* this allocates expanded_filename */ + if (expanded_filename == NULL) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_WARN, "Please specify either a filename or a full path, without using \"~\" or \"~user\".", "Couldn't expand filename \"%s\" to a full path.", - fname); + filename); + free(filename); return; } + free(filename); + free(info->finfo->out_file); + info->finfo->out_file = expanded_filename; - if (act == FILE_PRINT) { - free(save_pr_info.expanded_filename); - save_pr_info.expanded_filename = expanded_filename; - } - else { - free(save_save_info.expanded_filename); - save_save_info.expanded_filename = expanded_filename; - } - - - if (act == FILE_SAVE && save_save_info.output_format == FMT_DVI) { /* canonicalize filename */ - char *tmp = expand_filename_append_dvi(save_save_info.expanded_filename, USE_CWD_PATH, False); + if (info->act == FILE_SAVE && info->fmt == FMT_DVI) { /* canonicalize filename */ + char *tmp = expand_filename_append_dvi(info->finfo->out_file, USE_CWD_PATH, False); /* this mallocs tmp */ if (strcmp(tmp, globals.dvi_name) == 0) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Cannot overwrite the current DVI file (%s). " - "Please select a different file name.", - save_save_info.expanded_filename); + "Please choose a different file name.", + info->finfo->out_file); free(tmp); + free(info->finfo->out_file); + info->finfo->out_file = NULL; return; } - free(save_save_info.expanded_filename); - save_save_info.expanded_filename = tmp; + free(info->finfo->out_file); + info->finfo->out_file = tmp; } - if (act == FILE_SAVE || (act == FILE_PRINT && curr_pr_info.print_radio == PRINT_TO_FILE)) { + if (info->act == FILE_SAVE || (info->act == FILE_PRINT && info->print_target == TO_FILE)) { /* check whether to clobber existing file */ struct stat statbuf; - - if ((act == FILE_SAVE - && stat(save_save_info.expanded_filename, &statbuf) == 0 - && S_ISREG(statbuf.st_mode)) - || (act == FILE_PRINT - && stat(save_pr_info.expanded_filename, &statbuf) == 0 - && S_ISREG(statbuf.st_mode))) { - + if (stat(info->finfo->out_file, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) { info->message_popup = - choice_dialog(act == FILE_PRINT ? print_shell : save_shell, + choice_dialog(info->shell, MSG_QUESTION, NULL, #ifndef MOTIF NULL, /* TODO: binding for RET */ @@ -2880,10 +2262,8 @@ print_precheck2(XtPointer myinfo) printing, but would probably just like to choose another filename */ "Cancel", NULL, (XtPointer)NULL, - "%s already exists.\nDo you want to replace it?", - act == FILE_SAVE - ? save_save_info.expanded_filename - : save_pr_info.expanded_filename); + "The file %s already exists.\nDo you want to replace it?", + info->finfo->out_file); return; } else { @@ -2895,79 +2275,165 @@ print_precheck2(XtPointer myinfo) } } -/* called from pagesel.c if user marks or unmarks a page in the page list */ -void -notify_print_dialog_have_marked(Boolean flag) +static void +notify_dialog(Widget w, pageRadioT *value_bak) { - /* Note: check for *both* windows, save and print: */ + Widget radio_all, radio_marked; +#ifdef MOTIF + Widget radio_range; +#endif + Boolean have_marked = pageinfo_have_marked_pages(); + pageRadioT value_curr; - static pageRadioT old_value = NO_PAGE_VAL; + /* fprintf(stderr, "have_marked: %d\n", have_marked); */ - if (save_is_active) { - if (!flag && curr_save_info.range_radio == SAVE_MARKED) { - /* switch button from `marked' to its previous value */ - switch (old_value) { - case SAVE_ALL: + if (get_widget_by_name(&radio_all, w, Xdvi_PAGES_ALL_RADIO_NAME, True) + && get_widget_by_name(&radio_marked, w, Xdvi_PAGES_MARKED_RADIO_NAME, True) #ifdef MOTIF - XmToggleButtonGadgetSetState(range_all_radio[FILE_SAVE], True, True); -#else - XawToggleSetCurrent(range_all_radio[FILE_SAVE], (XtPointer)old_value); + && get_widget_by_name(&radio_range, w, Xdvi_PAGES_RANGE_RADIO_NAME, True) #endif - break; - case SAVE_RANGE: + ) { + + /* get the current value */ #ifdef MOTIF - XmToggleButtonGadgetSetState(range_from_to_radio[FILE_SAVE], True, True); + if (XmToggleButtonGadgetGetState(radio_all)) + value_curr = PAGE_ALL; + else if (XmToggleButtonGadgetGetState(radio_marked)) + value_curr = PAGE_MARKED; + else + value_curr = PAGE_RANGE; #else - XawToggleSetCurrent(range_from_to_radio[FILE_SAVE], (XtPointer)old_value); + value_curr = (pageRadioT)XawToggleGetCurrent(radio_all); #endif - break; - default: break; - } - } - else if (flag) { - /* switch button to `marked', saving the current value */ - if (curr_save_info.range_radio != SAVE_MARKED) /* guard for second invocation on mouse release */ - old_value = curr_save_info.range_radio; + + /* fprintf(stderr, "current value: %d\n", value_curr); */ + + if (value_curr == PAGE_MARKED && have_marked) + return; + if (value_curr != PAGE_MARKED && !have_marked) { + XtVaSetValues(radio_marked, #ifdef MOTIF - XmToggleButtonGadgetSetState(range_marked_radio[FILE_SAVE], True, True); + XmNsensitive, #else - XawToggleSetCurrent(range_marked_radio[FILE_SAVE], (XtPointer)SAVE_MARKED); -#endif /* MOTIF */ + XtNsensitive, +#endif + False, NULL); + return; } - XtSetSensitive(range_marked_radio[FILE_SAVE], flag); - } - if (print_is_active) { - if (!flag && curr_pr_info.range_radio == PRINT_MARKED) { - /* switch button from `marked' to its previous value */ - switch (old_value) { - case PRINT_ALL: + /* otherwise, if we have marked pages now, we want to switch from + the current value to `marked', saving the current value in *value_bak. */ + + /* XXX FIXME: There's a bug with OpenMotif 2.1 if the following order is used: + - without marked pages, open dialog + - mark a page; button `marked' is selected + - select button `all' + - select button `range' + - unmark page; `marked' becomes insensitive + - mark page, `marked' becomes sensitive and is selected, `range' is unselected + - up to here, everything is as expected, but if you now select `range', + it doesn't work, no button changes its state. As a workaround, if you select + `marked' again and then `range', it works. Strangely, the callback when unsetting + `range' is invoked correctly, so the button should be in the correct internal state ... + I think this is an OpenMotif bug. + */ + if (have_marked) { + *value_bak = value_curr; #ifdef MOTIF - XmToggleButtonGadgetSetState(range_all_radio[FILE_PRINT], True, True); + if (value_curr == PAGE_ALL) { + XmToggleButtonGadgetSetState(radio_all, False, True); + } + else { + XmToggleButtonGadgetSetState(radio_range, False, True); + } + XmToggleButtonGadgetSetState(radio_marked, True, True); + XtVaSetValues(radio_marked, XmNsensitive, True, NULL); + XmProcessTraversal(radio_marked, XmTRAVERSE_CURRENT); #else - XawToggleSetCurrent(range_all_radio[FILE_PRINT], (XtPointer)old_value); + XawToggleSetCurrent(radio_all, (XtPointer)PAGE_MARKED); + XtVaSetValues(radio_marked, XtNsensitive, True, NULL); #endif - break; - case PRINT_RANGE: + } + else { + /* no marked pages now; switch back to the value from *value_bak. */ + /* fprintf(stderr, "switching back to button %d\n", *value_bak); */ #ifdef MOTIF - XmToggleButtonGadgetSetState(range_from_to_radio[FILE_PRINT], True, True); + if (*value_bak == PAGE_ALL) { + XmToggleButtonGadgetSetState(radio_all, True, True); + XmProcessTraversal(radio_all, XmTRAVERSE_CURRENT); + } + else { + XmToggleButtonGadgetSetState(radio_range, True, True); + XmProcessTraversal(radio_range, XmTRAVERSE_CURRENT); + } + XmToggleButtonGadgetSetState(radio_marked, False, True); + XtVaSetValues(radio_marked, XmNsensitive, False, NULL); #else - XawToggleSetCurrent(range_from_to_radio[FILE_PRINT], (XtPointer)old_value); + XawToggleSetCurrent(radio_all, (XtPointer)*value_bak); + XtVaSetValues(radio_marked, XtNsensitive, *value_bak == PAGE_MARKED, NULL); #endif - break; - default: break; - } } - else if (flag) { - /* switch button to `marked', saving the current value */ - if (curr_pr_info.range_radio != PRINT_MARKED) /* guard for second invocation on mouse release */ - old_value = curr_pr_info.range_radio; + } +} + +/* access from pagesel.c if user marks or unmarks a page in the page list */ +void +notify_print_dialog_have_marked(void) +{ + Widget print_shell, save_shell; + static pageRadioT save_value_bak = PAGE_ALL; + static pageRadioT print_value_bak = PAGE_ALL; + + /* notify *both* windows, save and print, but only if they already exist */ + if (get_widget_by_name(&print_shell, globals.widgets.top_level, Xdvi_PRINT_SHELL_NAME, False)) + notify_dialog(print_shell, &save_value_bak); + + if (get_widget_by_name(&save_shell, globals.widgets.top_level, Xdvi_SAVE_SHELL_NAME, False)) + notify_dialog(save_shell, &print_value_bak); +} + +/* main entry point: pop up the dialog */ +void +save_or_print_callback(struct save_or_print_info *info) +{ + if (info->shell != NULL && window_is_mapped(XtWindow(info->shell), DISP)) { + XBell(DISP, 0); + XRaiseWindow(DISP, XtWindow(info->shell)); + return; + } + + if (info->act == FILE_PRINT && printlog_raise_active(info)) { + XBell(DISP, 0); + return; + } + + if (globals.dvi_file.bak_fp == NULL) { + popup_message(globals.widgets.top_level, + MSG_ERR, + NULL, + "Empty or incomplete DVI file. " + "Please select a new DVI file via File -> Open."); + return; + } + + if (info->shell == NULL) { /* first time */ + get_initial_values(info); #ifdef MOTIF - XmToggleButtonGadgetSetState(range_marked_radio[FILE_PRINT], True, True); + motif_create_dialog(info); #else - XawToggleSetCurrent(range_marked_radio[FILE_PRINT], (XtPointer)PRINT_MARKED); -#endif /* MOTIF */ - } - XtSetSensitive(range_marked_radio[FILE_PRINT], flag); + xaw_create_dialog(info); +#endif + /* fprintf(stderr, "SHELL IS: %p\n", (void *)info->shell); */ + set_check_page_range(info, False); /* set initial values */ + + if (info->act == FILE_SAVE) + update_dvips_options_sensitivity(resource.default_saving_format, info->shell); } + else { + set_check_page_range(info, False); /* was: True, use False to reset values to current page */ + } + + /* map the dialog */ + XtPopup(info->shell, XtGrabNone); } + diff --git a/Build/source/texk/xdvik/gui/print-dialog.h b/Build/source/texk/xdvik/gui/print-dialog.h index 95f73de3e18..7b7c6ccf4d6 100644 --- a/Build/source/texk/xdvik/gui/print-dialog.h +++ b/Build/source/texk/xdvik/gui/print-dialog.h @@ -23,22 +23,10 @@ #ifndef PRINT_DIALOG_H_ #define PRINT_DIALOG_H_ -#define Xdvi_SAVE_SHELL_NAME "save_popup" -#define Xdvi_PRINT_SHELL_NAME "print_popup" - -typedef enum { FILE_PRINT = 0, FILE_SAVE = 1, FILE_ALL = 2 } printOrSaveActionT; - -struct save_or_print_info { - printOrSaveActionT act; - Widget message_popup; - struct select_pages_info *pinfo; -}; +#include "print-internal.h" extern void save_or_print_callback(struct save_or_print_info *info); extern void cancel_saving(struct save_or_print_info *info); -extern const char *get_printer_options(void); -extern char *get_dvips_options(printOrSaveActionT act); - -extern void notify_print_dialog_have_marked(Boolean flag); +extern void notify_print_dialog_have_marked(void); #endif /* PRINT_DIALOG_H_ */ diff --git a/Build/source/texk/xdvik/gui/print-log.c b/Build/source/texk/xdvik/gui/print-log.c index dd1c26bc008..62e729fbe19 100644 --- a/Build/source/texk/xdvik/gui/print-log.c +++ b/Build/source/texk/xdvik/gui/print-log.c @@ -20,22 +20,33 @@ * OTHER DEALINGS IN THE SOFTWARE. */ + +/* + FIXME: The printlog presents too much detail and is confusing for users. + Re-implement it using an `printing page n of m' message, + i.e. according to the spec on: + http://xdvi.sourceforge.net/gui.html#file-print + Possible save the detailed log to a different window that can be viewed + via `File -> logs', as described on: + http://xdvi.sourceforge.net/gui.html#file-logs +*/ + #include <string.h> #include "xdvi-config.h" #include "xdvi.h" #include "xdvi-debug.h" #include "print-dialog.h" +#include "print-internal.h" #include "print-log.h" /* for adjust_vertically() */ #include "util.h" +#include "string-utils.h" #include "x_util.h" #include "xlwradio.h" #include <X11/Xatom.h> #include <X11/StringDefs.h> -/* FIXME: change #if XAW to #if !defined(MOTIF) to make it consistent with other files */ - #ifdef MOTIF # include <Xm/BulletinB.h> # include <Xm/DialogS.h> @@ -67,30 +78,12 @@ #endif /* MOTIF */ -static Boolean printlog_active = False; /* if the print log is active */ -static Widget printlog_shell = NULL; - -/* global callbacks - FIXME: avoid this, by passing the callback as argument to the action? */ -static void (*g_close_callback)(Widget w, XtPointer client_data, XtPointer call_data); -static void (*g_cancel_callback)(Widget w, XtPointer client_data, XtPointer call_data); -static void (*g_destroy_callback)(Widget w, XtPointer client_data, XtPointer call_data); static void printlog_act_close(Widget, XEvent *, String *, Cardinal *); static void printlog_act_keep(Widget, XEvent *, String *, Cardinal *); static void printlog_act_unkeep(Widget, XEvent *, String *, Cardinal *); static void printlog_act_cancel(Widget, XEvent *, String *, Cardinal *); -static void printlog_act_destroy(Widget, XEvent *, String *, Cardinal *); - -#ifdef MOTIF -static void xm_printlog_act_destroy(Widget w, XtPointer a, XtPointer b) -{ - UNUSED(w); - UNUSED(a); - UNUSED(b); - ASSERT(g_destroy_callback != NULL, "Callback not initialized"); - (g_destroy_callback)(NULL, NULL, NULL); -} -#endif +static void printlog_act_cancel_or_destroy(Widget, XEvent *, String *, Cardinal *); static Atom WM_DELETE_WINDOW; @@ -99,385 +92,522 @@ static XtActionsRec printlog_actions[] = { {"printlogIntKeep", printlog_act_keep}, {"printlogIntUnkeep", printlog_act_unkeep}, {"printlogIntCancel", printlog_act_cancel}, - {"WM_destroy", printlog_act_destroy }, + {"WM_cancel_or_destroy", printlog_act_cancel_or_destroy }, }; -static char *text_translations = \ - "<Key>Return:printlogIntClose()\n" - "^<Key>c:printlogIntCancel()\n" - "^<Key>s:printlogIntKeep()\n" - "^<Key>q:printlogIntUnkeep()"; +static const char *const PRINTLOG_WINDOW_TRANSLATIONS = +#ifdef MOTIF +"<Key>osfCancel:WM_cancel_or_destroy(%p)" +#else +"<Key>Escape:WM_cancel_or_destroy(%p)" +#endif +; -static Widget printlog_text; -static Widget printlog_close; -static Widget printlog_unkeep; -static Widget printlog_cancel; +#ifdef MOTIF +static const char *const PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS = +"#override\n" +"<Key>osfCancel:WM_cancel_or_destroy(%p)"; +#endif +static const char *const PRINTLOG_TEXT_TRANSLATIONS = #ifdef MOTIF -static XmTextPosition printlog_length; +"<Key>osfCancel:WM_cancel_or_destroy(%p)\n" #else -static XawTextPosition printlog_length; +"<Key>Escape:WM_cancel_or_destroy(%p)\n" #endif +"<Key>Return:printlogIntClose(%p)\n" +"^<Key>c:printlogIntCancel(%p)\n" +"^<Key>s:printlogIntKeep(%p)\n" +"^<Key>q:printlogIntUnkeep(%p)\n" +"<Key>q:printlogIntClose(%p)"; + +#define Xdvi_PRINTLOG_TEXT_NAME "text" +#define Xdvi_PRINTLOG_CLOSE_NAME "close" +#define Xdvi_PRINTLOG_KEEP_NAME "keep" +#define Xdvi_PRINTLOG_CANCEL_NAME "cancel" + +static void +cb_printlog_act_cancel_or_destroy(Widget w, XtPointer client_data, XtPointer call_data) +{ + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + Widget cancel_button = NULL; + + UNUSED(w); + UNUSED(call_data); + + ASSERT(info->callbacks != NULL && info->callbacks->cb_destroy != NULL, "Callback not initialized"); + + /* If the `Cancel' button is still active, cancel printing, else close the window. */ + if (get_widget_by_name(&cancel_button, info->printlog, Xdvi_PRINTLOG_CANCEL_NAME, True)) { + Boolean sensitive = False; + + XtVaGetValues(cancel_button, +#ifdef MOTIF + XmNsensitive, +#else + XtNsensitive, +#endif + &sensitive, + NULL); + fprintf(stderr, "Sensitive: %d\n", sensitive); + if (sensitive) + info->callbacks->cb_cancel(w, info, NULL); + else + info->callbacks->cb_destroy(w, info, NULL); + } +} + Boolean -printlog_raise_active(void) +printlog_raise_active(struct save_or_print_info *info) { - if (printlog_active) { - XRaiseWindow(DISP, XtWindow(printlog_shell)); + Widget w = info->printlog; + if (w != NULL && window_is_mapped(XtWindow(w), DISP)) { + XRaiseWindow(DISP, XtWindow(w)); return True; } return False; } void -printlog_popup(void) +printlog_popup(struct save_or_print_info *info) { - printlog_length = 0; - center_window(printlog_shell, globals.widgets.top_level); - XtMapWidget(printlog_shell); -/* XtPopup(printlog_shell, XtGrabNone); */ - printlog_active = True; + Widget w = info->printlog; +#ifdef MOTIF + Widget cancel, text; +#endif + +#ifdef MOTIF + char *text_translations = get_string_va(PRINTLOG_TEXT_TRANSLATIONS, info, info, info, info, info, info); + char *window_translations = get_string_va(PRINTLOG_WINDOW_TRANSLATIONS, info); +#endif + + printlog_reset(info); + + center_window(w, globals.widgets.top_level); + XtMapWidget(w); + /* XtPopup(w, XtGrabNone); */ #ifndef MOTIF - XSetWMProtocols(XtDisplay(printlog_shell), XtWindow(printlog_shell), &WM_DELETE_WINDOW, 1); + XSetWMProtocols(XtDisplay(w), XtWindow(w), &WM_DELETE_WINDOW, 1); #else - XmProcessTraversal(printlog_cancel, XmTRAVERSE_CURRENT); - XtOverrideTranslations(printlog_text, XtParseTranslationTable(text_translations)); + XtOverrideTranslations(w, XtParseTranslationTable(window_translations)); + + if (get_widget_by_name(&cancel, w, Xdvi_PRINTLOG_CANCEL_NAME, True) + && get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) { + + /* This breaks PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS?? + * We don't want it activated on Return anyway ... + */ + /* XmProcessTraversal(cancel, XmTRAVERSE_CURRENT); */ + XtOverrideTranslations(text, XtParseTranslationTable(text_translations)); + XtOverrideTranslations(text, XtParseTranslationTable(window_translations)); + free(text_translations); + free(window_translations); + } #endif } void -printlog_reset(void) +printlog_reset(struct save_or_print_info *info) { - printlog_length = 0; -} + Widget w = info->printlog; + Widget text; + if (get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) { +#ifndef MOTIF + XtVaSetValues(text, XtNstring, "", NULL); + XawTextSetInsertionPoint(text, 0); +#else + XmTextSetString(text, ""); + XtVaSetValues(text, XmNcursorPosition, 0, NULL); +#endif + } +} void -printlog_create(const char *title, - const char *close_label, - void (*close_callback)(Widget w, XtPointer client_data, XtPointer call_data), - void (*cancel_callback)(Widget w, XtPointer client_data, XtPointer call_data), - void (*destroy_callback)(Widget w, XtPointer client_data, XtPointer call_data), - void (*unkeep_callback)(Widget w, XtPointer client_data, XtPointer call_data)) +printlog_create(struct save_or_print_info *info, + const char *title, + const char *close_label) { - /* - FIXME BETA: The printlog presents too much detail and is confusing for users. - Re-implement it using an `printing page n of m' message, - i.e. according to the spec on: - http://xdvi.sourceforge.net/gui.html#file-print - Possible save the detailed log to a different window that can be viewed - via `File -> logs', as described on: - http://xdvi.sourceforge.net/gui.html#file-logs - */ + Widget printlog_text, printlog_close, printlog_keep, printlog_cancel; + Widget form, paned, box; + char *window_translation_str; + +#ifdef MOTIF + XmString str; + XtTranslations window_override_translations; +#else + char *text_translation_str = NULL; + XtTranslations wm_translations; + XtTranslations window_translations; +#endif + +#ifdef MOTIF + window_translation_str = get_string_va(PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS, info); + window_override_translations = XtParseTranslationTable(window_translation_str); + free(window_translation_str); +#else + window_translation_str = get_string_va(PRINTLOG_WINDOW_TRANSLATIONS, info); + window_translations = XtParseTranslationTable(window_translation_str); + free(window_translation_str); +#endif + XtAddActions(printlog_actions, XtNumber(printlog_actions)); - g_destroy_callback = destroy_callback; #ifndef MOTIF - /* Create popup window */ - if (printlog_shell == NULL) { - Widget form, box, paned; -/* int ddist; */ -/* Dimension w0, w1, w2, w3, b; */ - XtTranslations wm_translations = XtParseTranslationTable("<Message>WM_PROTOCOLS: WM_destroy()"); - printlog_shell = XtVaCreatePopupShell("printlog", - transientShellWidgetClass, globals.widgets.top_level, - XtNtitle, title, - XtNtransientFor, globals.widgets.top_level, - XtNmappedWhenManaged, False, - XtNtranslations, wm_translations, - XtNtransientFor, globals.widgets.top_level, - NULL); - - WM_DELETE_WINDOW = XInternAtom(XtDisplay(printlog_shell), "WM_DELETE_WINDOW", False); + wm_translations = XtParseTranslationTable("<Message>WM_PROTOCOLS: WM_cancel_or_destroy()"); + info->printlog = XtVaCreatePopupShell("printlog", + transientShellWidgetClass, globals.widgets.top_level, + XtNtitle, title, + XtNtransientFor, globals.widgets.top_level, + XtNmappedWhenManaged, False, + XtNtranslations, wm_translations, + XtNtransientFor, globals.widgets.top_level, + NULL); + + WM_DELETE_WINDOW = XInternAtom(XtDisplay(info->printlog), "WM_DELETE_WINDOW", False); + + XtOverrideTranslations(info->printlog, window_translations); - paned = XtVaCreateManagedWidget("paned", panedWidgetClass, printlog_shell, NULL); + paned = XtVaCreateManagedWidget("paned", panedWidgetClass, info->printlog, NULL); - form = XtVaCreateManagedWidget("form", formWidgetClass, - paned, - XtNdefaultDistance, 6, - NULL); - printlog_text = XtVaCreateManagedWidget("text", - asciiTextWidgetClass, form, - XtNstring, "", - XtNdataCompression, False, - XtNeditType, XawtextAppend, - XtNscrollHorizontal, XawtextScrollAlways, - XtNscrollVertical, XawtextScrollAlways, - XtNwidth, 600, - XtNheight, 400, - XtNleft, XawChainLeft, - XtNright, XawChainRight, - XtNtop, XawChainTop, - XtNbottom, XawChainBottom, - NULL); - XtOverrideTranslations(printlog_text, XtParseTranslationTable(text_translations)); - - printlog_unkeep = XtVaCreateManagedWidget("keep", + form = XtVaCreateManagedWidget("form", formWidgetClass, + paned, + XtNdefaultDistance, 6, + NULL); + printlog_text = XtVaCreateManagedWidget(Xdvi_PRINTLOG_TEXT_NAME, + asciiTextWidgetClass, form, + XtNstring, "", + XtNdataCompression, False, + XtNeditType, XawtextAppend, + XtNscrollHorizontal, XawtextScrollAlways, + XtNscrollVertical, XawtextScrollAlways, + XtNwidth, 600, + XtNheight, 400, + XtNleft, XawChainLeft, + XtNright, XawChainRight, + XtNtop, XawChainTop, + XtNbottom, XawChainBottom, + NULL); + text_translation_str = get_string_va(PRINTLOG_TEXT_TRANSLATIONS, info, info, info, info, info, info); + XtOverrideTranslations(printlog_text, XtParseTranslationTable(text_translation_str)); + free(text_translation_str); + + printlog_keep = XtVaCreateManagedWidget(Xdvi_PRINTLOG_KEEP_NAME, #ifdef XAW - radioWidgetClass, + radioWidgetClass, #else - toggleWidgetClass, + toggleWidgetClass, #endif - form, - XtNlabel, close_label, - XtNborderWidth, 0, - XtNisRadio, False, - XtNhighlightThickness, 1, - XtNfromVert, printlog_text, - XtNleft, XawChainLeft, - XtNright, XawChainLeft, - XtNtop, XawChainBottom, - XtNbottom, XawChainBottom, - NULL); - XtVaSetValues(printlog_unkeep, - XtNstate, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, - NULL); - XtAddCallback(printlog_unkeep, XtNcallback, unkeep_callback, NULL); - - /* box for the Close/Cancel button */ - box = XtVaCreateManagedWidget("box", formWidgetClass, - paned, - /* resizing by user isn't needed */ - XtNshowGrip, False, - XtNdefaultDistance, 6, /* some padding */ - /* resizing the window shouldn't influence this box, - * but only the pane widget - */ - XtNskipAdjust, True, - XtNaccelerators, G_accels_cr, - NULL); + form, + XtNlabel, close_label, + XtNborderWidth, 0, +#ifdef XAW + XtNisRadio, False, +#endif + XtNhighlightThickness, 1, + XtNfromVert, printlog_text, + XtNleft, XawChainLeft, + XtNright, XawChainLeft, + XtNtop, XawChainBottom, + XtNbottom, XawChainBottom, + NULL); + XtVaSetValues(printlog_keep, + XtNstate, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, + NULL); + XtAddCallback(printlog_keep, XtNcallback, info->callbacks->cb_keep, (XtPointer)info); - printlog_close = XtVaCreateManagedWidget("close", - commandWidgetClass, box, - XtNlabel, "Close", - XtNsensitive, False, - XtNleft, XawChainLeft, - XtNright, XawChainLeft, - XtNtop, XawChainBottom, - XtNbottom, XawChainBottom, - NULL); - XtAddCallback(printlog_close, XtNcallback, close_callback, NULL); - g_close_callback = close_callback; + /* box for the Close/Cancel button */ + box = XtVaCreateManagedWidget("box", formWidgetClass, + paned, + /* resizing by user isn't needed */ + XtNshowGrip, False, + XtNdefaultDistance, 6, /* some padding */ + /* resizing the window shouldn't influence this box, + * but only the pane widget + */ + XtNskipAdjust, True, + XtNaccelerators, G_accels_cr, + NULL); - printlog_cancel = XtVaCreateManagedWidget("cancel", - commandWidgetClass, box, - XtNlabel, "Cancel", - XtNfromHoriz, printlog_unkeep, - XtNleft, XawChainRight, - XtNright, XawChainRight, - XtNtop, XawChainBottom, - XtNbottom, XawChainBottom, - NULL); - XtAddCallback(printlog_cancel, XtNcallback, cancel_callback, NULL); - g_cancel_callback = cancel_callback; - XtManageChild(printlog_shell); - } - else { - XtSetSensitive(printlog_close, False); - XtSetSensitive(printlog_cancel, True); - } - -#else /* MOTIF */ - - /* Create popup window */ - if (printlog_shell == NULL) { - Widget form, pane, box; - XmString str; - Arg args[10]; - int n; + printlog_close = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CLOSE_NAME, + commandWidgetClass, box, + XtNlabel, "Close", + XtNsensitive, False, + XtNleft, XawChainLeft, + XtNright, XawChainLeft, + XtNtop, XawChainBottom, + XtNbottom, XawChainBottom, + NULL); + XtAddCallback(printlog_close, XtNcallback, info->callbacks->cb_close, (XtPointer)info); - printlog_shell = XtVaCreatePopupShell("printlog", - xmDialogShellWidgetClass, globals.widgets.top_level, - XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ - XmNtitle, title, - XtNmappedWhenManaged, False, + printlog_cancel = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CANCEL_NAME, + commandWidgetClass, box, + XtNlabel, "Cancel", + XtNfromHoriz, printlog_keep, + XtNleft, XawChainRight, + XtNright, XawChainRight, + XtNtop, XawChainBottom, + XtNbottom, XawChainBottom, NULL); + XtAddCallback(printlog_cancel, XtNcallback, info->callbacks->cb_cancel, (XtPointer)info); + XtManageChild(info->printlog); - WM_DELETE_WINDOW = XmInternAtom(XtDisplay(printlog_shell), "WM_DELETE_WINDOW", False); - XmAddWMProtocolCallback(printlog_shell, WM_DELETE_WINDOW, xm_printlog_act_destroy, NULL); - - pane = XtVaCreateWidget("printlog_pane", xmPanedWindowWidgetClass, printlog_shell, - /* make sashes invisible */ - XmNsashWidth, 1, - XmNsashHeight, 1, - NULL); + printlog_enable_cancelbutton(info); - form = XtVaCreateWidget("form", xmFormWidgetClass, pane, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNautoUnmanage, False, - NULL); - /* force vertical scrollbars. Under Motif 2.x (2.1.0 and 2.2.2 at least), - XmNeditMode must be set early in order to have an effect. */ - n = 0; +#else /* MOTIF */ + info->printlog = XtVaCreatePopupShell("printlog", + xmDialogShellWidgetClass, globals.widgets.top_level, + XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ + XmNtitle, title, + XtNmappedWhenManaged, False, + XmNtranslations, window_override_translations, + NULL); + + WM_DELETE_WINDOW = XmInternAtom(XtDisplay(info->printlog), "WM_DELETE_WINDOW", False); + XmAddWMProtocolCallback(info->printlog, WM_DELETE_WINDOW, cb_printlog_act_cancel_or_destroy, (XtPointer)info); + + paned = XtVaCreateWidget("printlog_pane", xmPanedWindowWidgetClass, info->printlog, + /* make sashes invisible */ + XmNsashWidth, 1, + XmNsashHeight, 1, + XmNtranslations, window_override_translations, + NULL); + + form = XtVaCreateWidget("form", xmFormWidgetClass, paned, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNautoUnmanage, False, + XmNtranslations, window_override_translations, + NULL); + /* force vertical scrollbars. Under Motif 2.x (2.1.0 and 2.2.2 at least), + XmNeditMode must be set early in order to have an effect. */ + { + Arg args[10]; + int n = 0; XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; XtSetArg(args[n], XmNeditable, False); n++; XtSetArg(args[n], XmNrows, 24); n++; XtSetArg(args[n], XmNcolumns, 80); n++; - printlog_text = XmCreateScrolledText(form, "text", args, n); - - XtVaSetValues(XtParent(printlog_text), - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); + printlog_text = XmCreateScrolledText(form, Xdvi_PRINTLOG_TEXT_NAME, args, n); + } - XtManageChild(printlog_text); - - str = XmStringCreateLocalized((char *)close_label); - printlog_unkeep = XtVaCreateManagedWidget("keep", - xmToggleButtonGadgetClass, form, - XmNlabelString, str, - XmNnavigationType, XmTAB_GROUP, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, XtParent(printlog_text), - XmNleftAttachment, XmATTACH_FORM, - NULL); - XmStringFree(str); - XtAddCallback(printlog_unkeep, XmNvalueChangedCallback, unkeep_callback, NULL); - XmToggleButtonGadgetSetState(printlog_unkeep, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, False); - - /* box for Close/Cancel button */ - box = XtVaCreateManagedWidget("box", xmFormWidgetClass, - pane, - NULL); + XtVaSetValues(XtParent(printlog_text), + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNtranslations, window_override_translations, + NULL); + + XtManageChild(printlog_text); + + str = XmStringCreateLocalized((char *)close_label); + printlog_keep = XtVaCreateManagedWidget(Xdvi_PRINTLOG_KEEP_NAME, + xmToggleButtonGadgetClass, form, + XmNlabelString, str, + XmNindicatorType, XmN_OF_MANY, + XmNnavigationType, XmTAB_GROUP, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, XtParent(printlog_text), + XmNleftAttachment, XmATTACH_FORM, + XmNtranslations, window_override_translations, + NULL); + XmStringFree(str); + XtAddCallback(printlog_keep, XmNvalueChangedCallback, info->callbacks->cb_keep, (XtPointer)info); + XmToggleButtonGadgetSetState(printlog_keep, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, False); + + /* box for Close/Cancel button */ + box = XtVaCreateManagedWidget("box", xmFormWidgetClass, + paned, + NULL); - str = XmStringCreateLocalized("Close"); - printlog_close = XtVaCreateManagedWidget("close", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNshowAsDefault, True, - XmNsensitive, False, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNleftOffset, 10, - NULL); - XmStringFree(str); - XtAddCallback(printlog_close, XmNactivateCallback, close_callback, NULL); - g_close_callback = close_callback; - - str = XmStringCreateLocalized("Cancel"); - printlog_cancel = XtVaCreateManagedWidget("cancel", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNrightOffset, 10, - NULL); - XmStringFree(str); - XtAddCallback(printlog_cancel, XmNactivateCallback, cancel_callback, NULL); - g_cancel_callback = cancel_callback; - - XtManageChild(box); - XtManageChild(form); - XtManageChild(pane); -/* center_window(printlog_shell, globals.widgets.top_level); */ -/* XtMapWidget(printlog_shell); */ - /* this doesn't help */ - /* XtOverrideTranslations(form, XtParseTranslationTable(text_translations)); */ - /* XtOverrideTranslations(pane, XtParseTranslationTable(text_translations)); */ - } - else { - XtSetSensitive(printlog_close, False); - XtSetSensitive(printlog_cancel, True); - } + str = XmStringCreateLocalized("Close"); + printlog_close = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CLOSE_NAME, + xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNshowAsDefault, True, + XmNsensitive, False, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + /* mimick appearance of native dialog buttons (better way would be + to extend existing dialog with custom widgets, as in search-dialog.c) */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNleftOffset, 10, + XmNtranslations, window_override_translations, + NULL); + XmStringFree(str); + XtAddCallback(printlog_close, XmNactivateCallback, info->callbacks->cb_close, (XtPointer)info); + XtOverrideTranslations(printlog_close, XtParseTranslationTable("<Key>Return:ArmAndActivate()\n")); + + + str = XmStringCreateLocalized("Cancel"); + printlog_cancel = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CANCEL_NAME, + xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + /* to mimick appearance of native dialog buttons: */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNrightOffset, 10, + XmNtranslations, window_override_translations, + NULL); + XmStringFree(str); + XtAddCallback(printlog_cancel, XmNactivateCallback, info->callbacks->cb_cancel, (XtPointer)info); + XtOverrideTranslations(printlog_close, XtParseTranslationTable("<Key>Return:ArmAndActivate()\n")); + + XtManageChild(box); + XtManageChild(form); + XtManageChild(paned); + /* center_window(info->printlog, globals.widgets.top_level); */ + /* XtMapWidget(info->printlog); */ + /* this doesn't help */ + /* XtOverrideTranslations(form, XtParseTranslationTable(text_translation_str)); */ + /* XtOverrideTranslations(paned, XtParseTranslationTable(text_translation_str)); */ + + printlog_enable_cancelbutton(info); + #endif adjust_width(printlog_close, printlog_cancel); } void -printlog_append(const char *str, size_t len) +printlog_append(struct save_or_print_info *info, const char *str, size_t len) { -#ifndef MOTIF + Widget text; + Widget w = info->printlog; - static XawTextBlock block = {0, 0, NULL, 0}; + if (!get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) + return; + +#ifndef MOTIF + { + XawTextPosition point; + static XawTextBlock block = {0, 0, NULL, 0}; - block.ptr = (char *) str; - block.length = len; - block.format = XawFmt8Bit; - while (XawTextReplace(printlog_text, printlog_length, printlog_length, &block) - != XawEditDone) { - int length; + block.ptr = (char *) str; + block.length = len; + block.format = XawFmt8Bit; + + point = XawTextGetInsertionPoint(text); + while (XawTextReplace(text, point, point, &block) != XawEditDone) { + int length; - XtVaGetValues(printlog_text, XtNlength, &length, NULL); - printlog_length = length; + XtVaGetValues(text, XtNlength, &length, NULL); + point = length; + } + point += len; + XawTextSetInsertionPoint(text, point); } - printlog_length += len; - XawTextSetInsertionPoint(printlog_text, printlog_length); - #else /* MOTIF */ - - XmTextInsert(printlog_text, printlog_length, (char *) str); - printlog_length += len; - XtVaSetValues(printlog_text, XmNcursorPosition, printlog_length, NULL); - XmTextShowPosition(printlog_text, printlog_length); - + { + XmTextPosition point = XmTextGetInsertionPosition(text); + XmTextInsert(text, point, (char *) str); + point += len; + XtVaSetValues(text, XmNcursorPosition, point, NULL); + XmTextShowPosition(text, point); + } #endif /* MOTIF */ } void -printlog_append_str(const char *str) +printlog_append_str(struct save_or_print_info *info, const char *str) { - printlog_append(str, strlen(str)); + printlog_append(info, str, strlen(str)); +} + +/* enable cancel button, disable close button */ +void +printlog_enable_cancelbutton(struct save_or_print_info *info) +{ + Widget w = info->printlog; + Widget close, cancel; + + if (get_widget_by_name(&cancel, w, Xdvi_PRINTLOG_CANCEL_NAME, True) + && get_widget_by_name(&close, w, Xdvi_PRINTLOG_CLOSE_NAME, True)) { + + XtSetSensitive(close, False); + XtSetSensitive(cancel, True); +#if MOTIF + /* This breaks PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS?? + * We don't want it activated on Return anyway ... + */ + /* XmProcessTraversal(cancel, XmTRAVERSE_CURRENT); */ +#endif + } } /* disable cancel button, enable close button */ void -printlog_enable_closebutton(void) +printlog_enable_closebutton(struct save_or_print_info *info) { - XtSetSensitive(printlog_close, True); - XtSetSensitive(printlog_cancel, False); + Widget w = info->printlog; + Widget close, cancel; + + if (get_widget_by_name(&cancel, w, Xdvi_PRINTLOG_CANCEL_NAME, True) + && get_widget_by_name(&close, w, Xdvi_PRINTLOG_CLOSE_NAME, True)) { +#if MOTIF + char *window_translations = get_string_va(PRINTLOG_WINDOW_TRANSLATIONS, info); +#endif + XtSetSensitive(close, True); + XtSetSensitive(cancel, False); #if MOTIF - XmProcessTraversal(printlog_close, XmTRAVERSE_CURRENT); + XmProcessTraversal(close, XmTRAVERSE_CURRENT); + XtOverrideTranslations(close, XtParseTranslationTable(window_translations)); + free(window_translations); #endif + } } static void -printlog_internal_close(void) +printlog_internal_close(struct save_or_print_info *info) { - XtUnmapWidget(printlog_shell); - printlog_active = False; + Widget w = info->printlog; + Widget text; + + XtUnmapWidget(w); + + if (get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) { #ifndef MOTIF - XtVaSetValues(printlog_text, XtNstring, "", NULL); + XtVaSetValues(text, XtNstring, "", NULL); #else - XmTextSetString(printlog_text, ""); + XmTextSetString(text, ""); #endif + } } void -printlog_popdown(Boolean force) +printlog_popdown(struct save_or_print_info *info, Boolean force) { + Widget w = info->printlog; + Widget keep; + if (force) { /* user clicked on `Close' */ - printlog_internal_close(); + printlog_internal_close(info); } - else { /* timer elapsed */ + else if (get_widget_by_name(&keep, w, Xdvi_PRINTLOG_KEEP_NAME, True)) { /* timer elapsed */ #ifndef MOTIF Boolean state; - XtVaGetValues(printlog_unkeep, XtNstate, &state, NULL); + XtVaGetValues(keep, XtNstate, &state, NULL); if (state) { - printlog_internal_close(); + printlog_internal_close(info); } #else - if (XmToggleButtonGadgetGetState(printlog_unkeep)) { - printlog_internal_close(); + if (XmToggleButtonGadgetGetState(keep)) { + printlog_internal_close(info); } #endif } @@ -487,66 +617,119 @@ printlog_popdown(Boolean force) static void printlog_act_close(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); - ASSERT(g_close_callback != NULL, "Callback not initialized"); - (g_close_callback)(NULL, NULL, NULL); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + ASSERT(info->callbacks != NULL && info->callbacks->cb_close != NULL, "Callback not initialized"); + info->callbacks->cb_close(w, info, NULL); } static void printlog_act_keep(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + Widget keep; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + ASSERT(info->callbacks != NULL && info->callbacks->cb_keep != NULL, "Callback not initialized"); + info->callbacks->cb_keep(w, info, NULL); + + if (get_widget_by_name(&keep, info->printlog, Xdvi_PRINTLOG_KEEP_NAME, True)) { #ifdef MOTIF - XmToggleButtonGadgetSetState(printlog_unkeep, False, False); + XmToggleButtonGadgetSetState(keep, False, False); #else - XtVaSetValues(printlog_unkeep, XtNstate, False, NULL); + XtVaSetValues(keep, XtNstate, False, NULL); #endif + } } - static void printlog_act_unkeep(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + Widget keep; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); + + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + if (get_widget_by_name(&keep, info->printlog, Xdvi_PRINTLOG_KEEP_NAME, True)) { #ifdef MOTIF - XmToggleButtonGadgetSetState(printlog_unkeep, True, False); + XmToggleButtonGadgetSetState(keep, True, False); #else - XtVaSetValues(printlog_unkeep, XtNstate, True, NULL); + XtVaSetValues(keep, XtNstate, True, NULL); #endif + } } + static void printlog_act_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); - ASSERT(g_cancel_callback != NULL, "Callback not initialized"); - (g_cancel_callback)(NULL, NULL, NULL); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + ASSERT(info->callbacks != NULL && info->callbacks->cb_cancel != NULL, "Callback not initialized"); + info->callbacks->cb_cancel(w, info, NULL); } + static void -printlog_act_destroy(Widget w, XEvent *event, String *params, Cardinal *num_params) +printlog_act_cancel_or_destroy(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); - ASSERT((g_destroy_callback) != NULL, "Callback not initialized"); - (g_destroy_callback)(NULL, NULL, NULL); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + cb_printlog_act_cancel_or_destroy(w, (XtPointer)ptr, NULL); + + /* ASSERT(info->callbacks != NULL && info->callbacks->cb_cancel != NULL, "Callback not initialized"); */ + /* info->callbacks->cb_cancel(w, info, NULL); */ } diff --git a/Build/source/texk/xdvik/gui/print-log.h b/Build/source/texk/xdvik/gui/print-log.h index 90e69be8343..53855d8e04e 100644 --- a/Build/source/texk/xdvik/gui/print-log.h +++ b/Build/source/texk/xdvik/gui/print-log.h @@ -23,24 +23,19 @@ #ifndef PRINT_LOG_H_ #define PRINT_LOG_H_ -/* printlog access functions */ +struct save_or_print_info *info; /* forward declaration */ -extern void printlog_create(const char *title, - const char *close_label, - /* callback for `close' button */ - void (*close_callback)(Widget w, XtPointer client_data, XtPointer call_data), - /* callback for `cancel' button */ - void (*cancel_callback)(Widget w, XtPointer client_data, XtPointer call_data), - /* callback for destroying window via window manager */ - void (*destroy_callback)(Widget w, XtPointer client_data, XtPointer call_data), - /* callback for `close automatically' checkbox */ - void (*unkeep_callback)(Widget w, XtPointer client_data, XtPointer call_data)); -extern Boolean printlog_raise_active(void); -extern void printlog_popup(void); -extern void printlog_reset(void); -extern void printlog_append(const char *str, size_t len); -extern void printlog_append_str(const char *str); -extern void printlog_enable_closebutton(void); -extern void printlog_popdown(Boolean override_timer); +/* printlog access functions */ +extern void printlog_create(struct save_or_print_info *info, + const char *title, + const char *close_label); +extern Boolean printlog_raise_active(struct save_or_print_info *info); +extern void printlog_popup(struct save_or_print_info *info); +extern void printlog_reset(struct save_or_print_info *info); +extern void printlog_append(struct save_or_print_info *info, const char *str, size_t len); +extern void printlog_append_str(struct save_or_print_info *info, const char *str); +extern void printlog_enable_closebutton(struct save_or_print_info *info); +extern void printlog_enable_cancelbutton(struct save_or_print_info *info); +extern void printlog_popdown(struct save_or_print_info *info, Boolean override_timer); #endif /* PRINT_LOG_H_ */ diff --git a/Build/source/texk/xdvik/gui/search-dialog.c b/Build/source/texk/xdvik/gui/search-dialog.c index c77fa9d219e..e84e6c4ec40 100644 --- a/Build/source/texk/xdvik/gui/search-dialog.c +++ b/Build/source/texk/xdvik/gui/search-dialog.c @@ -30,9 +30,11 @@ #include "xlwradio.h" #include "statusline.h" #include "string-utils.h" +#include "string_list.h" #include "util.h" #include "message-window.h" #include "x_util.h" +#include "xm_menu.h" /* for popdown_callback() */ #include <X11/Xatom.h> #include <X11/StringDefs.h> @@ -51,6 +53,10 @@ # include <Xm/PushB.h> # include <Xm/Protocols.h> # include <Xm/AtomMgr.h> +# if USE_COMBOBOX +# include <Xm/ComboBox.h> +# include <Xm/List.h> +# endif /* USE_COMBOBOX */ #else /* MOTIF */ # include <X11/Shell.h> # include <X11/Xaw/Paned.h> @@ -91,6 +97,172 @@ # define ACTIVATE_CALLBACK_NAME XtNcallback #endif /* MOTIF */ +#if defined(MOTIF) && USE_COMBOBOX +struct search_history { + char **char_items; + size_t item_cnt; + Boolean empty; +}; + +#define Xdvi_HISTORY_EMPTY_MARKER "<History empty>" + +static void +search_history_init(struct search_history *hist) +{ + if (resource.search_history == NULL) { + hist->empty = True; + hist->char_items = xmalloc(1 * sizeof *(hist->char_items)); + hist->char_items[0] = NULL; + hist->item_cnt = 0; + } + else { + hist->char_items = get_separated_list(resource.search_history, "\n", False); + hist->empty = False; + /* count number of items and save to hist->item_cnt */ + for (hist->item_cnt = 0; hist->char_items[hist->item_cnt] != NULL; hist->item_cnt++) { ; } + } +} + + +static void +search_history_update(struct search_history *hist, Widget w, const char *str) +{ + size_t i; + char *tmp; + XmString tmp_str = XmStringCreateLocalized((char *)str); + Boolean found = False; + Widget textfield = NULL; + + TRACE_FIND((stderr, "search_history_update for: |%s|\n", str)); + + /* special case if Xdvi_HISTORY_EMPTY_MARKER is present: Replace it with `str' */ + if (hist->empty) { + XmComboBoxDeletePos(w, 0); + hist->empty = False; + hist->char_items = string_list_prepend(hist->char_items, str); + XmComboBoxAddItem(w, tmp_str, 0, True); + hist->item_cnt++; + XmStringFree(tmp_str); + return; + } + + XtVaGetValues(w, XmNtextField, &textfield, NULL); + if (textfield == NULL) { + XDVI_ERROR((stderr, "Could not get text field from combo box!")); + XmStringFree(tmp_str); + return; + } + + /* if str is already in the history, just move it to the first position */ + for (i = 0; hist->char_items[i] != NULL; i++) { + if (strcmp(hist->char_items[i], str) == 0) { + found = True; + break; + } + } + if (found) { + hist->char_items = string_list_move_to_start(hist->char_items, i); + XmComboBoxDeletePos(w, i + 1); + XmComboBoxAddItem(w, tmp_str, 1, True); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(hist->char_items[0]), NULL); + XmStringFree(tmp_str); + return; + } + + if ((int)hist->item_cnt >= resource.search_history_size) { + /* history has reached its max size, delete the oldest element and + put the new element at the beginning */ + + XmComboBoxDeletePos(w, hist->item_cnt); + + free(hist->char_items[hist->item_cnt - 1]); + hist->char_items[hist->item_cnt - 1] = xstrdup(str); + hist->char_items = string_list_rotate_up(hist->char_items); + + XmComboBoxAddItem(w, tmp_str, 1, False); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(str), NULL); + } + else { /* add item */ + hist->char_items = string_list_prepend(hist->char_items, str); + XmComboBoxAddItem(w, tmp_str, 1, False); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(str), NULL); + + hist->item_cnt++; + } + + tmp = string_list_to_str(hist->char_items, "\n"); + TRACE_FIND((stderr, "Saving search history: |%s|\n", tmp)); + store_preference(NULL, "searchHistory", "%s", tmp); + free(tmp); + + + XmStringFree(tmp_str); +} + + +/* + * User selected an item from seach history list + */ +static void +cb_search_history_select(Widget w, XtPointer client_data, XtPointer call_data) +{ + XmComboBoxCallbackStruct *cb = (XmComboBoxCallbackStruct *)call_data; + struct search_history *hist = NULL; + Widget textfield; + int pos; + int idx; + + UNUSED(client_data); + + if (cb->event == NULL) /* only browsing, no selection */ + return; + + pos = cb->item_position; + TRACE_FIND((stderr, "POS: %d; reason: %d, event type: %d\n", pos, cb->reason, cb->event->type)); + + /* Return if user didn't select from menu, but entered text directly. + Strangely, `pos == 0' doesn't indicate this, contrary to what the docs say + about XmONE_BASED. */ + if (pos == 0 || cb->event->type != ButtonRelease) + return; + + + XtVaGetValues(w, + XmNuserData, &hist, + XmNtextField, &textfield, + NULL); + + if (hist == NULL || textfield == NULL) { + XDVI_ERROR((stderr, "Couldn't get XmNuserData or XmNtextField from combo box widget!\n")); + return; + } + + idx = pos - 1; + + if (idx == 0 && hist->char_items[0] == NULL) { /* Xdvi_HISTORY_EMPTY_MARKER selected, do nothing */ + XtVaSetValues(textfield, XmNvalue, "", NULL); + } + else { + XmString tmp_str; + + TRACE_FIND((stderr, "moving item %d, %s to pos 0\n", idx, hist->char_items[idx])); + hist->char_items = string_list_move_to_start(hist->char_items, idx); + + /* same for list in combo box */ + tmp_str = XmStringCreateLocalized(hist->char_items[0]); + XmComboBoxDeletePos(w, pos); + XmComboBoxAddItem(w, tmp_str, 1, True); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(hist->char_items[0]), NULL); + XmStringFree(tmp_str); + } +} + +#endif /* defined(MOTIF) && USE_COMBOBOX */ + static Boolean m_find_popup_active = False; /* flags for setting single bits in resource.search_window_defaults */ @@ -98,6 +270,7 @@ static const int SETTINGS_USE_REGEXP_FLAG = 1; static const int SETTINGS_CASE_SENSITIVE_FLAG = 2; static const int SETTINGS_BACKWARDS_FLAG = 4; static const int SETTINGS_IGNORE_LINEBREAKS_FLAG = 8; +static const int SETTINGS_WRAP_FLAG = 16; static void @@ -110,24 +283,21 @@ cb_search_go(Widget w, XtPointer client_data, XtPointer call_data) ASSERT(settings != NULL, "client_data cb_search_go mustn't be NULL!"); UNUSED(call_data); - TRACE_FIND((stderr, "cb_search_go: settings: searchterm=|%s|, down = %d, re = %d, case = %d", - settings->term, settings->direction, settings->use_regexp, settings->case_sensitive)); + TRACE_FIND((stderr, "cb_search_go: settings: searchterm=|%s|, down = %d, re = %d, case = %d, wrap = %d", + settings->term, settings->direction, settings->use_regexp, settings->case_sensitive, settings->wrap)); - /* retrieve the find popup window */ - if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_popup\" widget!")); - x = y = 0; - } - else { - XtVaGetValues(find_popup, XtNx, &x, XtNy, &y, NULL); - /* add some offsets */ - settings->x_pos = x + 10; - settings->y_pos = y + 10; - TRACE_GUI((stderr, "SHELL: %ld; x: %d, y: %d", (unsigned long)w, x, y)); - } + if (!get_widget_by_name(&find_popup, globals.widgets.top_level, "find_popup", True)) + return; + + XtVaGetValues(find_popup, XtNx, &x, XtNy, &y, NULL); + /* add some offsets */ + settings->x_pos = x + 10; + settings->y_pos = y + 10; + TRACE_GUI((stderr, "SHELL: %ld; x: %d, y: %d", (unsigned long)w, x, y)); settings->from_page = current_page; settings->message_window = 0; + settings->wrapcnt = 0; TRACE_FIND((stderr, "starting search from page: %d", settings->from_page)); search_dvi((XtPointer)settings); } @@ -136,14 +306,15 @@ static void show_settings(const char *func_name, struct search_settings *settings) { TRACE_FIND((stderr, "%s: settings: str=|%s|, down = %d, re = %d, " - "case = %d, ignore_hyphens = %d, ignore_linebreaks = %d\n", + "case = %d, ignore_hyphens = %d, ignore_linebreaks = %d, wrap = %d\n", func_name, settings->term, settings->direction, settings->use_regexp, settings->case_sensitive, settings->ignore_hyphens, - settings->ignore_linebreaks)); + settings->ignore_linebreaks, + settings->wrap)); } @@ -222,6 +393,26 @@ cb_backwards_search(Widget w, XtPointer client_data, XtPointer call_data) } static void +cb_wrap_search(Widget w, XtPointer client_data, XtPointer call_data) +{ + struct search_settings *settings = (struct search_settings *)client_data; + ASSERT(settings != NULL, "client_data cb_search_go mustn't be NULL!"); + UNUSED(w); + UNUSED(call_data); + + settings->wrap = !settings->wrap; + + show_settings("cb_wrap_search", settings); + + if (settings->wrap) + resource.search_window_defaults |= SETTINGS_WRAP_FLAG; + else + resource.search_window_defaults &= ~SETTINGS_WRAP_FLAG; + + store_preference(NULL, "searchWindowDefaults", "%u", resource.search_window_defaults); +} + +static void cb_match_case(Widget w, XtPointer client_data, XtPointer call_data) { struct search_settings *settings = (struct search_settings *)client_data; @@ -260,6 +451,7 @@ cb_linebreaks(Widget w, XtPointer client_data, XtPointer call_data) store_preference(NULL, "searchWindowDefaults", "%u", resource.search_window_defaults); } + static void cb_search_cancel(Widget w, XtPointer client_data, XtPointer call_data) { @@ -268,12 +460,9 @@ cb_search_cancel(Widget w, XtPointer client_data, XtPointer call_data) UNUSED(w); UNUSED(call_data); - - /* retrieve the find popup window */ - if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_popup\" widget!")); + + if (!get_widget_by_name(&find_popup, globals.widgets.top_level, "find_popup", True)) return; - } /* This flag is checked in the scanning routines, and will be eventually reset by do_pages() in events.c. @@ -297,6 +486,10 @@ cb_search_get_term_button(Widget w, XtPointer client_data, XtPointer call_data) struct search_settings *settings = (struct search_settings *)client_data; char *searchterm = NULL; +#if defined(MOTIF) && USE_COMBOBOX + struct search_history *hist = NULL; +#endif + Widget searchbox_input, paned, box; UNUSED(call_data); @@ -305,13 +498,26 @@ cb_search_get_term_button(Widget w, XtPointer client_data, XtPointer call_data) paned = XtParent(box); ASSERT(paned != 0, "Parent of box widget mustn't be NULL!"); - if ((searchbox_input = XtNameToWidget(paned, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); + if (!get_widget_by_name(&searchbox_input, paned, Xdvi_SEARCHBOX_INPUT_NAME, True)) return; - } #ifdef MOTIF +# if USE_COMBOBOX + { + Widget textfield = NULL; + XtVaGetValues(searchbox_input, + XmNtextField, &textfield, + XmNuserData, &hist, + NULL); + if (textfield == NULL || hist == NULL) { + XDVI_ERROR((stderr, "Couldn't get XmNtextField or XmNuserData from combo box widget!\n")); + return; + } + XtVaGetValues(textfield, XmNvalue, &searchterm, NULL); + } +# else XtVaGetValues(searchbox_input, XmNvalue, &searchterm, NULL); +# endif #else XtVaGetValues(searchbox_input, XtNstring, &searchterm, NULL); #endif @@ -322,6 +528,10 @@ cb_search_get_term_button(Widget w, XtPointer client_data, XtPointer call_data) TRACE_FIND((stderr, "searchterm1: |%s|", searchterm)); settings->term = searchterm; +#if defined(MOTIF) && USE_COMBOBOX + search_history_update(hist, searchbox_input, searchterm); +#endif + cb_search_go(w, settings, NULL); } @@ -355,26 +565,32 @@ cb_search_get_term(Widget w, XtPointer client_data, XtPointer call_data) { struct search_settings *settings = (struct search_settings *)client_data; char *searchterm = NULL; - Widget form, paned, searchbox_form; - Widget button; + Widget popup, button, textfield; XEvent ev; UNUSED(call_data); + TRACE_FIND((stderr, "cb_search_get_term!\n")); + +#if USE_COMBOBOX + UNUSED(w); + { + Widget combobox; + if (!get_widget_by_name(&combobox, globals.widgets.top_level, Xdvi_SEARCHBOX_INPUT_NAME, True) + || !get_widget_by_name(&textfield, globals.widgets.top_level, "Text", True)) + return; + } +#else + textfield = w; +#endif + /* retrieve the `Find' button widget */ - searchbox_form = XtParent(w); - ASSERT(searchbox_form != 0, "Parent of button widget mustn't be NULL!"); - form = XtParent(searchbox_form); - ASSERT(form != 0, "Parent of searchbox_form widget mustn't be NULL!"); - paned = XtParent(form); - ASSERT(paned != 0, "Parent of form widget mustn't be NULL!"); - if ((button = XtNameToWidget(paned, "*find_button")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_button\" widget!")); + if (!get_widget_by_name(&popup, globals.widgets.top_level, Xdvi_SEARCH_POPUP_NAME, True) + || !get_widget_by_name(&button, popup, "find_button", True)) return; - } if (settings != NULL) { /* retrieve search term from text input field */ - XtVaGetValues(w, XmNvalue, &searchterm, NULL); + XtVaGetValues(textfield, XmNvalue, &searchterm, NULL); if (searchterm == NULL) { XDVI_WARNING((stderr, "Searchterm in cb_search_get_term callback shouldn't be NULL!")); return; @@ -385,8 +601,8 @@ cb_search_get_term(Widget w, XtPointer client_data, XtPointer call_data) } /* make the `Find' button think it got pushed. - Also synthetisize an event, just to be sure ... */ - synthetisize_event(&ev, button); + Also synthesize an event, just to be sure ... */ + synthesize_event(&ev, button); XtCallActionProc(button, "ArmAndActivate", &ev, NULL, 0); /* the following don't make the button appear visually pressed: */ @@ -407,7 +623,7 @@ xm_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) if (params != NULL) { /* re-initialize search term */ ASSERT(*num_params == 1, "num_params in xm_search_go should be 1 if *params != NULL"); /* - * the *params char pointer contains the pointer value (address) of `settings'; + * the *params char pointer contains the pointer value (address) of `settings' as a string; * convert it back to a pointer: */ TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); @@ -417,11 +633,9 @@ xm_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) ASSERT(settings != NULL, "Shouldn't happen: Couldn't get string representation of argument pointer."); } - if ((input = XtNameToWidget(globals.widgets.top_level, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); - return; + if (get_widget_by_name(&input, globals.widgets.top_level, "searchbox_input", True)) { + cb_search_get_term(input, settings, NULL); } - cb_search_get_term(input, settings, NULL); } #else /* MOTIF */ @@ -434,7 +648,7 @@ xaw_unset_button(XtPointer client_data, XtIntervalId *id) UNUSED(id); - synthetisize_event(&ev, button); + synthesize_event(&ev, button); XtCallActionProc(button, "unset", &ev, NULL, 0); } @@ -449,15 +663,9 @@ xaw_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) UNUSED(w); - /* retrieve the `Find' button widget */ - if ((button = XtNameToWidget(globals.widgets.top_level, "*find_button")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_button\" widget!")); + if (!get_widget_by_name(&button, globals.widgets.top_level, "find_button", True) + || !get_widget_by_name(&input, globals.widgets.top_level, "searchbox_input", True)) return; - } - if ((input = XtNameToWidget(globals.widgets.top_level, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); - return; - } XtVaGetValues(input, XtNstring, &searchterm, NULL); if (searchterm == NULL) { @@ -488,7 +696,7 @@ xaw_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) XtCallActionProc(button, "set", event, NULL, 0); XtCallActionProc(button, "notify", event, NULL, 0); XSync(DISP, False); - timeout = XtAppAddTimeOut(app, 150, xaw_unset_button, (XtPointer)button); + timeout = XtAppAddTimeOut(globals.app, 150, xaw_unset_button, (XtPointer)button); } @@ -531,6 +739,8 @@ static XtActionsRec search_actions[] = { { "cancel-search", search_cancel }, }; + + static Widget create_search_window(struct search_settings *settings) { @@ -539,11 +749,15 @@ create_search_window(struct search_settings *settings) Widget form, find_paned, box; unsigned char curr_state; +#if defined(MOTIF) && USE_COMBOBOX + static struct search_history hist = { NULL, 0, True }; +#endif + Widget searchbox_form, searchbox_label, searchbox_input; /* left and right column */ Widget options_left_form, options_right_form; /* checkboxes in left column */ - Widget regexp_checkbox, matchcase_checkbox, backwards_checkbox; + Widget regexp_checkbox, matchcase_checkbox, backwards_checkbox, wrap_checkbox; /* checkboxes in right column */ Widget linebreaks_checkbox; Widget find_button, cancel_button; @@ -579,10 +793,23 @@ create_search_window(struct search_settings *settings) translation_str = NULL; #endif /* not MOTIF */ + translation_str = get_string_va( +#ifdef MOTIF + "<Key>osfCancel:cancel-search(%p)\n" +#else + "<Key>Escape:cancel-search(%p)\n" +#endif + "<Key>Return:do-search(%p)\n" + "Ctrl<Key>g:find-next()", + (void *)settings, (void *)settings); + + xlats = XtParseTranslationTable(translation_str); + free(translation_str); + top_level_shell = XtVaCreatePopupShell("find_popup", SHELL_WIDGET, globals.widgets.top_level, - XtNtitle, "xdvik: Find in DVI file", + XtNtitle, "xdvik: Find in File", XtNmappedWhenManaged, False, /* so that we can center it first */ XtNtransientFor, globals.widgets.top_level, XtNallowShellResize, True, @@ -659,7 +886,83 @@ create_search_window(struct search_settings *settings) #endif NULL); - searchbox_input = XtVaCreateManagedWidget("searchbox_input", +#if defined(MOTIF) && USE_COMBOBOX + + { + Widget textfield = NULL; + Widget grab_shell = NULL; + size_t n; + XmStringTable items; + + search_history_init(&hist); + + /* initialize Motif string list */ + n = hist.item_cnt == 0 ? 1 : hist.item_cnt; + items = (XmStringTable)XtMalloc(n * sizeof(XmString *)); + + if (hist.item_cnt == 0) + items[0] = XmStringCreateLocalized(Xdvi_HISTORY_EMPTY_MARKER); + else { + for (n = 0; hist.char_items[n] != NULL; n++) + items[n] = XmStringCreateLocalized(hist.char_items[n]); + } + + searchbox_input = XtVaCreateManagedWidget(Xdvi_SEARCHBOX_INPUT_NAME, xmComboBoxWidgetClass, + searchbox_form, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, searchbox_label, + XmNbottomAttachment, XmATTACH_FORM, + XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX, + XmNitems, items, + XmNitemCount, n, + /* XmONE_BASED so that we can distinguish between + keyboard entry and selection from popdown list */ + XmNpositionMode, XmONE_BASED, + /* XmNitemCount, hist.item_cnt, */ + /* XmNvisibleItemCount, hist.item_cnt, */ + XmNuserData, &hist, + XmNarrowSize, Xdvi_COMBO_BOX_ARROW_SIZE, + NULL); + if (resource.search_history_size < 10) { + /* usually the dropdown list shows 10 entries */ + XtVaSetValues(searchbox_input, XmNvisibleItemCount, resource.search_history_size); + } + + /* free Motif strings */ + if (hist.item_cnt == 0) + XmStringFree(items[0]); + else { + for (n = 0; hist.char_items[n] != NULL; n++) + XmStringFree(items[n]); + } + XtFree((XtPointer)items); + + /* start with empty search field */ + XtVaGetValues(searchbox_input, XmNtextField, &textfield, NULL); + if (textfield == NULL) + XDVI_ERROR((stderr, "Couldn't get textfield from combo box widget!\n")); + + if (settings->term != NULL) { + XtVaSetValues(textfield, XmNvalue, settings->term, NULL); + } + else { + XtVaSetValues(textfield, XmNvalue, "", NULL); + } + XtAddCallback(textfield, XmNactivateCallback, cb_search_get_term, settings); + XtAddCallback(searchbox_input, XmNselectionCallback, cb_search_history_select, (XtPointer)settings); + + XtOverrideTranslations(textfield, xlats); + /* workaround for pointer grabbing bug (see xm_menu.c) */ + if (get_widget_by_name(&grab_shell, searchbox_input, "GrabShell", True)) { + XtAddCallback(grab_shell, XtNpopdownCallback, popdown_callback, NULL); + } + + } +#else /* defined(MOTIF) && USE_COMBOBOX */ + + searchbox_input = XtVaCreateManagedWidget(Xdvi_SEARCHBOX_INPUT_NAME, TEXT_WIDGET, searchbox_form, #ifdef MOTIF @@ -677,7 +980,9 @@ create_search_window(struct search_settings *settings) VERTICAL_RESIZING_NO, #endif NULL); - +#ifdef MOTIF + XtAddCallback(searchbox_input, XmNactivateCallback, cb_search_get_term, settings); +#endif if (settings->term != NULL) { XtVaSetValues(searchbox_input, @@ -688,11 +993,15 @@ create_search_window(struct search_settings *settings) #endif settings->term, NULL); } + +#endif /* defined(MOTIF) && USE_COMBOBOX */ + XtManageChild(searchbox_form); -#ifdef MOTIF - XtAddCallback(searchbox_input, XmNactivateCallback, cb_search_get_term, settings); + /* Fix for #1499566: Force input focus for text input field */ +#ifndef MOTIF + XtSetKeyboardFocus(find_paned, searchbox_input); #endif /* @@ -708,8 +1017,8 @@ create_search_window(struct search_settings *settings) XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, searchbox_form, XmNleftAttachment, XmATTACH_FORM, -/* XmNrightAttachment, XmATTACH_FORM, */ -/* XmNbottomAttachment, XmATTACH_FORM, */ + /* XmNrightAttachment, XmATTACH_FORM, */ + /* XmNbottomAttachment, XmATTACH_FORM, */ #else XtNborderWidth, 0, XtNfromVert, searchbox_form, @@ -731,7 +1040,7 @@ create_search_window(struct search_settings *settings) XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, options_left_form, XmNrightAttachment, XmATTACH_FORM, -/* XmNbottomAttachment, XmATTACH_FORM, */ + /* XmNbottomAttachment, XmATTACH_FORM, */ #else XtNborderWidth, 0, XtNfromVert, searchbox_form, @@ -778,7 +1087,6 @@ create_search_window(struct search_settings *settings) XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, regexp_checkbox, XmNleftAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, #else XtNlabel, "Find backwards", XtNfromVert, regexp_checkbox, @@ -794,6 +1102,34 @@ create_search_window(struct search_settings *settings) #ifdef MOTIF XmStringFree(str); + str = XmStringCreateLocalized("Wrap search"); +#endif + + wrap_checkbox = XtVaCreateManagedWidget("backwards_checkbox", + CHECKBOX_WIDGET, + options_left_form, +#ifdef MOTIF + XmNlabelString, str, + XmNindicatorType, XmN_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, backwards_checkbox, + XmNleftAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, +#else + XtNlabel, "Wrap search", + XtNfromVert, backwards_checkbox, + XtNborderWidth, 0, + XtNisRadio, False, + XtNhighlightThickness, 1, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, +#endif + NULL); + + XtAddCallback(wrap_checkbox, VALUE_CALLBACK_NAME, cb_wrap_search, settings); + +#ifdef MOTIF + XmStringFree(str); str = XmStringCreateLocalized("Case sensitive"); #endif @@ -930,19 +1266,6 @@ create_search_window(struct search_settings *settings) XtAddCallback(cancel_button, ACTIVATE_CALLBACK_NAME, cb_search_cancel, settings); XtAddCallback(find_button, ACTIVATE_CALLBACK_NAME, cb_search_get_term_button, settings); - translation_str = get_string_va( -#ifdef MOTIF - "<Key>osfCancel:cancel-search(%p)\n" -#else - "<Key>Escape:cancel-search(%p)\n" -#endif - "<Key>Return:do-search(%p)\n" - "Ctrl<Key>g:find-next()", - (void *)settings, (void *)settings); - - xlats = XtParseTranslationTable(translation_str); - free(translation_str); - XtOverrideTranslations(searchbox_form, xlats); XtOverrideTranslations(options_left_form, xlats); XtOverrideTranslations(options_right_form, xlats); @@ -978,7 +1301,7 @@ create_search_window(struct search_settings *settings) #ifdef MOTIF XmProcessTraversal(searchbox_input, XmTRAVERSE_CURRENT); -/* XmProcessTraversal(find_button, XmTRAVERSE_CURRENT); */ + /* XmProcessTraversal(find_button, XmTRAVERSE_CURRENT); */ #endif XSetWMProtocols(XtDisplay(top_level_shell), XtWindow(top_level_shell), &WM_DELETE_WINDOW, 1); @@ -991,6 +1314,8 @@ create_search_window(struct search_settings *settings) XtVaSetValues(backwards_checkbox, CHECKBUTTON_IS_SET, True, NULL); if (resource.search_window_defaults & SETTINGS_IGNORE_LINEBREAKS_FLAG) XtVaSetValues(linebreaks_checkbox, CHECKBUTTON_IS_SET, True, NULL); + if (resource.search_window_defaults & SETTINGS_WRAP_FLAG) + XtVaSetValues(wrap_checkbox, CHECKBUTTON_IS_SET, True, NULL); /* initialize `settings' values according to the checkbox states (in case user has assigned values via X defaults): */ @@ -998,6 +1323,8 @@ create_search_window(struct search_settings *settings) settings->use_regexp = curr_state; XtVaGetValues(matchcase_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); settings->case_sensitive = curr_state; + XtVaGetValues(wrap_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); + settings->wrap = curr_state; XtVaGetValues(backwards_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); settings->direction = curr_state ? SEARCH_UP : SEARCH_DOWN; XtVaGetValues(linebreaks_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); @@ -1020,15 +1347,18 @@ dvi_find_string(const char *str, Boolean find_next) * Also pops up the find dialog, to make it easier for user to * edit options, change direction etc. */ Widget find_popup; - if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { + if (!get_widget_by_name(&find_popup, globals.widgets.top_level, "find_popup", False)) { static struct search_settings settings; - static struct search_info searchinfo = { False, False, False, 0, 0, 0, 0 }; + static struct search_info searchinfo = { False, False, False, 0, 0, 0, 0 }; settings.term = str; settings.use_regexp = False; settings.case_sensitive = False; settings.direction = SEARCH_DOWN; settings.ignore_hyphens = False; settings.ignore_linebreaks = False; + settings.wrap = False; + settings.isearchterm = NULL; + settings.wrapcnt = 0; settings.x_pos = -1; settings.y_pos = -1; settings.searchinfo = &searchinfo; @@ -1041,10 +1371,8 @@ dvi_find_string(const char *str, Boolean find_next) } else if (str != NULL) { /* change the search term */ Widget searchbox_input; - if ((searchbox_input = XtNameToWidget(find_popup, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); + if (!get_widget_by_name(&searchbox_input, find_popup, "searchbox_input", True)) return; - } XtVaSetValues(searchbox_input, #ifdef MOTIF XmNvalue, diff --git a/Build/source/texk/xdvik/gui/search-dialog.h b/Build/source/texk/xdvik/gui/search-dialog.h index c272658d021..6c9f2ec5287 100644 --- a/Build/source/texk/xdvik/gui/search-dialog.h +++ b/Build/source/texk/xdvik/gui/search-dialog.h @@ -52,12 +52,15 @@ struct search_settings { Boolean case_sensitive; Boolean ignore_hyphens; Boolean ignore_linebreaks; + Boolean wrap; + int wrapcnt; /* > 0 if search has wrapped */ + char *isearchterm; /* non-NULL when doing isearch */ searchDirectionT direction; struct search_info *searchinfo; /* internal state management */ int x_pos, y_pos; /* position of the search popup window */ int from_page; /* page to start search from */ - int curr_page; /* current page of search search from */ + int curr_page; /* current page of search */ int to_page; /* highest page already scanned */ int hyphen_delta; /* difference in offsets when hyphenation is removed */ Widget message_window; /* warning popup, or NULL if it doesn't exist */ diff --git a/Build/source/texk/xdvik/gui/selection.c b/Build/source/texk/xdvik/gui/selection.c index e0bef1e5f1e..8fb2347c0d2 100644 --- a/Build/source/texk/xdvik/gui/selection.c +++ b/Build/source/texk/xdvik/gui/selection.c @@ -124,13 +124,13 @@ deliver_selection_cb(Widget w, if (*target == targets) { /* TARGETS handling copied from xclipboard.c */ Atom* targetP; - Atom* std_targets; + XPointer std_targets; /* was: Atom* */ unsigned long std_length; XSelectionRequestEvent* req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); TRACE_GUI((stderr, "Selection type: targets")); XmuConvertStandardSelection(w, req->time, selection, - target, type, (XPointer*)&std_targets, &std_length, format); + target, type, &std_targets, &std_length, format); *value = XtMalloc(sizeof(Atom)*(std_length + 2)); targetP = *(Atom**)value; *length = std_length + 2; @@ -144,74 +144,76 @@ deliver_selection_cb(Widget w, } else #endif - if (*target == utf8_string) { - TRACE_GUI((stderr, "Selection type: UTF8_STRING")); - *type = *target; - *value = (XtPointer)XtNewString(m_selection_text); - /* *value = (XtPointer)m_selection_text; */ - *length = strlen(m_selection_text); - *format = 8; - return True; - } - else if (*target == XA_STRING) { - char *ptr = utf8_to_native_encoding(m_selection_text); - TRACE_GUI((stderr, "Selection type: XA_STRING")); - strncpy(m_cvt_selection_text, ptr, m_selection_size); - m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ - free(ptr); - *type = *target; - *value = (XtPointer)XtNewString(m_cvt_selection_text); - /* *value = (XtPointer)m_selection_text; */ - *length = strlen(m_cvt_selection_text); - *format = 8; - return True; - } + { + if (*target == utf8_string) { + TRACE_GUI((stderr, "Selection type: UTF8_STRING")); + *type = *target; + *value = (XtPointer)XtNewString(m_selection_text); + /* *value = (XtPointer)m_selection_text; */ + *length = strlen(m_selection_text); + *format = 8; + return True; + } + else if (*target == XA_STRING) { + char *ptr = utf8_to_native_encoding(m_selection_text); + TRACE_GUI((stderr, "Selection type: XA_STRING")); + strncpy(m_cvt_selection_text, ptr, m_selection_size); + m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ + free(ptr); + *type = *target; + *value = (XtPointer)XtNewString(m_cvt_selection_text); + /* *value = (XtPointer)m_selection_text; */ + *length = strlen(m_cvt_selection_text); + *format = 8; + return True; + } #if HAVE_X11_XMU_XMU_H - else if (*target == XA_COMPOUND_TEXT(DISP) || *target == XA_TEXT(DISP)) { - const char *cl[1]; - char *ptr; - int retval; + else if (*target == XA_COMPOUND_TEXT(DISP) || *target == XA_TEXT(DISP)) { + const char *cl[1]; + char *ptr; + int retval; - XTextProperty ct; - XICCEncodingStyle style = XStdICCTextStyle; + XTextProperty ct; + XICCEncodingStyle style = XStdICCTextStyle; - TRACE_GUI((stderr, "Selection type: XA_COMPOUND_TEXT")); - ptr = utf8_to_native_encoding(m_selection_text); - strncpy(m_cvt_selection_text, ptr, m_selection_size); - m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ - cl[0] = m_cvt_selection_text; + TRACE_GUI((stderr, "Selection type: XA_COMPOUND_TEXT")); + ptr = utf8_to_native_encoding(m_selection_text); + strncpy(m_cvt_selection_text, ptr, m_selection_size); + m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ + cl[0] = m_cvt_selection_text; - *type = *target; - retval = XmbTextListToTextProperty(DISP, (char **)cl, 1, style, &ct); + *type = *target; + retval = XmbTextListToTextProperty(DISP, (char **)cl, 1, style, &ct); - if (retval == XNoMemory || retval == XLocaleNotSupported || retval == XConverterNotFound) { - statusline_print(STATUS_MEDIUM, "XmbTextListToTextProperty failed: %d", retval); - return False; - } + if (retval == XNoMemory || retval == XLocaleNotSupported || retval == XConverterNotFound) { + statusline_info(STATUS_MEDIUM, "XmbTextListToTextProperty failed: %d", retval); + return False; + } - *value = ct.value; - *length = ct.nitems; - *format = 8; - return True; - } -#endif - else { -#if HAVE_X11_XMU_XMU_H - TRACE_GUI((stderr, "Selection type: standard selection")); - if (XmuConvertStandardSelection(w, CurrentTime, selection, - target, type, (XPointer *)value, length, format)) + *value = ct.value; + *length = ct.nitems; + *format = 8; return True; + } +#endif else { +#if HAVE_X11_XMU_XMU_H + TRACE_GUI((stderr, "Selection type: standard selection")); + if (XmuConvertStandardSelection(w, CurrentTime, selection, + target, type, (XPointer *)value, length, format)) + return True; + else { #endif - TRACE_GUI((stderr, "Selection type unsupported: %lu (%s)", - (unsigned long)*target, XGetAtomName(DISP, *target))); - statusline_print(STATUS_MEDIUM, - "X client asked for an unsupported selection target type: %lu (%s)", - (unsigned long)*target, XGetAtomName(DISP, *target)); - return False ; + TRACE_GUI((stderr, "Selection type unsupported: %lu (%s)", + (unsigned long)*target, XGetAtomName(DISP, *target))); + statusline_error(STATUS_MEDIUM, + "X client asked for an unsupported selection target type: %lu (%s)", + (unsigned long)*target, XGetAtomName(DISP, *target)); + return False ; #if HAVE_X11_XMU_XMU_H - } + } #endif + } } } diff --git a/Build/source/texk/xdvik/gui/sfDraw.c b/Build/source/texk/xdvik/gui/sfDraw.c index 7a3ddd8cf06..4d693c8c4cf 100644 --- a/Build/source/texk/xdvik/gui/sfDraw.c +++ b/Build/source/texk/xdvik/gui/sfDraw.c @@ -108,10 +108,10 @@ SFcreateGC(void) XGCValues gcValues; XRectangle rectangles[1]; -/* XtVaGetValues(selFileLists[0], */ -/* XtNforeground, &(gcValues.foreground), */ -/* XtNbackground, &(gcValues.background), */ -/* NULL); */ + /* XtVaGetValues(selFileLists[0], */ + /* XtNforeground, &(gcValues.foreground), */ + /* XtNbackground, &(gcValues.background), */ + /* NULL); */ gcValues.foreground = SFfore; SFlineGC = XtGetGC(selFileLists[0], (XtGCMask) @@ -121,7 +121,7 @@ SFcreateGC(void) 0, &gcValues); gcValues.function = GXinvert; -/* gcValues.plane_mask = (gcValues.foreground ^ gcValues.background); */ + /* gcValues.plane_mask = (gcValues.foreground ^ gcValues.background); */ gcValues.plane_mask = (SFfore ^ SFback); SFinvertGC = XtGetGC(selFileLists[0], (XtGCMask) @@ -264,7 +264,7 @@ SFstatAndCheck(SFDir *dir, SFEntry *entry) len = strlen(shown); entry->shown = XtMalloc((unsigned)(len + 2) - ); + ); (void)strcpy(entry->shown, shown); SFwriteStatChar(entry->shown, len, &statBuf); entry->shown[len + 1] = 0; @@ -364,7 +364,7 @@ SFdrawList(int n, int doScroll) SFtextX - dir->hOrigin * SFcharWidth, SFlineToTextV + SFaboveAndBelowText + SFcharAscent, dir->dir, strlen(dir->dir) - ); + ); SFdrawStrings(w, dir, 0, SFlistSize - 1); } } @@ -480,7 +480,7 @@ SFnewInvertEntry(int n, XMotionEvent *event) return -1; } else if ((x >= 0) && (x <= SFupperX) && (y >= SFlowerY) && (y <= SFupperY) - ) { + ) { SFDir *dir = &(SFdirs[SFdirPtr + n]); if (SFscrollTimerAdded) { diff --git a/Build/source/texk/xdvik/gui/sfPath.c b/Build/source/texk/xdvik/gui/sfPath.c index 3349919391b..278f5dc9327 100644 --- a/Build/source/texk/xdvik/gui/sfPath.c +++ b/Build/source/texk/xdvik/gui/sfPath.c @@ -206,12 +206,12 @@ SFreplaceText(SFDir *dir, char *str) else { (void)strncat(SFcurrentPath, str, len - 1); } -/* if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) { */ -/* SFsetText(SFcurrentPath); */ -/* } */ -/* else { */ -/* SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); */ -/* } */ + /* if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) { */ + /* SFsetText(SFcurrentPath); */ + /* } */ + /* else { */ + /* SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); */ + /* } */ SFsetText(SFcurrentPath); SFtextChanged(); @@ -433,7 +433,7 @@ SFgetHomeDirs(void) SFlogins = (SFLogin *) XtRealloc((char *)SFlogins, (unsigned)(alloc * sizeof(SFLogin)) - ); + ); } len = strlen(pw->pw_name); entries[i].real = XtMalloc((unsigned)(len + 3)); @@ -599,7 +599,7 @@ SFupdatePath(void) (char *)SFdirs, (unsigned)((alloc *= 2) * sizeof(SFDir)) - ); + ); for (j = alloc / 2; j < alloc; j++) { SFdirs[j].dir = NULL; } @@ -844,8 +844,6 @@ SFdirModTimer(XtPointer cl, XtIntervalId *id) UNUSED(cl); UNUSED(id); - fprintf(stderr, "sfdirmodtimer called!\n"); - if ((!SFtwiddle) && (SFdirPtr < SFdirEnd)) { n++; if ((n > 2) || (SFdirPtr + n >= SFdirEnd)) { diff --git a/Build/source/texk/xdvik/gui/sfSelFile.c b/Build/source/texk/xdvik/gui/sfSelFile.c index 9964c69ad37..4980362ec86 100644 --- a/Build/source/texk/xdvik/gui/sfSelFile.c +++ b/Build/source/texk/xdvik/gui/sfSelFile.c @@ -39,6 +39,8 @@ #include "sfDraw.h" #include "sfSelFile.h" #include "util.h" +#include "xlwradio.h" +#include "x_util.h" #include <ctype.h> #include "kpathsea/c-fopen.h" @@ -46,7 +48,6 @@ #if !defined(MOTIF) /* entire file */ - #include <errno.h> #ifdef X_NOT_STDC_ENV @@ -130,8 +131,8 @@ static char fileMask[MASKWIDTH + 2] = "*.dvi"; static Atom SFwmDeleteWindow; static char *oneLineTextEditTranslations = - "<Key>Return: redraw-display()\n" - "Ctrl<Key>M: redraw-display()\n"; +"<Key>Return: redraw-display()\n" +"Ctrl<Key>M: redraw-display()\n"; #if !defined (HAVE_STRERROR) && !defined (strerror) static char * @@ -145,8 +146,10 @@ strerror(int errnum) void raise_file_selector(void) { - if (selFile != 0) { + if (selFile != NULL && XtIsManaged(selFile)) { + XBell(DISP, 10); XRaiseWindow(DISP, XtWindow(selFile)); + return; } } @@ -163,6 +166,24 @@ SFexposeList(Widget w, XtPointer n, XEvent *event, Boolean *cont) SFdrawList((int)n, SF_DO_NOT_SCROLL); } + +static void +cb_open_new_window(Widget w, XtPointer client_data, XtPointer call_data) +{ + Boolean set; + + UNUSED(client_data); + UNUSED(call_data); + + XtVaGetValues(w, XtNstate, &set, NULL); + + if (set) + resource.filesel_open_new_window = True; + else + resource.filesel_open_new_window = False; + store_preference(NULL, "fileselOpenNewWindow", "%d", resource.filesel_open_new_window); +} + static void SFmodVerifyCallback(Widget w, XtPointer client_data, XEvent *event, Boolean *cont) { @@ -329,8 +350,9 @@ hideFiles(Widget w, XtPointer client_data, XtPointer call_data) static Widget -SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char *ok, const char *cancel) +SFcreateWidgets(Widget parent, struct filesel_callback *callback) { + Widget open_menu = NULL; Cardinal i, n; int listWidth, listHeight; int listSpacing = 10; @@ -342,9 +364,8 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char Widget paned, box; i = 0; - XtSetArg(arglist[i], XtNtransientFor, parent); - XtSetArg(arglist[i], XtNtitle, title); - i++; + XtSetArg(arglist[i], XtNtransientFor, parent); i++; + XtSetArg(arglist[i], XtNtitle, callback->title); i++; selFile = XtAppCreateShell("xdviSelFile", "XdviSelFile", transientShellWidgetClass, SFdisplay, @@ -357,39 +378,31 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char XtParseTranslationTable(wmDeleteWindowTranslation)); paned = XtVaCreateManagedWidget("paned", panedWidgetClass, selFile, NULL); + i = 0; - XtSetArg(arglist[i], XtNdefaultDistance, 6); - i++; + XtSetArg(arglist[i], XtNdefaultDistance, 6); i++; + selFileForm = XtCreateManagedWidget("selFileForm", formWidgetClass, paned, arglist, i); i = 0; - XtSetArg(arglist[i], XtNlabel, prompt); - i++; - XtSetArg(arglist[i], XtNresizable, True); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNborderWidth, 0); - i++; - XtSetArg(arglist[i], XtNvertDistance, 20); - i++; + XtSetArg(arglist[i], XtNlabel, callback->prompt); i++; + XtSetArg(arglist[i], XtNresizable, True); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + XtSetArg(arglist[i], XtNborderWidth, 0); i++; + XtSetArg(arglist[i], XtNvertDistance, 20); i++; + selFilePrompt = XtCreateManagedWidget("selFilePrompt", labelWidgetClass, selFileForm, arglist, i); #if 1 i = 0; - XtSetArg(arglist[i], XtNforeground, &SFfore); - i++; - XtSetArg(arglist[i], XtNbackground, &SFback); - i++; + XtSetArg(arglist[i], XtNforeground, &SFfore); i++; + XtSetArg(arglist[i], XtNbackground, &SFback); i++; XtGetValues(selFilePrompt, arglist, i); #endif @@ -439,74 +452,43 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char SFlineToTextH + SFentryWidth - 1; i = 0; -/* XtSetArg(arglist[i], XtNwidth, 3 * listWidth + 2 * listSpacing + 4 - w - 10); */ - XtSetArg(arglist[i], XtNwidth, 3 * listWidth + 2 * listSpacing + 4); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - -/* XtSetArg(arglist[i], XtNfromHoriz, selFilePrompt); */ -/* i++; */ -/* XtSetArg(arglist[i], XtNhorizDistance, 10); */ - XtSetArg(arglist[i], XtNfromVert, selFilePrompt); - i++; -/* XtSetArg(arglist[i], XtNvertDistance, 0); */ -/* i++; */ - XtSetArg(arglist[i], XtNresizable, True); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNstring, SFtextBuffer); - i++; - XtSetArg(arglist[i], XtNlength, MAXPATHLEN); - i++; - XtSetArg(arglist[i], XtNeditType, XawtextEdit); - i++; - XtSetArg(arglist[i], XtNwrap, XawtextWrapWord); - i++; - XtSetArg(arglist[i], XtNresize, XawtextResizeHeight); - i++; - XtSetArg(arglist[i], XtNuseStringInPlace, True); - i++; - XtSetArg(arglist[i], XtNvertDistance, 5); - i++; + XtSetArg(arglist[i], XtNwidth, + 3 * listWidth + 2 * listSpacing + 4); i++; + XtSetArg(arglist[i], XtNfromVert, selFilePrompt); i++; + XtSetArg(arglist[i], XtNresizable, True); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + XtSetArg(arglist[i], XtNstring, SFtextBuffer); i++; + XtSetArg(arglist[i], XtNlength, MAXPATHLEN); i++; + XtSetArg(arglist[i], XtNeditType, XawtextEdit); i++; + XtSetArg(arglist[i], XtNwrap, XawtextWrapWord); i++; + XtSetArg(arglist[i], XtNresize, XawtextResizeHeight); i++; + XtSetArg(arglist[i], XtNuseStringInPlace, True); i++; + XtSetArg(arglist[i], XtNvertDistance, 5); i++; + selFileField = XtCreateManagedWidget("selFileField", - asciiTextWidgetClass, selFileForm, - arglist, i); + asciiTextWidgetClass, selFileForm, + arglist, i); XtOverrideTranslations(selFileField, XtParseTranslationTable (oneLineTextEditTranslations)); -/* XtSetKeyboardFocus(selFileForm, selFileField); + /* XtSetKeyboardFocus(selFileForm, selFileField); need focus for selFileMask widget to set the filter */ i = 0; - XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); - i++; - XtSetArg(arglist[i], XtNwidth, SFpathScrollWidth); - i++; - XtSetArg(arglist[i], XtNheight, scrollThickness); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromVert, selFileField); - i++; - XtSetArg(arglist[i], XtNvertDistance, 30); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); i++; + XtSetArg(arglist[i], XtNwidth, SFpathScrollWidth); i++; + XtSetArg(arglist[i], XtNheight, scrollThickness); i++; + XtSetArg(arglist[i], XtNfromVert, selFileField); i++; + XtSetArg(arglist[i], XtNvertDistance, 30); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileHScroll = XtCreateManagedWidget("selFileHScroll", scrollbarWidgetClass, selFileForm, arglist, i); @@ -517,78 +499,47 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char (XtCallbackProc)SFpathAreaSelectedCallback, (XtPointer) NULL); i = 0; - XtSetArg(arglist[i], XtNwidth, listWidth); - i++; - XtSetArg(arglist[i], XtNheight, listHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromVert, selFileHScroll); - i++; - XtSetArg(arglist[i], XtNvertDistance, 10); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNwidth, listWidth); i++; + XtSetArg(arglist[i], XtNheight, listHeight); i++; + XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; + XtSetArg(arglist[i], XtNvertDistance, 10); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileLists[0] = XtCreateManagedWidget("selFileList1", compositeWidgetClass, selFileForm, arglist, i); i = 0; - XtSetArg(arglist[i], XtNwidth, listWidth); - i++; - XtSetArg(arglist[i], XtNheight, listHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromHoriz, selFileLists[0]); - i++; - XtSetArg(arglist[i], XtNfromVert, selFileHScroll); - i++; - XtSetArg(arglist[i], XtNhorizDistance, listSpacing); - i++; - XtSetArg(arglist[i], XtNvertDistance, 10); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNwidth, listWidth); i++; + XtSetArg(arglist[i], XtNheight, listHeight); i++; + XtSetArg(arglist[i], XtNfromHoriz, selFileLists[0]); i++; + XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; + XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++; + XtSetArg(arglist[i], XtNvertDistance, 10); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileLists[1] = XtCreateManagedWidget("selFileList2", compositeWidgetClass, selFileForm, arglist, i); i = 0; - XtSetArg(arglist[i], XtNwidth, listWidth); - i++; - XtSetArg(arglist[i], XtNheight, listHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromHoriz, selFileLists[1]); - i++; - XtSetArg(arglist[i], XtNfromVert, selFileHScroll); - i++; - XtSetArg(arglist[i], XtNhorizDistance, listSpacing); - i++; - XtSetArg(arglist[i], XtNvertDistance, 10); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNwidth, listWidth); i++; + XtSetArg(arglist[i], XtNheight, listHeight); i++; + XtSetArg(arglist[i], XtNfromHoriz, selFileLists[1]); i++; + XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; + XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++; + XtSetArg(arglist[i], XtNvertDistance, 10); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileLists[2] = XtCreateManagedWidget("selFileList3", compositeWidgetClass, selFileForm, arglist, i); @@ -596,16 +547,11 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char for (n = 0; n < 3; n++) { i = 0; - XtSetArg(arglist[i], XtNx, vScrollX); - i++; - XtSetArg(arglist[i], XtNy, vScrollY); - i++; - XtSetArg(arglist[i], XtNwidth, scrollThickness); - i++; - XtSetArg(arglist[i], XtNheight, SFvScrollHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ + XtSetArg(arglist[i], XtNx, vScrollX); i++; + XtSetArg(arglist[i], XtNy, vScrollY); i++; + XtSetArg(arglist[i], XtNwidth, scrollThickness); i++; + XtSetArg(arglist[i], XtNheight, SFvScrollHeight); i++; + selFileVScrolls[n] = XtCreateManagedWidget("selFileVScroll", scrollbarWidgetClass, selFileLists[n], arglist, i); @@ -616,19 +562,12 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char (XtCallbackProc)SFvAreaSelectedCallback, (XtPointer) n); i = 0; + XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); i++; + XtSetArg(arglist[i], XtNx, hScrollX); i++; + XtSetArg(arglist[i], XtNy, hScrollY); i++; + XtSetArg(arglist[i], XtNwidth, SFhScrollWidth); i++; + XtSetArg(arglist[i], XtNheight, scrollThickness); i++; - XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); - i++; - XtSetArg(arglist[i], XtNx, hScrollX); - i++; - XtSetArg(arglist[i], XtNy, hScrollY); - i++; - XtSetArg(arglist[i], XtNwidth, SFhScrollWidth); - i++; - XtSetArg(arglist[i], XtNheight, scrollThickness); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ selFileHScrolls[n] = XtCreateManagedWidget("selFileHScroll", scrollbarWidgetClass, selFileLists[n], arglist, i); @@ -639,13 +578,35 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char (XtCallbackProc)SFhAreaSelectedCallback, (XtPointer) n); } + /* When opening a DVI file, offer to open in new window */ + if (callback->must_exist) { + open_menu = XtVaCreateManagedWidget(Xdvi_NEW_WINDOW_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + selFileForm, +#ifdef XAW + XtNisRadio, False, +#endif + XtNfromVert, selFileLists[0], + XtNvertDistance, 30, + XtNhighlightThickness, 1, + XtNborderWidth, 0, + XtNlabel, "Open file in new window", + XtNstate, resource.filesel_open_new_window, + NULL); + XtAddCallback(open_menu, XtNcallback, cb_open_new_window, (XtPointer)NULL); + } + /* Do the file filter stuff. */ selFileLabel = XtVaCreateManagedWidget("selFileLabel", labelWidgetClass, selFileForm, - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, -/* XtNfromHoriz, selFileCancel, */ -/* XtNhorizDistance, 60, */ + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, + /* XtNfromHoriz, selFileCancel, */ + /* XtNhorizDistance, 60, */ XtNlabel, "File Mask:", XtNborderWidth, 0, XtNtop, XtChainTop, @@ -654,8 +615,8 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char selFileMask = XtVaCreateManagedWidget("selFileMask", asciiTextWidgetClass, selFileForm, XtNwidth, MASKWIDTH / 2 * SFcharWidth, - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, XtNfromHoriz, selFileLabel, XtNhorizDistance, 0, XtNtop, XtChainTop, @@ -678,8 +639,8 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char selFileLabel = XtVaCreateManagedWidget("selFileLabel", labelWidgetClass, selFileForm, - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, XtNfromHoriz, selFileMask, XtNhorizDistance, 40, XtNlabel, "Dot files are:", @@ -689,15 +650,15 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char selFileHide = XtVaCreateManagedWidget("selFileHide", commandWidgetClass, selFileForm, -/* XtNwidth, 7 * SFcharWidth, */ - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, + /* XtNwidth, 7 * SFcharWidth, */ + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, XtNfromHoriz, selFileLabel, XtNhorizDistance, 2, XtNlabel, hideFlag ? "hidden" : "shown", -/* XtNborderWidth, 1, */ + /* XtNborderWidth, 1, */ XtNtop, XtChainTop, -/* XtNjustify, XtJustifyLeft, */ + /* XtNjustify, XtJustifyLeft, */ XtNbottom, XtChainTop, NULL); XtAddCallback(selFileHide, XtNcallback, (XtCallbackProc)hideFiles, NULL); @@ -710,19 +671,19 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char XtNaccelerators, G_accels_cr, NULL); selFileOK = XtVaCreateManagedWidget("selFileOK", commandWidgetClass, - box, - XtNlabel, ok, - XtNcallback, SFokSelect, - XtNtop, XtChainTop, - XtNbottom, XtChainBottom, - XtNleft, XtChainLeft, - XtNright, XtChainLeft, - NULL); + box, + XtNlabel, callback->ok, + XtNcallback, SFokSelect, + XtNtop, XtChainTop, + XtNbottom, XtChainBottom, + XtNleft, XtChainLeft, + XtNright, XtChainLeft, + NULL); selFileCancel = XtVaCreateManagedWidget("selFileCancel", commandWidgetClass, box, - XtNlabel, cancel, + XtNlabel, callback->cancel, XtNcallback, SFcancelSelect, -/* XtNborderColor, SFfore, */ + /* XtNborderColor, SFfore, */ XtNfromHoriz, selFileOK, XtNbottom, XtChainBottom, XtNleft, XtChainRight, @@ -878,58 +839,57 @@ SFprepareToReturn(void) } } -void +Widget XsraSelFile(Widget parent, struct filesel_callback *callback) -/* const char *title, const char *prompt, */ -/* const char *ok, const char *cancel, */ -/* const char *init_path, */ -/* const char *mask, */ -/* Boolean must_exist, */ -/* Widget *ret_widget */ { - static Boolean firstTime = True; - Widget w; + SFdisplay = XtDisplay(parent); + return SFcreateWidgets(parent, callback); +} + +void +XsraSelFilePopup(struct filesel_callback *callback) +{ Cardinal i; Arg arglist[20]; XEvent event; - if (!callback->prompt) { - callback->prompt = "Pathname:"; + if (XtIsManaged(callback->shell)) { + XBell(DISP, 10); + XRaiseWindow(DISP, XtWindow(callback->shell)); + return; } - if (!callback->title) { - callback->title = "Xdvi: select filename"; - } + if (!callback->prompt) + callback->prompt = "Pathname:"; + + if (!callback->title) + callback->title = "xdvik: select filename"; - if (!callback->ok) { + if (!callback->ok) callback->ok = "OK"; - } - if (!callback->cancel) { + if (!callback->cancel) callback->cancel = "Cancel"; - } - if (firstTime) { - firstTime = False; - SFdisplay = XtDisplay(parent); - w = SFcreateWidgets(parent, callback->title, callback->prompt, callback->ok, callback->cancel); - } - else { - i = 0; - XtSetArg(arglist[i], XtNlabel, callback->prompt); - i++; - XtSetValues(selFilePrompt, arglist, i); + /* if (!callback->browse_fname) */ + /* callback->browse_fname = xt_strdup(xgetcwd()); */ + + i = 0; + XtSetArg(arglist[i], XtNlabel, callback->prompt); i++; + XtSetValues(selFilePrompt, arglist, i); - i = 0; - XtSetArg(arglist[i], XtNlabel, callback->ok); - i++; - XtSetValues(selFileOK, arglist, i); + i = 0; + XtSetArg(arglist[i], XtNlabel, callback->ok); i++; + XtSetValues(selFileOK, arglist, i); - i = 0; - XtSetArg(arglist[i], XtNlabel, callback->cancel); - i++; - XtSetValues(selFileCancel, arglist, i); - } + i = 0; + XtSetArg(arglist[i], XtNtitle, callback->title); i++; + XtSetValues(selFile, arglist, i); + + i = 0; + XtSetArg(arglist[i], XtNlabel, callback->cancel); i++; + XtSetValues(selFileCancel, arglist, i); + SFpositionWidget(selFile); XtMapWidget(selFile); @@ -988,8 +948,8 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) XtAppNextEvent(SFapp, &event); switch (event.type) { Widget w; -#if 0 /* don't do this, it may send the X server into a busy loop if the File selector - is positioned over a window that is `on top' by default */ +#if 0 /* DON'T do this, it may send the X server into a busy loop if the File selector + is positioned over a window that is `on top' by default */ case Expose: if (!raise_message_windows()) raise_file_selector(); @@ -997,7 +957,7 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) #endif case KeyPress: case ButtonPress: - /* beep if keypress was inside main window */ + /* ignore keypress inside the main window (and beep to warn) */ w = XtWindowToWidget(DISP, event.xany.window); while ((w != NULL) && (w != selFile)) { /* exception: message windows */ @@ -1007,6 +967,7 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) } if (w == NULL || w == globals.widgets.top_level) { XBell(DISP, 0); + continue; } break; } @@ -1044,21 +1005,21 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) SFprepareToReturn(); callback->func_ptr(SFtextBuffer, callback->data); return; -/* return xstrdup(SFtextBuffer); */ + /* return xstrdup(SFtextBuffer); */ } } else { SFprepareToReturn(); callback->func_ptr(SFtextBuffer, callback->data); return; -/* return xstrdup(SFtextBuffer); */ + /* return xstrdup(SFtextBuffer); */ } case SEL_FILE_CANCEL: SFprepareToReturn(); if (callback->exit_on_cancel) exit(0); return; -/* return NULL; */ + /* return NULL; */ case SEL_FILE_NULL: break; } diff --git a/Build/source/texk/xdvik/gui/sfSelFile.h b/Build/source/texk/xdvik/gui/sfSelFile.h index 298d15ea45a..cdda4d7d323 100644 --- a/Build/source/texk/xdvik/gui/sfSelFile.h +++ b/Build/source/texk/xdvik/gui/sfSelFile.h @@ -25,6 +25,8 @@ #define SFSELFILE_H_ struct filesel_callback { + Widget shell; + char *browse_fname; const char *title; const char *prompt; const char *ok; @@ -37,10 +39,13 @@ struct filesel_callback { void *data; }; +#define Xdvi_NEW_WINDOW_RADIO_NAME "new_window_radio" + extern void SFpositionWidget(Widget w); extern FILE *SFopenFile(const char *name, const char *mode, const char *prompt, const char *failed); extern void SFtextChanged(void); -extern void XsraSelFile(Widget parent, struct filesel_callback *callback); +extern Widget XsraSelFile(Widget parent, struct filesel_callback *callback); +extern void XsraSelFilePopup(struct filesel_callback *callback); void raise_file_selector(void); #endif /* SF_SEL_FILE_H_ */ diff --git a/Build/source/texk/xdvik/gui/sfinternal.h b/Build/source/texk/xdvik/gui/sfinternal.h index c776bfc6c97..05a194d8686 100644 --- a/Build/source/texk/xdvik/gui/sfinternal.h +++ b/Build/source/texk/xdvik/gui/sfinternal.h @@ -1,5 +1,6 @@ /* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan + * Copyright 2004 the Xdvik development team * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided @@ -39,6 +40,16 @@ #define SF_DO_SCROLL 1 #define SF_DO_NOT_SCROLL 0 +/* Widget names for get_widget_by_name() */ +#define SfSelFile_FIELD_NAME "selFileField" +#define SfSelFile_FORM_NAME "selFileForm" +#define SfSelFile_HSCROLL_BIG_NAME "selFileHScrollBig" +#define SfSelFile_VSCROLL_BASE_NAME "selFileVScroll" +#define SfSelFile_HSCROLL_BASE_NAME "selFileHScroll" +#define SfSelFile_LIST_BASE_NAME "selFileList" +#define SfSelFile_LIST1_NAME "selFileList1" +#define SfSelFile_LIST2_NAME "selFileList2" +#define SfSelFile_LIST3_NAME "selFileList3" extern void SFenterList(), diff --git a/Build/source/texk/xdvik/gui/statusline.c b/Build/source/texk/xdvik/gui/statusline.c index 16715283cf4..67a5e370041 100644 --- a/Build/source/texk/xdvik/gui/statusline.c +++ b/Build/source/texk/xdvik/gui/statusline.c @@ -65,19 +65,25 @@ static Boolean initialized = False; */ static char g_string_savebuf[MAX_LEN + 2]; -int global_statusline_h = 20; +static int m_statusline_h = 20; + +/* access method */ +int get_statusline_height(void) +{ + return m_statusline_h; +} #if MOTIF static void handle_statusline_event(Widget w, XtPointer client_data, XEvent *ev, Boolean *cont) { -/* const char *text = (const char *)client_data; */ + /* const char *text = (const char *)client_data; */ UNUSED(w); UNUSED(client_data); UNUSED(cont); -/* fprintf(stderr, "text: |%s|; event: %p\n", text, ev); */ + /* fprintf(stderr, "text: |%s|; event: %p\n", text, ev); */ /* only used to do this if page history was already active, but it's probably nicer to be able to get the history by clicking on the statusline ... */ @@ -85,7 +91,7 @@ handle_statusline_event(Widget w, XtPointer client_data, XmTextPosition pos = XmTextGetCursorPosition(statusline); char *ptr1, *ptr2; int diff = 0; -/* fprintf(stderr, "pos: %d\n", pos); */ + /* fprintf(stderr, "pos: %d\n", pos); */ if (pos == 0) { /* just display the page history */ page_history_move(0); return; @@ -96,7 +102,7 @@ handle_statusline_event(Widget w, XtPointer client_data, page_history_move(0); return; } -/* fprintf(stderr, "ptr1: |%s|; ptr2: |%s|\n", ptr1, ptr2); */ + /* fprintf(stderr, "ptr1: |%s|; ptr2: |%s|\n", ptr1, ptr2); */ while (ptr1 < ptr2) { if (*ptr1 == ' ' && *(ptr1 + 1) != '-') /* separator */ diff--; @@ -108,7 +114,7 @@ handle_statusline_event(Widget w, XtPointer client_data, diff++; ptr1--; } -/* fprintf(stderr, "diff: %d\n", diff); */ + /* fprintf(stderr, "diff: %d\n", diff); */ page_history_move(diff); } } @@ -119,7 +125,7 @@ handle_statusline_event(Widget w, XtPointer client_data, * of the program, and when expert mode is switched off. * * Side effects: - * sets <global_statusline_h> to the height of the statusline in pixels. + * sets <m_statusline_h> to the height of the statusline in pixels. */ Widget @@ -156,7 +162,7 @@ create_statusline( XtNlabel, (XtArgVal) "test", NULL); XtVaGetValues(statusline, XtNheight, &my_h, NULL); - global_statusline_h = my_h; + m_statusline_h = my_h; XtDestroyWidget(statusline); #endif initialized = True; @@ -245,12 +251,8 @@ toggle_statusline(void) else XtManageChild(statusline); -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.expert_mode, Act_set_expert_mode, check_resource_expert); #else - set_show_statusline_option(); -#endif -#else static Boolean initialized = False; static Boolean statusline_mapped = False; @@ -329,29 +331,29 @@ handle_statusline_resize(void) #if 0 /* - BROKEN Position vport_h, clip_x, clip_w; - BROKEN static Position my_h = 0; - BROKEN - BROKEN XtVaGetValues(globals.widgets.clip_widget, - BROKEN XtNx, &clip_x, - BROKEN XtNwidth, &clip_w, - BROKEN NULL); - BROKEN XtVaGetValues(globals.widgets.vport_widget, - BROKEN XtNheight, &vport_h, - BROKEN NULL); - BROKEN - BROKEN XtUnmanageChild(statusline); - BROKEN XtVaSetValues(statusline, - BROKEN XtNlabel, (XtArgVal) "", - BROKEN XtNwidth, clip_w, - BROKEN XtNx, clip_x - 1, - BROKEN XtNy, vport_h - my_h, - BROKEN XtNborderWidth, 1, - BROKEN XtNjustify, XtJustifyLeft, - BROKEN XtNborder, (XtArgVal) resource.fore_Pixel, - BROKEN NULL); - BROKEN XtManageChild(statusline); - BROKEN XFlush(DISP); + BROKEN Position vport_h, clip_x, clip_w; + BROKEN static Position my_h = 0; + BROKEN + BROKEN XtVaGetValues(globals.widgets.clip_widget, + BROKEN XtNx, &clip_x, + BROKEN XtNwidth, &clip_w, + BROKEN NULL); + BROKEN XtVaGetValues(globals.widgets.vport_widget, + BROKEN XtNheight, &vport_h, + BROKEN NULL); + BROKEN + BROKEN XtUnmanageChild(statusline); + BROKEN XtVaSetValues(statusline, + BROKEN XtNlabel, (XtArgVal) "", + BROKEN XtNwidth, clip_w, + BROKEN XtNx, clip_x - 1, + BROKEN XtNy, vport_h - my_h, + BROKEN XtNborderWidth, 1, + BROKEN XtNjustify, XtJustifyLeft, + BROKEN XtNborder, (XtArgVal) resource.fore_Pixel, + BROKEN NULL); + BROKEN XtManageChild(statusline); + BROKEN XFlush(DISP); */ #endif @@ -425,9 +427,20 @@ clear_statusline_timer_proc(XtPointer client_data, XtIntervalId *id) } static void -internal_print_statusline(statusTimerT timeout, const char *old_content, const char *fmt, va_list argp) +internal_print_statusline(Boolean error, + statusTimerT timeout, + const char *old_content, + const char *fmt, + va_list argp) { - if (!XtIsRealized(globals.widgets.top_level) || !initialized || (resource.expert_mode & XPRT_SHOW_STATUSLINE) == 0) { + if (!XtIsRealized(globals.widgets.top_level) + || !initialized + || (resource.expert_mode & XPRT_SHOW_STATUSLINE) == 0) { + + /* only print errors to stdout */ + if (!error) + return; + if (!resource.hush_stdout && strlen(fmt) > 0) { /* check for strlen since sometimes we clear the statusline by printing "" to it, and we don't want that on stdout */ fprintf(stdout, "xdvi: "); @@ -463,17 +476,17 @@ internal_print_statusline(statusTimerT timeout, const char *old_content, const c #else XtVaSetValues(statusline, XtNlabel, buf, NULL); #endif -/* fprintf(stderr, "timeout: %d, id: %ld\n", timeout, clear_timeout_id); */ + /* fprintf(stderr, "timeout: %d, id: %ld\n", timeout, clear_timeout_id); */ if (timeout > 0) { timeout *= 1000; /* convert to miliseconds */ if (clear_timeout_id) { -/* fprintf(stderr, "clearing!\n"); */ + /* fprintf(stderr, "clearing!\n"); */ if (globals.debug & DBG_EVENT) fprintf(stderr, "%s:%d: removing timeout %ld\n", __FILE__, __LINE__, clear_timeout_id); XtRemoveTimeOut(clear_timeout_id); } - clear_timeout_id = XtAppAddTimeOut(app, timeout, + clear_timeout_id = XtAppAddTimeOut(globals.app, timeout, clear_statusline_timer_proc, (XtPointer) NULL); } } @@ -506,7 +519,7 @@ statusline_append(statusTimerT timeout, const char *pattern, const char *fmt, .. if (buf != NULL && memcmp(buf, pattern, strlen(pattern)) == 0) { buf = NULL; } - internal_print_statusline(timeout, buf, fmt, argp); + internal_print_statusline(false, timeout, buf, fmt, argp); va_end(argp); } @@ -516,16 +529,52 @@ statusline_append(statusTimerT timeout, const char *pattern, const char *fmt, .. */ void -statusline_print(statusTimerT timeout, const char *fmt, ...) +statusline_info(statusTimerT timeout, const char *fmt, ...) { va_list argp; va_start(argp, fmt); - internal_print_statusline(timeout, NULL, fmt, argp); + /* for the time being, we don't differentiate between info/error + * wrt. printing to stdout/stderr. We could probably at some point + * remove the printing to stdout altogether (it's a bit un-GUIsh), + * but then there's already an option 'hushstdout' to suppress it ... + */ + internal_print_statusline(True, timeout, NULL, fmt, argp); + va_end(argp); +} + +void +statusline_error(statusTimerT timeout, const char *fmt, ...) +{ + va_list argp; + va_start(argp, fmt); + internal_print_statusline(True, timeout, NULL, fmt, argp); va_end(argp); } void statusline_clear(void) { - statusline_print(STATUS_SHORT, ""); + statusline_info(STATUS_SHORT, ""); +} + +/* + * Erase the contents of the statusline if it starts with 'pattern'. + */ +void +statusline_erase(const char *pattern) +{ + const char *buf = NULL; + if (XtIsRealized(globals.widgets.top_level) && initialized && (resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0) { + /* get current statusline contents */ +#ifdef MOTIF + XtVaGetValues(statusline, XmNvalue, &buf, NULL); +#else + XtVaGetValues(statusline, XtNlabel, &buf, NULL); +#endif + + if (strncmp(buf, pattern, strlen(pattern)) == 0) { + statusline_clear(); + } + } } + diff --git a/Build/source/texk/xdvik/gui/statusline.h b/Build/source/texk/xdvik/gui/statusline.h index 5f9f5dcd10c..79cd65feb84 100644 --- a/Build/source/texk/xdvik/gui/statusline.h +++ b/Build/source/texk/xdvik/gui/statusline.h @@ -31,13 +31,17 @@ */ typedef enum statusTimerT_ { STATUS_FOREVER = 0, + STATUS_VERYSHORT = 1, STATUS_SHORT = 5, STATUS_MEDIUM = 10, STATUS_LONG = 30 } statusTimerT; +extern int get_statusline_height(void); extern void statusline_clear(void); -extern void statusline_print(statusTimerT timeout, const char *fmt, ...); +extern void statusline_erase(const char *pattern); +extern void statusline_info(statusTimerT timeout, const char *fmt, ...); +extern void statusline_error(statusTimerT timeout, const char *fmt, ...); extern void statusline_append(statusTimerT timeout, const char *pattern, const char *fmt, ...); #ifdef MOTIF extern Widget create_statusline(Widget parent); diff --git a/Build/source/texk/xdvik/gui/topic-window.c b/Build/source/texk/xdvik/gui/topic-window.c index 7a87a03b5c8..6e987d2b0f6 100644 --- a/Build/source/texk/xdvik/gui/topic-window.c +++ b/Build/source/texk/xdvik/gui/topic-window.c @@ -270,7 +270,7 @@ select_topic(struct topic_info *info, size_t idx) } else { /* Note: doesn't matter if not managed yet */ -/* XtUnmanageChild(info->items[0].widget); */ + /* XtUnmanageChild(info->items[0].widget); */ } XtManageChild(info->items[idx].widget); diff --git a/Build/source/texk/xdvik/gui/xaw_bitmaps.c b/Build/source/texk/xdvik/gui/xaw_bitmaps.c index 6b45ca60a74..4222f9dfe13 100644 --- a/Build/source/texk/xdvik/gui/xaw_bitmaps.c +++ b/Build/source/texk/xdvik/gui/xaw_bitmaps.c @@ -19,15 +19,15 @@ unsigned char button_check_off_bits[] = { /* radiobuttons: round and filled with dot if on, empty else */ unsigned char button_radio_on_bits[] = { -/* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x72, 0x02, 0xf9, 0x04, 0xf9, 0x04, */ -/* 0xf9, 0x04, 0x72, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ + /* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x72, 0x02, 0xf9, 0x04, 0xf9, 0x04, */ + /* 0xf9, 0x04, 0x72, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ 0x00,0x00,0x00,0x00,0xc0,0x03,0x30,0x0c,0x08,0x10,0xc8,0x13,0xe4,0x27,0xe4, 0x27,0xe4,0x27,0xe4,0x27,0xc8,0x13,0x08,0x10,0x30,0x0c,0xc0,0x03,0x00,0x00, 0x00,0x00 }; unsigned char button_radio_off_bits[] = { -/* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x04, 0x01, 0x04, */ -/* 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ + /* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x04, 0x01, 0x04, */ + /* 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ 0x00,0x00,0x00,0x00,0xc0,0x03,0x30,0x0c,0x08,0x10,0x08,0x10,0x04,0x20,0x04, 0x20,0x04,0x20,0x04,0x20,0x08,0x10,0x08,0x10,0x30,0x0c,0xc0,0x03,0x00,0x00, 0x00,0x00 @@ -63,14 +63,14 @@ unsigned char menu_radio_off_bits[] = { /* arrow for Xaw submenus */ unsigned char menu_arrow_bits[] = { -/* 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, */ -/* 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00 */ + /* 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, */ + /* 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00 */ 0x00, 0x00, 0x20, 0x00, 0x60, 0x00, 0xe0, 0x00, 0xe0, 0x01, 0xe0, 0x03, 0xe0, 0x01, 0xe0, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00 -/* 0x00, 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, */ -/* 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00 */ -/* 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00 */ + /* 0x00, 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, */ + /* 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00 */ + /* 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00 */ }; diff --git a/Build/source/texk/xdvik/gui/xaw_menu.c b/Build/source/texk/xdvik/gui/xaw_menu.c index ef9b387f8c1..9cc3700f4bd 100644 --- a/Build/source/texk/xdvik/gui/xaw_menu.c +++ b/Build/source/texk/xdvik/gui/xaw_menu.c @@ -39,9 +39,7 @@ #include "message-window.h" #include "my-snprintf.h" #include "filehist.h" -#ifdef NEW_MENU_CREATION #include "menu.h" -#endif /* NEW_MENU_CREATION */ #ifndef MOTIF /* entire file */ @@ -69,55 +67,27 @@ #endif -#ifndef NEW_MENU_CREATION -#define SEP_CHAR ':' /* character separating entries in translations lines */ -#endif - -/* needed to count the callbacks */ -static int destroy_count = 0; +static Widget line_widget, panel_widget; /* width of button panel */ -static int my_panel_width = 0; +static int m_panel_width = 0; + +/* used for communication with the pagelist in xaw_create_pagelist */ +static int m_y_pos; + /* access method for panel width */ int get_panel_width(void) { - int retval = 0; - if (resource.expert_mode & XPRT_SHOW_BUTTONS) - retval = my_panel_width; - TRACE_GUI((stderr, "get_panel_width: %d", retval)); - return retval; + /* int retval = 0; */ + /* if (resource.expert_mode & XPRT_SHOW_BUTTONS) */ + /* retval = m_panel_width; */ + /* TRACE_GUI((stderr, "get_panel_width: %d", retval)); */ + /* return retval; */ + return m_panel_width; } -#ifndef NEW_MENU_CREATION -typedef enum { INVALID, /* some error */ - NONE, /* no new button created */ - MENU_SEPARATOR, MENU_BUTTON, MENU_ENTRY, COMMAND_BUTTON } buttonTypeT; - -struct button_info { - struct button_info *next; - char *label; - struct xdvi_action *action; - Widget widget; - buttonTypeT type; -}; - -static Widget panner = 0; -static struct button_info *b_head = NULL; - -#define MAX_MENU_NUM 128 -#define MAX_BUTTON_NUM 128 - -static struct menu_list_ { - char *name; - Widget button_widget; - Widget popup_widget; -} menu_list[MAX_MENU_NUM]; - -#endif /* not NEW_MENU_CREATION */ - -#ifdef NEW_MENU_CREATION /* ================================================================================ Pixmaps indicating the state of menu buttons (radiobutton/checkbox @@ -130,12 +100,6 @@ static Pixmap menu_check_off_bitmap; static Pixmap menu_radio_on_bitmap; static Pixmap menu_radio_off_bitmap; static Pixmap menu_arrow_bitmap; -#else -#include "xaw_bitmaps.h" -/* lifted from menu.c, check_bits in xterm */ -static Pixmap menu_check_bitmap; -static Pixmap menu_arrow_bitmap; -#endif /* NEW_MENU_CREATION */ /* ============================================================ @@ -159,8 +123,6 @@ static XtActionsRec menu_actions[] = { { "popdown-submenus", ActPopdownSubmenus } }; -static XtAccelerators menu_accels; - struct pullright_position_info { Position y; Dimension w; @@ -170,7 +132,6 @@ struct pullright_position_info { }; -#ifdef NEW_MENU_CREATION /* * Set all pixmaps indicating the state of the wigdet pointed to by `elems'. */ @@ -224,120 +185,183 @@ xaw_initialize_menu_bitmaps(void) } } -#else -/* toggle `checked' symbol on xaw menu w */ void -toggle_tick(Boolean val, Widget w) +xaw_create_pagelist(void) { - static Arg args = { XtNleftBitmap, (XtArgVal) 0 }; - if (val) - args.value = (XtArgVal) menu_check_bitmap; - else - args.value = None; - XtSetValues(w, &args, 1); + Dimension height, width; + + XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); + XtVaGetValues(panel_widget, XtNwidth, &width, NULL); + + width = MAX(width - 2 * (resource.btn_side_spacing + resource.btn_border_width), + xaw_get_pagelist_size()); + height -= resource.btn_top_spacing + resource.btn_border_width + m_y_pos; + xaw_create_pagelist_widgets(height, width, m_y_pos, panel_widget); } + +static XtCallbackRec command_call[] = { + {handle_command, NULL}, + {NULL, NULL}, +}; + +#ifdef USE_PANNER void -toggle_menu(int val, XtActionProc proc) +scroll_x_panner(int x) { - struct button_info *bp; - - for (bp = b_head; bp != NULL; bp = bp->next) { - if (bp->action != NULL && bp->action->proc == proc && bp->action->param != NULL) { - TRACE_GUI((stderr, "found proc; param: |%s|", bp->action->param)); - if (strcmp(bp->action->param, "toggle") == 0) { - if (val != 0) - toggle_tick(True, bp->widget); - else - toggle_tick(False, bp->widget); - } - else if (strcmp(bp->action->param, "a") == 0) { - if (val == shrink_to_fit()) - toggle_tick(True, bp->widget); - else - toggle_tick(False, bp->widget); - } - else { - int testval = strtoul(bp->action->param, (char **)NULL, 10); - if (testval == val) { - TRACE_GUI((stderr, "enabling param |%s|", bp->action->param)); - toggle_tick(True, bp->widget); - } - else - toggle_tick(False, bp->widget); - } - } + static int old_x = 0; + if (panner != 0 && ABS(x - old_x) > 8) { + XtVaSetValues(panner, XtNsliderX, x, NULL); + old_x = x; } } -/* initialize `checked' symbol on xaw menu w */ -static void -initialize_tick_marks(void) +void +scroll_y_panner(int y) { - int use_gs; - if (menu_check_bitmap == None) { - int check_width = 9; - int check_height = 8; - unsigned char check_bits[] = { - 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x60, 0x00, - 0x31, 0x00, 0x1b, 0x00, 0x0e, 0x00, 0x04, 0x00 - }; - - menu_check_bitmap = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), - RootWindowOfScreen(XtScreen(globals.widgets.top_level)), - (char *)check_bits, check_width, check_height); + static int old_y = 0; + if (panner != 0 && ABS(y - old_y) > 8) { + XtVaSetValues(panner, XtNsliderY, y, NULL); + old_y = y; } +} + +static void +panner_cb(Widget widget, XtPointer closure, XtPointer report_ptr) +{ + XawPannerReport *report = (XawPannerReport *)report_ptr; + static int orig_x = 0, orig_y = 0; + int x = report->slider_x; + int y = report->slider_y; + static Dimension w, h; + static Arg arg_wh_clip[] = { + {XtNwidth, (XtArgVal) &w}, + {XtNheight, (XtArgVal) &h}, + }; + + UNUSED(closure); - /* initialize tickmarks for all possible actions */ - use_gs = resource.postscript; -#ifdef PS_GS - if (!resource.useGS) - use_gs = 0; -#endif + XtGetValues(globals.widgets.clip_widget, arg_wh_clip, XtNumber(arg_wh_clip)); + + fprintf(stderr, "w: %d, h: %d, globals.page.w: %d, globals.page.h: %d\n", + w, h, globals.page.w, globals.page.h); + XtVaSetValues(widget, + XtNsliderWidth, w, XtNsliderHeight, h, + XtNcanvasWidth, globals.page.w, XtNcanvasHeight, globals.page.h, + NULL); - toggle_menu(use_gs, Act_set_ps); - toggle_menu(resource.gs_alpha, Act_set_gs_alpha); - toggle_menu(resource.keep_flag, Act_set_keep_flag); - toggle_menu(resource.pixels_per_inch / mane.shrinkfactor, Act_shrink_to_dpi); - toggle_menu(mane.shrinkfactor, Act_set_shrink_factor); - toggle_menu(resource.use_tex_pages, Act_use_tex_pages); - toggle_menu(resource.mouse_mode, Act_switch_mode); + fprintf(stderr, "panner moved: %d, %d\n", report->slider_x, report->slider_y); + if (globals.widgets.x_bar != NULL) + XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer)(x - orig_x)); + if (globals.widgets.y_bar != NULL) + XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer)(y - orig_y)); + orig_x = x; + orig_y = y; } -#endif /* NEW_MENU_CREATION */ +#endif /* USE_PANNER */ -/* ================================================================================ - ================================================================================ -*/ -static Widget line_widget, panel_widget; +static void +create_menu_entries(struct button_info *item, Widget parent) +{ + size_t i; -/* used for communication with the pagelist in xaw_create_pagelist */ -static int my_y_pos; + /* add our own popdown-submenus() action to the default translations of this menu */ + XtAccelerators menu_accels = XtParseAcceleratorTable("<BtnUp>:MenuPopdown()notify()unhighlight()popdown-submenus()"); + + for (i = 0; item != NULL && i < item->size; i++) { + Widget w; + + if (item->elems[i].submenu != NULL) { /* another submenu */ + XDVI_ERROR((stderr, "Xaw menus don't support nested pulldown menus (ignoring)")); + continue; + } + + if (item->elems[i].type == BT_SEP) { /* separator */ + w = XtCreateManagedWidget(item->elems[i].title, smeLineObjectClass, parent, NULL, 0); + } + else if (item->elems[i].action != NULL && item->elems[i].action->proc == Act_recent_files) { + /* special case: submenu with recent files */ + w = XtVaCreateManagedWidget(item->elems[i].title, smeBSBObjectClass, parent, + XtNlabel, item->elems[i].title, + XtNleftMargin, 20, + XtNrightMargin, 16, + XtNrightBitmap, menu_arrow_bitmap, + NULL); + m_submenu = w; + XtOverrideTranslations(parent, menu_accels); + } + else { /* normal menu entry */ + w = XtVaCreateManagedWidget(item->elems[i].title, smeBSBObjectClass, parent, + XtNlabel, item->elems[i].title, + XtNleftMargin, 20, + NULL); + XtAddCallback(w, XtNcallback, handle_command, item->elems[i].action); + } + item->elems[i].widget = w; + } +} -/* access function: panel, height of buttons etc. */ void -xaw_create_pagelist(void) +xaw_create_menu(struct button_info *item, Widget parent, int *ret_width) { - Dimension height, width; - int button_width = get_panel_width() - 2 * (resource.btn_side_spacing + resource.btn_border_width); - - XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); - width = MAX(button_width, xaw_get_pagelist_size()); - height -= resource.btn_top_spacing + resource.btn_border_width + my_y_pos; - xaw_create_pagelist_widgets(height, width, my_y_pos, panel_widget); -} + Dimension y_pos = resource.btn_top_spacing; + size_t i; + XtAppAddActions(XtWidgetToApplicationContext(globals.widgets.form_widget), menu_actions, XtNumber(menu_actions)); -static XtCallbackRec command_call[] = { - {handle_command, NULL}, - {NULL, NULL}, -}; + for (i = 0; item != NULL && i < item->size; i++) { + Widget button; + Dimension w, h; -#ifdef NEW_MENU_CREATION -void xaw_create_menu(struct button_info *items, Widget parent, int menu_depth, int *ret_width) -{ + if (item->elems[i].type == BT_SEP) { /* separator */ + XDVI_ERROR((stderr, "Cannot have a separator on a toplevel Xaw menu (ignoring)")); + /* y_pos += resource.btn_between_extra; */ + continue; + } + else if (item->elems[i].submenu != NULL) { /* menu button, create a pulldown menu */ + Widget shell; + + button = XtVaCreateWidget("button", menuButtonWidgetClass, parent, + XtNmenuName, item->elems[i].title, + XtNlabel, item->elems[i].title, + XtNx, resource.btn_side_spacing, + XtNy, y_pos, + XtNborderWidth, resource.btn_border_width, + NULL); + shell = XtCreatePopupShell(item->elems[i].title, simpleMenuWidgetClass, button, NULL, 0); + + create_menu_entries(item->elems[i].submenu, shell); + } + else { /* command button */ + command_call[0].closure = (XtPointer)item->elems[i].action; + button = XtVaCreateWidget(item->elems[i].title, commandWidgetClass, parent, + XtNlabel, item->elems[i].title, + XtNx, resource.btn_side_spacing, + XtNy, y_pos, + XtNborderWidth, resource.btn_border_width, + XtNcallback, (XtArgVal)command_call, + NULL); + } + XtVaGetValues(button, XtNwidth, &w, XtNheight, &h, NULL); + y_pos += h + resource.btn_between_spacing + 2 * resource.btn_border_width; + if (w > m_panel_width) + m_panel_width = w; + item->elems[i].widget = button; + } + + /* adjust button sizes, and manage buttons (managing them earlier may result + in `parent has no geometry manager' error) */ + for (i = 0; item != NULL && i < item->size; i++) { + XtVaSetValues(item->elems[i].widget, XtNwidth, m_panel_width, NULL); + XtManageChild(item->elems[i].widget); + } + m_y_pos = y_pos - resource.btn_between_spacing + resource.btn_top_spacing + 2 * resource.btn_border_width; + m_panel_width += 2 * resource.btn_side_spacing + resource.btn_border_width; + XtVaSetValues(panel_widget, XtNwidth, m_panel_width, NULL); + *ret_width = m_panel_width; } Widget @@ -346,6 +370,8 @@ xaw_create_menu_widgets(Widget parent) /* hack to disable the magnifier in the panel: */ XtTranslations panel_translations = XtParseTranslationTable("#augment <ButtonPress>:"); + XtAppAddActions(XtWidgetToApplicationContext(parent), menu_actions, XtNumber(menu_actions)); + line_widget = XtVaCreateWidget("line", widgetClass, parent, XtNbackground, (XtArgVal)resource.fore_Pixel, XtNwidth, (XtArgVal)1, @@ -368,9 +394,6 @@ xaw_create_menu_widgets(Widget parent) return panel_widget; } -#else /* NEW_MENU_CREATION */ - - static void filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) { @@ -505,7 +528,6 @@ filehist_insert_submenu(int idx, const char *filename, int pageno, void *data) XtAddCallback(w, XtNcallback, filehist_select_cb, NULL); } - /* ============================================================ Hack for pullright menus part II: callbacks and functions @@ -582,7 +604,7 @@ popup_pullright(XtPointer client_data, XtIntervalId *id) /* * This event handler (to be called by read_events(), the main event handling loop) * creates a timeout for the pullright to pop up. -*/ + */ void SubMenuHandleEvent(XtAppContext app, XEvent *event) { @@ -599,13 +621,13 @@ SubMenuHandleEvent(XtAppContext app, XEvent *event) || event->type == LeaveNotify || event->type == ButtonPress) { -/* fprintf(stderr, "SubMenuHandleEvent: 0x%lx, 0x%lx\n", event->xany.window, XtWindow(m_submenu)); */ + /* fprintf(stderr, "SubMenuHandleEvent: 0x%lx, 0x%lx\n", event->xany.window, XtWindow(m_submenu)); */ /* Could also loop through a list of windows here ... We need to check for the parent of the menu item, since smeBSBObject is not a real window, and then manually check whether the pointer is inside the menu item. - */ + */ if (XtParent(m_submenu) != NULL && event->xany.window == XtWindow(XtParent(m_submenu))) { /* don't need to check for x coordinates since we already @@ -627,7 +649,7 @@ SubMenuHandleEvent(XtAppContext app, XEvent *event) /* Create a timeout of 200ms to pop up the menu, so that it doesn't pop up always when the cursor is only moved over the pulldown menu. I think this is about the same delay as the one used by Motif. - */ + */ flag = 1; TRACE_GUI((stderr, "ENTER: %d, %d, %d; %d, %d", info.y, info.w, info.h, event->xbutton.x, event->xbutton.y)); @@ -649,611 +671,18 @@ SubMenuHandleEvent(XtAppContext app, XEvent *event) } } -static Widget -create_pulldown_entry(const char *menu_name, - Widget parent, - const char *item_name, - const char *accelerator, /* accelerator, or NULL */ - struct xdvi_action *action, - buttonTypeT *type) -{ - Widget w; - char buf[1024]; - char *m_name = xstrdup(menu_name); - m_name = xstrcat(m_name, item_name); - -#ifdef SHOW_ACCELERATORS - if (accelerator != NULL && *accelerator != '\0') - SNPRINTF(buf, 1024, "%s [%s]", item_name, accelerator); - else - strncpy(buf, item_name, 1024); -#else - UNUSED(accelerator); - strncpy(buf, item_name, 1024); -#endif - -/* fprintf(stderr, "creating pulldown for parent %p: `%s', `%s'\n", */ -/* (void *)parent, menu_name, item_name); */ - - if (strcmp(item_name, "SEP") == 0) { /* it's a separator */ - *type = MENU_SEPARATOR; - w = XtCreateManagedWidget(m_name, smeLineObjectClass, parent, NULL, 0); - } - else if (action->proc != NULL && action->proc == Act_recent_files) { /* special case: submenu with recent files */ -/* w = recent_files_submenu(m_name, parent, buf); */ -/* *type = MENU_ENTRY; */ - w = XtVaCreateManagedWidget(m_name, smeBSBObjectClass, parent, - XtNlabel, buf, - XtNleftMargin, 20, - XtNrightMargin, 16, - XtNrightBitmap, menu_arrow_bitmap, - NULL); - m_submenu = w; - /* fprintf(stderr, "setting translations for %p\n", (void *)XtParent(parent)); */ - XtOverrideTranslations(parent, menu_accels); - /* XtOverrideTranslations(XtParent(parent), menu_accels); */ - - *type = MENU_ENTRY; - } - else { /* normal menu item */ - w = XtVaCreateManagedWidget(m_name, smeBSBObjectClass, parent, - XtNlabel, buf, - XtNleftMargin, 20, - NULL); - *type = MENU_ENTRY; - XtAddCallback(w, XtNcallback, handle_command, action); - } - free(m_name); - return w; -} - -static Widget -create_pulldown_menu(const char *menu_name, - Dimension *width, - int *index, - Dimension *y_pos, - buttonTypeT *type, - int *menu_number) -{ - int i; - - /* check whether a pulldown menu with this name already exists, - and if yes, return its position in index: */ - for (i = 0; i < *menu_number; i++) { - if (menu_list[i].name != NULL && (strcmp(menu_list[i].name, menu_name)) == 0) { - *index = i; - break; - } - } - if (i == *menu_number) { /* doesn't exist, create one */ - Dimension w, h; - Widget n_button_widget, n_popup_widget; - char *button_widget_name = NULL; - - (*menu_number)++; - if (*menu_number > MAX_MENU_NUM) { - XDVI_WARNING((stderr, "Too many menus (max=%d), skipping all from \"%s\"", - MAX_MENU_NUM, menu_name)); - *type = INVALID; - return 0; - } - - /* save menu_name to list for later comparison */ - menu_list[i].name = xrealloc(menu_list[i].name, strlen(menu_name) + 1); - strcpy(menu_list[i].name, menu_name); - - button_widget_name = xstrdup(menu_name); - button_widget_name = xstrcat(button_widget_name, "B"); /* make it unique */ - - if (globals.debug & DBG_ALL) { - fprintf(stderr, "ypos: %d; h: %d; between: %d; border: %d\n", - *y_pos, - h, - resource.btn_between_spacing, - resource.btn_border_width); - } - - n_button_widget = XtVaCreateWidget(menu_list[i].name, menuButtonWidgetClass, panel_widget, - XtNmenuName, button_widget_name, - XtNx, resource.btn_side_spacing, - XtNy, *y_pos, - XtNborderWidth, resource.btn_border_width, - NULL); - n_popup_widget = XtVaCreatePopupShell(button_widget_name, simpleMenuWidgetClass, n_button_widget, - NULL); - /* Mustn't free this one?? */ -/* free(button_widget_name); */ - menu_list[i].button_widget = n_button_widget; - menu_list[i].popup_widget = n_popup_widget; - XtVaGetValues(n_button_widget, XtNwidth, &w, XtNheight, &h, NULL); - *width = w; - *index = i; - *y_pos += h + resource.btn_between_spacing + 2 * resource.btn_border_width; - *type = MENU_BUTTON; - return n_button_widget; - } - *type = NONE; - return 0; -} - -static struct button_info * -create_button_info(const char *label, struct xdvi_action *action, Widget w, buttonTypeT type) -{ - struct button_info *info = xmalloc(sizeof *info); - info->label = xstrdup(label); - info->action = action; - info->widget = w; - info->type = type; - return info; -} - -typedef enum shrinkArgT_ { NO_SHRINK_ARG, HASH, PERCENT, UNDERSCORE } shrinkArgT; - -static shrinkArgT -test_for_shrink_arg(const char *item, int *idx) -{ - const char *ptr = item; - size_t i; - for (i = 0; ptr[i] != '\0'; i++) { - if (ptr[i] == '$') { - i++; - if (ptr[i] == '#') { - *idx = i; - return HASH; - } - else if (ptr[i] == '%') { - *idx = i; - return PERCENT; - } - else if (ptr[i] == '_') { - *idx = i; - return UNDERSCORE; - } - } - } - *idx = 0; - return NO_SHRINK_ARG; -} - -static Boolean -create_shrink_button(char **label, int offset, shrinkArgT type, struct xdvi_action *action) -{ - int shrink_arg = 0; -#define TEMPSTR_LEN 128 /* enough for printing a number into */ - char tempstr[TEMPSTR_LEN]; - char *new_label = NULL; - - for (;; action = action->next) { - if (action == NULL) { - return False; - } - if (action->proc == Act_set_shrink_factor || action->proc == Act_shrink_to_dpi) { - /* NOTE: the shrinkbutton[] resource isn't implemented. It probably makes - less sense with the pulldown menu resources?? - */ - if (action->num_params > 0) { - shrink_arg = atoi(action->param); - if (action->proc == Act_shrink_to_dpi) - shrink_arg = (double)resource.pixels_per_inch / shrink_arg + 0.5; - if (shrink_arg < 1) - shrink_arg = 1; - else if (shrink_arg > 99) - shrink_arg = 99; - } - break; /* found shrink action */ - } - } - - if (type == HASH) - SNPRINTF(tempstr, TEMPSTR_LEN, "%d", shrink_arg); - else if (type == PERCENT) { - if (shrink_arg <= 15) - SNPRINTF(tempstr, TEMPSTR_LEN, "%d", (int)(100.0 / shrink_arg + .5)); - else - SNPRINTF(tempstr, TEMPSTR_LEN, "%.2f", 100.0 / shrink_arg); - } - /* NOTE: I think UNDERSCORE is related to the shrinkbutton[] resource, - which is not implemented */ - - /* return resized label */ - new_label = xmalloc(offset - 1 + strlen(tempstr) + strlen(*label + offset + 1) + 1); - memcpy(new_label, *label, offset - 1); - strcpy(new_label + offset - 1, tempstr); /* now it's null-terminated */ - strcat(new_label, *label + offset + 1); - free(*label); - *label = new_label; - -#undef TEMPSTR_LEN - return True; -} - -static Dimension -create_button(int button_number, /* number of this button */ - int *menu_num, /* number of submenus in this button */ - char **items, /* description of label and action strings */ - size_t item_count, /* number of items in description */ - Widget parent, /* parent of widget to create */ - struct button_info ***bipp, /* button info to insert new button into */ - Dimension *y_pos, /* vertical position after creating button */ - const char *c_ptr, /* entire rest of resource string, for error messages */ - size_t len) /* length of current line in resource string, for error messages*/ -{ - int menu_idx = -1, label_idx = -1, accelerator_idx = -1, action_idx = -1; -#define NAME_LEN 16 - char name[NAME_LEN]; - struct button_info *bp; - shrinkArgT shrink_arg_type; - struct xdvi_action *action; - Widget widget; - buttonTypeT b_type; -/* static int menu_num = 0; /\* count number of created menus *\/ */ - Dimension width = 0; - - ASSERT(item_count >= 2, "Too few items"); - - if (item_count == 4) { /* submenu for a button */ - menu_idx = 0; - label_idx = 1; - accelerator_idx = 2; - action_idx = 3; - } - else if (item_count == 3) { /* command button */ - label_idx = 0; - accelerator_idx = 1; - action_idx = 2; - } - else { /* separator */ - if (strcmp(items[1], "SEP") == 0) { /* separator */ - menu_idx = 0; - label_idx = 1; - } - else { - XDVI_WARNING((stderr, "Wrong number of items (%d) in translations line:\n\"%.*s\" (skipping this line).", - item_count, (int)len, c_ptr)); - return 0; - } - } - - if (action_idx != -1) { - int offset; - shrink_arg_type = test_for_shrink_arg(items[label_idx], &offset); - -/* fprintf(stderr, "compiling action: |%s|\n", items[action_idx]); */ - if ((action = compile_action(items[action_idx])) == NULL) { - XDVI_WARNING((stderr, "Invalid action \"%s\" in translations line:\n\"%.*s\" (skipping this line).", - items[action_idx], (int)len, c_ptr)); - return 0; - } - - if (shrink_arg_type != NO_SHRINK_ARG) { /* search for corresponding shrink action */ - if (!create_shrink_button(&(items[label_idx]), offset, shrink_arg_type, action)) { - XDVI_WARNING((stderr, "Non-existent shrink action \"%s\" in translations line:\n\"%.*s\"", - items[action_idx], (int)len, c_ptr)); - return 0; - } - } - } - else { - action = NULL; - } - - command_call[0].closure = (XtPointer) action; - SNPRINTF(name, NAME_LEN, "button%d", button_number); - - if (menu_idx != -1) { /* it's a pulldown menu */ - int index; - - /* create a new pulldown menu if it doesn't exist yet */ - widget = create_pulldown_menu(items[menu_idx], &width, &index, y_pos, &b_type, menu_num); - if (b_type == INVALID) - return 0; - if (b_type != NONE) { /* it didn't exist yet */ - bp = create_button_info(items[label_idx], NULL, widget, b_type); - **bipp = bp; - *bipp = &bp->next; - } - - /* create an entry for this item */ - widget = create_pulldown_entry(menu_list[index].name, - menu_list[index].popup_widget, - items[label_idx], - accelerator_idx > 0 ? items[accelerator_idx] : NULL, - action, - &b_type); - bp = create_button_info(items[label_idx], action, widget, b_type); - **bipp = bp; - *bipp = &bp->next; - } - else { /* not a pulldown menu, but a simple command button */ - command_call[0].closure = (XtPointer) action; - widget = XtVaCreateWidget(name, commandWidgetClass, parent, - XtNlabel, (XtArgVal)items[label_idx], - XtNx, resource.btn_side_spacing, - XtNy, (XtArgVal)*y_pos, - XtNborderWidth, resource.btn_border_width, - XtNcallback, (XtArgVal)command_call, - NULL); - bp = create_button_info(items[label_idx], action, widget, COMMAND_BUTTON); - **bipp = bp; - *bipp = &bp->next; - } -#undef NAME_LEN - return width; -} - -void -scroll_x_panner(int x) -{ - static int old_x = 0; - if (panner != 0 && ABS(x - old_x) > 8) { - XtVaSetValues(panner, XtNsliderX, x, NULL); - old_x = x; - } -} - -void -scroll_y_panner(int y) -{ - static int old_y = 0; - if (panner != 0 && ABS(y - old_y) > 8) { - XtVaSetValues(panner, XtNsliderY, y, NULL); - old_y = y; - } -} - -#ifdef USE_PANNER -static void -panner_cb(Widget widget, XtPointer closure, XtPointer report_ptr) -{ - XawPannerReport *report = (XawPannerReport *)report_ptr; - static int orig_x = 0, orig_y = 0; - int x = report->slider_x; - int y = report->slider_y; - static Dimension w, h; - static Arg arg_wh_clip[] = { - {XtNwidth, (XtArgVal) &w}, - {XtNheight, (XtArgVal) &h}, - }; - - UNUSED(closure); - - XtGetValues(globals.widgets.clip_widget, arg_wh_clip, XtNumber(arg_wh_clip)); - - fprintf(stderr, "w: %d, h: %d, globals.page.w: %d, globals.page.h: %d\n", - w, h, globals.page.w, globals.page.h); - XtVaSetValues(widget, - XtNsliderWidth, w, XtNsliderHeight, h, - XtNcanvasWidth, globals.page.w, XtNcanvasHeight, globals.page.h, - NULL); - - fprintf(stderr, "panner moved: %d, %d\n", report->slider_x, report->slider_y); - if (globals.widgets.x_bar != NULL) - XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer)(x - orig_x)); - if (globals.widgets.y_bar != NULL) - XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer)(y - orig_y)); - orig_x = x; - orig_y = y; -} -#endif /* USE_PANNER */ - void -create_menu_buttons(Widget form, int *ret_panel_width) +realize_button_panel(XtArgVal h) { - Dimension max_button_width = 0, curr_width; - Dimension y_pos; - struct button_info **bipp; - struct button_info *bp; - const char *c_ptr, *e_ptr; - int max_size; - int button_number = 0; - int menu_number = 0; /* number of menus created; passed through to create_pulldown_menu */ - - /* disable the magnifier in the panel: */ - XtTranslations panel_translations = XtParseTranslationTable("#augment <ButtonPress>:"); - - XtAppAddActions(XtWidgetToApplicationContext(form), menu_actions, XtNumber(menu_actions)); - /* add our own popdown-submenus() action to the default translations of this menu */ - menu_accels = XtParseAcceleratorTable("<BtnUp>:MenuPopdown()notify()unhighlight()popdown-submenus()"); - - line_widget = XtVaCreateWidget("line", widgetClass, form, - XtNbackground, (XtArgVal)resource.fore_Pixel, - XtNwidth, (XtArgVal) 1, - XtNfromHoriz, (XtArgVal)globals.widgets.vport_widget, - XtNborderWidth, (XtArgVal)0, - XtNtop, (XtArgVal)XtChainTop, - XtNbottom, (XtArgVal)XtChainBottom, - XtNleft, (XtArgVal)XtChainRight, - XtNright, (XtArgVal)XtChainRight, - NULL); - panel_widget = XtVaCreateWidget("panel", compositeWidgetClass, form, - XtNborderWidth, (XtArgVal)0, - XtNfromHoriz, (XtArgVal)line_widget, - XtNtranslations, (XtArgVal)panel_translations, - XtNtop, (XtArgVal)XtChainTop, - XtNbottom, (XtArgVal)XtChainBottom, - XtNleft, (XtArgVal)XtChainRight, - XtNright, (XtArgVal)XtChainRight, - NULL); - menu_arrow_bitmap - = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), - RootWindowOfScreen(XtScreen(globals.widgets.top_level)), - (char *)menu_arrow_bits, MENU_ARROW_W, MENU_ARROW_H); - - b_head = NULL; - bipp = &b_head; - - *ret_panel_width = 0; - y_pos = resource.btn_top_spacing; - -#define FREE_LINE_ITEMS do { \ - for (curr = 0; curr < item_count; curr++) { \ - free(line_items[curr]); \ - } \ - free(line_items); \ - } while (0) - - for (c_ptr = resource.menu_translations; - c_ptr != NULL && *c_ptr != '\0'; - c_ptr = e_ptr + 1) { - e_ptr = strchr(c_ptr, '\n'); - if (e_ptr != NULL) { - char **line_items = NULL; - size_t len, curr, item_count = 0; - - if (e_ptr == c_ptr) { /* single '\n' marks additional space between buttons */ - y_pos += resource.btn_between_extra; - continue; - } - len = e_ptr - c_ptr; - - if (++button_number > MAX_BUTTON_NUM) { - XDVI_WARNING((stderr, "Too many buttons (max=%d), skipping all from:\n\"%.*s\"", - MAX_BUTTON_NUM, (int)len, c_ptr)); - break; - } - - line_items = split_line(c_ptr, SEP_CHAR, 0, len, &item_count); - if (item_count < 3 && !(item_count > 1 && strcmp(line_items[1], "SEP") == 0)) { - XDVI_WARNING((stderr, "Too few separators \"%c\" in translations line:\n\"%.*s\" (skipping this line).\n", - SEP_CHAR, (int)len, c_ptr)); - FREE_LINE_ITEMS; - continue; - } - curr_width = create_button(button_number, - &menu_number, - line_items, - item_count, - panel_widget, - &bipp, - &y_pos, - c_ptr, len); - if (curr_width == 0) { /* no button created */ - FREE_LINE_ITEMS; - continue; - } - /* adjust max_button_width to this new entry */ - if (curr_width > max_button_width) - max_button_width = curr_width; - - FREE_LINE_ITEMS; - } - } - -#undef FREE_LINE_ITEMS - - /* null-terminate button info */ - *bipp = NULL; - - max_size = xaw_get_pagelist_size(); - if (max_size > max_button_width) { - max_button_width = max_size; - } - - *ret_panel_width = max_button_width + 2 * (resource.btn_side_spacing + resource.btn_border_width); - TRACE_GUI((stderr, "panel_widget: w: %d", *ret_panel_width)); - XtVaSetValues(panel_widget, XtNwidth, (XtArgVal)*ret_panel_width, NULL); - ++(*ret_panel_width); - my_panel_width = *ret_panel_width; /* make it available */ - - for (bp = b_head; bp != NULL; bp = bp->next) { - if (bp->type == MENU_BUTTON || bp->type == COMMAND_BUTTON) { - TRACE_GUI((stderr, "bp->widget: w: %d", max_button_width)); - XtVaSetValues(bp->widget, XtNwidth, (XtArgVal)max_button_width, NULL); - XtManageChild(bp->widget); - } - } - - my_y_pos = y_pos - resource.btn_between_spacing + resource.btn_top_spacing + 2 * resource.btn_border_width; - initialize_tick_marks(); -#ifdef USE_PANNER - { - static Dimension w, h; - static Arg arg_wh_clip[] = { - {XtNwidth, (XtArgVal) &w}, - {XtNheight, (XtArgVal) &h}, - }; - XtGetValues(globals.widgets.clip_widget, arg_wh_clip, XtNumber(arg_wh_clip)); - - fprintf(stderr, "w: %d, h: %d, globals.page.w: %d, globals.page.h: %d\n", - w, h, globals.page.w, globals.page.h); - if (w == 0) - w = globals.page.w - 2; - if (h == 0) - h = globals.page.h - 2; - panner = XtVaCreateManagedWidget("panner", pannerWidgetClass, panel_widget, - XtNx, resource.btn_side_spacing, - XtNy, my_y_pos, - XtNheight, 60, - XtNwidth, max_button_width, - XtNshadowThickness, 0, - XtNsliderWidth, w, - XtNsliderHeight, h, - XtNcanvasWidth, globals.page.w, - XtNcanvasHeight, globals.page.h, - XtNsliderX, 5, - XtNsliderY, 7, - XtNinternalSpace, 0, - NULL); - } - my_y_pos += 60 + resource.btn_top_spacing + 2 * resource.btn_border_width; - XtAddCallback(panner, XtNreportCallback, panner_cb, (XtPointer)NULL); - -#endif /* USE_PANNER */ - -} -#endif /* NEW_MENU_CREATION */ - - -void -set_button_panel_height(XtArgVal h) -{ - TRACE_GUI((stderr, "line_widget: h %d", (int)h)); XtVaSetValues(line_widget, XtNheight, h, NULL); - XtManageChild(line_widget); - XtVaSetValues(panel_widget, XtNheight, h, NULL); - XtManageChild(panel_widget); -} - -/**************************************************************************** - * Action handling code. - */ - - -static void -handle_destroy_buttons(Widget widget, XtPointer client_data, XtPointer call_data) -{ - int panel_width; - Dimension window_w, window_h; - UNUSED(widget); - UNUSED(client_data); - UNUSED(call_data); - - if (--destroy_count != 0) { - return; - } - XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)True, NULL); - XtVaGetValues(globals.widgets.form_widget, - XtNwidth, &window_w, - XtNheight, &window_h, - NULL); - - if ((resource.expert_mode & XPRT_SHOW_BUTTONS) == 0) { - /* destroy buttons */ - TRACE_GUI((stderr, "globals.widgets.vport_widget: h %d, w %d", window_w, window_h)); - XtVaSetValues(globals.widgets.vport_widget, XtNwidth, window_w, XtNheight, window_h, NULL); - } - else { - create_menu_buttons(globals.widgets.form_widget, &panel_width); - window_w -= panel_width; - TRACE_GUI((stderr, "globals.widgets.vport_widget: h %d, w %d", window_h, window_w)); - XtVaSetValues(globals.widgets.vport_widget, XtNwidth, window_w, XtNheight, window_h, NULL); - set_button_panel_height((XtArgVal) window_h); + if ((resource.expert_mode & XPRT_SHOW_BUTTONS) != 0) { + XtManageChild(line_widget); + XtManageChild(panel_widget); } } - static void reconfig_window(void) { Dimension x_top, y_top, h_top, w_top; @@ -1364,82 +793,27 @@ toggle_scrollbars(void) void toggle_buttons(void) { - static Boolean buttons_active = False; - static Boolean initialized = False; - Dimension window_w, window_h; - - - Boolean make_buttons_visible = False; - Boolean make_buttons_invisible = False; - - int panel_width; - - if (!initialized) { - buttons_active = (resource.expert_mode & XPRT_SHOW_BUTTONS) != 0; - initialized = True; - } - - if ((resource.expert_mode & XPRT_SHOW_BUTTONS) == 0) { - if (buttons_active) - make_buttons_invisible = True; - } - else { - if (!buttons_active) - make_buttons_visible = True; - } + static Dimension panel_width = 0; + Dimension w; - if (make_buttons_visible) { - if (destroy_count != 0) { - return; - } + if (panel_width == 0) /* initialize */ + XtVaGetValues(panel_widget, XtNwidth, &panel_width, NULL); + + /* need to get current width of form in case user has resized the window */ + XtVaGetValues(globals.widgets.form_widget, XtNwidth, &w, NULL); + XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)True, NULL); - create_menu_buttons(globals.widgets.form_widget, &panel_width); - XtVaGetValues(globals.widgets.form_widget, - XtNwidth, &window_w, - XtNheight, &window_h, + if (resource.expert_mode & XPRT_SHOW_BUTTONS) { /* show buttons */ + XtManageChild(panel_widget); + XtManageChild(line_widget); + XtVaSetValues(globals.widgets.vport_widget, + XtNwidth, w - panel_width - 1, /* -1 for line_widget */ NULL); - XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)True, NULL); - window_w -= panel_width; - TRACE_GUI((stderr, "globals.widgets.vport_widget: w: %d, h: %d", window_w, window_h)); - XtVaSetValues(globals.widgets.vport_widget, XtNwidth, window_w, XtNheight, window_h, NULL); - set_button_panel_height((XtArgVal) window_h); - buttons_active = True; } - else if (make_buttons_invisible) { - if (destroy_count != 0) { - return; - } - /* this counts the callback calls; 1 for the panel, 1 for the line */ - destroy_count = 2; - - XtAddCallback(panel_widget, XtNdestroyCallback, - handle_destroy_buttons, (XtPointer)0); - XtAddCallback(panel_widget, XtNdestroyCallback, - handle_destroy_pagelist, (XtPointer)0); - XtAddCallback(line_widget, XtNdestroyCallback, - handle_destroy_buttons, (XtPointer)0); - XtDestroyWidget(panel_widget); - XtDestroyWidget(line_widget); - buttons_active = False; -/* window_w += get_panel_width(); */ - - while (b_head != NULL) { - struct button_info *bp = b_head; - struct xdvi_action *action; - - b_head = bp->next; - free(bp->label); - /* free bp->action */ - for (action = bp->action; action != NULL;) { - struct xdvi_action *act2 = action; - action = act2->next; - if (act2->num_params > 0) { - free(act2->param); - } - free(act2); - } - free(bp); - } + else { /* hide buttons */ + XtUnmanageChild(panel_widget); + XtUnmanageChild(line_widget); + XtVaSetValues(globals.widgets.vport_widget, XtNwidth, w, NULL); } } diff --git a/Build/source/texk/xdvik/gui/xaw_menu.h b/Build/source/texk/xdvik/gui/xaw_menu.h index 750f79cfeb5..693273c5ed9 100644 --- a/Build/source/texk/xdvik/gui/xaw_menu.h +++ b/Build/source/texk/xdvik/gui/xaw_menu.h @@ -24,39 +24,29 @@ #ifndef XAW_MENU_H_ #define XAW_MENU_H_ -#ifdef NEW_MENU_CREATION #include "menu.h" -#endif /* NEW_MENU_CREATION */ #ifndef MOTIF -#ifdef NEW_MENU_CREATION extern void xaw_set_button_state(struct button_elems *elems, Boolean on); extern void xaw_initialize_menu_bitmaps(void); extern Widget xaw_create_menu_widgets(Widget parent); extern void xaw_create_menu(struct button_info *items, Widget parent, int *ret_width); -extern void xaw_set_button_state(struct button_elems *elems, Boolean on); - -extern Pixmap menu_check_bitmap; -extern Pixmap menu_uncheck_bitmap; -#else -extern void create_menu_buttons(Widget menu_bar, int *ret_panel_width); -extern void toggle_menu(int val, XtActionProc proc); -#endif /* NEW_MENU_CREATION */ extern void SubMenuHandleEvent(XtAppContext app, XEvent *event); extern void filehist_menu_add_entry(const char *filename); extern int get_panel_width(void); -extern void toggle_tick(Boolean val, Widget w); -extern void set_button_panel_height(XtArgVal); +extern void realize_button_panel(XtArgVal height); extern void filehist_menu_refresh(void); extern void xaw_create_pagelist(void); extern void toggle_scrollbars(void); extern void toggle_buttons(void); +#ifdef USE_PANNER extern void scroll_y_panner(int y); extern void scroll_x_panner(int x); +#endif #endif /* not MOTIF */ #endif /* XAW_MENU_H_ */ diff --git a/Build/source/texk/xdvik/gui/xlwradio.c b/Build/source/texk/xdvik/gui/xlwradio.c index 27bb14c3eb2..94240d25b33 100644 --- a/Build/source/texk/xdvik/gui/xlwradio.c +++ b/Build/source/texk/xdvik/gui/xlwradio.c @@ -11,11 +11,11 @@ myWidget = XtVaCreateManagedWidget("foo", #ifdef XAW - radioWidgetClass, + radioWidgetClass, #else - toggleWidgetClass, + toggleWidgetClass, #endif - ... arglist ...); + ... arglist ...); Feel free to submit patches if you want this implemented. @@ -25,22 +25,22 @@ /* Radio Widget for XEmacs. Copyright (C) 1999 Edward A. Falk -This file is part of XEmacs. + This file is part of XEmacs. -XEmacs is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. + XEmacs is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. -XEmacs is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + XEmacs is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with XEmacs; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* Synched up with: Radio.c 1.1 */ @@ -154,90 +154,90 @@ static void RadioSize (RadioWidget, Dimension *, Dimension *); */ static XtActionsRec actionsList[] = -{ - {"highlight", RadioHighlight}, - {"unhighlight", RadioUnhighlight}, -}; + { + {"highlight", RadioHighlight}, + {"unhighlight", RadioUnhighlight}, + }; #define offset(field) XtOffset(RadioWidget, radio.field) static XtResource resources[] = { - {XtNisRadio, XtCIsRadio, XtRBoolean, sizeof(Boolean), - offset(isRadio), XtRImmediate, (XtPointer)True }, + {XtNisRadio, XtCIsRadio, XtRBoolean, sizeof(Boolean), + offset(isRadio), XtRImmediate, (XtPointer)True }, }; #undef offset #define SuperClass ((ToggleWidgetClass)&toggleClassRec) RadioClassRec radioClassRec = { - { - (WidgetClass) SuperClass, /* superclass */ - "Radio", /* class_name */ - sizeof(RadioRec), /* size */ - RadioClassInit, /* class_initialize */ - RadioClassPartInit, /* class_part_initialize */ - FALSE, /* class_inited */ - RadioInit, /* initialize */ - NULL, /* initialize_hook */ - XtInheritRealize, /* realize */ - actionsList, /* actions */ - XtNumber(actionsList), /* num_actions */ - resources, /* resources */ - XtNumber(resources), /* resource_count */ - NULLQUARK, /* xrm_class */ - TRUE, /* compress_motion */ - TRUE, /* compress_exposure */ - TRUE, /* compress_enterleave */ - FALSE, /* visible_interest */ - RadioDestroy, /* destroy */ - RadioResize, /* resize */ - RadioExpose, /* expose */ - RadioSetValues, /* set_values */ - NULL, /* set_values_hook */ - XtInheritSetValuesAlmost, /* set_values_almost */ - NULL, /* get_values_hook */ - NULL, /* accept_focus */ - XtVersion, /* version */ - NULL, /* callback_private */ - XtInheritTranslations, /* tm_table */ - RadioQueryGeometry, /* query_geometry */ - XtInheritDisplayAccelerator, /* display_accelerator */ - NULL /* extension */ - }, /* CoreClass fields initialization */ - { - XtInheritChangeSensitive /* change_sensitive */ + { + (WidgetClass) SuperClass, /* superclass */ + "Radio", /* class_name */ + sizeof(RadioRec), /* size */ + RadioClassInit, /* class_initialize */ + RadioClassPartInit, /* class_part_initialize */ + FALSE, /* class_inited */ + RadioInit, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* resource_count */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + RadioDestroy, /* destroy */ + RadioResize, /* resize */ + RadioExpose, /* expose */ + RadioSetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + XtInheritTranslations, /* tm_table */ + RadioQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + }, /* CoreClass fields initialization */ + { + XtInheritChangeSensitive /* change_sensitive */ #ifndef HAVE_OLD_XAW - , NULL + , NULL #endif - }, /* SimpleClass fields initialization */ + }, /* SimpleClass fields initialization */ #ifdef _ThreeDP_h - { - XtInheritXaw3dShadowDraw /* field not used */ - }, /* ThreeDClass fields initialization */ + { + XtInheritXaw3dShadowDraw /* field not used */ + }, /* ThreeDClass fields initialization */ #endif - { - 0 /* field not used */ - }, /* LabelClass fields initialization */ - { - 0 /* field not used */ - }, /* CommandClass fields initialization */ - { - RadioSet, /* Set Procedure. */ - RadioUnset, /* Unset Procedure. */ - NULL /* extension. */ - }, /* ToggleClass fields initialization */ - { - BOX_SIZE, - DrawDiamond, /* draw procedure */ - None, /* selected radiobutton */ - None, /* unselected radiobutton */ - None, /* selected menubutton */ - None, /* unselected menubutton */ - NULL /* extension. */ - } /* RadioClass fields initialization */ + { + 0 /* field not used */ + }, /* LabelClass fields initialization */ + { + 0 /* field not used */ + }, /* CommandClass fields initialization */ + { + RadioSet, /* Set Procedure. */ + RadioUnset, /* Unset Procedure. */ + NULL /* extension. */ + }, /* ToggleClass fields initialization */ + { + BOX_SIZE, + DrawDiamond, /* draw procedure */ + None, /* selected radiobutton */ + None, /* unselected radiobutton */ + None, /* selected menubutton */ + None, /* unselected menubutton */ + NULL /* extension. */ + } /* RadioClass fields initialization */ }; - /* for public consumption */ +/* for public consumption */ WidgetClass radioWidgetClass = (WidgetClass) &radioClassRec; @@ -254,20 +254,20 @@ WidgetClass radioWidgetClass = (WidgetClass) &radioClassRec; static void RadioClassInit (void) { - XawInitializeWidgetSet(); + XawInitializeWidgetSet(); } static void RadioClassPartInit (WidgetClass class) { - RadioWidgetClass c = (RadioWidgetClass) class; - RadioWidgetClass super = (RadioWidgetClass)c->core_class.superclass; + RadioWidgetClass c = (RadioWidgetClass) class; + RadioWidgetClass super = (RadioWidgetClass)c->core_class.superclass; - if( c->radio_class.drawDiamond == NULL || - c->radio_class.drawDiamond == XtInheritDrawDiamond ) - { - c->radio_class.drawDiamond = super->radio_class.drawDiamond; - } + if( c->radio_class.drawDiamond == NULL || + c->radio_class.drawDiamond == XtInheritDrawDiamond ) + { + c->radio_class.drawDiamond = super->radio_class.drawDiamond; + } } @@ -351,13 +351,13 @@ RadioResize (Widget w) /* override label offset */ switch( rw->label.justify ) { - case XtJustifyLeft: + case XtJustifyLeft: rw->label.label_x += (bs(rw) + rw->label.internal_width); break; - case XtJustifyRight: + case XtJustifyRight: break; - case XtJustifyCenter: - default: + case XtJustifyCenter: + default: rw->label.label_x += (bs(rw) + rw->label.internal_width)/2; break; } @@ -373,49 +373,49 @@ RadioExpose (Widget w, XEvent *event, Region region) { - RadioWidget rw = (RadioWidget) w; - Display *dpy = XtDisplay(w); - Window win = XtWindow(w); - GC gc; - Pixmap left_bitmap; - extern WidgetClass labelWidgetClass; - - /* Note: the Label widget examines the region to decide if anything - * needs to be drawn. I'm not sure that this is worth the effort, - * but it bears thinking on. - */ - - /* Command widget may sometimes override the label GC in order - * to draw inverse video. We don't use inverse video, so we need - * to restore the label's normal GC. - */ - rw->label.normal_GC = rw->command.normal_GC; - - - /* Let label widget draw the label. If there was an lbm_x - * field, we could let Label draw the bitmap too. But there - * isn't, so we need to temporarily remove the bitmap and - * draw it ourself later. - */ - left_bitmap = rw->label.left_bitmap; - rw->label.left_bitmap = None; - labelWidgetClass->core_class.expose(w,event,region); - rw->label.left_bitmap = left_bitmap; - - /* now manually draw the left bitmap. TODO: 3-d look, xaw-xpm */ - gc = XtIsSensitive(w) ? rw->label.normal_GC : rw->label.gray_GC; - if( left_bitmap != None && rw->label.lbm_width > 0 ) - { - /* TODO: handle pixmaps */ - XCopyPlane(dpy, left_bitmap, win, gc, - 0,0, rw->label.lbm_width, rw->label.lbm_height, - (int) rw->label.internal_width*2 + bs(rw), - (int) rw->label.internal_height + rw->label.lbm_y, - 1UL); - } - DrawDiamond(w); - /* Finally, the button itself */ - ((RadioWidgetClass)(w->core.widget_class))->radio_class.drawDiamond(w); + RadioWidget rw = (RadioWidget) w; + Display *dpy = XtDisplay(w); + Window win = XtWindow(w); + GC gc; + Pixmap left_bitmap; + extern WidgetClass labelWidgetClass; + + /* Note: the Label widget examines the region to decide if anything + * needs to be drawn. I'm not sure that this is worth the effort, + * but it bears thinking on. + */ + + /* Command widget may sometimes override the label GC in order + * to draw inverse video. We don't use inverse video, so we need + * to restore the label's normal GC. + */ + rw->label.normal_GC = rw->command.normal_GC; + + + /* Let label widget draw the label. If there was an lbm_x + * field, we could let Label draw the bitmap too. But there + * isn't, so we need to temporarily remove the bitmap and + * draw it ourself later. + */ + left_bitmap = rw->label.left_bitmap; + rw->label.left_bitmap = None; + labelWidgetClass->core_class.expose(w,event,region); + rw->label.left_bitmap = left_bitmap; + + /* now manually draw the left bitmap. TODO: 3-d look, xaw-xpm */ + gc = XtIsSensitive(w) ? rw->label.normal_GC : rw->label.gray_GC; + if( left_bitmap != None && rw->label.lbm_width > 0 ) + { + /* TODO: handle pixmaps */ + XCopyPlane(dpy, left_bitmap, win, gc, + 0,0, rw->label.lbm_width, rw->label.lbm_height, + (int) rw->label.internal_width*2 + bs(rw), + (int) rw->label.internal_height + rw->label.lbm_y, + 1UL); + } + DrawDiamond(w); + /* Finally, the button itself */ + ((RadioWidgetClass)(w->core.widget_class))->radio_class.drawDiamond(w); } @@ -456,7 +456,7 @@ RadioSetValues (Widget current, newrw->core.height != oldrw->core.height || newrw->core.border_width != oldrw->core.border_width ) ) { - RadioSize(newrw, &newrw->core.width, &newrw->core.height); + RadioSize(newrw, &newrw->core.width, &newrw->core.height); } /* The label set values routine can resize the widget. We need to @@ -464,7 +464,7 @@ RadioSetValues (Widget current, */ if (newrw->label.label_x != oldrw->label.label_x) { - RadioResize (new); + RadioResize (new); } return FALSE; } @@ -480,7 +480,7 @@ RadioQueryGeometry (Widget w, RadioSize(rw, &preferred->width, &preferred->height); if ( ((intended->request_mode & (CWWidth | CWHeight)) - == (CWWidth | CWHeight)) && + == (CWWidth | CWHeight)) && intended->width == preferred->width && intended->height == preferred->height) return XtGeometryYes; @@ -511,27 +511,27 @@ static void DrawHighlight (Widget w, GC gc) { - RadioWidget rw = (RadioWidget)w; - XRectangle rects[4]; - Dimension ht = rw->command.highlight_thickness; - - if( ht <= 0 || - ht > rw->core.width/2 || - ht > rw->core.height/2 ) - return; - - if( ! XtIsRealized(w) ) - return; - - rects[0].x = 0; rects[0].y = 0; - rects[0].width = rw->core.width; rects[0].height = ht; - rects[1].x = 0; rects[1].y = rw->core.height - ht; - rects[1].width = rw->core.width; rects[1].height = ht; - rects[2].x = 0; rects[2].y = ht; - rects[2].width = ht; rects[2].height = rw->core.height - ht*2; - rects[3].x = rw->core.width - ht; rects[3].y = ht; - rects[3].width = ht; rects[3].height = rw->core.height - ht*2; - XFillRectangles( XtDisplay(w), XtWindow(w), gc, rects, 4); + RadioWidget rw = (RadioWidget)w; + XRectangle rects[4]; + Dimension ht = rw->command.highlight_thickness; + + if( ht <= 0 || + ht > rw->core.width/2 || + ht > rw->core.height/2 ) + return; + + if( ! XtIsRealized(w) ) + return; + + rects[0].x = 0; rects[0].y = 0; + rects[0].width = rw->core.width; rects[0].height = ht; + rects[1].x = 0; rects[1].y = rw->core.height - ht; + rects[1].width = rw->core.width; rects[1].height = ht; + rects[2].x = 0; rects[2].y = ht; + rects[2].width = ht; rects[2].height = rw->core.height - ht*2; + rects[3].x = rw->core.width - ht; rects[3].y = ht; + rects[3].width = ht; rects[3].height = rw->core.height - ht*2; + XFillRectangles( XtDisplay(w), XtWindow(w), gc, rects, 4); } static void @@ -578,11 +578,11 @@ RadioSet (Widget w, UNUSED(num_params); if( rw->command.set ) - return; + return; rw->command.set = TRUE; if( XtIsRealized(w) ) - class->radio_class.drawDiamond(w); + class->radio_class.drawDiamond(w); } @@ -600,11 +600,11 @@ RadioUnset (Widget w, UNUSED(num_params); if( ! rw->command.set ) - return; + return; rw->command.set = FALSE; if( XtIsRealized(w) ) - class->radio_class.drawDiamond(w); + class->radio_class.drawDiamond(w); } @@ -627,10 +627,10 @@ RadioSize (RadioWidget rw, Dimension *w, Dimension *h) { - *w = rw->label.label_width + bs(rw) + LEFT_OFFSET(rw) + - 3 * rw->label.internal_width; - *h = MAX( rw->label.label_height, bs(rw) ) + - 2 * rw->label.internal_width; + *w = rw->label.label_width + bs(rw) + LEFT_OFFSET(rw) + + 3 * rw->label.internal_width; + *h = MAX( rw->label.label_height, bs(rw) ) + + 2 * rw->label.internal_width; } diff --git a/Build/source/texk/xdvik/gui/xm_colorsel.c b/Build/source/texk/xdvik/gui/xm_colorsel.c index 9b91e2c76fd..f48bcbc7d03 100644 --- a/Build/source/texk/xdvik/gui/xm_colorsel.c +++ b/Build/source/texk/xdvik/gui/xm_colorsel.c @@ -117,13 +117,27 @@ popdown_cb(Widget widget, XtPointer client_data, XtPointer call_data) ASSERT(prefs != NULL, "user_data in popdown_cb musn't be NULL!"); if (get_widget_by_name(&dialog, widget, Xdvi_COLOR_DIALOG_NAME, True)) { -/* fprintf(stderr, "popdown!\n"); */ + /* fprintf(stderr, "popdown!\n"); */ remove_from_deplist(prefs, dialog); XtUnmanageChild(dialog); } } static void +h_update_sliders(struct color_info *cinfo) +{ + unsigned r, g, b; + + r = cinfo->new_color.red >> 8; + g = cinfo->new_color.green >> 8; + b = cinfo->new_color.blue >> 8; + + XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); + XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); + XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); +} + +static void popdown_apply_cb(Widget widget, XtPointer client_data, XtPointer call_data) { struct color_info *cinfo = NULL; @@ -199,14 +213,14 @@ popdown_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { struct prefs_choice *prefs = (struct prefs_choice *)client_data; -/* fprintf(stderr, "popdown cancel; call_data: %p!\n", call_data); */ + /* fprintf(stderr, "popdown cancel; call_data: %p!\n", call_data); */ if (call_data != NULL) { -/* fprintf(stderr, "removing from deplist: %p!!!\n", prefs); */ + /* fprintf(stderr, "removing from deplist: %p!!!\n", prefs); */ remove_from_deplist(prefs, widget); } XtUnmanageChild(widget); -/* XtPopdown(XtParent(widget)); */ + /* XtPopdown(XtParent(widget)); */ } static void @@ -214,7 +228,6 @@ revert_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) { struct color_info *cinfo = (struct color_info *)client_data; Pixel pix; - unsigned r, g, b; UNUSED(call_data); @@ -233,16 +246,7 @@ revert_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) /* update sliders */ XFreeColors(DISP, G_colormap, &(cinfo->new_color.pixel), 1, 0); pixel_to_color(pix, &(cinfo->new_color), DISP, G_colormap); - - r = cinfo->new_color.red >> 8; - g = cinfo->new_color.green >> 8; - b = cinfo->new_color.blue >> 8; - -/* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ - - XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); - XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); - XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); + h_update_sliders(cinfo); } static void @@ -250,11 +254,10 @@ show_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) { struct color_info *cinfo = (struct color_info *)client_data; Pixel pix; - unsigned r, g, b; UNUSED(call_data); XtVaGetValues(widget, XmNbackground, &pix, NULL); -/* fprintf(stderr, "Color: 0x%.6lx\n", pix); */ + /* fprintf(stderr, "Color: 0x%.6lx\n", pix); */ /* use this instead of XtVaSetValues on XmNbackground so that the foreground color gets also changed appropriately. */ @@ -267,16 +270,7 @@ show_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) /* update sliders */ XFreeColors(DISP, G_colormap, &(cinfo->new_color.pixel), 1, 0); pixel_to_color(pix, &(cinfo->new_color), DISP, G_colormap); - - r = cinfo->new_color.red >> 8; - g = cinfo->new_color.green >> 8; - b = cinfo->new_color.blue >> 8; - -/* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ - - XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); - XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); - XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); + h_update_sliders(cinfo); } static void @@ -285,7 +279,7 @@ slider_cb(Widget widget, XtPointer client_data, XtPointer call_data) struct color_info *cinfo = (struct color_info *)client_data; XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *)call_data; -/* fprintf(stderr, "Pixel1 : 0x%.6lx\n", cinfo->new_color.pixel); */ + /* fprintf(stderr, "Pixel1 : 0x%.6lx\n", cinfo->new_color.pixel); */ /* reuse cinfo->new_color */ XFreeColors(DISP, G_colormap, &(cinfo->new_color.pixel), 1, 0); @@ -303,7 +297,7 @@ slider_cb(Widget widget, XtPointer client_data, XtPointer call_data) XDVI_ERROR((stderr, "Couldn't XAllocColor\n")); return; } -/* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ + /* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ #if XmVersion >= 1002 /* if avaliable, use this so that the foreground color also @@ -314,20 +308,6 @@ slider_cb(Widget widget, XtPointer client_data, XtPointer call_data) #endif } -static void -h_init_sliders(struct color_info *cinfo) -{ - unsigned r, g, b; - - r = cinfo->new_color.red >> 8; - g = cinfo->new_color.green >> 8; - b = cinfo->new_color.blue >> 8; - - XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); - XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); - XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); -} - static Widget h_create_color_matrix(Widget parent, Widget top, struct color_info *cinfo) { @@ -486,7 +466,7 @@ h_create_sliders(Widget parent, Widget top, struct color_info *cinfo) XtManageChild(g_scale); XtManageChild(b_scale); - h_init_sliders(cinfo); + h_update_sliders(cinfo); } @@ -510,15 +490,15 @@ h_create_shell(Widget parent, struct color_info *cinfo) struct color_button_info *binfo = cinfo->button_info; struct topic_info *tinfo = binfo->tinfo; struct prefs_choice *prefs = (struct prefs_choice *)tinfo->data; -/* struct prefs_choice *prefs; */ + /* struct prefs_choice *prefs; */ n = 0; XtSetArg(args[n], XmNuserData, cinfo); n++; -/* XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++; */ -/* XtSetArg(args[n], XmNnoResize, True); n++; */ -/* XtSetArg(args[n], XmNmwmFunctions, functions); n++; */ -/* XtSetArg(args[n], XmNmwmDecorations, decoration); n++; */ + /* XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++; */ + /* XtSetArg(args[n], XmNnoResize, True); n++; */ + /* XtSetArg(args[n], XmNmwmFunctions, functions); n++; */ + /* XtSetArg(args[n], XmNmwmDecorations, decoration); n++; */ XtSetArg(args[n], XtNtitle, "Xdvik: Select Color"); n++; dialog = XmCreatePromptDialog(parent, Xdvi_COLOR_DIALOG_NAME, args, n); @@ -586,11 +566,10 @@ h_create_shell(Widget parent, struct color_info *cinfo) XmNshadowThickness, 1, NULL); XmStringFree(str); + /* disable clicking on the new_sample button */ XtInsertEventHandler(new_sample, KeyPressMask | KeyReleaseMask | - ButtonPressMask | ButtonReleaseMask | - PointerMotionMask| PointerMotionHintMask | - ButtonMotionMask | FocusChangeMask, + ButtonPressMask | ButtonReleaseMask, True, block_event_callback, (XtPointer)0, 0); cinfo->new_sample = new_sample; @@ -608,13 +587,8 @@ h_create_shell(Widget parent, struct color_info *cinfo) add_to_deplist(prefs, dialog); -/* h_create_commands(shell, color_globals.widgets.paned, "OK", "Cancel", cinfo); */ - -/* XtManageChild(color_globals.widgets.paned); */ - -/* XtRealizeWidget(shell); */ - TipAddWidget(tip_shell, old_sample, "Click to revert to old color"); + TipAddWidget(tip_shell, new_sample, "Preview of new color"); /* TipAddWidget(tip_shell, color_matrix, "Select color"); */ WM_DELETE_WINDOW = XmInternAtom(DISP, "WM_DELETE_WINDOW", False); diff --git a/Build/source/texk/xdvik/gui/xm_filesel.c b/Build/source/texk/xdvik/gui/xm_filesel.c index e5475f0bbe5..09495a8487e 100644 --- a/Build/source/texk/xdvik/gui/xm_filesel.c +++ b/Build/source/texk/xdvik/gui/xm_filesel.c @@ -35,13 +35,16 @@ #include "events.h" #include "message-window.h" #include "dvi-init.h" /* for dviErrFlagT */ +#include "x_util.h" #if defined(MOTIF) /* entire file */ #include <Xm/FileSB.h> +#include <Xm/Form.h> +#include <Xm/ToggleBG.h> -static Widget dialog = NULL; -static char *browse_fname = NULL; +/* static Widget dialog = NULL; */ +/* static char *browse_fname = NULL; */ /* * Process callback from Dialog cancel actions. @@ -58,14 +61,14 @@ cancel_callback(Widget w, #if 0 /* DON'T reset browse_fname, so that user gets the current value as default next time when he cancels now */ - if (browse_fname != NULL) + if (callback->browse_fname != NULL) { - XtFree(browse_fname); - browse_fname = NULL; + XtFree(callback->browse_fname); + callback->browse_fname = NULL; } #endif - XtUnmanageChild(dialog); + XtUnmanageChild(callback->shell); if (callback->exit_on_cancel) { exit(0); } @@ -88,31 +91,34 @@ accept_callback(Widget w, ASSERT(client_data != NULL, "struct filesel_callback pointer expected in client data"); callback = (struct filesel_callback *)client_data; - if (browse_fname != NULL) { - XtFree(browse_fname); - browse_fname = NULL; - } - fcb = (XmFileSelectionBoxCallbackStruct *)call_data; - /* get the filename from the file selection box */ - XmStringGetLtoR(fcb->value, G_charset, &browse_fname); + fcb = (XmFileSelectionBoxCallbackStruct *)call_data; + if (callback->browse_fname != NULL) { + XtFree(callback->browse_fname); + callback->browse_fname = NULL; + } + XmStringGetLtoR(fcb->value, G_charset, &callback->browse_fname); - if (callback->must_exist) { - FILE *tmp_fp = XFOPEN(browse_fname, "r"); + if (0 && callback->must_exist) { + FILE *tmp_fp = XFOPEN(callback->browse_fname, "r"); dviErrFlagT errflag = NO_ERROR; if (tmp_fp == NULL) { - popup_message(XtParent(dialog), + popup_message(XtParent(callback->shell), MSG_ERR, NULL, "Could not open %s: %s.\n", - browse_fname, strerror(errno)); + callback->browse_fname, strerror(errno)); /* leave file selection box open */ return; } else if (!process_preamble(tmp_fp, &errflag) || !find_postamble(tmp_fp, &errflag) - || !read_postamble(tmp_fp, &errflag, True)) { - popup_message(XtParent(dialog), + || !read_postamble(tmp_fp, &errflag, True +#if DELAYED_MKTEXPK + , False +#endif + )) { + popup_message(XtParent(callback->shell), MSG_ERR, NULL, "Error opening %s:\n%s.", - browse_fname, get_dvi_error(errflag)); + callback->browse_fname, get_dvi_error(errflag)); fclose(tmp_fp); /* leave file selection box open */ return; @@ -123,8 +129,21 @@ accept_callback(Widget w, } /* success; close dialog, and call our callback */ - XtUnmanageChild(dialog); - callback->func_ptr(browse_fname, callback->data); + XtUnmanageChild(callback->shell); + callback->func_ptr(callback->browse_fname, callback->data); +} + +static void +cb_open_new_window(Widget w, XtPointer client_data, XtPointer call_data) +{ + UNUSED(client_data); + UNUSED(call_data); + + if (XmToggleButtonGadgetGetState(w)) + resource.filesel_open_new_window = True; + else + resource.filesel_open_new_window = False; + store_preference(NULL, "fileselOpenNewWindow", "%d", resource.filesel_open_new_window); } void raise_file_selector(void) @@ -134,59 +153,80 @@ void raise_file_selector(void) } void -XsraSelFile(Widget parent, struct filesel_callback *callback) +XsraSelFilePopup(struct filesel_callback *callback) { -#define ARG_CNT 4 - XmString filemask = NULL; - XmString directory = NULL; - Arg args[ARG_CNT]; - int i = 0; - - if (dialog == NULL) { - dialog = XmCreateFileSelectionDialog(parent, "file", NULL, 0); - /* Set ret_dialog to the DialogShell parent, not the command widget - returned by the Motif routines. We need the DialogShell, otherwise - Motif will crash if ret_dialog is used as parent for popup_message() - windows!!! - */ - XtVaSetValues(XtParent(dialog), XmNtitle, callback->title, NULL); - - /* my_must_exist = must_exist; */ - /* XtAddCallback(dialog, XmNokCallback, accept_callback, (XtPointer)&my_must_exist); */ - XtAddCallback(dialog, XmNokCallback, accept_callback, (XtPointer)callback); - XtAddCallback(dialog, XmNcancelCallback, cancel_callback, (XtPointer)callback); - /* We have no help in this window, so hide help button */ - XtUnmanageChild(XmFileSelectionBoxGetChild(dialog, (unsigned char)XmDIALOG_HELP_BUTTON)); - } - else if (XtIsManaged(dialog)) { + if (XtIsManaged(callback->shell)) { XBell(DISP, 10); - XRaiseWindow(DISP, XtWindow(dialog)); + XRaiseWindow(DISP, XtWindow(callback->shell)); return; } - - /* only show files matching our mask */ - filemask = XmStringCreateLtoR((char *)callback->filemask, G_charset); - XtSetArg(args[i], XmNpattern, filemask); i++; - - /* set directory to last directory used */ - if (browse_fname != NULL) { - char *path = xstrdup(browse_fname); - char *ptr = strrchr(path, '/'); + else { +#define ARG_CNT 4 + XmString filemask = NULL; + XmString directory = NULL; + Arg args[ARG_CNT]; + int i = 0; + char *path, *ptr; + + /* only show files matching our mask */ + filemask = XmStringCreateLtoR((char *)callback->filemask, G_charset); + XtSetArg(args[i], XmNpattern, filemask); i++; + + /* set directory to last directory used */ + if (callback->browse_fname == NULL) { + ASSERT(callback->init_path != NULL, "callback->init_path mustn't be NULL!"); + callback->browse_fname = xt_strdup(callback->init_path); + } + path = xstrdup(callback->browse_fname); + ptr = strrchr(path, '/'); if (ptr != NULL) *ptr = '\0'; directory = XmStringCreateLtoR(path, G_charset); XtSetArg(args[i], XmNdirectory, directory); i++; free(path); - } + - ASSERT(i < ARG_CNT, "args list too short"); - XtSetValues(dialog, args, (Cardinal)i); + ASSERT(i < ARG_CNT, "args list too short"); + XtSetValues(callback->shell, args, (Cardinal)i); - free(filemask); - free(directory); + free(filemask); + free(directory); - XtManageChild(dialog); + XtManageChild(callback->shell); #undef ARG_CNT + } +} + +Widget +XsraSelFile(Widget parent, struct filesel_callback *callback) +{ + Widget dialog = XmCreateFileSelectionDialog(parent, "file", NULL, 0); + + XtVaSetValues(XtParent(dialog), XmNtitle, callback->title, NULL); + + XtAddCallback(dialog, XmNokCallback, accept_callback, (XtPointer)callback); + XtAddCallback(dialog, XmNcancelCallback, cancel_callback, (XtPointer)callback); + + /* When opening a DVI file, offer to open in new window */ + if (callback->must_exist) { + Widget form, button; + XmString test; + form = XtVaCreateManagedWidget("new_window_form", xmFormWidgetClass, dialog, NULL); + test = XmStringCreateLocalized("Open file in new window"); + button = XtVaCreateManagedWidget(Xdvi_NEW_WINDOW_RADIO_NAME, xmToggleButtonGadgetClass, form, + XmNlabelString, test, + XmNindicatorType, XmN_OF_MANY, + XmNset, resource.filesel_open_new_window, + NULL); + XmStringFree(test); + XtAddCallback(button, XmNvalueChangedCallback, cb_open_new_window, (XtPointer)NULL); + } + + + /* We have no help in this window, so hide help button */ + XtUnmanageChild(XmFileSelectionBoxGetChild(dialog, (unsigned char)XmDIALOG_HELP_BUTTON)); + + return dialog; } #else diff --git a/Build/source/texk/xdvik/gui/xm_menu.c b/Build/source/texk/xdvik/gui/xm_menu.c index 51a2bedbd53..6b5d766852a 100644 --- a/Build/source/texk/xdvik/gui/xm_menu.c +++ b/Build/source/texk/xdvik/gui/xm_menu.c @@ -107,7 +107,7 @@ update_menu_labels(Widget menu) XmNchildren, &children, NULL); -/* for (i = 0; i < num_children; i++) { */ + /* for (i = 0; i < num_children; i++) { */ for (i = 0; i < (int)file_history_size(); i++) { int dummy_page; char *filename; @@ -152,7 +152,7 @@ filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) char *fname; int idx; -/* UNUSED(w); */ + /* UNUSED(w); */ UNUSED(call_data); UNUSED(client_data); @@ -172,7 +172,7 @@ filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) return; } if ((fname = file_history_get_elem(idx, &pageno)) == NULL) { - statusline_print(STATUS_MEDIUM, "Error accessing file %d of history", idx); + statusline_error(STATUS_MEDIUM, "Error accessing file %d of history", idx); return; } @@ -242,7 +242,7 @@ filehist_submenu(int idx, const char *filename, int pageno, void *data) sprintf(buf, "%d %s", idx + 1, filename); TRACE_GUI((stderr, "Creating menu `%s'", buf)); w = XtVaCreateManagedWidget(buf, xmPushButtonGadgetClass, menu, -/* XmNmnemonic, buf[0], */ + /* XmNmnemonic, buf[0], */ XmNuserData, menu, NULL); if (idx + 1 < 10) { diff --git a/Build/source/texk/xdvik/gui/xm_prefs.c b/Build/source/texk/xdvik/gui/xm_prefs.c index 388ef07ac12..4c389259b45 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs.c +++ b/Build/source/texk/xdvik/gui/xm_prefs.c @@ -81,7 +81,7 @@ h_attach_below(Widget x, Widget y) { XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, y, XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, NULL); } } @@ -268,7 +268,7 @@ revert_resources(void) /* save some old values */ int save_shrink = resource.shrinkfactor; - reload_app_resources(); + load_app_resources(True); /* revert from saved values */ resource.use_color = globals.curr_use_color; @@ -327,7 +327,7 @@ revert_resources(void) need_redraw |= revert_colors(curr_fg, curr_bg, curr_hl); -/* if (need_redraw) */ + /* if (need_redraw) */ /* just reload it always, there's too many exceptions ... redraw isn't always sufficient if file has colors. */ globals.ev.flags |= EV_RELOAD; @@ -413,10 +413,10 @@ apply_prefs_cb(XtPointer arg) free(globals.curr_browser); if (resource.browser != NULL) - globals.curr_browser = xstrdup(resource.browser); + globals.curr_browser = xstrdup(resource.browser); -/* fprintf(stderr, "set curr_browser to: |%s|\n", globals.curr_browser); */ -/* fprintf(stderr, "set curr_editor to: |%s|\n", globals.curr_editor); */ + /* fprintf(stderr, "set curr_browser to: |%s|\n", globals.curr_browser); */ + /* fprintf(stderr, "set curr_editor to: |%s|\n", globals.curr_editor); */ if (get_xdvi_window_id(False, NULL) && save_user_preferences(False)) { /* if other instances of xdvi are running, make them reread the @@ -487,11 +487,11 @@ close_prefs_exit(Widget w, XtPointer arg) { struct topic_info *info = (struct topic_info *)arg; struct prefs_choice *prefs = (struct prefs_choice *)info->data; -/* Widget dialog; */ -/* if (get_widget_by_name(&dialog, w, Xdvi_MESSAGE_DIALOG_NAME, True)) { */ -/* fprintf(stderr, "!!!!!!!!! removing window from deplist!\n"); */ -/* remove_from_deplist(prefs, dialog); */ -/* } */ + /* Widget dialog; */ + /* if (get_widget_by_name(&dialog, w, Xdvi_MESSAGE_DIALOG_NAME, True)) { */ + /* fprintf(stderr, "!!!!!!!!! removing window from deplist!\n"); */ + /* remove_from_deplist(prefs, dialog); */ + /* } */ remove_from_deplist(prefs, w); @@ -545,17 +545,17 @@ popup_preferences_dialog(Widget parent, int arg) info.ok_callback = apply_prefs_cb; info.cancel_callback = revert_prefs_cb; info.items = items; -/* info.items_size = NUM_PREFS_TOPICS; */ + /* info.items_size = NUM_PREFS_TOPICS; */ prefs = xmalloc(sizeof *prefs); prefs->depwin_cnt = 0; prefs->depwin = NULL; -/* prefs->orig = orig_prefs; */ + /* prefs->orig = orig_prefs; */ /* apply_prefs_cb/revert_prefs_cb are responsible for copying the changed preferences into the current preferences as appropriate, and free()ing prefs.changed */ -/* prefs->changed = xmalloc(sizeof *(prefs->changed)); */ -/* copy_resources(orig_prefs, prefs->changed); */ + /* prefs->changed = xmalloc(sizeof *(prefs->changed)); */ + /* copy_resources(orig_prefs, prefs->changed); */ prefs->db = NULL; /* XrmGetStringDatabase(""); */ info.data = prefs; diff --git a/Build/source/texk/xdvik/gui/xm_prefsP.h b/Build/source/texk/xdvik/gui/xm_prefsP.h index 3ec65ef9607..530373af241 100644 --- a/Build/source/texk/xdvik/gui/xm_prefsP.h +++ b/Build/source/texk/xdvik/gui/xm_prefsP.h @@ -96,9 +96,14 @@ #define Xdvi_APPLY_STR "Apply" #define Xdvi_PREFS_BROWSER_DEFAULTS \ - "mozilla -remote 'openURL(%s,new-window)'\n" \ - "netscape -raise -remote 'openURL(%s,new-window)'\n" \ + "xdg-open %s\n" \ + "htmlview %s\n" \ + "firefox -remote \"openURL(%s,new-window)\"\n" \ + "mozilla -remote \"openURL(%s,new-window)\"\n" \ + "netscape -raise -remote \"openURL(%s,new-window)\"\n" \ + "xterm -e w3m %s\n" \ "xterm -e lynx %s\n" \ + "xterm -e wget %s\n" \ Xdvi_ADD_COMMAND_STR #define Xdvi_PREFS_EDITOR_DEFAULTS \ "gnuclient -q +%l %f\n" \ diff --git a/Build/source/texk/xdvik/gui/xm_prefs_appearance.c b/Build/source/texk/xdvik/gui/xm_prefs_appearance.c index b7f966059d5..e65f84cbf2f 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_appearance.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_appearance.c @@ -215,31 +215,31 @@ void update_preferences_expert(void) void update_preferences_tooltips(void) { - Widget shell; - Widget statusline_b, popup_b, label1, text, label2; + Widget shell; + Widget statusline_b, popup_b, label1, text, label2; - if (resource.toolbar_unusable) - return; + if (resource.toolbar_unusable) + return; - if (get_widget_by_name(&shell, globals.widgets.top_level, Xdvi_PREFS_DIALOG_NAME, True) - && get_widget_by_name(&statusline_b, shell, Xdvi_TIPS_STATUSLINE, True) - && get_widget_by_name(&popup_b, shell, Xdvi_TIPS_POPUPS, True) - && get_widget_by_name(&label1, shell, Xdvi_TIPS_DELAY_LABEL1, True) - && get_widget_by_name(&text, shell, Xdvi_TIPS_DELAY_TEXT, True) - && get_widget_by_name(&label2, shell, Xdvi_TIPS_DELAY_LABEL2, True)) { + if (get_widget_by_name(&shell, globals.widgets.top_level, Xdvi_PREFS_DIALOG_NAME, True) + && get_widget_by_name(&statusline_b, shell, Xdvi_TIPS_STATUSLINE, True) + && get_widget_by_name(&popup_b, shell, Xdvi_TIPS_POPUPS, True) + && get_widget_by_name(&label1, shell, Xdvi_TIPS_DELAY_LABEL1, True) + && get_widget_by_name(&text, shell, Xdvi_TIPS_DELAY_TEXT, True) + && get_widget_by_name(&label2, shell, Xdvi_TIPS_DELAY_LABEL2, True)) { - char buf[LENGTH_OF_INT]; + char buf[LENGTH_OF_INT]; - SNPRINTF(buf, LENGTH_OF_INT, "%d", ABS(resource.tooltips_wait_period)); - XtVaSetValues(text, XmNvalue, buf, NULL); + SNPRINTF(buf, LENGTH_OF_INT, "%d", ABS(resource.tooltips_wait_period)); + XtVaSetValues(text, XmNvalue, buf, NULL); - XmToggleButtonGadgetSetState(statusline_b, resource.tooltips_in_statusline, False); - XmToggleButtonGadgetSetState(popup_b, resource.show_tooltips, False); + XmToggleButtonGadgetSetState(statusline_b, resource.tooltips_in_statusline, False); + XmToggleButtonGadgetSetState(popup_b, resource.show_tooltips, False); - XtSetSensitive(label1, resource.show_tooltips); - XtSetSensitive(text, resource.show_tooltips); - XtSetSensitive(label2, resource.show_tooltips); - } + XtSetSensitive(label1, resource.show_tooltips); + XtSetSensitive(text, resource.show_tooltips); + XtSetSensitive(label2, resource.show_tooltips); + } } void update_preferences_search(void) diff --git a/Build/source/texk/xdvik/gui/xm_prefs_fonts.c b/Build/source/texk/xdvik/gui/xm_prefs_fonts.c index bf25734bc50..a79658b3d5f 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_fonts.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_fonts.c @@ -58,12 +58,8 @@ #include <Xm/Text.h> #include <Xm/TextF.h> -#if XmVersion >= 2000 && !defined(LESSTIF_VERSION) -/* spinbox only available with Motif 2.0; the lesstif version (as of 0.93) looks like shit */ +#if USE_SPINBOX #include <Xm/SpinB.h> -#define USE_SPINBOX 1 -#else -#define USE_SPINBOX 0 #endif /* @@ -106,7 +102,7 @@ colorspecial_toggle_cb(Widget w, XtPointer client_data, XtPointer call_data) struct prefs_choice *prefs; UNUSED(w); -/* UNUSED(client_data); */ + /* UNUSED(client_data); */ UNUSED(call_data); ASSERT(tinfo != NULL, "struct topic_info * in colorspecial_toggle_cb mustn't be NULL!"); @@ -416,7 +412,7 @@ h_create_fonts_frame(Widget top, struct topic_info *info) #endif } -/* XtManageChild(darkness_form); */ + /* XtManageChild(darkness_form); */ return darkness_form; } @@ -566,7 +562,7 @@ h_create_colors_form(Widget top, struct topic_info *info) NULL); XtManageChild(underline_toggle); -/* if (res->link_style & 1) */ + /* if (res->link_style & 1) */ if (resource.link_style & 1) XmToggleButtonGadgetSetState(underline_toggle, True, False); else diff --git a/Build/source/texk/xdvik/gui/xm_prefs_helpers.c b/Build/source/texk/xdvik/gui/xm_prefs_helpers.c index 493e061827f..03975ee478f 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_helpers.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_helpers.c @@ -33,6 +33,7 @@ #include "topic-window.h" #include "util.h" #include "string-utils.h" +#include "string_list.h" #include "message-window.h" #include "events.h" #include "xm_menu.h" @@ -73,75 +74,17 @@ struct choice_dialog_info { static char **m_browser_list = NULL; static char **m_editor_list = NULL; -/* "mozilla -remote 'openURL(%s,new-window)'", */ -/* "netscape -raise -remote 'openURL(%s,new-window)'", */ -/* "xterm -e lynx %s", */ -/* Xdvi_ADD_COMMAND_STR, */ -/* NULL /\* terminate *\/ */ -/* }; */ - -/* static const char *editor_list[] = { */ -/* "gnuclient -q +%l %f", */ -/* "emacsclient --no-wait +%l %f", */ -/* "gvim --servername xdvi --remote +%l %f", */ -/* "nc -noask +%l %f", */ -/* "xterm -e vi +%l %f", */ -/* Xdvi_ADD_COMMAND_STR, */ -/* NULL /\* terminate *\/ */ -/* }; */ - -/* combo box only available with Motif 2.0; - * the lesstif version is incomplete - */ -#if XmVersion >= 2000 && !defined(LESSTIF_VERSION) +#if USE_COMBOBOX #include <Xm/ComboBox.h> #include <Xm/List.h> -#define USE_COMBOBOX 1 #else #include <Xm/CascadeBG.h> -#define USE_COMBOBOX 0 #endif static void select_browser_cb(Widget w, XtPointer client_data, XtPointer call_data); static void select_editor_cb(Widget w, XtPointer client_data, XtPointer call_data); /* - * Helper functions - */ -static char * -flatten_list(char **list, const char *sep) -{ - char *result = xstrdup(""); - int i; - - for (i = 0; list[i] != NULL; i++) { - result = xstrcat(result, list[i]); - result = xstrcat(result, sep); - } - return result; -} - -static char ** -add_to_list(char **list, const char *str) -{ - int i, k; - /* reallocate with larger capacity */ - for (i = 0; list[i] != NULL; i++) { ; } - i++; - list = xrealloc(list, (i + 1) * sizeof *list); - - /* shift old contents down */ - for (k = i; k > 0; k--) { - list[k] = list[k - 1]; - } - /* add new element at beginning */ - list[0] = xstrdup(str); - - return list; -} - - -/* * User clicked on `Help' in browser text input prompt */ static void @@ -190,7 +133,7 @@ help_editor_dialog_cb(Widget w, XtPointer client_data, XtPointer call_data) static void destroy_dialog_cb(Widget w, XtPointer client_data, XtPointer call_data) { -/* Widget browser_combo = (Widget)client_data; */ + /* Widget browser_combo = (Widget)client_data; */ struct choice_dialog_info *info = (struct choice_dialog_info *)client_data; Widget browser_combo = NULL; Widget help_popup; @@ -251,7 +194,7 @@ destroy_dialog_cb(Widget w, XtPointer client_data, XtPointer call_data) * Since `help_popup' is the top-level xmDialogShellWidget, we need to get its * xmMessageBoxWidget child (by name ...). Don't report an error if it doesn't * exist in case the help window has already been closed. - */ + */ if (help_popup != NULL) { static Widget message; if (get_widget_by_name(&message, help_popup, Xdvi_MESSAGE_DIALOG_NAME, False)) @@ -272,7 +215,7 @@ static void h_get_input_wrapper(const char *listbox_name, Widget w, XtPointer client_data, XtPointer call_data) { -/* Widget combobox = (Widget)client_data; */ + /* Widget combobox = (Widget)client_data; */ struct choice_dialog_info *info = (struct choice_dialog_info *)client_data; struct topic_info *tinfo = info->tinfo; struct prefs_choice *prefs = (struct prefs_choice *)tinfo->data; @@ -321,13 +264,13 @@ h_get_input_wrapper(const char *listbox_name, fprintf(stderr, "list %d: |%s|\n", i, m_browser_list[i]); } #endif - m_browser_list = add_to_list(m_browser_list, ptr); + m_browser_list = string_list_prepend(m_browser_list, ptr); #if 0 for (i = 0; m_browser_list[i] != NULL; i++) { fprintf(stderr, "NEW list %d: |%s|\n", i, m_browser_list[i]); } #endif - tmp_list = flatten_list(m_browser_list, "\n"); + tmp_list = string_list_to_str(m_browser_list, "\n"); #if 0 fprintf(stderr, "TMP LIST: |%s|\n", tmp_list); #endif /* 0 */ @@ -344,8 +287,8 @@ h_get_input_wrapper(const char *listbox_name, editor_choice = xstrdup(ptr); resource.editor = editor_choice; - m_editor_list = add_to_list(m_editor_list, ptr); - tmp_list = flatten_list(m_editor_list, "\n"); + m_editor_list = string_list_prepend(m_editor_list, ptr); + tmp_list = string_list_to_str(m_editor_list, "\n"); store_preference(&(prefs->db), "prefsEditorList", "%s", tmp_list); free(tmp_list); @@ -362,6 +305,11 @@ h_get_input_wrapper(const char *listbox_name, /* add user input to the combo box list, and make it current */ XmComboBoxAddItem(combobox, cbs->value, 1, True); XmComboBoxSelectItem(combobox, cbs->value); + { /* if more than 9 items, add scrollbar */ + size_t n; + XtVaGetValues(combobox, XmNitemCount, &n, NULL); + XtVaSetValues(combobox, XmNvisibleItemCount, n > 10 ? 10 : n, NULL); + } #else { Widget new_menu, parent, grandparent, rowcol; @@ -461,7 +409,7 @@ h_selector(const char *prompt_name, XtParent(w), #endif (char *)prompt_name, args, n); -/* XmStringFree(label); */ + /* XmStringFree(label); */ add_to_deplist(prefs, prompt_widget); @@ -551,7 +499,7 @@ static void select_browser_cb(Widget w, XtPointer client_data, XtPointer call_data) { h_selector(Xdvi_BROWSER_POPUP_NAME, - "Xdvi: Add Browser Command", + "xdvik: Add Browser Command", "Browser Command (optional `%s' is replaced by URL): ", get_browser_text_cb, destroy_dialog_cb, help_browser_dialog_cb, w, client_data, call_data); @@ -565,7 +513,7 @@ select_editor_cb(Widget w, XtPointer client_data, XtPointer call_data) { UNUSED(client_data); h_selector(Xdvi_EDITOR_POPUP_NAME, - "Xdvi: Add Editor Command", + "xdvik: Add Editor Command", "Editor Command (optional: `%l' = line number, `%f' = file name): ", get_editor_text_cb, destroy_dialog_cb, help_editor_dialog_cb, w, client_data, call_data); @@ -667,7 +615,7 @@ update_preferences_helpers(void) XtVaGetValues(buttons[i], XmNlabelString, &str, NULL); XmStringGetLtoR(str, G_charset, &ptr); -/* fprintf(stderr, "kid %d: %s\n", i, ptr); */ + /* fprintf(stderr, "kid %d: %s\n", i, ptr); */ if (globals.curr_browser != NULL) { /* if this is set, ignore browser setting */ if (strcmp(globals.curr_browser, ptr) == 0) { break; @@ -693,7 +641,7 @@ update_preferences_helpers(void) XtVaGetValues(buttons[i], XmNlabelString, &str, NULL); XmStringGetLtoR(str, G_charset, &ptr); -/* fprintf(stderr, "kid %d: %s\n", i, ptr); */ + /* fprintf(stderr, "kid %d: %s\n", i, ptr); */ if (globals.curr_editor != NULL) { /* if this is set, ignore editor setting */ if (strcmp(globals.curr_editor, ptr) == 0) { break; @@ -713,16 +661,16 @@ update_preferences_helpers(void) #endif /* for browser/editor, try: - Widget menu; - int num_buttons; - WidgetList buttons; + Widget menu; + int num_buttons; + WidgetList buttons; - XtVaGetValues( simple_option_widget, XmNsubMenuId, &menu, NULL); + XtVaGetValues( simple_option_widget, XmNsubMenuId, &menu, NULL); - XtVaGetValues( menu, XmNnumChildren, &num_buttons, - XmNchildren, &buttons, NULL ) ; + XtVaGetValues( menu, XmNnumChildren, &num_buttons, + XmNchildren, &buttons, NULL ) ; - */ + */ } } @@ -767,7 +715,7 @@ h_create_command(const char *name, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, top, XmNleftAttachment, XmATTACH_FORM, -/* XmNrightAttachment, XmATTACH_FORM, */ + /* XmNrightAttachment, XmATTACH_FORM, */ NULL); /* count elements in command_list */ @@ -794,14 +742,16 @@ h_create_command(const char *name, combo_box = XtVaCreateWidget(name, xmComboBoxWidgetClass, parent, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, top, /* if top == NULL, this used XmATTACH_FORM */ + XmNtopWidget, top, /* if top == NULL, this uses XmATTACH_FORM */ XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, text_label, XmNrightAttachment, XmATTACH_FORM, XmNcomboBoxType, XmDROP_DOWN_LIST, XmNitems, str_list, XmNitemCount, num, + XmNvisibleItemCount, num > 10 ? 10 : num, XmNuserData, curr_index, + XmNarrowSize, Xdvi_COMBO_BOX_ARROW_SIZE, NULL); if (top != NULL) /* FIXME: This assumes we only have 2 items ... */ XtVaSetValues(combo_box, @@ -836,12 +786,12 @@ h_create_command(const char *name, return combo_box; #else menu = XmCreatePulldownMenu(parent, (char *)menu_name, NULL, 0); -/* XtVaSetValues(menu, */ -/* XmNtopAttachment, XmATTACH_WIDGET, */ -/* XmNtopWidget, top, */ -/* XmNleftAttachment, XmATTACH_FORM, */ -/* XmNrightAttachment, XmATTACH_FORM, */ -/* NULL); */ + /* XtVaSetValues(menu, */ + /* XmNtopAttachment, XmATTACH_WIDGET, */ + /* XmNtopWidget, top, */ + /* XmNleftAttachment, XmATTACH_FORM, */ + /* XmNrightAttachment, XmATTACH_FORM, */ + /* NULL); */ str = XmStringCreateLocalized((char *)label); n = 0; @@ -871,8 +821,8 @@ h_create_command(const char *name, for (i = 0; command_list[i] != NULL; i++) { item = XtVaCreateManagedWidget(command_list[i], xmPushButtonGadgetClass, menu, - XmNuserData, tinfo, - NULL); + XmNuserData, tinfo, + NULL); XtAddCallback(item, XmNactivateCallback, select_cb, menu); } XtManageChild(cascade); @@ -883,13 +833,13 @@ h_create_command(const char *name, Widget prefs_helpers(struct topic_info *tinfo) { -/* struct prefs_choice *prefs = (struct prefs_choice *)info->data; */ + /* struct prefs_choice *prefs = (struct prefs_choice *)info->data; */ Widget form, /* frame, */ form1; Widget browser_command, editor_command; form = XmCreateForm(tinfo->right_form, "helpers_form", NULL, 0); -/* frame = XmCreateFrame(form, "commands_frame", NULL, 0); */ + /* frame = XmCreateFrame(form, "commands_frame", NULL, 0); */ form1 = XtVaCreateWidget("commands_form", xmFormWidgetClass, form, @@ -919,22 +869,22 @@ prefs_helpers(struct topic_info *tinfo) m_editor_list, select_editor_cb, tinfo); -/* #if PS_GS */ -/* Widget b2 = XmCreateLabelGadget(rowcol, "[x] Use Ghostscript to interpret PS specials", NULL, 0); */ + /* #if PS_GS */ + /* Widget b2 = XmCreateLabelGadget(rowcol, "[x] Use Ghostscript to interpret PS specials", NULL, 0); */ /* TODO: don't need this??? Similar: ps2pdf, dvips conversion?? */ /* Widget b3 = XmCreateLabelGadget(rowcol, "Path to Ghostscript: ____________", NULL, 0); */ -/* #endif */ -/* Widget b4 = XmCreateLabelGadget(rowcol, "Editor for source specials: <pulldown> [Other ...]", NULL, 0); */ -/* XtManageChild(b1); */ -/* XtManageChild(b2); */ -/* XtManageChild(b3); */ -/* XtManageChild(b4); */ -/* XtManageChild(rowcol); */ + /* #endif */ + /* Widget b4 = XmCreateLabelGadget(rowcol, "Editor for source specials: <pulldown> [Other ...]", NULL, 0); */ + /* XtManageChild(b1); */ + /* XtManageChild(b2); */ + /* XtManageChild(b3); */ + /* XtManageChild(b4); */ + /* XtManageChild(rowcol); */ XtManageChild(form1); -/* XtManageChild(frame); */ + /* XtManageChild(frame); */ return form; } diff --git a/Build/source/texk/xdvik/gui/xm_prefs_page.c b/Build/source/texk/xdvik/gui/xm_prefs_page.c index b40f1f63132..cbff7b3c065 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_page.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_page.c @@ -60,12 +60,8 @@ #include <Xm/TextF.h> #include <Xm/CascadeBG.h> -#if XmVersion >= 2000 && !defined(LESSTIF_VERSION) -/* spinbox only available with Motif 2.0; the lesstif version (as of 0.93) looks like shit */ +#if USE_SPINBOX #include <Xm/SpinB.h> -#define USE_SPINBOX 1 -#else -#define USE_SPINBOX 0 #endif /* @@ -180,9 +176,9 @@ landscape_cb(Widget w, XtPointer client_data, XtPointer call_data) landscape = is_set; } -/* fprintf(stderr, "++++++++ CALLBACK: setting portrait to %s, landscape to %s\n", */ -/* landscape ? "False" : "True", */ -/* landscape ? "True" : "False"); */ + /* fprintf(stderr, "++++++++ CALLBACK: setting portrait to %s, landscape to %s\n", */ + /* landscape ? "False" : "True", */ + /* landscape ? "True" : "False"); */ XmToggleButtonGadgetSetState(portrait_b, !landscape, False); XmToggleButtonGadgetSetState(landscape_b, landscape, False); @@ -274,22 +270,22 @@ update_preferences_paper(void) #endif /* 0 */ /* - Apparently there's a bug in Motif (OpenMotif 2.1) in that the button - is not properly updated in all cases. - - To reproduce: - - Open Preferences dialog, change `landscape' option, click - `OK'. Now open the dialog again, change the option again, - but click `Cancel'. This correctly reverts the visible - state of the buttons, but when opening the dialog again, - the button's internal state is not consistent with the - visual appearance: when clicking on the unset button, its - ValueChanged callback is not invoked, so nothing happens; - but after clicking on another(!) button in the preferences - dialog, it works again. - - As a workaround, we destroy the buttons and re-create them from scratch - yuck! + Apparently there's a bug in Motif (OpenMotif 2.1) in that the button + is not properly updated in all cases. + + To reproduce: + + Open Preferences dialog, change `landscape' option, click + `OK'. Now open the dialog again, change the option again, + but click `Cancel'. This correctly reverts the visible + state of the buttons, but when opening the dialog again, + the button's internal state is not consistent with the + visual appearance: when clicking on the unset button, its + ValueChanged callback is not invoked, so nothing happens; + but after clicking on another(!) button in the preferences + dialog, it works again. + + As a workaround, we destroy the buttons and re-create them from scratch - yuck! */ { Widget form = XtParent(portrait_button); @@ -353,7 +349,7 @@ static void shrinkfactor_spinbox_cb(Widget w, XtPointer client_data, XtPointer call_data) { int val; -/* static Boolean first_time = True; */ + /* static Boolean first_time = True; */ struct topic_info *info = (struct topic_info *)client_data; struct prefs_choice *prefs = (struct prefs_choice *)(info->data); UNUSED(call_data); @@ -363,9 +359,9 @@ shrinkfactor_spinbox_cb(Widget w, XtPointer client_data, XtPointer call_data) /* return if value not changed yet; else the first invocation of the window may actually reset the shrink factor to the default. */ -/* if (val != resource.shrinkfactor) { */ -/* first_time = False; */ -/* } */ + /* if (val != resource.shrinkfactor) { */ + /* first_time = False; */ + /* } */ if (XtIsRealized(w)) { /* don't set the resource.shrinkfactor here so that we can revert it from there if needed */ @@ -395,7 +391,7 @@ set_shrinkfactor_cb(Widget w, XtPointer client_data, XtPointer call_data) ASSERT(text_field != 0, "Expected text field in XmNuserData, set_shrinkfactor_cb()"); XtVaGetValues(text_field, XmNvalue, &text, NULL); val = strtol(text, (char **)NULL, 10); -/* fprintf(stderr, "spinbox value: |%s|\n", text); */ + /* fprintf(stderr, "spinbox value: |%s|\n", text); */ #endif if (!XtIsRealized(w)) @@ -404,9 +400,9 @@ set_shrinkfactor_cb(Widget w, XtPointer client_data, XtPointer call_data) /* verify values in case of direct text input */ if (val > 100 || val <= 0) { if (val > 100) - statusline_print(STATUS_MEDIUM, "Shrink factor larger than maximum 100"); + statusline_info(STATUS_MEDIUM, "Shrink factor larger than maximum 100"); else if (val <= 0) - statusline_print(STATUS_MEDIUM, "Shrink factor smaller than minimum 1"); + statusline_info(STATUS_MEDIUM, "Shrink factor smaller than minimum 1"); return; } #if USE_SPINBOX @@ -431,8 +427,8 @@ h_create_shrink_frame(Widget top, struct topic_info *info) shrink_form = XmCreateForm(top, "shrink_form", NULL, 0); XtVaSetValues(shrink_form, -/* XmNverticalSpacing, 10, */ -/* XmNhorizontalSpacing, 10, */ + /* XmNverticalSpacing, 10, */ + /* XmNhorizontalSpacing, 10, */ NULL); @@ -506,7 +502,7 @@ h_create_shrink_frame(Widget top, struct topic_info *info) #endif } -/* XtManageChild(shrink_form); */ + /* XtManageChild(shrink_form); */ return shrink_form; } @@ -581,11 +577,11 @@ h_create_papersize_form(Widget parent, struct topic_info *info) XmNleftOffset, 10, XmNuserData, (XtPointer)info, NULL); -/* adjust_heights(landscape_option, menu, cascade, NULL); */ + /* adjust_heights(landscape_option, menu, cascade, NULL); */ XtAddCallback(portrait_option, XmNvalueChangedCallback, landscape_cb, (XtPointer)info); XtAddCallback(landscape_option, XmNvalueChangedCallback, landscape_cb, (XtPointer)info); -/* XtAddCallback(portrait_option, XmNarmCallback, test_cb, (XtPointer)info); */ -/* XtAddCallback(landscape_option, XmNarmCallback, test_cb, (XtPointer)info); */ + /* XtAddCallback(portrait_option, XmNarmCallback, test_cb, (XtPointer)info); */ + /* XtAddCallback(landscape_option, XmNarmCallback, test_cb, (XtPointer)info); */ XtManageChild(portrait_option); XtManageChild(landscape_option); @@ -594,7 +590,7 @@ h_create_papersize_form(Widget parent, struct topic_info *info) Widget w = XtVaCreateManagedWidget(papersizes[i].format, xmPushButtonGadgetClass, menu, XmNuserData, landscape_option, NULL); -/* fprintf(stderr, "Created button: %p for %s\n", w, papersizes[i].format); */ + /* fprintf(stderr, "Created button: %p for %s\n", w, papersizes[i].format); */ /* select default value */ if (strncmp(resource.paper, diff --git a/Build/source/texk/xdvik/gui/xm_prefs_scroll.c b/Build/source/texk/xdvik/gui/xm_prefs_scroll.c index fda08dd33dd..0e33793f93e 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_scroll.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_scroll.c @@ -345,7 +345,7 @@ h_create_scrolling(Widget parent, struct topic_info *info) XmNleftWidget, x_off_label, XmNbottomAttachment, XmATTACH_FORM, XmNvalue, x_buf, -/* XmNvalue, buf, */ + /* XmNvalue, buf, */ NULL); y_off_label = XmCreateLabelGadget(form1, Xdvi_HOME_POSITION_Y_STR, NULL, 0); XtVaSetValues(y_off_label, diff --git a/Build/source/texk/xdvik/gui/xm_toolbar.c b/Build/source/texk/xdvik/gui/xm_toolbar.c index c1bc76286a1..514a84a5126 100644 --- a/Build/source/texk/xdvik/gui/xm_toolbar.c +++ b/Build/source/texk/xdvik/gui/xm_toolbar.c @@ -117,11 +117,11 @@ void toggle_toolbar(void) { #if !HAVE_XPM - statusline_print(STATUS_LONG, + statusline_error(STATUS_LONG, "Compiled without XPM support; no toolbar available."); #else if (resource.toolbar_unusable) { - statusline_print(STATUS_LONG, + statusline_error(STATUS_LONG, "Toolbar pixmap file not found; toolbar is disabled."); return; } @@ -626,7 +626,7 @@ enter_leave(Widget w, XtPointer closure, XEvent *event, Boolean *cont) } entered = True; if (resource.tooltips_in_statusline) { - statusline_print(STATUS_SHORT, tooltip); + statusline_info(STATUS_SHORT, tooltip); } } else if (ev->type == LeaveNotify && !resource.toolbar_buttons_raised) { @@ -748,6 +748,7 @@ create_toolbar(Widget parent, Widget menu_bar) } else if (item_count == 4) { Pixmap sens, insens; + sens = insens = 0; /* make compiler happy ... */ int idx = strtoul(line_items[0], (char **)NULL, 10); struct xdvi_action *action; |