static XtAppContext app_context;
static Widget toplevel, text, form;
-static Widget navigation, weapons, status, planets, misc;
-static Widget navlabel, weaplabel, statlabel, planlabel, misclabel;
+static Widget navigation, weapons, planets, misc;
+static Widget navlabel, weaplabel, planlabel, misclabel;
static String fallback[] = {
/* text window resources */
/* use this for commands that take no arguments */
{
/* currently a stub */
+ printf("Button %s pressed\n", XtName(w));
}
static struct cmd_t commands[] = {
{"Deathray", noargs_proc, &weapons, 0},
{"Mayday", noargs_proc, &weapons, 0},
- {"Score", noargs_proc, &status, 0},
- {"Report", noargs_proc, &status, 0},
- {"Computer", noargs_proc, &status, 0},
-
{"Sensors", noargs_proc, &planets, OPTION_PLANETS},
{"Orbit", noargs_proc, &planets, OPTION_PLANETS},
{"Transport", noargs_proc, &planets, OPTION_PLANETS},
{"Shuttle", noargs_proc, &planets, OPTION_PLANETS},
{"Planets", noargs_proc, &planets, OPTION_PLANETS},
- {"Emexit", noargs_proc, &misc, 0},
+ {"Score", noargs_proc, &misc, 0},
+ {"Report", noargs_proc, &misc, 0},
+ {"Computer", noargs_proc, &misc, 0},
{"Save", NULL, &misc, 0},
{"Quit", quit_proc, &misc, 0},
{"Help", noargs_proc, &misc, 0},
};
-int main(int argc, char **argv)
+#define MAXWIDTH 640
+#define TEXTHEIGHT 200
+
+static void instantiate_main(int argc, char **argv)
{
struct cmd_t *cp;
form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel, NULL);
/* the command window */
text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, form,
- XtNwidth, 400, XtNheight, 200,
+ XtNwidth, MAXWIDTH, XtNheight, TEXTHEIGHT,
NULL);
XtVaSetValues(text, XtNeditType,XawtextRead, XtNdisplayCaret,False, NULL);
/* The button panels */
navigation = XtVaCreateManagedWidget("navigation",
- boxWidgetClass, form,
- XtNfromVert, text,
- XtNorientation, XtorientHorizontal,
- NULL);
+ boxWidgetClass, form,
+ XtNborderWidth, 0,
+ XtNfromVert, text,
+ XtNorientation, XtorientHorizontal,
+ NULL);
navlabel = XtVaCreateManagedWidget("Navigation: ",
labelWidgetClass, navigation,
XtNborderWidth, 0,
NULL);
weapons = XtVaCreateManagedWidget("weapons",
boxWidgetClass, form,
+ XtNborderWidth, 0,
XtNfromVert, navigation,
XtNorientation, XtorientHorizontal,
NULL);
labelWidgetClass, weapons,
XtNborderWidth, 0,
NULL);
- status = XtVaCreateManagedWidget("status",
- boxWidgetClass, form,
- XtNfromVert, weapons,
- XtNorientation, XtorientHorizontal,
- NULL);
- statlabel = XtVaCreateManagedWidget("Status: ",
- labelWidgetClass, status,
- XtNborderWidth, 0,
- NULL);
planets = XtVaCreateManagedWidget("planets",
boxWidgetClass, form,
- XtNfromVert, status,
+ XtNborderWidth, 0,
+ XtNfromVert, weapons,
XtNorientation, XtorientHorizontal,
NULL);
planlabel = XtVaCreateManagedWidget("Planets: ",
NULL);
misc = XtVaCreateManagedWidget("misc",
boxWidgetClass, form,
+ XtNborderWidth, 0,
XtNfromVert, planets,
XtNorientation, XtorientHorizontal,
NULL);
XtAppMainLoop(app_context);
/* loop may be interrupted */
XtDestroyApplicationContext(app_context);
+}
+
+int main(int argc, char **argv)
+{
+ instantiate_main(argc, argv);
exit(0);
}