home *** CD-ROM | disk | FTP | other *** search
- /**---------------------------------------------------------------------
- ***
- *** file: xmespec.c
- *** Special dialogs and supporting routines.
- ***
- *** project: jetedit - Motif Widgets text editor
- ***
- ***-------------------------------------------------------------------*/
-
- #include "xme.h"
- #define FIND 1
- #define REPLACE 2
-
- static Widget Find_dialog;
- static Widget find_entry;
- static Widget replace_entry;
- static Widget start_at_top;
- static Widget find_case;
- static Widget regular_exp;
-
- char *seg_string;
- char *find_string;
- #define EXPSIZE 4096
- #define INIT register char *sp = find_string;
- #define GETC() (*sp++)
- #define PEEKC() (*sp)
- #define UNGETC(c) (--sp)
- #define RETURN(c) return;
- #define ERROR(c) fprintf (stderr, "\7")
- #include <regexp.h>
-
- /* bits for exclamation point in dialog */
- char warningBits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf0, 0x0f, 0x00,
- 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00};
-
- /************************************************************************
- *
- * CreateDefaultImage - create a default image for warning symbol.
- *
- **********************************<->***********************************/
- XImage *CreateDefaultImage (bits, width, height)
- char *bits;
- int width, height;
- {
- XImage *image;
-
- image = (XImage *) XtMalloc (sizeof (XImage));
- image->width = width;
- image->height = height;
- image->data = bits;
- image->depth = 1;
- image->xoffset = 0;
- image->format = XYBitmap;
- image->byte_order = LSBFirst;
- image->bitmap_unit = 8;
- image->bitmap_bit_order = LSBFirst;
- image->bitmap_pad = 8;
- image->bytes_per_line = (width+7)/8;
- return (image);
- }
-
-
-
- /*-------------------------------------------------------------
- ** CreateSpecialWarningDialog
- ** Create special 3 button message box out of a
- ** Selection box.
- */
- Widget CreateSpecialWarningDialog (parent, name, image_string, message,
- arglist, argcount)
- Widget parent;
- String name;
- String image_string;
- String message;
- Arg arglist[];
- Cardinal argcount;
- {
- Widget warning_dialog; /* special warning selection box */
- Widget work_area; /* rowcolumn for pixmap and text */
- Widget pixmap_label;
- Widget text_label;
- Widget apply_button;
- Widget ok_button;
- Widget kid[5]; /* buttons */
- XmFontList font_list;
- Pixel foreground; /* dialog foreground */
- Pixel background; /* dialog background */
- Pixmap pixmap; /* dialog pixmap */
- register int i; /* kid index */
- Arg al[10];
- Cardinal ac;
-
- warning_dialog = XmCreatePromptDialog(parent, name, arglist, argcount);
-
- /* Create work area for insertion of prompt. */
- ac = 0;
- XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
- work_area = XmCreateRowColumn(warning_dialog, "workarea", al, ac);
- XtManageChild(work_area);
-
- ac = 0;
- XtSetArg(al[ac], XmNforeground, &foreground); ac++;
- XtSetArg(al[ac], XmNbackground, &background); ac++;
- XtGetValues(warning_dialog, al, ac);
-
- /* Create and insert prompt. */
- ac = 0;
- XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++;
- pixmap = XmGetPixmap(XtScreen(warning_dialog), image_string,
- foreground, background);
- XtSetArg(al[ac], XmNlabelPixmap, pixmap); ac++;
- pixmap_label = XmCreateLabel(work_area, "pixmap_label", al, ac);
- XtManageChild(pixmap_label);
-
- /* Label for the prompt. */
- ac = 0;
- XtSetArg(al[ac], XmNlabelString,
- XmStringCreateLtoR(message, charset)); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- text_label = XmCreateLabel(work_area, "text_label", al, ac);
- XtManageChild(text_label);
-
- /* Create discard button. */
- ac = 0;
- apply_button = XmSelectionBoxGetChild (warning_dialog,
- XmDIALOG_APPLY_BUTTON);
- XtSetArg(al[ac], XmNlabelString,
- XmStringCreateLtoR("Discard", charset)); ac++;
- XtSetValues(apply_button, al, ac);
- XtManageChild(apply_button);
-
- /* Change label on OK button. */
- ac = 0;
- ok_button = XmSelectionBoxGetChild (warning_dialog,
- XmDIALOG_OK_BUTTON);
- XtSetArg(al[ac], XmNlabelString,
- XmStringCreateLtoR("Save", charset)); ac++;
- XtSetValues(ok_button, al, ac);
-
-
- /* Unmanage unneeded children.
- */
- i = 0;
- kid[i++] = XmSelectionBoxGetChild (warning_dialog, XmDIALOG_TEXT);
- kid[i++] = XmSelectionBoxGetChild (warning_dialog,
- XmDIALOG_SELECTION_LABEL);
- kid[i++] = XmSelectionBoxGetChild (warning_dialog, XmDIALOG_HELP_BUTTON);
- XtUnmanageChildren (kid, i);
-
- return(warning_dialog);
- }
-
-
- /*-------------------------------------------------------------
- ** strlwr
- ** Convert any upper case letters in string
- ** to lower case.
- */
- void strlwr (theString)
- char *theString;
- {
- int i, j;
-
- j = strlen (theString);
- for (i=0; i<j; i++)
- if (theString[i] >= 'A' && theString[i] <= 'Z')
- theString[i] += 'a' - 'A';
- }
-
-
-
- /*-------------------------------------------------------------
- ** ReplaceString
- ** The callback for the menu replace function.
- */
- void ReplaceString()
- {
- Arg al[1];
- char replaceString[MAXLENGTH];
- char *aString;
- char *selString;
- char *file_string; /* Contents of file. */
- XmTextPosition cursorPos;
-
- /* Get the Replace string */
- aString = &replaceString[0];
- XtSetArg (al[0], XmNvalue, &aString);
- XtGetValues (replace_entry, al, 1);
-
- if (selString = XmTextGetSelection(text)) {
- file_string = XmTextGetString(text);
- XtSetArg (al[0], XmNcursorPosition, &cursorPos);
- XtGetValues (text, al, 1);
- if (!strncmp (selString, file_string+cursorPos, strlen(selString))) {
- XmTextReplace (text, cursorPos, cursorPos + strlen(selString), "");
- XmTextReplace (text, cursorPos, cursorPos, aString);
- }
- else {
- XmTextReplace (text, cursorPos, cursorPos, aString);
- XmTextReplace (text, cursorPos - strlen(selString), cursorPos, "");
- }
- XtFree (selString);
- XtFree (file_string);
- }
- }
-
-
- /*-------------------------------------------------------------
- ** FindString
- ** The use of regular expressions was contributed by:
- ** jec@milne.boeing.com (Jim Campbell)
- */
- Boolean FindString(thetime)
- Time thetime;
- {
- char *file_string; /* Contents of file. */
- char *found;
- char buffer[30];
- XmTextPosition cursorPos;
- XmTextPosition end_cursorPos;
- Arg al[1];
- Boolean ignore_case;
- Boolean reg_exp;
- char expbuf [EXPSIZE];
-
- if (!the_string) {
- fprintf (stderr, "\7"); /* Beep */
- XmTextClearSelection(text, thetime);
- return (False);
- }
-
- /* get the text string */
- file_string = XmTextGetString(text);
- XtSetArg (al[0], XmNcursorPosition, &cursorPos);
- XtGetValues (text, al, 1);
- seg_string = (char *)((long)file_string + (long)cursorPos);
- find_string = XtMalloc (strlen(the_string) + 1);
- strcpy (find_string, the_string);
-
- XtSetArg (al[0], XmNset, &ignore_case);
- XtGetValues (find_case, al, 1);
- if (ignore_case) {
- strlwr (seg_string);
- strlwr (find_string);
- }
-
- XtSetArg (al[0], XmNset, ®_exp);
- XtGetValues (regular_exp, al, 1);
- if (reg_exp) {
- compile (find_string, expbuf, &expbuf[EXPSIZE], '\0');
- if (step (seg_string, expbuf)) {
- cursorPos = (XmTextPosition)((long)loc1 + (long)cursorPos - (long)seg_string);
- end_cursorPos = (XmTextPosition)((long)cursorPos + (long)loc2 - (long)loc1);
- XmTextSetSelection(text, cursorPos, end_cursorPos, thetime);
- MoveTo(end_cursorPos);
- XtFree (file_string);
- XtFree (find_string);
- return (True);
- }
- else {
- fprintf (stderr, "\7"); /* Beep */
- XmTextClearSelection(text, thetime);
- XtFree (file_string);
- XtFree (find_string);
- return (False);
- }
- }
- else {
- if ((found = strstr (seg_string, find_string)) != NULL) {
- cursorPos = (XmTextPosition)((long)found + (long)cursorPos - (long)seg_string);
- end_cursorPos = (XmTextPosition)((long)cursorPos + strlen(the_string));
- XmTextSetSelection(text, cursorPos, end_cursorPos, thetime);
- MoveTo(end_cursorPos);
- XtFree (file_string);
- XtFree (find_string);
- return (True);
- }
- else {
- fprintf (stderr, "\7"); /* Beep */
- XmTextClearSelection(text, thetime);
- XtFree (file_string);
- XtFree (find_string);
- return (False);
- }
- }
- }
-
-
- /*-------------------------------------------------------------
- ** FindCB
- */
- void FindCB (w, client_data, call_data)
- Widget w; /* widget id */
- caddr_t client_data; /* data from application */
- caddr_t call_data; /* data from widget class */
- {
- Arg al[1];
- Boolean startAtTop;
-
- XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data;
-
- XtSetArg (al[0], XmNvalue, &the_string);
- XtGetValues (find_entry, al, 1);
-
- /* Get Start at beginning of file indicator */
- XtSetArg (al[0], XmNset, &startAtTop);
- XtGetValues (start_at_top, al, 1);
- if (startAtTop) {
- MoveTo((XmTextPosition)0);
- XtSetArg (al[0], XmNset, False);
- XtSetValues (start_at_top, al, 1);
- }
-
- FindString (cb->event->xbutton.time);
- XtSetSensitive (findA_button, True);
- XtSetSensitive (replace_button, True);
- XtSetSensitive (replace_pb, True);
- XtSetSensitive (replaceAll_pb, True);
- }
-
-
- /*-------------------------------------------------------------
- ** ReplaceCB
- */
- void ReplaceCB (w, client_data, call_data)
- Widget w; /* widget id */
- caddr_t client_data; /* data from application */
- caddr_t call_data; /* data from widget class */
- {
- Arg al[1];
- char replaceString[MAXLENGTH];
- char *aString;
- XmTextPosition cursorPos; /* text cursor position */
- XmTextPosition cursorBack;
- Boolean startAtTop;
- Time thetime;
-
- XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data;
- thetime = cb->event->xbutton.time;
-
- ReplaceString();
- FindString(thetime+2);
- }
-
- /*-------------------------------------------------------------
- ** ReplaceAllCB
- */
- void ReplaceAllCB (w, client_data, call_data)
- Widget w; /* widget id */
- caddr_t client_data; /* data from application */
- caddr_t call_data; /* data from widget class */
- {
- Arg al[1];
- char replaceString[MAXLENGTH];
- char *aString;
- XmTextPosition cursorPos; /* text cursor position */
- XmTextPosition cursorBack;
- Boolean startAtTop;
- Time thetime;
-
- XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data;
- thetime = cb->event->xbutton.time;
-
- /* Get the Find string */
- XtSetArg (al[0], XmNvalue, &the_string);
- XtGetValues (find_entry, al, 1);
- cursorBack = strlen (the_string);
- /* Get the Replace string */
- aString = &replaceString[0];
- XtSetArg (al[0], XmNvalue, &aString);
- XtGetValues (replace_entry, al, 1);
- /* Get Start at beginning of file indicator */
- XtSetArg (al[0], XmNset, &startAtTop);
- XtGetValues (start_at_top, al, 1);
-
- XtSetSensitive (findA_button, True);
- if (startAtTop) {
- MoveTo((XmTextPosition)0);
- XtSetArg (al[0], XmNset, False);
- XtSetValues (start_at_top, al, 1);
- }
-
- while (FindString(thetime++)) {
- XtSetArg (al[0], XmNcursorPosition, &cursorPos);
- XtGetValues (text, al, 1);
- XmTextReplace (text, cursorPos-cursorBack, cursorPos, aString);
- }
- }
-
- /*-------------------------------------------------------------
- ** ExitCB
- */
- void ExitCB (w, client_data, call_data)
- Widget w; /* widget id */
- caddr_t client_data; /* data from application */
- caddr_t call_data; /* data from widget class */
- {
- XtUnmanageChild (Find_dialog);
- }
-
-
- /*-------------------------------------------------------------
- ** FindHelpCB
- */
- void FindHelpCB (w, client_data, call_data)
- Widget w; /* widget id */
- caddr_t client_data; /* data from application */
- caddr_t call_data; /* data from widget class */
- {
- XtManageChild (find_help_dialog);
- }
-
-
- /*--------------------------------------------------------------
- ** Translation table for the find dialog's text widgets.
- */
- static char defaultTranslations[] =
- "Meta<Key>X: CutItem() \n\
- Meta<Key>C: CopyItem() \n\
- Meta<Key>V: PasteItem()";
-
- /*-------------------------------------------------------------
- ** CreateSpecialFindDialog
- ** Create find & replace message box out of a
- ** Dialog Shell.
- */
- Widget CreateSpecialFindDialog (parent, dialog_name, arglist, argcount)
- Widget parent;
- String dialog_name;
- Arg arglist[];
- Cardinal argcount;
- {
- Widget work_area;
- Widget help_area;
- Widget button;
- Widget separator;
- Widget label;
- Widget kid[5];
- int i;
- Arg al[15];
- Cardinal ac;
- XmFontList font_list;
- Dimension button_width;
- XtTranslations trans_table;
-
- trans_table = XtParseTranslationTable(defaultTranslations);
-
- Find_dialog = XmCreatePromptDialog(parent, dialog_name, arglist, argcount);
-
- ac = 0;
- XtSetArg(al[ac], XmNtextFontList, &font_list); ac++;
- XtGetValues(Find_dialog, al, ac);
-
- /* Create work area. */
- ac=0;
- work_area = XmCreateRowColumn(Find_dialog, "workarea", al, ac);
- XtManageChild(work_area);
-
- /* Label for the "Find Text". */
- ac = 0;
- XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- label = XmCreateLabel(work_area, "Find Text:", al, ac);
- XtManageChild(label);
-
- /* Create "Find Text" box. */
- ac = 0;
- XtSetArg(al[ac], XmNmaxLength, MAXLENGTH); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- find_entry = XmCreateText(work_area, "find_entry", al, ac);
- XtManageChild(find_entry);
- XtOverrideTranslations (find_entry, trans_table);
-
- /* Label for the "Replace With". */
- ac = 0;
- XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
- XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- label = XmCreateLabel(work_area, "Replace With:", al, ac);
- XtManageChild(label);
-
- /* Create "Replace With" box. */
- ac = 0;
- XtSetArg(al[ac], XmNmaxLength, MAXLENGTH); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- replace_entry = XmCreateText(work_area, "replace_entry", al, ac);
- XtManageChild(replace_entry);
- XtOverrideTranslations (replace_entry, trans_table);
-
- /* Create "Ignore Case" button. */
- ac = 0;
- XtSetArg(al[ac], XmNlabelString,
- XmStringCreateLtoR("Ignore text case", charset)); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- find_case = XmCreateToggleButtonGadget(work_area, "find_case", al, ac);
- XtManageChild(find_case);
-
- /* Create "Start at top of file" button. */
- ac = 0;
- XtSetArg(al[ac], XmNlabelString,
- XmStringCreateLtoR("Start at top of file", charset)); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- start_at_top = XmCreateToggleButtonGadget(work_area, "start_at_top", al, ac);
- XtManageChild(start_at_top);
-
- /* Create "Use Regular Expressions" button. */
- ac = 0;
- XtSetArg(al[ac], XmNlabelString,
- XmStringCreateLtoR("Use regular expressions", charset)); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- regular_exp = XmCreateToggleButtonGadget(work_area, "regular_exp", al, ac);
- XtManageChild(regular_exp);
-
- /*** Put a separator and help message below the work area ***/
- ac = 0;
- separator = XmCreateSeparator(work_area, "separator", al, ac);
- XtManageChild(separator);
-
- ac = 0;
- XtSetArg (al[ac], XmNorientation, XmHORIZONTAL); ac++;
- help_area = XmCreateRowColumn(work_area, "help_area", al, ac);
- XtManageChild(help_area);
-
- ac = 0;
- XtSetArg(al[ac], XmNlabelString,
- XmStringCreateLtoR("Help", charset)); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- button = XmCreatePushButtonGadget(help_area, "Help", al, ac);
- XtManageChild(button);
-
- ac = 0;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- label = XmCreateLabelGadget (help_area,
- "Press HELP for a quick reference to regular expressions.", al, ac);
- XtManageChild (label);
-
- /* Relabel OK button */
- ac = 0;
- XtSetArg(al[ac], XmNokLabelString,
- XmStringCreateLtoR("Find", charset)); ac++;
- XtSetValues(Find_dialog, al, ac);
-
- /* Create Replace button. */
- ac = 0;
- XtSetArg(al[ac], XmNapplyLabelString,
- XmStringCreateLtoR("Replace", charset)); ac++;
- XtSetValues(Find_dialog, al, ac);
- replace_pb = XmSelectionBoxGetChild (Find_dialog, XmDIALOG_APPLY_BUTTON);
- XtManageChild(replace_pb);
- XtSetSensitive(replace_pb, False);
-
- /* Relabel Cancel button */
- ac = 0;
- XtSetArg(al[ac], XmNcancelLabelString,
- XmStringCreateLtoR("Replace All", charset)); ac++;
- XtSetValues(Find_dialog, al, ac);
- replaceAll_pb = XmSelectionBoxGetChild (Find_dialog, XmDIALOG_CANCEL_BUTTON);
- XtSetSensitive(replaceAll_pb, False);
-
- /* Relabel Help button */
- ac = 0;
- XtSetArg(al[ac], XmNhelpLabelString,
- XmStringCreateLtoR("Done", charset)); ac++;
- XtSetValues(Find_dialog, al, ac);
-
- XtAddCallback (button, XmNactivateCallback, FindHelpCB, NULL);
- XtAddCallback (Find_dialog, XmNokCallback, FindCB, NULL);
- XtAddCallback (Find_dialog, XmNapplyCallback, ReplaceCB, NULL);
- XtAddCallback (Find_dialog, XmNcancelCallback, ReplaceAllCB, NULL);
- XtAddCallback (Find_dialog, XmNhelpCallback, ExitCB, NULL);
-
- /* Unmanage unneeded children. */
- i = 0;
- kid[i++] = XmSelectionBoxGetChild (Find_dialog, XmDIALOG_TEXT);
- kid[i++] = XmSelectionBoxGetChild (Find_dialog, XmDIALOG_SELECTION_LABEL);
- XtUnmanageChildren (kid, i);
-
- XmAddTabGroup(find_entry);
- XmAddTabGroup(replace_entry);
- XmAddTabGroup(find_case);
- XmAddTabGroup(start_at_top);
- XmAddTabGroup(regular_exp);
- XmAddTabGroup(button);
- XmAddTabGroup(Find_dialog);
- return(Find_dialog);
- }
-
-
-
- /*-------------------------------------------------------------
- ** CreateSpecialHelpDialog
- */
- Widget CreateSpecialHelpDialog (parent, help_txt, dialog_name, arglist, argcount)
- Widget parent;
- Widget *help_txt;
- String dialog_name;
- Arg arglist[];
- Cardinal argcount;
- {
- Widget the_dialog;
- Widget text_window;
- Widget butt_sep;
- Widget button_area;
- Widget helpok_button;
- Arg al[15];
- Cardinal ac;
- int file_length; /* Length of file. */
- char *file_string; /* Contents of file. */
- int tfd; /* Temporary file descriptor */
- struct stat statbuf; /* Information on a file. */
- XmFontList font_list;
-
- the_dialog = XmCreateFormDialog(parent, dialog_name, arglist, argcount);
-
- ac = 0;
- XtSetArg(al[ac], XmNtextFontList, &font_list); ac++;
- XtGetValues(the_dialog, al, ac);
-
- ac = 0;
- XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
- XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
- XtSetArg(al[ac], XmNheight, 400); ac++;
- XtSetArg(al[ac], XmNwidth, 400); ac++;
- XtSetArg(al[ac], XmNresizePolicy, XmRESIZE_GROW); ac++;
- XtSetArg(al[ac], XmNdialogTitle,
- XmStringCreateLtoR(dialog_name, charset)); ac++;
- XtSetValues (the_dialog, al, ac);
-
- /* Create Help Ok button. */
- ac = 0;
- XtSetArg(al[ac], XmNbottomOffset, 10); ac++;
- XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNleftOffset, 15); ac++;
- XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNshowAsDefault, 1); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- helpok_button = XmCreatePushButtonGadget (the_dialog, "OK",al, ac);
- XtManageChild(helpok_button);
-
- /* Create seperator above button. */
- ac = 0;
- XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNbottomWidget, (XtArgVal)helpok_button); ac++;
- XtSetArg(al[ac], XmNbottomOffset, 10); ac++;
- XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
- butt_sep = XmCreateSeparator(the_dialog, "butt_sep", al, ac);
- XtManageChild(butt_sep);
-
- /* Create "Help Text" box. */
- ac = 0;
- XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNbottomWidget, (XtArgVal)butt_sep); ac++;
- XtSetArg(al[ac], XmNbottomOffset, 10); ac++;
- XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
- XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
- XtSetArg(al[ac], XmNeditable, False); ac++;
- XtSetArg(al[ac], XmNscrollHorizontal, False); ac++;
- XtSetArg(al[ac], XmNwordWrap, True); ac++;
- #ifdef HARDCODE
- XtSetArg (al[ac], XmNfontList, fontlist); ac++;
- #endif
- *help_txt = XmCreateScrolledText(the_dialog, "help_text", al, ac);
- XtManageChild(*help_txt);
-
- text_window = XtParent (*help_txt);
- ac = 0;
- XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
- XtSetArg(al[ac], XmNbottomWidget, (XtArgVal)butt_sep); ac++;
- XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
- XtSetValues (text_window, al, ac);
-
- return (the_dialog);
- }
-
-
-