commit 60c0376d40f93ad7d69e2b2eb5a2a91095e5aa71
parent 82377970cffad8807cb4fae60a75be9f6fcf433c
Author: Kyle Milz <milz@macbook.0x30.net>
Date: Tue, 18 Aug 2020 12:32:57 -0700
unifdef -DXAW=1
Use XAW toolkit unconitionally.
Diffstat:
M | dvi-draw.c | | | 18 | ------------------ |
M | dvi-init.c | | | 2 | -- |
M | events.c | | | 57 | --------------------------------------------------------- |
M | popups.c | | | 1176 | ------------------------------------------------------------------------------- |
M | util.c | | | 2 | -- |
M | xdvi.c | | | 41 | ----------------------------------------- |
M | xdvi.h | | | 48 | ------------------------------------------------ |
7 files changed, 0 insertions(+), 1344 deletions(-)
diff --git a/dvi-draw.c b/dvi-draw.c
@@ -35,15 +35,12 @@ NOTE:
# include <vfork.h>
#endif
-#if XAW
# include <X11/StringDefs.h>
# if XAW3d
# include <X11/Xaw3d/Label.h>
# else
# include <X11/Xaw/Label.h>
# endif
-#elif MOTIF
-#endif
#if HAVE_XKB_BELL_EXT
# include <X11/XKBlib.h>
@@ -878,23 +875,8 @@ prescan()
Sprintf(scanmsg, "Scanning pages %d-%d",
scanned_page + 1 + pageno_correct,
nextreportpage + pageno_correct);
-#if XAW
if (pr.popup_active)
XtVaSetValues(popup.label, XtNlabel, scanmsg, NULL);
-#elif MOTIF
- if (pr.popup_active) {
- XmString str;
-
- str = XmStringCreateLocalized((char *) scanmsg);
- XtVaSetValues(popup.label, XmNlabelString, str, NULL);
- XmStringFree(str);
- }
-#else /* no toolkit */
- if (top_level != 0) {
- showmessage(scanmsg);
- XFlush(DISP);
- }
-#endif
}
if (read_events(EV_NOWAIT) & EV_GE_NEWPAGE) break;
diff --git a/dvi-init.c b/dvi-init.c
@@ -40,9 +40,7 @@ NOTE:
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
-#if XAW
# include <X11/Shell.h> /* defines XtNtitle and XtNiconName */
-#endif
#define PK_PRE 247
#define PK_ID 89
diff --git a/events.c b/events.c
@@ -44,22 +44,14 @@ NOTE:
#if XtSpecificationRelease >= 4
-#if XAW
# if XAW3D
# include <X11/Xaw3d/Viewport.h>
# else
# include <X11/Xaw/Viewport.h>
# endif
# include <X11/cursorfont.h>
-#else /* MOTIF */
-#include <Xm/MainW.h>
-#include <Xm/ToggleB.h>
-#include <Xm/RowColumn.h>
-#include <Xm/MenuShell.h>
-#endif /* MOTIF */
#ifdef BUTTONS
-#if XAW
# if XAW3D
# include <X11/Xaw3d/Command.h>
# else
@@ -67,13 +59,6 @@ NOTE:
# endif
#define PANEL_WIDGET_CLASS compositeWidgetClass
#define BUTTON_WIDGET_CLASS commandWidgetClass
-#else /* MOTIF */
-#include <Xm/Form.h>
-#include <Xm/BulletinB.h>
-#include <Xm/PushB.h>
-#define PANEL_WIDGET_CLASS xmBulletinBoardWidgetClass
-#define BUTTON_WIDGET_CLASS xmPushButtonWidgetClass
-#endif /* MOTIF */
#endif /* BUTTONS */
#else /* XtSpecificationRelease < 4 */
@@ -213,15 +198,11 @@ static void xdvi_normal_exit();
* of mane.win in that case.
*/
-#if XAW
# if BUTTONS
# define CURSORWIN XtWindow(form_widget)
# else
# define CURSORWIN XtWindow(vport_widget)
# endif
-#else
-# define CURSORWIN mane.win
-#endif
#if COLOR
static XColor bg_Color;
@@ -583,7 +564,6 @@ create_buttons()
struct xdvi_action *action;
line_args[0].value = (XtArgVal) resource._fore_Pixel;
-#if XAW
line_args[2].value = (XtArgVal) vport_widget;
line_widget = XtCreateWidget("line", widgetClass, form_widget,
line_args, XtNumber(line_args));
@@ -593,12 +573,6 @@ create_buttons()
(XtArgVal) XtParseTranslationTable("<ButtonPress>:");
panel_widget = XtCreateWidget("panel", PANEL_WIDGET_CLASS,
form_widget, panel_args, XtNumber(panel_args));
-#else
- panel_widget = XtCreateManagedWidget("panel", PANEL_WIDGET_CLASS,
- form_widget, panel_args, XtNumber(panel_args));
- if (wheel_trans_table != NULL)
- XtOverrideTranslations(panel_widget, wheel_trans_table);
-#endif
button_number = shrink_button_number = 0;
b_head = NULL;
@@ -770,7 +744,6 @@ refers to non-existent shrink action.\n", button_number + 1);
#endif
}
-#if XAW
void
set_button_panel_height(h)
@@ -787,7 +760,6 @@ set_button_panel_height(h)
XDefineCursor(DISP, XtWindow(panel_widget), panel_cursor);
}
-#endif /* MOTIF */
#endif /* BUTTONS */
@@ -1669,7 +1641,6 @@ static void
home_bottom P1C(wide_bool, scrl)
{
XUnmapWindow(DISP, mane.win);
-#if XAW
get_xy();
if (x_bar != NULL) {
int coord = (page_w - clip_w) / 2;
@@ -1682,19 +1653,6 @@ home_bottom P1C(wide_bool, scrl)
if (y_bar != NULL)
XtCallCallbacks(y_bar, XtNscrollProc,
(XtPointer) (ptrdiff_t) (window_y + (page_h - clip_h)));
-#else /* if MOTIF */
- {
- int value;
-
- value = (page_w - clip_w) / 2;
- if (value > home_x / mane.shrinkfactor)
- value = home_x / mane.shrinkfactor;
- (void) set_bar_value(x_bar, value, (int) (page_w - clip_w));
-
- (void) set_bar_value(y_bar, (int) (page_h - clip_h),
- (int) (page_h - clip_h));
- }
-#endif /* MOTIF */
XMapWindow(DISP, mane.win);
/* Wait for the server to catch up---this eliminates flicker. */
XSync(DISP, False);
@@ -2720,9 +2678,7 @@ ACTION(Act_magnifier)
_Xconst char *p;
int x, y;
XSetWindowAttributes attr;
-#if XAW
Window throwaway;
-#endif
/*
@@ -3215,7 +3171,6 @@ handle_property_change(widget, junk, ev, cont)
#undef event
-#if XAW
void
handle_messages(widget, closure, event, cont)
@@ -3234,18 +3189,6 @@ handle_messages(widget, closure, event, cont)
}
}
-#elif MOTIF
-
-void
-handle_wm_delete(w, client_data, call_data)
- Widget w;
- XtPointer client_data;
- XtPointer call_data;
-{
- Act_quit(w, NULL, NULL, 0);
-}
-
-#endif /* MOTIF */
/*
diff --git a/popups.c b/popups.c
@@ -38,7 +38,6 @@ IN THE SOFTWARE.
#include <X11/Xatom.h>
#include <X11/StringDefs.h>
-#if XAW
# include <X11/Shell.h>
# if XAW3D
# include <X11/Xaw3d/Form.h>
@@ -64,20 +63,6 @@ IN THE SOFTWARE.
# if XtSpecificationRelease < 6
# define XawFmt8Bit FMT8BIT
# endif
-#else /* MOTIF */
-# include <Xm/BulletinB.h>
-# include <Xm/DialogS.h>
-# include <Xm/MessageB.h>
-# include <Xm/FileSB.h>
-# include <Xm/LabelG.h>
-# include <Xm/Form.h>
-# include <Xm/Frame.h>
-# include <Xm/ToggleBG.h>
-# include <Xm/Text.h>
-# include <Xm/TextF.h>
-# include <Xm/PushB.h>
-# include <Xm/Protocols.h>
-#endif /* MOTIF */
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
@@ -328,7 +313,6 @@ mprintf(va_alist)
}
-#if XAW
/*
* Realize the widget and set the callback for the WM_DESTROY protocol.
@@ -345,7 +329,6 @@ XdviXawRealizePopup(shell, callback)
XtAddEventHandler(shell, NoEventMask, True, handle_messages, callback);
}
-#endif /* XAW */
/*
@@ -418,7 +401,6 @@ handle_popup_events(widget, rec, ev, cont)
}
-#if XAW
void
simple_popup(rec, message, callback)
@@ -474,54 +456,6 @@ simple_popup(rec, message, callback)
}
}
-#else /* MOTIF */
-
-void
-simple_popup(rec, message, callback)
- struct status_popup *rec;
- _Xconst char *message;
- XtCallbackProc callback;
-{
- Widget bb;
- XmString str;
- Boolean old_rec_popped = rec->popped;
-
- rec->popped = True;
- str = XmStringCreateLtoR((char *) message, XmFONTLIST_DEFAULT_TAG);
- if (rec->shell == NULL) {
- rec->shell = XtVaCreatePopupShell("status",
- xmDialogShellWidgetClass, top_level,
- XmNallowShellResize, True,
- XmNdeleteResponse, XmDO_NOTHING,
- XmNtitle, "Xdvi status",
- NULL);
- XtAddEventHandler(rec->shell, StructureNotifyMask, False,
- handle_popup_events, (XtPointer) rec);
- XmAddWMProtocolCallback(rec->shell, XA_WM_DELETE_WINDOW, callback,
- NULL);
-
- bb = XtCreateWidget("bulletin", xmBulletinBoardWidgetClass,
- rec->shell, NULL, 0);
-
- rec->label = XtVaCreateManagedWidget("label", xmLabelGadgetClass,
- bb,
- XmNlabelString, str,
- NULL);
-
- XtManageChild(bb);
- }
- else
- XtVaSetValues(rec->label, XmNlabelString, str, NULL);
-
- XmStringFree(str);
-
- if (!rec->expected_type && !old_rec_popped) {
- rec->expected_type = MapNotify;
- XtPopup(rec->shell, XtGrabNone);
- }
-}
-
-#endif
void
simple_popdown(rec)
@@ -552,7 +486,6 @@ warn_callback(w, client_data, call_data)
XtDestroyWidget(XtIsShell(w) ? w : (Widget) client_data);
}
-#if XAW
void
do_popup(shell)
@@ -644,76 +577,6 @@ warning_popup(message, button_name, callback)
return shell;
}
-#else /* MOTIF */
-
-void
-do_popup(dialog)
- Widget dialog;
-{
- XtManageChild(dialog);
- XtPopup(XtParent(dialog), XtGrabNone);
-}
-
-Widget
-warning_popup(message, mtype, button_name, callback)
- _Xconst char *message;
- int mtype;
- _Xconst char *button_name;
- XtCallbackProc callback;
-{
- Widget shell;
- Widget dialog;
- XmString str;
-
- shell = XtVaCreatePopupShell("warn", xmDialogShellWidgetClass,
- top_level,
- XmNdeleteResponse, XmDO_NOTHING,
- XmNtitle, "Xdvi warning",
- NULL);
- XmAddWMProtocolCallback(shell, XA_WM_DELETE_WINDOW,
- callback != NULL ? callback : warn_callback, NULL);
-
- dialog = XtVaCreateWidget("dialog", xmMessageBoxWidgetClass, shell,
- XmNdialogType, mtype,
- NULL);
- XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
- XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
-
- XtAddCallback(dialog, XmNokCallback,
- callback != NULL ? callback : warn_callback, shell);
-
- str = XmStringCreateLtoR((char *) message, XmFONTLIST_DEFAULT_TAG);
- XtVaSetValues(dialog, XmNmessageString, str, NULL);
- XmStringFree(str);
-
- if (button_name != NULL) {
- str = XmStringCreateLocalized((char *) button_name);
- XtVaSetValues(dialog, XmNokLabelString, str, NULL);
- XmStringFree(str);
- }
-
- XtInstallAllAccelerators(dialog,
- XmMessageBoxGetChild(dialog, XmDIALOG_OK_BUTTON));
-
- if (postpone_popups) {
- /* save it for later */
- if (n_init_popups >= alloc_init_popups) {
- if (alloc_init_popups != 0)
- init_popups = xrealloc(init_popups,
- (alloc_init_popups += 2) * sizeof (*init_popups));
- else
- init_popups = xmalloc((alloc_init_popups = 2)
- * sizeof (*init_popups));
- }
- init_popups[n_init_popups++] = dialog;
- }
- else
- do_popup(dialog);
-
- return shell;
-}
-
-#endif /* MOTIF */
Widget
#if NeedVarargsPrototypes
@@ -723,18 +586,10 @@ warning_popup_long(_Xconst char *format,
# endif
_Xconst char *button_name, XtCallbackProc callback, ...)
#else /* ! NeedVarargsPrototypes */
-# if XAW
warning_popup_long(format, button_name, callback, va_alist)
_Xconst char *format;
_Xconst char *button_name;
XtCallbackProc callback;
-# else /* MOTIF */
-warning_popup_long(format, mtype, button_name, callback, va_alist)
- _Xconst char *format;
- int mtype;
- _Xconst char *button_name;
- XtCallbackProc callback;
-# endif
va_dcl
#endif /* ! NeedVarargsPrototypes */
{
@@ -750,11 +605,7 @@ warning_popup_long(format, mtype, button_name, callback, va_alist)
str = vmprintf(format, args);
va_end(args);
-#if XAW
w = warning_popup(str, button_name, callback);
-#else /* MOTIF */
- w = warning_popup(str, mtype, button_name, callback);
-#endif
free(str);
@@ -762,7 +613,6 @@ warning_popup_long(format, mtype, button_name, callback, va_alist)
}
-#if XAW
/*
* Confirm popup - Pop up a window and ask a yes/no question.
@@ -822,53 +672,6 @@ confirm_popup(message, button_name, callback, yes_answer, no_answer)
return shell;
}
-#else /* MOTIF */
-
-Widget
-confirm_popup(message, button_name, callback, yes_answer, no_answer)
- char *message;
- char *button_name;
- XtCallbackProc callback;
- XtPointer yes_answer, no_answer;
-{
- Widget dialog;
- XmString msg, yes, no;
-
- {
- static Arg cq_args[] = {
- {XmNdeleteResponse, XmDO_NOTHING},
- };
-
- dialog = XmCreateQuestionDialog(top_level, "confirm",
- cq_args, XtNumber(cq_args));
- XmAddWMProtocolCallback(XtParent(dialog), XA_WM_DELETE_WINDOW,
- callback, NULL);
- }
- msg = XmStringCreateLocalized(message);
- yes = XmStringCreateLocalized(button_name);
- no = XmStringCreateLocalized("Cancel");
- XtVaSetValues(dialog,
- XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
- XmNmessageString, msg,
- XmNokLabelString, yes,
- XmNcancelLabelString, no,
- NULL);
- XmStringFree(msg);
- XmStringFree(yes);
- XmStringFree(no);
-
- XtAddCallback(dialog, XmNokCallback, callback, yes_answer);
- XtAddCallback(dialog, XmNcancelCallback, callback, no_answer);
- XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
-
- XtManageChild(dialog);
- dialog = XtParent(dialog);
- XtPopup(dialog, XtGrabNone);
-
- return dialog;
-}
-
-#endif /* MOTIF */
/*
@@ -897,7 +700,6 @@ cb_file_cancel(w, client_data, call_data)
exit(1);
}
-#if XAW
static Widget f1text, f2vport, f2clip, f2form, f3text, f4text;
static Widget *widget_list; /* list of file entries */
@@ -2230,164 +2032,6 @@ Act_open_dvi_file P4C(Widget, w, XEvent *, event, String *, params,
file_active = True;
}
-#else /* MOTIF */
-
-/* ARGSUSED */
-static void
-cb_file_go(w, client_data, call_data)
- Widget w;
- XtPointer client_data;
- XtPointer call_data;
-{
- char *str;
- XmFileSelectionBoxCallbackStruct *cbs;
- struct stat buf;
-
- cbs = (XmFileSelectionBoxCallbackStruct *) call_data;
- if (!XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &str))
- return; /* shouldn't happen */
-
- if (stat(str, &buf) != 0) { /* if file does not exist (or error) */
- warning_popup_long("Error opening file: %s\n%s.", XmDIALOG_ERROR,
- "OK", NULL, str, strerror(errno));
- }
- else {
- FILE *f;
-
- /* Normally, dvi files are are not part of the fd-counting
- provided by xfopen(), since there is only one of them.
- However, in this case we're opening one before closing the
- old one, so we have to use xfopen() in this case. */
- f = xfopen(str, OPEN_MODE);
- if (f == NULL)
- warning_popup_long("Error opening file: %s\n%s.",
- XmDIALOG_ERROR, "OK", NULL, str, strerror(errno));
- else {
- ino_t old_inode;
-
- ++n_files_left;
- if (dvi_file != NULL)
- fclose(dvi_file);
- dvi_file = f;
-
- if (dvi_name != NULL)
- free(dvi_name);
-
- dvi_name = xstrdup(str);
- dvi_time = buf.st_mtime;
-
- old_inode = dvi_inode;
- form_dvi_property(buf.st_ino);
- titles_are_stale = True;
-
- if (mane.win != (Window) 0) { /* if not in startup code */
- if (dvi_inode != old_inode)
- set_dvi_property();
-
- goto_page(0, home);
- }
- else
- reposition = True;
-
- XtPopdown(file_shell);
- file_active = False;
-
- ev_flags |= EV_NEWDOC;
- }
- }
-
- XtFree(str);
-}
-
-/* ARGSUSED */
-void
-Act_open_dvi_file P4C(Widget, w, XEvent *, event, String *, params,
- Cardinal *, num_params)
-{
- Widget dialog;
-
- if (file_active) {
- XRaiseWindow(DISP, XtWindow(file_shell));
- return;
- }
-
- if (file_shell == NULL) {
- static Arg cf_args[] = {
- {XmNdirectory, (XtArgVal) NULL},
- {XmNpattern, (XtArgVal) NULL},
- };
-
- /* Set initial directory name. */
- if (dvi_name != NULL) {
- char *p;
-
- p = rindex(dvi_name, '/');
- if (p != NULL) {
- char c;
-
- for (;; --p) {
- if (p <= dvi_name) {
- ++p;
- break;
- }
- if (p[-1] != '/')
- break;
- }
- c = *p;
- *p = '\0';
- cf_args[0].value =
- (XtArgVal) XmStringCreateLocalized(dvi_name);
- *p = c;
- }
- }
-
- cf_args[1].value = (XtArgVal) XmStringCreateLocalized("*.dvi");
-
- dialog = XmCreateFileSelectionDialog(top_level, "file",
- cf_args, XtNumber(cf_args));
-
- if (cf_args[0].value != (XtArgVal) NULL) {
- XmStringFree((XmString) cf_args[0].value);
- cf_args[0].value = (XtArgVal) NULL;
- }
- XmStringFree((XmString) cf_args[1].value);
-
- XtAddCallback(dialog, XmNokCallback, cb_file_go, NULL);
- XtAddCallback(dialog, XmNcancelCallback, cb_file_cancel, NULL);
- XtUnmanageChild(
- XmFileSelectionBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
-
- file_shell = XtParent(dialog);
- XmAddWMProtocolCallback(file_shell, XA_WM_DELETE_WINDOW,
- cb_file_cancel, NULL);
- XtVaSetValues(file_shell, XmNtitle, "Xdvi: Open Dvi File", NULL);
-
- XtManageChild(dialog);
- }
- else if (reposition) {
- /* Center the popup over the main window */
- Position x, y;
- Dimension w1, h1, w2, h2;
-
- /* Get the size and location of the main window */
- x = y = 0;
- XtVaGetValues(top_level, XtNx, &x, XtNy, &y,
- XtNwidth, &w1, XtNheight, &h1, NULL);
-
- /* Get the size of the popup window */
- XtVaGetValues(file_shell, XtNwidth, &w2, XtNheight, &h2, NULL);
-
- /* Move the popup */
- XtVaSetValues(file_shell, XtNx, x + (w1 - w2) / 2,
- XtNy, y + (h1 - h2) / 2, NULL);
-
- reposition = False;
- }
-
- XtPopup(file_shell, XtGrabNone);
-}
-
-#endif
/*
@@ -2479,25 +2123,20 @@ cb_print(w, client_data, call_data)
print_precheck();
}
-#if XAW
static void print_act_go ARGS((Widget, XEvent *, String *, Cardinal *));
-#endif
static void printlog_act_close ARGS((Widget, XEvent *, String *, Cardinal *));
static void printlog_act_keep ARGS((Widget, XEvent *, String *, Cardinal *));
static void printlog_act_unkeep ARGS((Widget, XEvent *, String *, Cardinal *));
static void printlog_act_cancel ARGS((Widget, XEvent *, String *, Cardinal *));
static XtActionsRec print_actions[] = {
-#if XAW
{"printInternal", print_act_go},
-#endif
{"printlogIntClose", printlog_act_close},
{"printlogIntKeep", printlog_act_keep},
{"printlogIntUnkeep", printlog_act_unkeep},
{"printlogIntCancel", printlog_act_cancel},
};
-#if XAW
#ifndef PRINTINDENT
# define PRINTINDENT 25
@@ -3003,610 +2642,6 @@ Act_print P4C(Widget, w, XEvent *, event, String *, params,
print_active = True;
}
-#else /* MOTIF */
-
-#ifndef DDIST
-# define DDIST 4
-#endif
-
-#ifndef DDIST_MAJOR
-# define DDIST_MAJOR 10
-#endif
-
-static Widget f1radiowidget;
-static Widget f2radiowidget;
-static Widget r7label1, r7label2, r7label3;
-
-/* These are needed so that *pr_save_fileradio will work. */
-#define r2radio r1radio1
-#define r3radio r1radio2
-
-/* ARGSUSED */
-static void
-cb_print_vs_file(w, client_data, call_data)
- Widget w;
- XtPointer client_data;
- XtPointer call_data;
-{
- if (((XmToggleButtonCallbackStruct *) call_data)->set) {
- if (w != f1radiowidget) {
- XmToggleButtonGadgetSetState(f1radiowidget, False, False);
- f1radiowidget = w;
- set_sensitivity(client_data);
- XmProcessTraversal(
- pr_current_fileradio == &r1radio1 ? r2text : r3text,
- XmTRAVERSE_CURRENT);
- }
- }
- else if (w == f1radiowidget)
- XmToggleButtonGadgetSetState(w, True, False);
-}
-
-
-static void
-range_set_sensitivity(pageradio)
- Widget *pageradio;
-{
- Boolean sensitivity;
-
- if (pageradio == pr_current_pageradio) /* if no change */
- return;
-
- pr_current_pageradio = pageradio;
- sensitivity = (pageradio == &r7radio);
-
- XtSetSensitive(r7label1, sensitivity);
- XtSetSensitive(r7text1, sensitivity);
- XtSetSensitive(r7label2, sensitivity);
- XtSetSensitive(r7text2, sensitivity);
- XtSetSensitive(r7label3, sensitivity);
-}
-
-/* ARGSUSED */
-static void
-cb_range(w, client_data, call_data)
- Widget w;
- XtPointer client_data;
- XtPointer call_data;
-{
- if (((XmToggleButtonCallbackStruct *) call_data)->set) {
- if (w != f2radiowidget) {
- XmToggleButtonGadgetSetState(f2radiowidget, False, False);
- f2radiowidget = w;
- range_set_sensitivity((Widget *) client_data);
- if (pr_current_pageradio == &r7radio)
- XmProcessTraversal(r7text1, XmTRAVERSE_CURRENT);
- }
- }
- else if (w == f2radiowidget)
- XmToggleButtonGadgetSetState(w, True, False);
-}
-
-/* ARGSUSED */
-void
-Act_print P4C(Widget, w, XEvent *, event, String *, params,
- Cardinal *, num_params)
-{
- char *ofstring;
-
- if (print_active) {
- XRaiseWindow(DISP, XtWindow(print_shell));
- return;
- }
-
- if (printlog_active) {
- XRaiseWindow(DISP, XtWindow(printlog_shell));
- return;
- }
-
- if (dvi_file == NULL) {
- WARN(XmDIALOG_ERROR, "No active dvi file");
- return;
- }
-
- ofstring = (pageno_correct == 1 ? mprintf("of %d", total_pages)
- : mprintf("of %d to %d", pageno_correct,
- total_pages + pageno_correct - 1));
-
- if (print_shell == NULL) {
- Widget form;
- Widget frame1, f1label, f1child;
- Widget r4label;
- Widget r8label;
- Widget frame2, f2label, f2child;
- Widget r9ok, r9cancel;
- XmString str;
-
- XtAddActions(print_actions, XtNumber(print_actions));
- print_shell = XtVaCreatePopupShell("print",
- xmDialogShellWidgetClass, top_level,
- XmNtitle, "Print dvi file",
- XmNallowShellResize, True,
- XmNdeleteResponse, XmDO_NOTHING,
- NULL);
- XmAddWMProtocolCallback(print_shell, XA_WM_DELETE_WINDOW,
- cb_print_cancel, NULL);
-
- form = XtVaCreateWidget("form", xmFormWidgetClass, print_shell,
- XmNhorizontalSpacing, DDIST_MAJOR,
- XmNverticalSpacing, DDIST_MAJOR,
- XmNautoUnmanage, False,
- NULL);
-
- /* First frame (rows 1-3): print to printer or file */
-
- frame1 = XtVaCreateWidget("printtoframe", xmFrameWidgetClass, form,
- XmNmarginWidth, DDIST,
- XmNmarginHeight, DDIST,
- XmNtopAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- NULL);
-
- str = XmStringCreateLocalized("Print To");
- f1label = XtVaCreateManagedWidget("title", xmLabelGadgetClass,
- frame1,
- XmNchildType, XmFRAME_TITLE_CHILD,
- XmNlabelString, str,
- NULL);
- XmStringFree(str);
-
- f1child = XtVaCreateWidget("form", xmFormWidgetClass, frame1,
- XmNhorizontalSpacing, DDIST,
- XmNverticalSpacing, DDIST,
- NULL);
-
- str = XmStringCreateLocalized("Printer");
- f1radiowidget = r2radio = XtVaCreateManagedWidget("toprinter",
- xmToggleButtonGadgetClass, f1child,
- XmNlabelString, str,
- XmNindicatorType, XmONE_OF_MANY,
- XmNset, True,
- XmNtopAttachment, XmATTACH_FORM,
- XmNtopOffset, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNleftOffset, 0,
- NULL);
- XmStringFree(str);
- XtAddCallback(r2radio, XmNvalueChangedCallback, cb_print_vs_file,
- &r1radio1);
-
- str = XmStringCreateLocalized("Print command:");
- r2label = XtVaCreateManagedWidget("prncommand", xmLabelGadgetClass,
- f1child,
- XmNlabelString, str,
- XmNtopAttachment, XmATTACH_FORM,
- XmNtopOffset, 0,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r2radio,
- NULL);
- XmStringFree(str);
-
- r2text = XtVaCreateManagedWidget("prntext", xmTextFieldWidgetClass,
- f1child,
- XmNtopAttachment, XmATTACH_FORM,
- XmNtopOffset, 0,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r2label,
- NULL);
- XtAddCallback(r2text, XmNactivateCallback, cb_print, NULL);
-
- { /* straighten the row of widgets */
- Dimension h1, h2;
-
- XtVaGetValues(r2text, XmNheight, &h2, NULL);
- XtVaGetValues(r2radio, XmNheight, &h1, NULL);
- XtVaSetValues(r2radio, XmNtopOffset, (h2 - h1) / 2, NULL);
- XtVaGetValues(r2label, XmNheight, &h1, NULL);
- XtVaSetValues(r2label, XmNtopOffset, (h2 - h1) / 2, NULL);
- }
-
- str = XmStringCreateLocalized("File");
- r3radio = XtVaCreateManagedWidget("tofile",
- xmToggleButtonGadgetClass, f1child,
- XmNlabelString, str,
- XmNindicatorType, XmONE_OF_MANY,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r2text,
- XmNleftAttachment, XmATTACH_FORM,
- XmNleftOffset, 0,
- NULL);
- XmStringFree(str);
- XtAddCallback(r3radio, XmNvalueChangedCallback, cb_print_vs_file,
- &r1radio2);
-
- str = XmStringCreateLocalized("File name:");
- r3label = XtVaCreateManagedWidget("filename", xmLabelGadgetClass,
- f1child,
- XmNlabelString, str,
- XmNsensitive, False,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r2text,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r3radio,
- NULL);
- XmStringFree(str);
-
- r3text = XtVaCreateManagedWidget("prntext", xmTextFieldWidgetClass,
- f1child,
- XmNsensitive, False,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r2text,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r3label,
- NULL);
- XtAddCallback(r3text, XmNactivateCallback, cb_print, NULL);
-
- { /* straighten the row of widgets */
- Dimension h1, h2;
-
- XtVaGetValues(r3text, XmNheight, &h2, NULL);
- XtVaGetValues(r3radio, XmNheight, &h1, NULL);
- XtVaSetValues(r3radio, XmNtopOffset, DDIST + (h2 - h1) / 2,
- NULL);
- XtVaGetValues(r3label, XmNheight, &h1, NULL);
- XtVaSetValues(r3label, XmNtopOffset, DDIST + (h2 - h1) / 2,
- NULL);
- }
-
- { /* align left edges of text widgets */
- Dimension w2r, w3r, w2l, w3l;
-
- XtVaGetValues(r2radio, XmNwidth, &w2r, NULL);
- XtVaGetValues(r3radio, XmNwidth, &w3r, NULL);
- XtVaGetValues(r2label, XmNwidth, &w2l, NULL);
- XtVaGetValues(r3label, XmNwidth, &w3l, NULL);
- if (w2l < w3l || w2r < w3r) {
- Dimension offset;
-
- offset = DDIST;
- if (w2l < w3l) offset += w3l - w2l;
- if (w2r < w3r) offset += w3r - w2r;
- XtVaSetValues(r2label, XmNleftOffset, offset, NULL);
- }
- if (w2l > w3l || w2r > w3r) {
- Dimension offset;
-
- offset = DDIST;
- if (w2l > w3l) offset += w2l - w3l;
- if (w2r > w3r) offset += w2r - w3r;
- XtVaSetValues(r3label, XmNleftOffset, offset, NULL);
- }
- }
-
- XtManageChild(f1child);
- XtManageChild(frame1);
-
- /* Row 4: printer name (for dvips) */
-
- str = XmStringCreateLocalized("Printer name (used by dvips):");
- r4label = XtVaCreateManagedWidget("prname", xmLabelGadgetClass,
- form,
- XmNlabelString, str,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, frame1,
- XmNleftAttachment, XmATTACH_FORM,
- NULL);
- XmStringFree(str);
-
- r4text = XtVaCreateManagedWidget("prtext", xmTextFieldWidgetClass,
- form,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, frame1,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r4label,
- XmNcolumns, 5,
- NULL);
- XtAddCallback(r4text, XmNactivateCallback, cb_print, NULL);
-
- { /* straighten the row of widgets */
- Dimension h1, h2;
-
- XtVaGetValues(r4text, XmNheight, &h2, NULL);
- XtVaGetValues(r4label, XmNheight, &h1, NULL);
- XtVaSetValues(r4label,
- XmNtopOffset, DDIST_MAJOR + (h2 - h1) / 2,
- NULL);
- }
-
- /* Row 8 (row 4.5 for Motif): additional dvips args */
-
- str = XmStringCreateLocalized(
- "Additional dvips arguments (optional):");
- r8label = XtVaCreateManagedWidget("xargsname", xmLabelGadgetClass,
- form,
- XmNlabelString, str,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r4text,
- XmNleftAttachment, XmATTACH_FORM,
- NULL);
- XmStringFree(str);
-
- r8text = XtVaCreateManagedWidget("xargstext",
- xmTextFieldWidgetClass, form,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r8label,
- XmNleftAttachment, XmATTACH_FORM,
- XmNleftOffset, DDIST + DDIST_MAJOR,
- XmNrightAttachment, XmATTACH_FORM,
- XmNrightOffset, DDIST + DDIST_MAJOR,
- NULL);
- XtAddCallback(r8text, XmNactivateCallback, cb_print, NULL);
-
- /* Second frame (rows 5-7): page selection */
-
- frame2 = XtVaCreateWidget("printtoframe", xmFrameWidgetClass, form,
- XmNmarginWidth, DDIST,
- XmNmarginHeight, DDIST,
- XmNresizable, True,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r8text,
- XmNleftAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- NULL);
-
- str = XmStringCreateLocalized("Page Selection");
- f2label = XtVaCreateManagedWidget("title", xmLabelGadgetClass,
- frame2,
- XmNchildType, XmFRAME_TITLE_CHILD,
- XmNlabelString, str,
- NULL);
- XmStringFree(str);
-
- f2child = XtVaCreateWidget("form", xmFormWidgetClass, frame2,
- XmNhorizontalSpacing, DDIST,
- XmNverticalSpacing, DDIST,
- XmNresizable, True,
- NULL);
-
- str = XmStringCreateLocalized("All");
- f2radiowidget = r6radio = XtVaCreateManagedWidget("all",
- xmToggleButtonGadgetClass, f2child,
- XmNlabelString, str,
- XmNindicatorType, XmONE_OF_MANY,
- XmNset, True,
- XmNtopAttachment, XmATTACH_FORM,
- XmNtopOffset, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNleftOffset, 0,
- NULL);
- XmStringFree(str);
- XtAddCallback(r6radio, XmNvalueChangedCallback, cb_range,
- &r6radio);
-
- str = XmStringCreateLocalized("Range:");
- r7radio = XtVaCreateManagedWidget("range",
- xmToggleButtonGadgetClass, f2child,
- XmNlabelString, str,
- XmNindicatorType, XmONE_OF_MANY,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r6radio,
- XmNleftAttachment, XmATTACH_FORM,
- XmNleftOffset, 0,
- NULL);
- XmStringFree(str);
- XtAddCallback(r7radio, XmNvalueChangedCallback, cb_range,
- &r7radio);
-
- str = XmStringCreateLocalized("From");
- r7label1 = XtVaCreateManagedWidget("from", xmLabelGadgetClass,
- f2child,
- XmNlabelString, str,
- XmNsensitive, False,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r6radio,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r7radio,
- NULL);
- XmStringFree(str);
-
- r7text1 = XtVaCreateManagedWidget("frompage",
- xmTextFieldWidgetClass, f2child,
- XmNcolumns, 5,
- XmNsensitive, False,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r6radio,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r7label1,
- NULL);
- XtAddCallback(r7text1, XmNactivateCallback, cb_print, NULL);
-
- str = XmStringCreateLocalized("to");
- r7label2 = XtVaCreateManagedWidget("to", xmLabelGadgetClass,
- f2child,
- XmNlabelString, str,
- XmNsensitive, False,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r6radio,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r7text1,
- NULL);
- XmStringFree(str);
-
- r7text2 = XtVaCreateManagedWidget("topage", xmTextFieldWidgetClass,
- f2child,
- XmNcolumns, 5,
- XmNsensitive, False,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r6radio,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r7label2,
- NULL);
- XtAddCallback(r7text2, XmNactivateCallback, cb_print, NULL);
-
- str = XmStringCreateLocalized(ofstring);
- r7label3 = XtVaCreateManagedWidget("of", xmLabelGadgetClass,
- f2child,
- XmNlabelString, str,
- XmNsensitive, False,
- XmNresizable, True,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, r6radio,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r7text2,
- NULL);
- XmStringFree(str);
-
- { /* straighten the row of widgets */
- Dimension h1, h2;
-
- XtVaGetValues(r7text1, XmNheight, &h2, NULL);
- XtVaGetValues(r7radio, XmNheight, &h1, NULL);
- XtVaSetValues(r7radio, XmNtopOffset, DDIST + (h2 - h1) / 2,
- NULL);
- XtVaGetValues(r7label1, XmNheight, &h1, NULL);
- XtVaSetValues(r7label1, XmNtopOffset, DDIST + (h2 - h1) / 2,
- NULL);
- XtVaSetValues(r7label2, XmNtopOffset, DDIST + (h2 - h1) / 2,
- NULL);
- XtVaSetValues(r7label3, XmNtopOffset, DDIST + (h2 - h1) / 2,
- NULL);
- }
-
- XtManageChild(f2child);
- XtManageChild(frame2);
-
- str = XmStringCreateLocalized("OK");
- r9ok = XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass,
- form,
- XmNlabelString, str,
- XmNshowAsDefault, True,
- XmNdefaultButtonShadowThickness, 1,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, frame2,
- XmNtopOffset, DDIST_MAJOR + DDIST,
- XmNleftAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL);
- XmStringFree(str);
- XtAddCallback(r9ok, XmNactivateCallback, cb_print, NULL);
- XtOverrideTranslations(r9ok, XtParseTranslationTable(
- "<Key>Return:ArmAndActivate()"));
- XmProcessTraversal(r9ok, XmTRAVERSE_CURRENT);
-
- str = XmStringCreateLocalized("Show previous log");
- r9prev = XtVaCreateManagedWidget("prev",
- xmPushButtonWidgetClass, form,
- XmNlabelString, str,
- XmNsensitive, False,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, frame2,
- XmNtopOffset, DDIST_MAJOR + DDIST,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, r9ok,
- NULL);
- XmStringFree(str);
- XtAddCallback(r9prev, XmNactivateCallback, cb_print_cancel, NULL);
-
- str = XmStringCreateLocalized("Cancel");
- r9cancel = XtVaCreateManagedWidget("cancel",
- xmPushButtonWidgetClass, form,
- XmNlabelString, str,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, frame2,
- XmNtopOffset, DDIST_MAJOR + DDIST,
- XmNrightAttachment, XmATTACH_FORM,
- NULL);
- XmStringFree(str);
- XtAddCallback(r9cancel, XmNactivateCallback, cb_print_cancel, NULL);
-
- { /* straighten the row of widgets */
- Dimension h1, h2;
-
- XtVaGetValues(r9ok, XmNheight, &h1, NULL);
- XtVaGetValues(r9prev, XmNheight, &h2, NULL);
- XtVaSetValues(r9prev,
- XmNtopOffset, DDIST_MAJOR + DDIST + (h1 - h2) / 2, NULL);
- XtVaGetValues(r9cancel, XmNheight, &h2, NULL);
- XtVaSetValues(r9cancel,
- XmNtopOffset, DDIST_MAJOR + DDIST + (h1 - h2) / 2, NULL);
- }
-
- XtManageChild(form);
-
- { /* center middle button in bottom row */
- Dimension w, b;
- Position x1, x3;
-
- XtVaGetValues(r9ok, XmNx, &x1, XmNwidth, &w, NULL);
- x1 += w;
- XtVaGetValues(r9prev, XmNwidth, &w, NULL);
- XtVaGetValues(r9cancel, XmNx, &x3, NULL);
- XtVaSetValues(r9prev, XmNleftOffset, (x3 - x1 - w) / 2, NULL);
- }
- }
- else { /* if the window was already created */
- XmString str;
-
- if (pr_save_fileradio != pr_current_fileradio)
- XmToggleButtonGadgetSetState(*pr_save_fileradio, True, True);
- if (pr_save_pageradio != pr_current_pageradio)
- XmToggleButtonGadgetSetState(*pr_save_pageradio, True, True);
-
- str = XmStringCreateLocalized(ofstring);
- XtVaSetValues(r7label3, XmNlabelString, str, NULL);
- XmStringFree(str);
-
- if (pr_save_printer != NULL) {
- XtVaSetValues(r4text, XmNvalue, pr_save_printer,
- XmNcursorPosition, strlen(pr_save_printer), NULL);
- }
- else
- XtVaSetValues(r4text, XmNvalue, "", NULL);
-
- if (pr_save_xargs != NULL) {
- XtVaSetValues(r8text, XmNvalue, pr_save_xargs,
- XmNcursorPosition, strlen(pr_save_xargs), NULL);
- }
- else
- XtVaSetValues(r8text, XmNvalue, "", NULL);
- }
-
- free(ofstring);
-
- { /* set initial values of print command and file name fields */
- _Xconst char *s;
- char s2[3 * sizeof(int) + 1];
-
- s = pr_save_cmd;
- if (s == NULL) s = "lpr";
- XtVaSetValues(r2text, XmNvalue, s, XmNcursorPosition, strlen(s),
- NULL);
-
- if (pr_save_file == NULL) {
- char *s2;
- int n;
-
- s = rindex(dvi_name, '/');
- if (s == NULL) s = dvi_name;
- else ++s;
- n = strlen(s);
- if (n >= 4 && memicmp(s + n - 4, ".dvi", 4) == 0) n -= 4;
- s2 = xmalloc(n + 4);
- memcpy(s2, s, n);
- memcpy(s2 + n, ".ps", 4);
- pr_save_file = s2;
- }
- s = pr_save_file;
- XtVaSetValues(r3text, XmNvalue, s, XmNcursorPosition, strlen(s),
- NULL);
-
-#if HAVE_VSNPRINTF
- (void) snprintf(s2, sizeof s2, "%d", current_page + pageno_correct);
-#else
- (void) sprintf(s2, "%d", current_page + pageno_correct);
-#endif
- XtVaSetValues(r7text1, XmNvalue, s2, XmNcursorPosition, strlen(s2),
- NULL);
- XtVaSetValues(r7text2, XmNvalue, s2, XmNcursorPosition, strlen(s2),
- NULL);
- }
-
- XtPopup(print_shell, XtGrabNone);
- print_active = True;
-}
-
-#endif /* MOTIF */
/*
@@ -3619,11 +2654,7 @@ static Widget printlog_text;
static Widget printlog_close;
static Widget printlog_cancel;
-#if XAW
static XawTextPosition printlog_length;
-#else /* MOTIF */
-static XmTextPosition printlog_length;
-#endif
static void dvips_ended ARGS((int));
static struct xchild print_child = {NULL, 0, True, dvips_ended};
@@ -3653,27 +2684,14 @@ getpageno(w)
{
char *s, *p;
-#if XAW
XtVaGetValues(w, XtNstring, &s, NULL);
-#else /* MOTIF */
- s = XmTextFieldGetString(w);
-#endif
p = s;
if (*p == '-') ++p;
if (!isdigit(*p)) return 0;
do ++p; while (isdigit(*p));
if (*p != '\0') return 0;
-#if XAW
return atoi(s) - pageno_correct + 1;
-#else /* MOTIF */
- {
- int i = atoi(s) - pageno_correct + 1;
-
- XtFree(s);
- return i;
- }
-#endif
}
/* ARGSUSED */
@@ -3717,11 +2735,7 @@ print_precheck()
/* Check for whether to clobber existing file */
if (pr_current_fileradio == &r1radio2) { /* if print to file */
-#if XAW
XtVaGetValues(r3text, XtNstring, &dest, NULL);
-#else /* MOTIF */
- dest = XmTextFieldGetString(r3text);
-#endif
if (stat(dest, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) {
char *msg;
@@ -3783,7 +2797,6 @@ print_do_it()
pr_save_fileradio = pr_current_fileradio;
pr_save_pageradio = pr_current_pageradio;
-#if XAW
if (pr_save_fileradio == &r1radio1) { /* if print to printer */
if (pr_save_cmd != NULL)
@@ -3814,38 +2827,6 @@ print_do_it()
else
xargs = pr_save_xargs = NULL;
-#else /* MOTIF */
-
- if (pr_save_fileradio == &r1radio1) { /* if print to printer */
- if (pr_save_cmd != NULL)
- XtFree((char *) pr_save_cmd);
- dest = pr_save_cmd = XmTextFieldGetString(r2text);
- }
- else { /* if print to file */
- if (pr_save_file != NULL)
- XtFree((char *) pr_save_file);
- dest = pr_save_file = XmTextFieldGetString(r3text);
- }
-
- if (pr_save_printer != NULL)
- XtFree((char *) pr_save_printer);
- prn = XmTextFieldGetString(r4text);
- if (*prn == '\0') {
- XtFree((char *) prn);
- prn = NULL;
- }
- pr_save_printer = prn;
-
- if (pr_save_xargs != NULL)
- XtFree((char *) pr_save_xargs);
- xargs = XmTextFieldGetString(r8text);
- if (*xargs == '\0') {
- XtFree((char *) xargs);
- xargs = NULL;
- }
- pr_save_xargs = xargs;
-
-#endif
/* Open file for writing (if necessary) */
if (pr_save_fileradio == &r1radio2) { /* if print to file */
@@ -3857,7 +2838,6 @@ print_do_it()
}
}
-#if XAW
/* Create popup window */
if (printlog_shell == NULL) {
Widget form;
@@ -3958,117 +2938,6 @@ print_do_it()
XtSetSensitive(printlog_cancel, True);
}
-#else /* MOTIF */
-
- /* Create popup window */
- if (printlog_shell == NULL) {
- Widget form;
- XmString str;
-
- /* Under Motif 2.x (2.1.0 and 2.2.2 at least), XmNeditMode must be
- set early in order to have an effect. */
- static Arg args[] = {
- {XmNeditable, False},
- {XmNrows, 24},
- {XmNcolumns, 80},
- {XmNeditMode, (XtArgVal) XmMULTI_LINE_EDIT},
- };
-
- XtSetSensitive(r9prev, True);
- printlog_shell = XtVaCreatePopupShell("printlog",
- xmDialogShellWidgetClass, top_level,
- XmNtitle, "Xdvi print process",
- XmNdeleteResponse, XmDO_NOTHING,
- NULL);
- XmAddWMProtocolCallback(printlog_shell, XA_WM_DELETE_WINDOW,
- cb_dvips_delete, NULL);
-
- form = XtVaCreateWidget("form", xmFormWidgetClass, printlog_shell,
- XmNhorizontalSpacing, DDIST,
- XmNverticalSpacing, DDIST,
- XmNautoUnmanage, False,
- NULL);
-
- printlog_text = XmCreateScrolledText(form, "text",
- args, XtNumber(args));
- XtVaSetValues(XtParent(printlog_text),
- XmNtopAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- NULL);
- XtOverrideTranslations(printlog_text, XtParseTranslationTable(
- "<Key>Return:printlogIntClose()\n\
-^<Key>c:printlogIntCancel()\n\
-^<Key>s:printlogIntKeep()\n\
-^<Key>q:printlogIntUnkeep()"));
- XtManageChild(printlog_text);
-
- str = XmStringCreateLocalized(
- "Keep window open after dvips finishes");
- printlog_keep = XtVaCreateManagedWidget("keep",
- xmToggleButtonGadgetClass, form,
- XmNlabelString, str,
- XmNnavigationType, XmTAB_GROUP,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, XtParent(printlog_text),
- XmNleftAttachment, XmATTACH_FORM,
- NULL);
- XmStringFree(str);
- XtAddCallback(printlog_keep, XmNvalueChangedCallback, cb_dvips_keep,
- NULL);
-
- str = XmStringCreateLocalized("Close window");
- printlog_close = XtVaCreateManagedWidget("close",
- xmPushButtonWidgetClass, form,
- XmNlabelString, str,
- XmNshowAsDefault, True,
- XmNsensitive, False,
- XmNdefaultButtonShadowThickness, 1,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, printlog_keep,
- XmNtopOffset, DDIST,
- XmNleftAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL);
- XmStringFree(str);
- XtAddCallback(printlog_close, XmNactivateCallback, cb_dvips_close,
- NULL);
-
- str = XmStringCreateLocalized("Cancel");
- printlog_cancel = XtVaCreateManagedWidget("cancel",
- xmPushButtonWidgetClass, form,
- XmNlabelString, str,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, printlog_keep,
- XmNtopOffset, DDIST,
- XmNrightAttachment, XmATTACH_FORM,
- NULL);
- XmStringFree(str);
- XtAddCallback(printlog_cancel, XmNactivateCallback, cb_dvips_cancel,
- NULL);
-
- { /* straighten the row of widgets */
- Dimension h1, h2;
-
- XtVaGetValues(printlog_close, XmNheight, &h1, NULL);
- XtVaGetValues(printlog_cancel, XmNheight, &h2, NULL);
- XtVaSetValues(printlog_cancel,
- XmNtopOffset, DDIST + (h1 - h2) / 2, NULL);
- XtVaSetValues(printlog_cancel,
- XmNrightOffset, DDIST + (h1 - h2) / 2, NULL);
- }
-
- XtManageChild(form);
- XmProcessTraversal(printlog_text, XmTRAVERSE_CURRENT);
- }
- else {
- XmTextSetString(printlog_text, "");
- XtSetSensitive(printlog_close, False);
- XtSetSensitive(printlog_keep, True);
- XtSetSensitive(printlog_cancel, True);
- }
-
-#endif
/* Compute length of dvips command line */
/* dvips [-Pps] -f [-o!command] [-p=n -lm] [xargs] */
@@ -4200,11 +3069,7 @@ print_do_it()
}
printlog_append(argv[0], len);
-#if XAW
do_popup(printlog_shell);
-#else
- XtPopup(printlog_shell, XtGrabNone);
-#endif
printlog_active = True;
--argnext;
@@ -4286,7 +3151,6 @@ print_do_it()
}
-#if XAW
static void
printlog_append(str, len)
@@ -4309,20 +3173,6 @@ printlog_append(str, len)
XawTextSetInsertionPoint(printlog_text, printlog_length);
}
-#else /* MOTIF */
-
-static void
-printlog_append(str, len)
- _Xconst char *str;
- int len;
-{
- XmTextInsert(printlog_text, printlog_length, (char *) str);
- printlog_length += len;
- XtVaSetValues(printlog_text, XmNcursorPosition, printlog_length, NULL);
- XmTextShowPosition(printlog_text, printlog_length);
-}
-
-#endif
static void
read_from_dvips()
@@ -4331,11 +3181,7 @@ read_from_dvips()
char line[80];
for (;;) {
-#if XAW
bytes = read(print_xio.fd, line, sizeof line);
-#else
- bytes = read(print_xio.fd, line, sizeof line - 1);
-#endif
if (bytes < 0) {
if (AGAIN_CONDITION)
break;
@@ -4427,18 +3273,11 @@ static void
dvips_alarm(arg)
struct xtimer *arg;
{
-#if XAW
Boolean state;
-#endif
-#if XAW
XtVaGetValues(printlog_keep, XtNstate, &state, NULL);
if (!state)
dvips_pop_down();
-#else /* MOTIF */
- if (!XmToggleButtonGadgetGetState(printlog_keep))
- dvips_pop_down();
-#endif
dvips_status = DVIPS_STAT_NONE;
}
@@ -4467,21 +3306,14 @@ cb_dvips_keep(w, client_data, call_data)
XtPointer client_data;
XtPointer call_data;
{
-#if XAW
Boolean state;
-#endif
if (dvips_status != DVIPS_STAT_NONE)
return; /* Nothing to do */
-#if XAW
XtVaGetValues(printlog_keep, XtNstate, &state, NULL);
if (!state)
dvips_pop_down();
-#else
- if (!XmToggleButtonGadgetGetState(printlog_keep))
- dvips_pop_down();
-#endif
}
/* ARGSUSED */
@@ -4510,11 +3342,7 @@ static void
printlog_act_keep P4C(Widget, w, XEvent *, event, String *, params,
Cardinal *, num_params)
{
-#if XAW
XtVaSetValues(printlog_keep, XtNstate, True, NULL);
-#else /* MOTIF */
- XmToggleButtonGadgetSetState(printlog_keep, True, False);
-#endif
}
/* ARGSUSED */
@@ -4522,11 +3350,7 @@ static void
printlog_act_unkeep P4C(Widget, w, XEvent *, event, String *, params,
Cardinal *, num_params)
{
-#if XAW
XtVaSetValues(printlog_keep, XtNstate, False, NULL);
-#else /* MOTIF */
- XmToggleButtonGadgetSetState(printlog_keep, False, False);
-#endif
if (dvips_status == DVIPS_STAT_NONE)
dvips_pop_down();
}
diff --git a/util.c b/util.c
@@ -527,7 +527,6 @@ xfopen(filename, type, type2)
#undef TYPE
-#if XAW
/*
* Plain ordinary open() system call. Don't adjust n_files_left.
@@ -553,7 +552,6 @@ xopen(path, flags)
return fd;
}
-#endif /* XAW */
/*
diff --git a/xdvi.c b/xdvi.c
@@ -327,9 +327,7 @@ WidgetClass xmPushButtonWidgetClass;
static char * atom_names[] = {"XDVI WINDOWS", "DVI NAME", "SRC GOTO",
"WM_DELETE_WINDOW",
-#if XAW
"WM_PROTOCOLS",
-#endif
};
/*
@@ -1923,14 +1921,12 @@ or invalid argument:\n\t\"%s\", \"%s\".",
NULL, 0, XtCacheNone, NULL);
#endif
-#if XAW
accels_cr = XtParseAcceleratorTable(
"<Key>Return:set()notify()unset()");
accels_cr_click = XtParseAcceleratorTable(
"<Key>Return:set()notify()unset()\n\
<Btn1Down>:set()\n\
<Btn1Up>:notify()unset()");
-#endif
#if EXTRA_APP_DEFAULTS
/* get resource.progname and resource.debug_arg */
@@ -2011,9 +2007,7 @@ or invalid argument:\n\t\"%s\", \"%s\".",
|| (atoms[1] = XInternAtom(DISP, atom_names[1], False)) == None
|| (atoms[2] = XInternAtom(DISP, atom_names[2], False)) == None
|| (atoms[3] = XInternAtom(DISP, atom_names[3], False)) == None
-# if XAW
|| (atoms[4] = XInternAtom(DISP, atom_names[4], False)) == None
-# endif
)
#endif
oops("XInternAtoms failed.");
@@ -2384,36 +2378,20 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
db = XtScreenDatabase(SCRN);
XrmPutStringResource(&db,
-# if XAW
# if BUTTONS
"XDvi.form.baseTranslations",
# else
"XDvi.vport.baseTranslations",
# endif
-# else /* MOTIF */
-# if BUTTONS
- "XDvi.form.vport.drawing.baseTranslations",
-# else
- "XDvi.vport.drawing.baseTranslations",
-# endif
-# endif /* MOTIF */
base_translations);
if (resource.main_translations != NULL)
XrmPutStringResource(&db,
-# if XAW
# if BUTTONS
"XDvi.form.translations",
# else
"XDvi.vport.translations",
# endif
-# else /* MOTIF */
-# if BUTTONS
- "XDvi.form.vport.drawing.translations",
-# else
- "XDvi.vport.drawing.translations",
-# endif
-# endif /* MOTIF */
resource.main_translations);
#endif /* XtSpecificationRelease */
@@ -2578,18 +2556,8 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
<BtnUp>:release()"));
if (resource.wheel_unit != 0 && resource.wheel_translations != NULL) {
-#if XAW
XtAugmentTranslations(form_or_vport,
XtParseTranslationTable("<BtnDown>:wheel-actions()"));
-#else /* MOTIF */
-#if !BUTTONS
- XtTranslations wheel_trans_table;
-#endif
-
- wheel_trans_table
- = XtParseTranslationTable("<BtnDown>:wheel-actions()");
- XtAugmentTranslations(draw_widget, wheel_trans_table);
-#endif /* MOTIF */
compile_wheel_actions();
}
@@ -2689,19 +2657,12 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
(XtPointer) &mane);
XtRealizeWidget(top_level);
-#if XAW
XSetWMProtocols(DISP, XtWindow(top_level), &XA_WM_DELETE_WINDOW, 1);
XtAddEventHandler(top_level, NoEventMask, True, handle_messages, NULL);
# if BUTTONS
if (!resource.expert)
XDefineCursor(DISP, XtWindow(panel_widget), panel_cursor);
# endif
-#else /* MOTIF */
- XtVaSetValues(top_level, XmNdeleteResponse, XmDO_NOTHING, NULL);
- XmAddWMProtocolCallback(top_level, XA_WM_DELETE_WINDOW,
- handle_wm_delete, NULL);
- XmProcessTraversal(draw_widget, XmTRAVERSE_CURRENT);
-#endif
currwin.win = mane.win = XtWindow(draw_widget);
@@ -2808,7 +2769,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
highGC = MakeGC(GXcopy, hl_Pixel, back_Pixel);
}
-#if XAW
/*
* There's a bug in the Xaw toolkit, in which it uses the
* DefaultGCOfScreen to do vertical scrolling in the Text widget.
@@ -2817,7 +2777,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
*/
DefaultGCOfScreen(SCRN) = copyGC;
-#endif
#ifndef VMS
ready_cursor = XCreateFontCursor(DISP, XC_cross);
diff --git a/xdvi.h b/xdvi.h
@@ -93,7 +93,6 @@ NOTE:
#include <X11/Xfuncs.h>
#endif
-#if XAW || MOTIF
#include <X11/Intrinsic.h>
#if (defined(VMS) && (XtSpecificationRelease <= 4)) || defined(lint)
@@ -106,7 +105,6 @@ NOTE:
# endif
#endif
-#endif /* XAW || MOTIF */
#if EXTRA_APP_DEFAULTS && !SELFAUTO
#define SELFAUTO 1
@@ -812,9 +810,7 @@ EXTERN Display *DISP;
EXTERN Screen *SCRN;
extern XtActionsRec Actions[];
extern Cardinal num_actions;
-#if XAW
EXTERN XtAccelerators accels_cr, accels_cr_click;
-#endif
#ifdef GREY
EXTERN Visual *our_visual;
EXTERN unsigned int our_depth;
@@ -954,27 +950,13 @@ EXTERN Widget x_bar, y_bar; /* horizontal and vert. scroll bars */
EXTERN Widget form_widget;
EXTERN int xtra_wid INIT(0);
extern _Xconst char default_button_config[]; /* defined in events.c */
-# if XAW
EXTERN Widget panel_widget;
EXTERN Cursor panel_cursor INIT(0);
-# endif
# endif
-#if XAW
#define WARN(t, s) (void) warning_popup(s, "OK", NULL)
#define WARN1(t, s, s1) (void) warning_popup_long(s, "OK", NULL, s1)
#define WARN2(t, s, s1, s2) (void) warning_popup_long(s, "OK", NULL, s1, s2)
-#elif MOTIF
-#define WARN(t, s) (void) warning_popup(s, t, NULL, NULL)
-#define WARN1(t, s, s1) (void) warning_popup_long(s, t, NULL, NULL, s1)
-#define WARN2(t, s, s1, s2) (void) warning_popup_long(s, t, NULL, NULL, s1, s2)
-#elif CC_K_AND_R
-#define WARN(t, s) (void) fputs(s "\n", stderr)
-#define WARN1(t, s, s1) (void) fprintf(stderr, s "\n", s1)
-#else
-#define WARN(t, s) (void) (fputs(s, stderr), putc('\n', stderr))
-#define WARN1(t, s, s1) (void) (fprintf(stderr, s, s1), putc('\n', stderr))
-#endif
/*
* If a popup is popped up before the main window, then the main window is
@@ -1084,21 +1066,13 @@ EXTERN mouse_proc mouse_release INIT(null_mouse);
/* Used for source special lookup (forward search) and for window manager
delete protocol (toolkit only). */
-#if XAW
EXTERN Atom atoms[5];
-#elif MOTIF
-EXTERN Atom atoms[4];
-#else
-EXTERN Atom atoms[3];
-#endif
#define ATOM_XDVI_WINDOWS (atoms[0])
#define ATOM_DVI_FILE (atoms[1])
#define ATOM_SRC_GOTO (atoms[2])
#define XA_WM_DELETE_WINDOW (atoms[3])
-#if XAW
#define XA_WM_PROTOCOLS (atoms[4])
-#endif
#ifdef SELFAUTO
EXTERN _Xconst char *argv0; /* argv[0] */
@@ -1132,9 +1106,7 @@ extern int atopix ARGS((_Xconst char *, wide_bool));
extern Bool compile_action ARGS((_Xconst char *, struct xdvi_action **));
#if BUTTONS
extern void create_buttons ARGS((void));
-#if XAW
extern void set_button_panel_height ARGS((XtArgVal));
-#endif
#endif /* BUTTONS */
#if GREY
extern void init_plane_masks ARGS((void));
@@ -1153,11 +1125,7 @@ extern void handle_resize ARGS((Widget, XtPointer, XEvent *, Boolean *));
extern void handle_expose ARGS((Widget, XtPointer, XEvent *, Boolean *));
extern void handle_property_change ARGS((Widget, XtPointer, XEvent *,
Boolean *));
-#if XAW
extern void handle_messages ARGS((Widget, XtPointer, XEvent *, Boolean *));
-#elif MOTIF
-extern void handle_wm_delete ARGS((Widget, XtPointer, XtPointer));
-#endif
extern void goto_page ARGS((int, home_proc));
#if MOTIF
extern void file_pulldown_callback ARGS((Widget, XtPointer, XtPointer));
@@ -1175,7 +1143,6 @@ extern void cancel_timer ARGS((struct xtimer *));
extern unsigned int read_events ARGS((unsigned int));
extern void enable_intr ARGS((void));
extern void do_pages ARGS((void)) NORETURN;
-#if XAW
extern void simple_popup ARGS((struct status_popup *, _Xconst char *,
XtCallbackProc));
extern void simple_popdown ARGS((struct status_popup *));
@@ -1187,19 +1154,6 @@ extern Widget warning_popup_long VARGS((_Xconst char *, _Xconst char *,
extern void Act_print ARGS((Widget, XEvent *, String *, Cardinal *));
extern void Act_open_dvi_file ARGS((Widget, XEvent *, String *,
Cardinal *));
-#elif MOTIF
-extern void simple_popup ARGS((struct status_popup *, _Xconst char *,
- XtCallbackProc));
-extern void simple_popdown ARGS((struct status_popup *));
-extern void do_popup ARGS((Widget));
-extern Widget warning_popup ARGS((_Xconst char *, int, _Xconst char *,
- XtCallbackProc));
-extern Widget warning_popup_long ARGS((_Xconst char *, int, _Xconst char *,
- XtCallbackProc, ...));
-extern void Act_print ARGS((Widget, XEvent *, String *, Cardinal *));
-extern void Act_open_dvi_file ARGS((Widget, XEvent *, String *,
- Cardinal *));
-#endif
extern void reset_fonts ARGS((void));
#if COLOR
extern void reset_colors ARGS((void));
@@ -1278,9 +1232,7 @@ extern void xputenv ARGS((_Xconst char *, _Xconst char *));
#endif
extern int memicmp ARGS((_Xconst char *, _Xconst char *, size_t));
extern FILE *xfopen ARGS((_Xconst char *, OPEN_MODE_ARGS));
-#if XAW
extern int xopen ARGS((_Xconst char *, int));
-#endif
extern int xpipe ARGS((int *));
extern DIR *xopendir ARGS((_Xconst char *));
extern _Xconst struct passwd *ff_getpw ARGS((_Xconst char **, _Xconst char *));