-/* File: main-xaw.c */
+/* File: main-xaw.c */
/* Purpose: Support for X Athena Widget based Angband */
/* Most code written by Torbj\vn Lindgren (tl@cd.chalmers.se) */
#ifdef USE_XAW
-#include "angband.h"
-
+#include "system/angband.h"
+#include "game-option/runtime-arguments.h"
+#include "util/int-char-converter.h"
#ifndef __MAKEDEPEND__
#include <X11/Xlib.h>
{ XtNcolor15, XtCColor, XtRPixel, sizeof(Pixel),
offset(color[15]), XtRString, "#ffcc80" },
-#if 0
-
- { XtNcolor2, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[2]), XtRString, "#a6a6a6" },
- { XtNcolor3, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[3]), XtRString, "#ff6302" },
- { XtNcolor4, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[4]), XtRString, "#ca0808" },
- { XtNcolor5, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[5]), XtRString, "#008e18" },
- { XtNcolor6, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[6]), XtRString, "#0000e3" },
- { XtNcolor7, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[7]), XtRString, "#814007" },
- { XtNcolor8, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[8]), XtRString, "#6b6b6b" },
- { XtNcolor9, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[9]), XtRString, "#d6d6d6" },
- { XtNcolor10, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[10]), XtRString, "#5100c2" },
- { XtNcolor11, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[11]), XtRString, "#fdf105" },
- { XtNcolor12, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[12]), XtRString, "#ff9259" },
- { XtNcolor13, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[13]), XtRString, "#26cf17" },
- { XtNcolor14, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[14]), XtRString, "#02b2f2" },
- { XtNcolor15, XtCColor, XtRPixel, sizeof(Pixel),
- offset(color[15]), XtRString, "#b28b48" },
-
-#endif
-
{ XtNredrawCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
offset(redraw_callbacks), XtRCallback, (XtPointer)NULL }
};
static void Initialize(AngbandWidget request, AngbandWidget new);
static void Redisplay(AngbandWidget w, XEvent *event, Region region);
static Boolean SetValues(AngbandWidget current, AngbandWidget request,
- AngbandWidget new, ArgList args, Cardinal *num_args);
+ AngbandWidget new, ArgList args, Cardinal *num_args);
static void Destroy(AngbandWidget widget);
/* Forward declaration for internal functions */
static void calculateSizeHints(AngbandWidget new);
static XFontStruct *getFont(AngbandWidget widget,
- String font, Boolean fallback);
+ String font, Boolean fallback);
/* Class record constanst */
* Public procedures
*/
static void AngbandOutputText(AngbandWidget widget, int x, int y,
- String txt, int len, int color)
+ String txt, int len, int color)
{
/* Do nothing if the string is null */
if (!txt || !*txt)
/* Place the string */
XDrawImageString (XtDisplay(widget), XtWindow(widget),
- widget->angband.gc[color], x, y, txt, len);
+ widget->angband.gc[color], x, y, txt, len);
}
static void AngbandClearArea(AngbandWidget widget,
- int x, int y, int w, int h, int color)
+ int x, int y, int w, int h, int color)
{
/* Figure out which area to clear */
y = y * widget->angband.fontheight + widget->angband.internal_border;
/* Clear the area */
XFillRectangle(XtDisplay(widget), XtWindow(widget),
- widget->angband.gc[color],
- x, y, widget->angband.fontwidth*w,
- widget->angband.fontheight*h);
+ widget->angband.gc[color],
+ x, y, widget->angband.fontwidth*w,
+ widget->angband.fontheight*h);
}
/*
else
gcv.foreground = new->angband.color[n];
new->angband.gc[n] = XtGetGC((Widget)new, GCFont | GCForeground |
- GCBackground | GCGraphicsExposures,
- &gcv);
+ GCBackground | GCGraphicsExposures,
+ &gcv);
}
/* Create a special GC for highlighting */
WhitePixelOfScreen(XtScreen((Widget)new));
gcv.function = GXxor;
new->angband.gc[NUM_COLORS] = XtGetGC((Widget)new, GCFunction |
- GCGraphicsExposures |
- GCForeground, &gcv);
+ GCGraphicsExposures |
+ GCForeground, &gcv);
/* Calculate window geometry */
new->core.height = new->angband.start_rows * new->angband.fontheight +
* can potentially have effects that spans the whole widget).
*/
static Boolean SetValues(AngbandWidget current, AngbandWidget request,
- AngbandWidget new, ArgList args,
- Cardinal *num_args)
+ AngbandWidget new, ArgList args,
+ Cardinal *num_args)
{
int depth = DefaultDepthOfScreen(XtScreen((Widget) new));
Boolean font_changed = FALSE;
XtReleaseGC((Widget)current, current->angband.gc[n]);
/* Get the new GC */
new->angband.gc[n] = XtGetGC((Widget)new, GCFont | GCForeground |
- GCBackground | GCGraphicsExposures,
- &gcv);
+ GCBackground | GCGraphicsExposures,
+ &gcv);
}
/* Replace the old XOR/highlighting GC */
gcv.function = GXxor;
XtReleaseGC((Widget)current, current->angband.gc[NUM_COLORS]);
new->angband.gc[NUM_COLORS] = XtGetGC((Widget)new, GCFunction |
- GCGraphicsExposures |
- GCForeground, &gcv);
+ GCGraphicsExposures |
+ GCForeground, &gcv);
/* Fix the background color */
new->core.background_pixel = new->angband.color[0];
}
* Load a font
*/
static XFontStruct *getFont(AngbandWidget widget,
- String font, Boolean fallback)
+ String font, Boolean fallback)
{
Display *dpy = XtDisplay((Widget) widget);
char buf[256];
* Do a redraw
*/
static void react_redraw(Widget widget,
- XtPointer client_data, XtPointer call_data)
+ XtPointer client_data, XtPointer call_data)
{
term_data *old_td = (term_data*)(Term->data);
term_data *td = (term_data*)client_data;
if (ks)
{
sprintf(msg, "%c%s%s%s%s_%lX%c", 31,
- mc ? "N" : "", ms ? "S" : "",
- mo ? "O" : "", mx ? "M" : "",
- (unsigned long)(ks), 13);
+ mc ? "N" : "", ms ? "S" : "",
+ mo ? "O" : "", mx ? "M" : "",
+ (unsigned long)(ks), 13);
}
/* Hack -- Use the Keycode */
else
{
sprintf(msg, "%c%s%s%s%sK_%X%c", 31,
- mc ? "N" : "", ms ? "S" : "",
- mo ? "O" : "", mx ? "M" : "",
- ev->keycode, 13);
+ mc ? "N" : "", ms ? "S" : "",
+ mo ? "O" : "", mx ? "M" : "",
+ ev->keycode, 13);
}
/* Enqueue the "fake" string */
static void handle_event (Widget widget, XtPointer client_data, XEvent *event,
- Boolean *continue_to_dispatch)
+ Boolean *continue_to_dispatch)
{
term_data *old_td = (term_data*)(Term->data);
term_data *td = (term_data *)client_data;
for (i=0; i<MAX_TERM_DATA; i++) {
if (Term == &data[i].t)
XClearWindow(XtDisplay((Widget)data[i].widget),
- XtWindow((Widget)data[i].widget));
+ XtWindow((Widget)data[i].widget));
}
return (0);
}
/*
* Draw a number of characters
*/
-static errr Term_text_xaw(int x, int y, int n, byte a, cptr s)
+static errr Term_text_xaw(int x, int y, int n, byte a, concptr s)
{
term_data *td = (term_data*)(Term->data);
* Initialize a term_data
*/
static errr term_data_init(term_data *td, Widget topLevel,
- int key_buf, String name,
- ArgList widget_arg, Cardinal widget_arg_no)
+ int key_buf, String name,
+ ArgList widget_arg, Cardinal widget_arg_no)
{
Widget parent;
term *t = &td->t;
/* Create the shell widget */
parent = XtCreatePopupShell(name, topLevelShellWidgetClass, topLevel,
- NULL, 0);
+ NULL, 0);
/* Create the interior widget */
td->widget = (AngbandWidget)
XtCreateManagedWidget (name, angbandWidgetClass,
- parent, widget_arg, widget_arg_no);
+ parent, widget_arg, widget_arg_no);
/* Initialize the term (full size) */
term_init(t, 80, 24, key_buf);
/* Register the keypress event handler */
XtAddEventHandler((Widget)td->widget, KeyPressMask,
- False, (XtEventHandler) handle_event, td);
+ False, (XtEventHandler) handle_event, td);
/* Redraw callback */
XtAddCallback((Widget)td->widget, XtNredrawCallback,
- react_redraw, td);
+ react_redraw, td);
/* Realize the widget */
XtRealizeWidget(parent);
/* Initialize the toolkit */
topLevel = XtAppInitialize (&appcon, "Angband", NULL, 0, &argc, argv,
- fallback, NULL, 0);
+ fallback, NULL, 0);
/* Initialize the windows */
for (i=0; i<MAX_TERM_DATA; i++) {