summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/gui
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/xdvik/gui')
-rw-r--r--Build/source/texk/xdvik/gui/message-window.c39
-rw-r--r--Build/source/texk/xdvik/gui/message-window.h2
-rw-r--r--Build/source/texk/xdvik/gui/pagesel.c81
-rw-r--r--Build/source/texk/xdvik/gui/print-dialog.c37
-rw-r--r--Build/source/texk/xdvik/gui/print-log.c10
-rw-r--r--Build/source/texk/xdvik/gui/xicon.c1
-rw-r--r--Build/source/texk/xdvik/gui/xlwradioP.h1
-rw-r--r--Build/source/texk/xdvik/gui/xm_prefs_helpers.c4
8 files changed, 59 insertions, 116 deletions
diff --git a/Build/source/texk/xdvik/gui/message-window.c b/Build/source/texk/xdvik/gui/message-window.c
index d6d23c2a78d..98c4b7efadc 100644
--- a/Build/source/texk/xdvik/gui/message-window.c
+++ b/Build/source/texk/xdvik/gui/message-window.c
@@ -113,8 +113,8 @@ static Widget popup_window[MAX_POPUPS], message_box[MAX_POPUPS],
#endif
/* map popupMessageT's to strings/motif dialog elements */
-static struct message_map {
- char *window_title;
+static const struct message_map {
+ const char *window_title;
#ifdef MOTIF
int motif_msg_type;
#endif
@@ -301,7 +301,8 @@ help_action(Widget w, XtPointer client_data, XtPointer call_data)
UNUSED(call_data);
/* open another window with the help text */
- popup_message(get_matching_parent(w, globals.widgets.top_level, "message_popup", NULL), MSG_HELP, NULL, client_data);
+ popup_message(get_matching_parent(w, globals.widgets.top_level,
+ "message_popup", NULL), MSG_HELP, NULL, "%s", client_data);
}
@@ -705,7 +706,6 @@ internal_popup_window(Widget parent,
const char *no_button, message_cbT no_cb, XtPointer no_arg,
const char *cancel_button, message_cbT cancel_cb, XtPointer cancel_arg)
{
- char win_title[64];
int my_popup_num = 0;
#ifdef MOTIF
XmString str;
@@ -713,24 +713,20 @@ internal_popup_window(Widget parent,
Widget ret;
ASSERT(type < (sizeof my_msg_map / sizeof my_msg_map[0]), "too few elements in my_msg_map");
- sprintf(win_title, my_msg_map[type].window_title);
#if DEBUG
fprintf(stderr, "internal_popup_window called with prompt: \"%s\"\n", msg_buf);
#endif
if (globals.widgets.top_level == 0) {
- /* If toplevel window hasn't been create yet, dump messages to STDERR and return.
- All text must be passed as arguments to fprintf (NOT puts), since they are
- supposed to be printf-format strings (i.e. with doubled `%' to escape them)
+ /* If toplevel window hasn't been created yet, dump messages to STDERR
+ and return.
*/
- fprintf(stderr, "\n%s:\n", my_msg_map[type].window_title);
- fprintf(stderr, msg_buf);
- fprintf(stderr, "\n");
+ fprintf(stderr, "\n%s:\n%s\n", my_msg_map[type].window_title, msg_buf);
if (helptext) {
- fprintf(stderr, "---------- helptext ----------\n");
- fprintf(stderr, helptext);
- fprintf(stderr, "\n---------- end of helptext ----------\n");
+ fputs("---------- helptext ----------\n", stderr);
+ fputs(helptext, stderr);
+ fputs("\n---------- end of helptext ----------\n", stderr);
}
return NULL;
}
@@ -740,9 +736,7 @@ internal_popup_window(Widget parent,
}
if (my_popup_num == MAX_POPUPS) {
/* already enough popups on screen, just dump it to stderr */
- fprintf(stderr, "%s: ", win_title);
- fprintf(stderr, msg_buf);
- fputc('\n', stderr);
+ fprintf(stderr, "%s: %s\n", my_msg_map[type].window_title, msg_buf);
/* 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
@@ -771,8 +765,10 @@ internal_popup_window(Widget parent,
no_button, no_cb, no_arg,
cancel_button, cancel_cb, cancel_arg);
#ifdef MOTIF
- XtVaSetValues(popup_window[my_popup_num], XmNtitle, win_title, NULL);
- XtVaSetValues(dialog[my_popup_num], XmNdialogType, my_msg_map[type].motif_msg_type, NULL);
+ XtVaSetValues(popup_window[my_popup_num], XmNtitle,
+ my_msg_map[type].window_title, NULL);
+ XtVaSetValues(dialog[my_popup_num], XmNdialogType,
+ my_msg_map[type].motif_msg_type, NULL);
{ /* wrap message at space before MSG_WRAP_LEN */
char *testwrap = msg_buf;
int ctr;
@@ -852,7 +848,8 @@ internal_popup_window(Widget parent,
XtOverrideTranslations(message_text[my_popup_num], xlats);
}
- XtVaSetValues(popup_window[my_popup_num], XtNtitle, win_title, NULL);
+ XtVaSetValues(popup_window[my_popup_num], XtNtitle,
+ my_msg_map[type].window_title, NULL);
XtVaSetValues(message_text[my_popup_num], XtNstring, msg_buf, NULL);
XtRealizeWidget(popup_window[my_popup_num]);
@@ -945,6 +942,7 @@ popup_message(Widget parent, popupMessageT type, const char *helptext, const cha
return w;
}
+#if 0 /* This function is currently unused. */
Widget
popup_message_sized(Widget parent,
popupMessageT type,
@@ -973,6 +971,7 @@ popup_message_sized(Widget parent,
free(msg_buf);
return w;
}
+#endif
Widget
positioned_popup_message(Widget parent,
diff --git a/Build/source/texk/xdvik/gui/message-window.h b/Build/source/texk/xdvik/gui/message-window.h
index 98d5815677f..61a4509edff 100644
--- a/Build/source/texk/xdvik/gui/message-window.h
+++ b/Build/source/texk/xdvik/gui/message-window.h
@@ -49,11 +49,13 @@ extern Widget popup_message(Widget parent,
const char *helptext,
const char *format, ...);
+#if 0 /* This function is currently unused. */
extern Widget popup_message_sized(Widget parent,
popupMessageT type,
popupMessageSizeHintT size,
const char *helptext,
const char *format, ...);
+#endif
extern Widget positioned_popup_message(Widget parent,
popupMessageT type,
diff --git a/Build/source/texk/xdvik/gui/pagesel.c b/Build/source/texk/xdvik/gui/pagesel.c
index dd1f4c71eec..945ae760fad 100644
--- a/Build/source/texk/xdvik/gui/pagesel.c
+++ b/Build/source/texk/xdvik/gui/pagesel.c
@@ -147,6 +147,8 @@ static char *motif_custom_translations =
"<Btn2Motion>: ListSetMark(ListButtonMotion)\n"
"<Btn2Up>: ListSetMark(ListButtonMotion)\n"
"<Btn2Down>: ListSetMark(ListButtonMotion)\n"
+"<Btn4Down>,<Btn4Up>: scroll-list-up()\n"
+"<Btn5Down>,<Btn5Up>: scroll-list-down()\n"
/* /\* "s ~m ~a <Btn2Down>: ListMyProcessBtn2(ListBeginExtend)\n" *\/ */
/* /\* "s ~m ~a <Btn2Up>: ListMyProcessBtn2(ListEndExtend)\n" *\/ */
/* /\* "~c ~s ~m ~a <Btn2Down>: ListMyProcessBtn2(ListBeginSelect)\n" *\/ */
@@ -690,67 +692,8 @@ my_list_pos_to_bounds(Widget widget, int idx, Position *x, Position *y, Dimensio
return True;
#endif
}
-#endif /* !defined(LESSTIF_VERSION) */
-
-/* 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)
-{
- int button = event->xbutton.button;
- UNUSED(widget);
- UNUSED(data);
- UNUSED(cont);
- if (event->xany.type == ButtonPress && (button == 4 || button == 5)) {
-#if SCROLL_LIST_SCROLLBAR
- Widget vert = XtNameToWidget(viewport, "vertical");
- static Dimension row_height = 0, dummy = 0;
- int diff_y = 0;
-
- if (row_height == 0)
- xaw_get_row_height(LIST_WIDGET, &row_height, &dummy);
-
- if (vert == NULL) {
- XDVI_WARNING((stderr, "Couldn't get name of pagelist viewport widget!"));
- return;
- }
- if (button == 5) {
- diff_y = row_height;
- }
- else {
- diff_y = -row_height;
- }
- XtCallCallbacks(vert, XtNscrollProc, (XtPointer)diff_y);
-#else
- int pageno = current_page;
- if (button == 5) {
- if (current_page >= total_pages - 1) {
- xdvi_bell();
-/* statusline_info(STATUS_SHORT, "Last page of DVI file"); */
- return;
- }
- pageno++;
- }
- else {
- if (current_page == 0) {
- xdvi_bell();
-/* statusline_info(STATUS_SHORT, "First page of DVI file"); */
- return;
- }
- pageno--;
- }
- 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.
*/
@@ -1032,10 +975,19 @@ xaw_create_pagelist_widgets(Dimension height, Dimension width, Position y, Widge
False, highlight_page_callback, (XtPointer)NULL);
- XtAddEventHandler(LIST_WIDGET, ButtonPressMask | ButtonReleaseMask,
- False, wheel_scroll_list_callback, (XtPointer)NULL);
-
-
+ {
+ Widget y_bar;
+ XtTranslations xlats = XtParseTranslationTable(
+ "<Btn4Down>,<Btn4Up>: scroll-list-up()\n"
+ "<Btn5Down>,<Btn5Up>: scroll-list-down()\n");
+
+ XtOverrideTranslations(LIST_WIDGET, xlats);
+
+ y_bar = XtNameToWidget(viewport, "vertical");
+ if (y_bar != NULL)
+ XtOverrideTranslations(y_bar, xlats);
+ }
+
XtAddEventHandler(LIST_WIDGET,
/* FIXME: We should add PointerMotionMask here, but handling PointerMotionMask
currently doesn't work with the Xaw list widget: the auto-scrolling code doesn't
@@ -1252,9 +1204,6 @@ create_pagelist(void)
ButtonPressMask | ButtonReleaseMask | PointerMotionMask | LeaveWindowMask,
False, highlight_page_callback, (XtPointer)NULL);
#endif /* !defined(LESSTIF_VERSION) */
- XtAddEventHandler(LIST_WIDGET, ButtonPressMask | ButtonReleaseMask,
- False, wheel_scroll_list_callback, (XtPointer)NULL);
-
app = XtWidgetToApplicationContext(globals.widgets.top_level);
XtAppAddActions(app, CustomListActions, XtNumber(CustomListActions));
XtOverrideTranslations(LIST_WIDGET, XtParseTranslationTable(motif_custom_translations));
diff --git a/Build/source/texk/xdvik/gui/print-dialog.c b/Build/source/texk/xdvik/gui/print-dialog.c
index b06338b41ec..19b59f18a15 100644
--- a/Build/source/texk/xdvik/gui/print-dialog.c
+++ b/Build/source/texk/xdvik/gui/print-dialog.c
@@ -261,7 +261,7 @@ cb_select_format(Widget w, XtPointer client_data, XtPointer call_data)
struct save_or_print_info *info = NULL;
Widget file_text;
char *filename;
- int i = 0;
+ ptrdiff_t i;
#ifndef MOTIF
Widget button;
@@ -272,7 +272,7 @@ cb_select_format(Widget w, XtPointer client_data, XtPointer call_data)
UNUSED(call_data);
#ifdef MOTIF
- i = (int)client_data;
+ i = (ptrdiff_t) client_data;
XtVaGetValues(XtParent(w), XmNuserData, &info, NULL);
ASSERT(info != NULL, "Expected struct save_or_print_info * in XmNuserData of button!");
@@ -286,7 +286,8 @@ cb_select_format(Widget w, XtPointer client_data, XtPointer call_data)
}
#else /* MOTIF */
info = (struct save_or_print_info *)client_data;
-
+
+ i = 0;
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)) {
@@ -1257,11 +1258,11 @@ xaw_create_dialog(struct save_or_print_info *info)
XtNborderWidth, 0,
HORIZONTAL_RESIZING_YES,
NULL);
- XtVaCreateManagedWidget("print_to", labelWidgetClass, dummy_label_form,
- XtNlabel, "Print to: ",
- XtNborderWidth, 0,
- HORIZONTAL_RESIZING_NO,
- NULL);
+ 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,
@@ -1363,11 +1364,11 @@ xaw_create_dialog(struct save_or_print_info *info)
XtNborderWidth, 0,
HORIZONTAL_RESIZING_YES,
NULL);
- XtVaCreateManagedWidget("save_as", labelWidgetClass, dummy_label_form,
- XtNlabel, "Save as: ",
- XtNborderWidth, 0,
- HORIZONTAL_RESIZING_NO,
- NULL);
+ 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,
@@ -1550,11 +1551,11 @@ xaw_create_dialog(struct save_or_print_info *info)
HORIZONTAL_RESIZING_NO,
NULL);
- XtVaCreateManagedWidget("range_lab", labelWidgetClass, dummy_pages_form,
- XtNlabel, "Pages:",
- XtNborderWidth, 0,
- HORIZONTAL_RESIZING_NO,
- NULL);
+ 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,
diff --git a/Build/source/texk/xdvik/gui/print-log.c b/Build/source/texk/xdvik/gui/print-log.c
index 73d9df3bdac..72905fcefe5 100644
--- a/Build/source/texk/xdvik/gui/print-log.c
+++ b/Build/source/texk/xdvik/gui/print-log.c
@@ -728,12 +728,6 @@ printlog_act_cancel_or_destroy(Widget w, XEvent *event, String *params, Cardinal
cb_printlog_act_cancel_or_destroy(w, (XtPointer)ptr, NULL);
-#if 0
- {
- struct save_or_print_info *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);
- }
-#endif
+ /* 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/xicon.c b/Build/source/texk/xdvik/gui/xicon.c
index d0221997b36..f1b98dcbeab 100644
--- a/Build/source/texk/xdvik/gui/xicon.c
+++ b/Build/source/texk/xdvik/gui/xicon.c
@@ -126,7 +126,6 @@ add_icon(Widget top_level,
}
dsp = XtDisplay(top_level);
- XtScreen(top_level);
attr.valuemask = 0L;
attr.valuemask = XpmCloseness | XpmReturnPixels | XpmColormap | XpmDepth | XpmVisual;
diff --git a/Build/source/texk/xdvik/gui/xlwradioP.h b/Build/source/texk/xdvik/gui/xlwradioP.h
index 6c9da32f59e..15acbce8969 100644
--- a/Build/source/texk/xdvik/gui/xlwradioP.h
+++ b/Build/source/texk/xdvik/gui/xlwradioP.h
@@ -49,7 +49,6 @@ Boston, MA 02111-1307, USA. */
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/ToggleP.h>
-#include <X11/Xaw/XawInit.h>
/***********************************************************************
*
diff --git a/Build/source/texk/xdvik/gui/xm_prefs_helpers.c b/Build/source/texk/xdvik/gui/xm_prefs_helpers.c
index d4b0b6996dc..5feb3e387f0 100644
--- a/Build/source/texk/xdvik/gui/xm_prefs_helpers.c
+++ b/Build/source/texk/xdvik/gui/xm_prefs_helpers.c
@@ -152,13 +152,13 @@ destroy_dialog_cb(Widget w, XtPointer client_data, XtPointer call_data)
#if USE_COMBOBOX
/* Need to unselect the `Other...' entry from the list; to do this,
we select the index from XmNuserData if it's >= 0, or the first item. */
- int idx;
+ ptrdiff_t idx;
XtPointer p;
XtVaGetValues(browser_combo,
XmNlist, &browser_list_w,
XmNuserData, &p,
NULL);
- idx = (int)p;
+ idx = (ptrdiff_t) p;
if (browser_list_w == 0)
XDVI_ERROR((stderr, "couldn't get list component of combo box!\n"));
else {