X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fxio.c;h=6d604909d1fe150a5444b97c0c950f01d405040d;hp=58d419c6e484b2473069fcac7694ca55e8f38316;hb=e3730bb826efe601fe51626aab064d395733d4c3;hpb=a6fb36fa485fda1c5b0ff219a683c33ed685ab01 diff --git a/src/xio.c b/src/xio.c index 58d419c..6d60490 100644 --- a/src/xio.c +++ b/src/xio.c @@ -14,11 +14,14 @@ static Widget navigation, weapons, planets, misc; static Widget navlabel, weaplabel, planlabel, misclabel; static String fallback[] = { - /* text window resources */ "*text.resizable: true", "*text.resize: ResizeBoth", "*text.width: 640", "*text.height: 200", + "*text.autoFill: True", + "*text.scrollVertical: Always", + "*text.scrollHorizontal: WhenNeeded", + "*text.displayCaret: True", "*navigation.fromVert: text", "*navigation.borderWidth: 0", "*navlabel.label: Navigation: ", @@ -33,7 +36,7 @@ static String fallback[] = { "*planlabel.borderWidth: 0", "*misc.fromVert: planets", "*misc.borderWidth: 0", - "*misclabel.label: Miscellaneos: ", + "*misclabel.label: Miscellaneous:", "*misclabel.borderWidth: 0", NULL, }; @@ -53,10 +56,25 @@ static void quit_proc(Widget w, XtPointer client_data, XtPointer call_data) exit (0); } +static void text_append_to(Widget w, String str) +/* append text to a specified text widget */ +{ + XawTextBlock txtblk; + XawTextPosition textend = XawTextGetInsertionPoint(w); + + txtblk.ptr = str; + txtblk.length = strlen(str); + txtblk.firstPos = 0; + txtblk.format = FMT8BIT; + + XawTextReplace(w, textend, textend, &txtblk); +} + static void noargs_proc(Widget w, XtPointer client_data, XtPointer call_data) /* use this for commands that take no arguments */ { /* currently a stub */ + text_append_to(w, XtName(w)); printf("Button %s pressed\n", XtName(w)); } @@ -104,8 +122,10 @@ static void instantiate_main(int argc, char **argv) XtNallowShellResize, True, NULL); form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel, NULL); /* the command window */ - text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, form, NULL); - XtVaSetValues(text, XtNeditType,XawtextRead, XtNdisplayCaret,False, NULL); + text = XtVaCreateManagedWidget("text", + asciiTextWidgetClass, form, + XtNeditType, XawtextEdit, + NULL); /* The button panels */ navigation = XtVaCreateManagedWidget("navigation", boxWidgetClass, form,