|
|
1.1 ! root 1: ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/others/quipu/uips/pod/RCS/pod.c,v 7.0 90/06/12 13:15:50 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/others/quipu/uips/pod/RCS/pod.c,v 7.0 90/06/12 13:15:50 mrose Exp $ ! 9: */ ! 10: ! 11: /* ! 12: * $Log: pod.c,v $ ! 13: * Revision 7.0 90/06/12 13:15:50 mrose ! 14: * *** empty log message *** ! 15: * ! 16: * Revision 1.5 90/04/26 10:21:06 emsrdsm ! 17: * *** empty log message *** ! 18: * ! 19: * Revision 1.4 90/04/25 13:47:09 emsrdsm ! 20: * i) lint'ed ! 21: * ! 22: * Revision 1.3 90/04/20 10:28:00 emsrdsm ! 23: * (i) fixed form bug ! 24: * ! 25: * Revision 1.2 90/04/18 18:48:24 emsrdsm ! 26: * i) added logging ! 27: * ! 28: * Revision 1.1 90/04/10 16:44:42 emsrdsm ! 29: * Initial revision ! 30: * ! 31: * ! 32: */ ! 33: ! 34: #include "bitmaps/Search" ! 35: #include "bitmaps/SearchPress" ! 36: #include "bitmaps/List" ! 37: #include "bitmaps/ListPress" ! 38: #include "bitmaps/History" ! 39: #include "bitmaps/HistoryPress" ! 40: #include "bitmaps/Close" ! 41: #include "bitmaps/ClosePress" ! 42: #include "bitmaps/Quit" ! 43: #include "bitmaps/QuitPress" ! 44: #include "bitmaps/Help" ! 45: #include "bitmaps/HelpPress" ! 46: #include "bitmaps/Cancel" ! 47: #include "bitmaps/Okay" ! 48: #include "bitmaps/OkayPress" ! 49: #include "bitmaps/About" ! 50: #include "bitmaps/AboutPress" ! 51: ! 52: #include <X11/bitmaps/gray> ! 53: ! 54: #include "pod.h" ! 55: #include "defs.h" ! 56: ! 57: char help_string[1000]; ! 58: ! 59: extern dsEnqError srch_start(), rd_start(), list_start(); ! 60: ! 61: extern char base_path[]; ! 62: extern char friendly_base_path[]; ! 63: extern char mvalue[]; ! 64: ! 65: extern unsigned int filt_num, typeindx; ! 66: extern int *av_typeindx; ! 67: ! 68: extern char *filtvalue[]; ! 69: extern char *filttype[]; ! 70: ! 71: extern char dua_help_dir[]; ! 72: ! 73: extern int NUMLINES; ! 74: extern int px, py, maxx; ! 75: extern Pixmap photo_pixmap; ! 76: Widget PhotoWindow; ! 77: ! 78: extern int sizelimit; ! 79: ! 80: char selection[1024]; ! 81: char curr_help[1024]; ! 82: ! 83: static Widget sel_widget = 0; ! 84: static Widget popup = 0, error_popup = 0; ! 85: ! 86: static Display *dpy; ! 87: static Screen *screen; ! 88: static int scr; ! 89: ! 90: mode listmode = many; ! 91: ! 92: extern D_seq showseq, dnseq, backseq; ! 93: extern int entry_number, back_buf_num, dn_number; ! 94: ! 95: int element_number = 0; ! 96: int rdn_number = 0; ! 97: ! 98: int help_up = 0; ! 99: ! 100: static void Quit(), QuitFromHelp(), InsertHelp(); ! 101: static void List(), ListDestroy(), Close(); ! 102: static void AddNewList(), ListSelect(), Move(), DMove(), HMove(); ! 103: static void StartSearch(), Search(), SetType(), Read(), Help(); ! 104: static void TSearch(), ClearSearchArea(), killSearch(), killError(); ! 105: static void create_new_list(), create_genform(); ! 106: static void create_text_display(), create_search_popup(); ! 107: static void create_history_popup(), popupHistory(), popdownHistory(); ! 108: static void ChangeHelp(); ! 109: static void buttonPress(); ! 110: void CreateBackgroundPixmap(); ! 111: ! 112: static Widget create_type_menu(); ! 113: ! 114: Widget toplevel, outer; ! 115: ! 116: static XtActionsRec actionsTable[] = { ! 117: {"TSearch", (XtActionProc) TSearch}, ! 118: {"ClearSearchArea", (XtActionProc) ClearSearchArea}, ! 119: }; ! 120: ! 121: static char defaultTranslations[] = ! 122: "<Key>Return: TSearch() \n\ ! 123: Ctrl<Key>M: TSearch() \n\ ! 124: Ctrl<Key>O: TSearch() \n\ ! 125: Ctrl<Key>J: TSearch() \n\ ! 126: Ctrl<Key>U: ClearSearchArea()"; ! 127: ! 128: static XtActionsRec buttonActionsTable[] = { ! 129: {"ChangeHelp", (XtActionProc) ChangeHelp}, ! 130: {"buttonPress", (XtActionProc) buttonPress}, ! 131: }; ! 132: ! 133: init_widgets () ! 134: { ! 135: int count; ! 136: Arg args[10]; ! 137: ! 138: count = 0; ! 139: outer = XtCreateManagedWidget("outer", formWidgetClass, toplevel, ! 140: args, count); ! 141: ! 142: dpy = XtDisplay(toplevel); ! 143: scr = DefaultScreen(dpy); ! 144: screen = XtScreen(toplevel); ! 145: ! 146: XtAddActions(buttonActionsTable, XtNumber(buttonActionsTable)); ! 147: ! 148: curr_help[0] = '\0'; ! 149: create_genform(outer); ! 150: create_dnwindow(outer); ! 151: create_text_display(outer); ! 152: create_history_popup(backseq, ""); ! 153: create_help_popup(); ! 154: create_mess_popup(); ! 155: create_error_popup(); ! 156: } ! 157: ! 158: Loop() ! 159: { ! 160: Widget PosWindow; ! 161: ! 162: XtRealizeWidget(toplevel); ! 163: ! 164: PosWindow = XtNameToWidget(outer, ! 165: "PosForm.PosScrolledWindow.PosWindow"); ! 166: print_search_area(PosWindow); ! 167: ! 168: if (DefaultDepthOfScreen(screen) == 1) { ! 169: CreateBackgroundPixmap(XtNameToWidget(outer, "ButtonForm"), ! 170: gray_bits, gray_width, gray_height); ! 171: CreateBackgroundPixmap(outer, gray_bits, gray_width, gray_height); ! 172: } ! 173: ! 174: CreateBackgroundPixmap(XtNameToWidget(outer, "ButtonForm.searchButton"), ! 175: Search_bits, Search_width, Search_height); ! 176: ! 177: CreateBackgroundPixmap(XtNameToWidget(outer, "ButtonForm.listButton"), ! 178: List_bits, List_width, List_height); ! 179: ! 180: CreateBackgroundPixmap(XtNameToWidget(outer, "ButtonForm.historyButton"), ! 181: History_bits, History_width, History_height); ! 182: ! 183: CreateBackgroundPixmap(XtNameToWidget(outer, "ButtonForm.quitButton"), ! 184: Quit_bits, Quit_width, Quit_height); ! 185: ! 186: CreateBackgroundPixmap(XtNameToWidget(outer, "ButtonForm.helpButton"), ! 187: Help_bits, Help_width, Help_height); ! 188: ! 189: (void) rd_start(); ! 190: goto_addr(); ! 191: SetType((Widget) 0, (XtPointer) typeindx, (XtPointer) 0); ! 192: XtMainLoop(); ! 193: } ! 194: ! 195: static void ! 196: create_text_display(parent) ! 197: Widget parent; ! 198: { ! 199: Widget TextForm, TextScrolledWindow; ! 200: Arg args[15]; ! 201: int count = 0; ! 202: ! 203: count = 0; ! 204: TextScrolledWindow = XtCreateManagedWidget("TextScrolledWindow", ! 205: viewportWidgetClass, ! 206: parent, args, count); ! 207: ! 208: count = 0; ! 209: XtSetArg(args[count], XtNborderWidth, 0); count++; ! 210: TextForm = XtCreateManagedWidget("TextForm", ! 211: formWidgetClass, ! 212: TextScrolledWindow, args, count); ! 213: ! 214: count = 0; ! 215: XtSetArg(args[count], XtNresizable, TRUE); count++; ! 216: (void) XtCreateManagedWidget("TextWindow", ! 217: asciiTextWidgetClass, ! 218: TextForm, args, count); ! 219: } ! 220: ! 221: make_photo_widget() ! 222: { ! 223: int count; ! 224: Arg args[10]; ! 225: Widget TextForm, TextWindow; ! 226: ! 227: TextForm = XtNameToWidget(outer, ! 228: "TextScrolledWindow.TextForm"); ! 229: TextWindow = XtNameToWidget(outer, ! 230: "TextScrolledWindow.TextForm.TextWindow"); ! 231: ! 232: count = 0; ! 233: XtSetArg(args[count], XtNresizable, TRUE); count++; ! 234: XtSetArg(args[count], XtNwidth, (Dimension) maxx); count++; ! 235: XtSetArg(args[count], XtNheight, (Dimension) py); count++; ! 236: XtSetArg(args[count], XtNlabel, ""); count++; ! 237: XtSetArg(args[count], XtNfromVert, TextWindow); count++; ! 238: PhotoWindow = XtCreateManagedWidget("PhotoWindow", ! 239: labelWidgetClass, ! 240: TextForm, args, count); ! 241: } ! 242: ! 243: kill_photo() ! 244: { ! 245: if (PhotoWindow) { ! 246: XtDestroyWidget(PhotoWindow); ! 247: PhotoWindow = 0; ! 248: } ! 249: } ! 250: ! 251: print_photo() ! 252: { ! 253: int count; ! 254: Arg args[10]; ! 255: ! 256: count = 0; ! 257: if (photo_pixmap) ! 258: XtSetArg(args[count], XtNbackgroundPixmap, photo_pixmap); count++; ! 259: ! 260: XtSetArg(args[count], XtNresizable, FALSE); count++; ! 261: XtSetValues(PhotoWindow, args, count); ! 262: } ! 263: ! 264: static void ! 265: create_new_list(list_seq, top_mess, lower_mess) ! 266: D_seq list_seq; ! 267: char *top_mess, *lower_mess; ! 268: { ! 269: int count = 0; ! 270: char name[1024]; ! 271: Widget shell, swindow, ListForm, ListWindow, list_element, closeButton; ! 272: Arg args[15]; ! 273: ! 274: if (listmode == one) ! 275: if ((shell = XtNameToWidget(toplevel, "ListOutput")) != NULL) { ! 276: ListWindow = XtNameToWidget(shell, ! 277: "ListForm.ListScrolledWindow.ListWindow"); ! 278: ! 279: (void) strcpy(name, "X"); ! 280: ! 281: while ((list_element = XtNameToWidget(ListWindow, name)) != NULL) { ! 282: XtDestroyWidget(list_element); ! 283: (void) strcat(name, "X"); ! 284: } ! 285: ! 286: XtRemoveCallback(ListWindow, XtNdestroyCallback, ! 287: ListDestroy, (XtPointer) showseq); ! 288: free_seq(showseq); ! 289: XtAddCallback(ListWindow, XtNdestroyCallback, ! 290: ListDestroy, (XtPointer) list_seq); ! 291: ! 292: AddNewList(XtNameToWidget(shell, ! 293: "ListForm.ListScrolledWindow.ListWindow"), ! 294: list_seq); ! 295: ! 296: count = 0; ! 297: XtSetArg(args[count], XtNlabel, top_mess); count++; ! 298: XtSetValues(XtNameToWidget(shell, "ListForm.ListTitle"), ! 299: args, count); ! 300: ! 301: count = 0; ! 302: XtSetArg(args[count], XtNlabel, lower_mess); count++; ! 303: XtSetValues(XtNameToWidget(shell, "ListForm.ListMessage"), ! 304: args, count); ! 305: ! 306: return; ! 307: } ! 308: ! 309: count = 0; ! 310: shell = XtCreatePopupShell("ListOutput", topLevelShellWidgetClass, ! 311: toplevel, args, 0); ! 312: count = 0; ! 313: ListForm = XtCreateManagedWidget("ListForm", formWidgetClass, ! 314: shell, args, count); ! 315: ! 316: count = 0; ! 317: XtSetArg(args[count], XtNheight, Close_height); count++; ! 318: XtSetArg(args[count], XtNwidth, Close_width); count++; ! 319: closeButton = XtCreateManagedWidget("closeButton", ! 320: commandWidgetClass, ! 321: ListForm, args, count); ! 322: ! 323: XtAddCallback(closeButton, XtNcallback, ! 324: (XtCallbackProc) Close, (XtPointer) shell); ! 325: ! 326: count = 0; ! 327: XtSetValues(closeButton, args, count); ! 328: ! 329: count = 0; ! 330: XtSetArg(args[count], XtNlabel, top_mess); count++; ! 331: (void) XtCreateManagedWidget("ListTitle", labelWidgetClass, ! 332: ListForm, args, count); ! 333: ! 334: count = 0; ! 335: swindow = XtCreateManagedWidget("ListScrolledWindow", viewportWidgetClass, ! 336: ListForm, args, count); ! 337: ! 338: count = 0; ! 339: ListWindow = XtCreateManagedWidget("ListWindow", formWidgetClass, ! 340: swindow, args, count); ! 341: ! 342: count = 0; ! 343: XtSetArg(args[count], XtNlabel, lower_mess); count++; ! 344: (void) XtCreateManagedWidget("ListMessage", labelWidgetClass, ! 345: ListForm, args, count); ! 346: ! 347: XtAddCallback(ListWindow, XtNdestroyCallback, ! 348: ListDestroy, (XtPointer) list_seq); ! 349: ! 350: AddNewList(ListWindow, list_seq); ! 351: ! 352: XtRealizeWidget(shell); ! 353: XtPopup(shell, XtGrabNone); ! 354: ! 355: CreateBackgroundPixmap(closeButton, Close_bits, Close_width, Close_height); ! 356: if (DefaultDepthOfScreen(screen) == 1) ! 357: CreateBackgroundPixmap(ListForm, gray_bits, gray_width, gray_height); ! 358: } ! 359: ! 360: create_dnwindow(parent) ! 361: Widget parent; ! 362: { ! 363: int count; ! 364: Widget PosForm, swindow; ! 365: Arg args[20]; ! 366: ! 367: count = 0; ! 368: PosForm = XtCreateManagedWidget("PosForm", formWidgetClass, ! 369: parent, args, count); ! 370: count = 0; ! 371: (void) XtCreateManagedWidget("PosTitle", labelWidgetClass, PosForm, ! 372: args, count); ! 373: ! 374: count = 0; ! 375: swindow = XtCreateManagedWidget("PosScrolledWindow", viewportWidgetClass, ! 376: PosForm, args, count); ! 377: ! 378: count = 0; ! 379: (void) XtCreateManagedWidget("PosWindow", formWidgetClass, ! 380: swindow, args, count); ! 381: } ! 382: ! 383: add_to_history(rdn, seqnum) ! 384: String rdn; ! 385: int seqnum; ! 386: { ! 387: int count, n; ! 388: char name[1024]; ! 389: char *prev; ! 390: Widget history_popup, history_display, rdn_window, scrolwin; ! 391: Dimension width, rwidth; ! 392: Arg args[20]; ! 393: ! 394: history_popup = XtNameToWidget(toplevel, "Session History"); ! 395: ! 396: history_display = XtNameToWidget(history_popup, ! 397: "HistoryForm.ListScrolledWindow.ListWindow"); ! 398: ! 399: scrolwin = (Widget) XtParent(history_display); ! 400: ! 401: count = 0; ! 402: XtSetArg(args[count], XtNwidth, &width); count++; ! 403: XtGetValues(scrolwin, args, count); ! 404: ! 405: width -= 14; ! 406: ! 407: for (n = 0; n < seqnum; n++) { ! 408: (void) strcpy((name+n), "X"); ! 409: } ! 410: ! 411: count = 0; ! 412: XtSetArg(args[count], XtNlabel, (*rdn? rdn: "The World")); count++; ! 413: XtSetArg(args[count], XtNresizable, TRUE); count++; ! 414: XtSetArg(args[count], XtNborderWidth, 0); count++; ! 415: XtSetArg(args[count], XtNborderColor, WhitePixelOfScreen(screen)); count++; ! 416: XtSetArg(args[count], XtNhighlightThickness, 1); count++; ! 417: XtSetArg(args[count], XtNjustify, XtJustifyLeft); count++; ! 418: if (strlen(name) > 1) { ! 419: prev = (char *) (name + 1); ! 420: XtSetArg(args[count], XtNfromVert, XtNameToWidget(history_display, ! 421: prev)); ! 422: count++; ! 423: } ! 424: rdn_window = XtCreateManagedWidget((String) name, commandWidgetClass, ! 425: history_display, args, count); ! 426: ! 427: XtAddCallback(rdn_window, XtNcallback, ListSelect, ! 428: (XtPointer) get_from_seq(seqnum, backseq)); ! 429: ! 430: count = 0; ! 431: XtSetArg(args[count], XtNwidth, &rwidth); count++; ! 432: XtGetValues(rdn_window, args, count); count++; ! 433: ! 434: count = 0; ! 435: XtSetArg(args[count], XtNright, XtChainRight); count++; ! 436: XtSetArg(args[count], XtNleft, XtChainLeft); count++; ! 437: if (rwidth < width) ! 438: XtSetArg(args[count], XtNwidth, width); count++; ! 439: XtSetValues(rdn_window, args, count); ! 440: } ! 441: ! 442: print_search_area(PosWindow) ! 443: Widget PosWindow; ! 444: { ! 445: char *str, *end; ! 446: char save; ! 447: int count; ! 448: char array[1024]; ! 449: Dimension width; ! 450: Arg args[20]; ! 451: Widget rdn_window, last_rdn = 0; ! 452: ! 453: count = 0; ! 454: XtSetArg(args[count], XtNwidth, &width); count++; ! 455: XtGetValues(PosWindow, args, count); ! 456: ! 457: width -= 24; ! 458: ! 459: count = 0; ! 460: XtSetArg(args[count], XtNlabel, ("The World")); count++; ! 461: XtSetArg(args[count], XtNborderWidth, 0); count++; ! 462: XtSetArg(args[count], XtNborderColor, WhitePixelOfScreen(screen)); count++; ! 463: XtSetArg(args[count], XtNhighlightThickness, 1); count++; ! 464: XtSetArg(args[count], XtNjustify, XtJustifyLeft); count++; ! 465: XtSetArg(args[count], XtNwidth, width); count++; ! 466: rdn_window = XtCreateManagedWidget("x", commandWidgetClass, ! 467: PosWindow, args, count); ! 468: XtAddCallback(rdn_window, XtNcallback, DMove, (XtPointer) 0); ! 469: last_rdn = rdn_window; ! 470: ! 471: rdn_number = 1; ! 472: ! 473: (void) strcpy (array, "xx"); ! 474: ! 475: make_friendly(friendly_base_path, base_path); ! 476: end = friendly_base_path; ! 477: while (*end != 0) { ! 478: str = end; ! 479: ! 480: do { ! 481: end++; ! 482: } while (*end != ',' && *end != '\0'); ! 483: ! 484: save = *end; ! 485: *end = '\0'; ! 486: count = 0; ! 487: XtSetArg(args[count], XtNlabel, (*str? str: "ahem")); count++; ! 488: XtSetArg(args[count], XtNborderWidth, 0); count++; ! 489: XtSetArg(args[count], XtNborderColor, WhitePixelOfScreen(screen)); count++; ! 490: XtSetArg(args[count], XtNhighlightThickness, 1); count++; ! 491: XtSetArg(args[count], XtNjustify, XtJustifyLeft); count++; ! 492: XtSetArg(args[count], XtNwidth, width); count++; ! 493: XtSetArg(args[count], XtNfromVert, last_rdn); count++; ! 494: rdn_window = XtCreateManagedWidget((String) array, commandWidgetClass, ! 495: PosWindow, args, count); ! 496: last_rdn = rdn_window; ! 497: XtAddCallback(rdn_window, XtNcallback, DMove, (XtPointer) rdn_number); ! 498: ! 499: (void) strcat(array, "x"); ! 500: rdn_number++; ! 501: ! 502: *end = save; ! 503: if (*end == ',') end++; ! 504: } ! 505: } ! 506: ! 507: static void ! 508: create_search_popup(parent) ! 509: Widget parent; ! 510: { ! 511: Dimension height; ! 512: Widget form, SearchValueForm, okButton, ! 513: SearchValueDialog, shell, cancelButton; ! 514: XtTranslations trans_table; ! 515: Arg args[20]; ! 516: XFontStruct *font; ! 517: char string[1024]; ! 518: int count = 0; ! 519: ! 520: count = 0; ! 521: shell = XtCreatePopupShell("Search", transientShellWidgetClass, ! 522: parent, args, 0); ! 523: ! 524: count = 0; ! 525: form = XtCreateManagedWidget("SearchForm", formWidgetClass, ! 526: shell, args, count); ! 527: ! 528: count = 0; ! 529: XtSetArg(args[count], XtNheight, Okay_height); count++; ! 530: XtSetArg(args[count], XtNwidth, Okay_width); count++; ! 531: okButton = XtCreateManagedWidget("okButton", commandWidgetClass, ! 532: form, args, count); ! 533: ! 534: count = 0; ! 535: XtSetValues(okButton, args, count); ! 536: ! 537: XtAddCallback(okButton, XtNcallback, ! 538: (XtCallbackProc) StartSearch, (XtPointer) 0); ! 539: ! 540: count = 0; ! 541: XtSetArg(args[count], XtNheight, Cancel_height); count++; ! 542: XtSetArg(args[count], XtNwidth, Cancel_width); count++; ! 543: cancelButton = XtCreateManagedWidget("cancelButton", commandWidgetClass, ! 544: form, args, count); ! 545: ! 546: XtAddCallback(cancelButton, XtNcallback, ! 547: (XtCallbackProc) killSearch, (XtPointer) 0); ! 548: ! 549: SearchValueForm = XtCreateManagedWidget("SearchValueForm", formWidgetClass, ! 550: form, args, count); ! 551: ! 552: count = 0; ! 553: XtSetArg(args[count], XtNlabel, "Searching For "); count++; ! 554: (void) XtCreateManagedWidget("SearchLabel", labelWidgetClass, ! 555: SearchValueForm, args, count); ! 556: ! 557: count = 0; ! 558: XtSetArg(args[count], XtNeditType, XawtextEdit); count++; ! 559: SearchValueDialog = XtCreateManagedWidget("SearchValueDialog", ! 560: asciiTextWidgetClass, ! 561: SearchValueForm, args, count); ! 562: count = 0; ! 563: XtSetArg(args[count], XtNfont, &font); count++; ! 564: XtGetValues(SearchValueDialog, args, count); ! 565: ! 566: height = FONTHEIGHT(font); ! 567: height += 8; ! 568: ! 569: count = 0; ! 570: XtSetArg(args[count], XtNheight, height); count++; ! 571: XtSetValues(SearchValueDialog, args, count); ! 572: ! 573: XtAddActions(actionsTable, XtNumber(actionsTable)); ! 574: trans_table = XtParseTranslationTable(defaultTranslations); ! 575: XtOverrideTranslations(SearchValueDialog, trans_table); ! 576: ! 577: count = 0; ! 578: XtSetArg(args[count], XtNlabel, "Change Type"); count++; ! 579: (void) XtCreateManagedWidget("TypeMenuButton", menuButtonWidgetClass, ! 580: form, args, count); ! 581: ! 582: count = 0; ! 583: (void) strcpy(string, "Current Type - "); ! 584: (void) strcat(string, filttype[typeindx]); ! 585: XtSetArg(args[count], XtNlabel, (String) string); count++; ! 586: (void) XtCreateManagedWidget("SearchTypeLabel", labelWidgetClass, ! 587: form, args, count); ! 588: ! 589: XtRealizeWidget(shell); ! 590: ! 591: CreateBackgroundPixmap(okButton, Okay_bits, Okay_width, Okay_height); ! 592: CreateBackgroundPixmap(cancelButton, Cancel_bits, ! 593: Cancel_width, Cancel_height); ! 594: if (DefaultDepthOfScreen(screen) == 1) { ! 595: CreateBackgroundPixmap(SearchValueForm, gray_bits, ! 596: gray_width, gray_height); ! 597: CreateBackgroundPixmap(form, gray_bits, ! 598: gray_width, gray_height); ! 599: } ! 600: } ! 601: ! 602: /*ARGSUSED*/ ! 603: static void ! 604: StartSearch(w, clientdata, calldata) ! 605: Widget w; ! 606: XtPointer clientdata, calldata; ! 607: { ! 608: Arg args[15]; ! 609: int count, indx; ! 610: Widget text; ! 611: char entry[1024], string[1024], mess[1024]; ! 612: char *value; ! 613: dsEnqError status; ! 614: ! 615: message("Please Stand By........"); ! 616: ! 617: text = XtNameToWidget(XtNameToWidget(outer, "ButtonForm.searchButton"), ! 618: "Search.SearchForm.SearchValueForm.SearchValueDialog"); ! 619: ! 620: count = 0; ! 621: XtSetArg(args[count], XtNstring, &value); count++; ! 622: XtGetValues(text, args, count); ! 623: (void) strcpy(mvalue, value); ! 624: ! 625: if (mvalue[0] == '\0') { ! 626: kill_message(); ! 627: dir_error("You have not specified a search value!\nClick on this window to continue"); ! 628: return; ! 629: } ! 630: ! 631: killSearch(); ! 632: refresh(); ! 633: status = srch_start(); ! 634: ! 635: switch(status) { ! 636: case timelimit: ! 637: entry_number = 0; ! 638: dir_error("Time limit exceeded.\nClick on this window to continue"); ! 639: break; ! 640: case nothingfound: ! 641: dnseq = 0; ! 642: entry_number = 0; ! 643: dir_error("Nothing found!\nClick on this window to continue"); ! 644: break; ! 645: case localdsaerror: ! 646: dnseq = 0; ! 647: entry_number = 0; ! 648: dir_error("Problem with local directory server.\nClick on this window to continue"); ! 649: break; ! 650: case remotedsaerror: ! 651: dnseq = 0; ! 652: entry_number = 0; ! 653: dir_error("Requested data unavailable at present.\n Click on this window to continue"); ! 654: break; ! 655: case duaerror: ! 656: dnseq = 0; ! 657: entry_number = 0; ! 658: dir_error("Internal error. Sorry!\nClick on this window to continue"); ! 659: break; ! 660: case security: ! 661: dnseq = 0; ! 662: entry_number = 0; ! 663: dir_error("You do not have the access privileges required\nto make this request!\nClick on this window to continue"); ! 664: break; ! 665: case namerror: ! 666: dnseq = 0; ! 667: entry_number = 0; ! 668: dir_error("Invalid directory position!\nClick on this window to continue"); ! 669: break; ! 670: case attributerror: ! 671: dnseq = 0; ! 672: entry_number = 0; ! 673: dir_error("Faulty data found in database!\nClick on this window to continue"); ! 674: break; ! 675: case Okay: ! 676: if (entry_number == 1) { ! 677: (void) strcpy(entry, (get_from_seq(1, dnseq))); ! 678: if (!isleaf(entry)) { ! 679: (void) strcpy(base_path, entry); ! 680: make_friendly(friendly_base_path, base_path); ! 681: set_search_area(XtNameToWidget ! 682: (outer, "PosForm.PosScrolledWindow.PosWindow")); ! 683: goto_addr(); ! 684: SetType((Widget) 0, (XtPointer) typeindx, (XtPointer) 0); ! 685: kill_photo(); ! 686: refresh(); ! 687: (void) rd_start(); ! 688: } else { ! 689: (void) strcpy(string, base_path); ! 690: (void) strcpy(base_path, entry); ! 691: make_friendly(friendly_base_path, base_path); ! 692: kill_photo(); ! 693: refresh(); ! 694: (void) rd_start(); ! 695: (void) strcpy(base_path, string); ! 696: make_friendly(friendly_base_path, base_path); ! 697: } ! 698: clear_dnseq(); ! 699: entry_number = 0; ! 700: } else if (entry_number > 0) { ! 701: (void) strcpy(mess, "Results of search under "); ! 702: ! 703: if (strlen(base_path) > 3) { ! 704: indx = strlen(friendly_base_path); ! 705: while (friendly_base_path[indx] != ',' && indx != 0) indx--; ! 706: (void) strcat(mess, (char *) (friendly_base_path+indx)); ! 707: } else { ! 708: (void) strcat(mess, "The World"); ! 709: indx = 0; ! 710: } ! 711: ! 712: create_new_list(dnseq, mess, ""); ! 713: if (listmode == one) showseq = dnseq; ! 714: dnseq = 0; ! 715: break; ! 716: case listsizelimit: ! 717: (void) strcpy(mess, "Results of search under "); ! 718: ! 719: if (strlen(base_path) > 3) { ! 720: indx = strlen(friendly_base_path); ! 721: while (friendly_base_path[indx] != ',' && indx != 0) indx--; ! 722: (void) strcat(mess, (char *) (friendly_base_path+indx)); ! 723: } else { ! 724: (void) strcat(mess, "The World"); ! 725: indx = 0; ! 726: } ! 727: ! 728: (void) sprintf(string, ! 729: "List size limit exceeded. Only %d items displayed.", ! 730: sizelimit); ! 731: ! 732: create_new_list(dnseq, ! 733: mess, ! 734: string); ! 735: if (listmode == one) showseq = dnseq; ! 736: dnseq = 0; ! 737: } ! 738: } ! 739: kill_message(); ! 740: } ! 741: ! 742: static Widget ! 743: create_type_menu(parent) ! 744: Widget parent; ! 745: { ! 746: Widget menu_mgr, button; ! 747: Arg args[15]; ! 748: int count = 0, n; ! 749: ! 750: menu_mgr = XtCreatePopupShell("menu", simpleMenuWidgetClass, ! 751: parent, args, 0 ); ! 752: ! 753: n = 0; ! 754: while (av_typeindx[n] != -1) { ! 755: count = 0; ! 756: XtSetArg(args[count], XtNlabel, (String) filttype[av_typeindx[n]]);count++; ! 757: button = XtCreateManagedWidget((String) filttype[av_typeindx[n]], ! 758: smeBSBObjectClass, ! 759: menu_mgr, args, count); ! 760: XtAddCallback(button, XtNcallback, SetType, (XtPointer) av_typeindx[n]); ! 761: n++; ! 762: } ! 763: return menu_mgr; ! 764: } ! 765: ! 766: /*ARGSUSED*/ ! 767: static void ! 768: SetType(w, indx, calldata) ! 769: Widget w; ! 770: XtPointer indx, calldata; ! 771: { ! 772: Widget type_label, menu, searchButton, menuButton; ! 773: int count = 0; ! 774: Arg args[10]; ! 775: char label[1024]; ! 776: ! 777: searchButton = XtNameToWidget(outer,"ButtonForm.searchButton"); ! 778: menuButton = XtNameToWidget(searchButton, ! 779: "Search.SearchForm.TypeMenuButton"); ! 780: ! 781: if ((int) indx < 0 || (int) indx >= (int) filt_num) return; ! 782: ! 783: if ((menu = XtNameToWidget(searchButton, ! 784: "Search.SearchForm.TypeMenuButton.menu"))) ! 785: XtDestroyWidget(menu); ! 786: ! 787: (void) create_type_menu(menuButton); ! 788: ! 789: type_label = XtNameToWidget(searchButton, ! 790: "Search.SearchForm.SearchTypeLabel"); ! 791: ! 792: (void) strcpy(label, "Current Type - "); ! 793: (void) strcat(label, filttype[(int) indx]); ! 794: ! 795: count = 0; ! 796: XtSetArg(args[count], XtNlabel, label); count++; ! 797: XtSetValues(type_label, args, count); ! 798: ! 799: typeindx = (int) indx; ! 800: } ! 801: ! 802: static void ! 803: create_genform(parent) ! 804: Widget parent; ! 805: { ! 806: Widget form, quitButton, helpButton, searchButton, listButton, historyButton; ! 807: Arg args[10]; ! 808: int count; ! 809: ! 810: count = 0; ! 811: form = XtCreateManagedWidget("ButtonForm", formWidgetClass, parent, ! 812: args, count); ! 813: ! 814: count = 0; ! 815: XtSetArg(args[count], XtNheight, Quit_height); count++; ! 816: XtSetArg(args[count], XtNwidth, Quit_width); count++; ! 817: quitButton = XtCreateManagedWidget("quitButton", ! 818: commandWidgetClass, ! 819: form, args, count); ! 820: ! 821: XtAddCallback(quitButton, XtNcallback, ! 822: (XtCallbackProc) Quit, (XtPointer) 0); ! 823: ! 824: count = 0; ! 825: XtSetArg(args[count], XtNheight, Help_height); count++; ! 826: XtSetArg(args[count], XtNwidth, Help_width); count++; ! 827: helpButton = XtCreateManagedWidget("helpButton", ! 828: commandWidgetClass, ! 829: form, args, count); ! 830: ! 831: XtAddCallback(helpButton, XtNcallback, ! 832: (XtCallbackProc) Help, (XtPointer) 0); ! 833: ! 834: count = 0; ! 835: XtSetArg(args[count], XtNheight, Search_height); count++; ! 836: XtSetArg(args[count], XtNwidth, Search_width); count++; ! 837: searchButton = XtCreateManagedWidget("searchButton", ! 838: commandWidgetClass, ! 839: form, args, count); ! 840: ! 841: XtAddCallback(searchButton, XtNcallback, ! 842: (XtCallbackProc) Search, (XtPointer) 0); ! 843: ! 844: create_search_popup(searchButton); ! 845: ! 846: count = 0; ! 847: XtSetArg(args[count], XtNheight, List_height); count++; ! 848: XtSetArg(args[count], XtNwidth, List_width); count++; ! 849: listButton = XtCreateManagedWidget("listButton", ! 850: commandWidgetClass, ! 851: form, args, count); ! 852: ! 853: XtAddCallback(listButton, XtNcallback, ! 854: (XtCallbackProc) List, (XtPointer) 0); ! 855: ! 856: count = 0; ! 857: XtSetArg(args[count], XtNheight, History_height); count++; ! 858: XtSetArg(args[count], XtNwidth, History_width); count++; ! 859: historyButton = XtCreateManagedWidget("historyButton", ! 860: commandWidgetClass, ! 861: form, args, count); ! 862: ! 863: XtAddCallback(historyButton, XtNcallback, ! 864: (XtCallbackProc) popupHistory, (XtPointer) 0); ! 865: } ! 866: ! 867: cleartext() ! 868: { ! 869: Arg args[15]; ! 870: Widget text; ! 871: int count = 0; ! 872: ! 873: text = XtNameToWidget(outer, ! 874: "TextScrolledWindow.TextForm.TextWindow"); ! 875: count = 0; ! 876: XtSetArg(args[count], XtNstring, "\0"); count++; ! 877: XtSetArg(args[count], XtNwidth, (Dimension) 5); count++; ! 878: XtSetArg(args[count], XtNheight, (Dimension) 5); count++; ! 879: XtSetValues(text, args, count); ! 880: } ! 881: ! 882: static void ! 883: AddNewList(list_widget, list_seq) ! 884: Widget list_widget; ! 885: D_seq list_seq; ! 886: { ! 887: Arg args[15]; ! 888: Widget element, scrolwin; ! 889: int count = 0, n; ! 890: char name[1024], friendly_rdn[1024]; ! 891: char *prev, *string; ! 892: Dimension width, rwidth; ! 893: ! 894: scrolwin = (Widget) XtParent(list_widget); ! 895: ! 896: count = 0; ! 897: XtSetArg(args[count], XtNwidth, &width); count++; ! 898: XtGetValues(scrolwin, args, count); ! 899: ! 900: width -= 15; ! 901: ! 902: element_number = entry_number; ! 903: ! 904: for (n = 0; n < element_number; n++) { ! 905: (void) strcpy((name+n), "X"); ! 906: ! 907: string = get_from_seq(n+1, list_seq); ! 908: make_friendly_rdn(friendly_rdn, string, base_path); ! 909: count = 0; ! 910: XtSetArg(args[count], XtNlabel, (*friendly_rdn? ! 911: friendly_rdn: "The World"));count++; ! 912: XtSetArg(args[count], XtNborderWidth, 0);count++; ! 913: XtSetArg(args[count], XtNborderColor, WhitePixelOfScreen(screen)); count++; ! 914: XtSetArg(args[count], XtNhighlightThickness, 1); count++; ! 915: XtSetArg(args[count], XtNjustify, XtJustifyLeft); count++; ! 916: if (strlen(name) > 1) { ! 917: prev = (char *) name + 1; ! 918: XtSetArg(args[count], XtNfromVert, XtNameToWidget(list_widget, ! 919: prev)); ! 920: count++; ! 921: } ! 922: element = XtCreateManagedWidget((String) name, ! 923: commandWidgetClass, ! 924: list_widget, args, count); ! 925: ! 926: XtAddCallback(element, XtNcallback, ListSelect, (XtPointer) string); ! 927: ! 928: count = 0; ! 929: XtSetArg(args[count], XtNwidth, &rwidth); count++; ! 930: XtGetValues(element, args, count); ! 931: ! 932: if (rwidth < width) { ! 933: count = 0; ! 934: XtSetArg(args[count], XtNwidth, width); count++; ! 935: XtSetValues(element, args, count); ! 936: } ! 937: } ! 938: } ! 939: ! 940: void ! 941: xprint(str) ! 942: String str; ! 943: { ! 944: Arg args[15]; ! 945: Widget text; ! 946: char *string, *sptr; ! 947: char buffer[4024]; ! 948: int count; ! 949: Dimension height, addheight, width, addwidth; ! 950: int lines, maxchars, chars, char_width; ! 951: XFontStruct *font; ! 952: ! 953: text = XtNameToWidget(outer, ! 954: "TextScrolledWindow.TextForm.TextWindow"); ! 955: ! 956: lines = maxchars = chars = 0; ! 957: count = 0; ! 958: XtSetArg(args[count], XtNheight, &height); count++; ! 959: XtSetArg(args[count], XtNwidth, &width); count++; ! 960: XtSetArg(args[count], XtNfont, &font); count++; ! 961: XtSetArg(args[count], XtNstring, &string); count++; ! 962: XtGetValues(text, args, count); ! 963: ! 964: /* (void) strcpy(buffer, str);*/ ! 965: ! 966: sptr = str; ! 967: while (*sptr != '\0') { ! 968: switch (*sptr) { ! 969: case '\n': ! 970: lines++; ! 971: if (chars > maxchars) maxchars = chars; ! 972: chars = 0; ! 973: break; ! 974: default: ! 975: chars++; ! 976: break; ! 977: } ! 978: sptr++; ! 979: } ! 980: char_width = FONTWIDTH(font); ! 981: addwidth = char_width * maxchars; ! 982: width = addwidth > width? addwidth: width; ! 983: ! 984: addheight = FONTHEIGHT(font); ! 985: addheight *= lines; ! 986: height += addheight; ! 987: ! 988: if (*string == '\0') ! 989: (void) strcpy(buffer, str); ! 990: else ! 991: (void) sprintf(buffer, "%s%s", string, str); ! 992: ! 993: count = 0; ! 994: XtSetArg(args[count], XtNwidth, width); count++; ! 995: XtSetArg(args[count], XtNheight, height); count++; ! 996: XtSetArg(args[count], XtNstring, buffer); count++; ! 997: XtSetValues(text, args, count); ! 998: } ! 999: ! 1000: ! 1001: ! 1002: hold_text() ! 1003: { ! 1004: Widget text, form; ! 1005: ! 1006: text = XtNameToWidget(outer, ! 1007: "TextScrolledWindow.TextForm.TextWindow"); ! 1008: form = XtNameToWidget(outer, ! 1009: "TextScrolledWindow.TextForm"); ! 1010: ! 1011: XawFormDoLayout(form, FALSE); ! 1012: XawTextDisableRedisplay(text); ! 1013: refresh(); ! 1014: } ! 1015: ! 1016: restart_text() ! 1017: { ! 1018: Widget text, form; ! 1019: ! 1020: text = XtNameToWidget(outer, ! 1021: "TextScrolledWindow.TextForm.TextWindow"); ! 1022: form = XtNameToWidget(outer, ! 1023: "TextScrolledWindow.TextForm"); ! 1024: ! 1025: XawTextEnableRedisplay(text); ! 1026: if (PhotoWindow) { ! 1027: XtRealizeWidget(PhotoWindow); ! 1028: print_photo(); ! 1029: } ! 1030: XawFormDoLayout(form, TRUE); ! 1031: refresh(); ! 1032: } ! 1033: ! 1034: refresh() ! 1035: { ! 1036: XFlush(dpy); ! 1037: } ! 1038: ! 1039: /*ARGSUSED*/ ! 1040: static void ! 1041: Quit(widget, closure, callData) ! 1042: Widget widget; ! 1043: XtPointer closure, callData; ! 1044: { ! 1045: XtDestroyWidget(toplevel); ! 1046: quit(0); ! 1047: } ! 1048: ! 1049: /*ARGSUSED*/ ! 1050: static void ! 1051: Search(w, data, calldata) ! 1052: Widget w; ! 1053: XtPointer data, calldata; ! 1054: { ! 1055: Widget search_popup; ! 1056: int win_x, win_y, root_x, root_y; ! 1057: Window a, b; ! 1058: Cardinal buttons; ! 1059: ! 1060: search_popup = XtNameToWidget(XtNameToWidget(outer, ! 1061: "ButtonForm.searchButton"), ! 1062: "Search"); ! 1063: ! 1064: XQueryPointer(dpy, XtWindow(outer), &a, &b, ! 1065: &root_x, &root_y, &win_x, &win_y, &buttons); ! 1066: ! 1067: XtMoveWidget(search_popup, root_x, root_y); ! 1068: ! 1069: XtPopup(search_popup, XtGrabNone); ! 1070: XFlush(dpy); ! 1071: } ! 1072: ! 1073: static void ! 1074: killSearch() ! 1075: { ! 1076: Widget search_popup; ! 1077: ! 1078: search_popup = XtNameToWidget(XtNameToWidget(outer, ! 1079: "ButtonForm.searchButton"), ! 1080: "Search"); ! 1081: ! 1082: XtPopdown(search_popup); ! 1083: } ! 1084: ! 1085: /*ARGSUSED*/ ! 1086: static void ! 1087: TSearch(w, event, params, num_params) ! 1088: Widget w; ! 1089: XEvent *event; ! 1090: String *params; ! 1091: Cardinal *num_params; ! 1092: { ! 1093: StartSearch((Widget) 0, (XtPointer) 0, (XtPointer) 0); ! 1094: } ! 1095: ! 1096: /*ARGSUSED*/ ! 1097: static void ! 1098: ClearSearchArea(w, event, params, num_params) ! 1099: Widget w; ! 1100: XEvent *event; ! 1101: String *params; ! 1102: Cardinal *num_params; ! 1103: { ! 1104: Arg args[2]; ! 1105: int count= 0; ! 1106: XtSetArg(args[count], XtNstring, "\0"); count++; ! 1107: XtSetValues(w, args, count); ! 1108: } ! 1109: ! 1110: /*ARGSUSED*/ ! 1111: static void ! 1112: Read(w, data, calldata) ! 1113: Widget w; ! 1114: XtPointer data, calldata; ! 1115: { ! 1116: cleartext(); ! 1117: kill_photo(); ! 1118: refresh(); ! 1119: (void) rd_start(); ! 1120: } ! 1121: ! 1122: set_search_area(search_area) ! 1123: Widget search_area; ! 1124: { ! 1125: WidgetList wlist; ! 1126: char name[1024]; ! 1127: int count = 0, n; ! 1128: ! 1129: wlist = (WidgetList) XtMalloc((rdn_number + 1) * sizeof(Widget)); ! 1130: ! 1131: for (n = 0; n < rdn_number; n++) { ! 1132: (void) strcpy((name+n), "x"); ! 1133: wlist[count] = XtNameToWidget(search_area, name); ! 1134: if (wlist[count]) count++; ! 1135: } ! 1136: XtUnmanageChildren(wlist, count); ! 1137: ! 1138: for (n = 0; n < count; n++) ! 1139: XtDestroyWidget(wlist[n]); ! 1140: ! 1141: XtFree(wlist); ! 1142: print_search_area(search_area); ! 1143: } ! 1144: ! 1145: /*ARGSUSED*/ ! 1146: static void ! 1147: List(w, clientdata, calldata) ! 1148: Widget w; ! 1149: XtPointer clientdata, calldata; ! 1150: { ! 1151: int indx; ! 1152: char string[1024], mess[1024]; ! 1153: dsEnqError status; ! 1154: ! 1155: message("Please Stand By......"); ! 1156: refresh(); ! 1157: status = list_start(); ! 1158: kill_message(); ! 1159: ! 1160: switch(status) { ! 1161: case timelimit: ! 1162: entry_number = 0; ! 1163: dir_error("Time limit exceeded.\nClick on this window to continue"); ! 1164: break; ! 1165: case listsizelimit: ! 1166: (void) strcpy(mess, "Results of list under "); ! 1167: ! 1168: if (strlen(base_path) > 3) { ! 1169: indx = strlen(friendly_base_path); ! 1170: while (friendly_base_path[indx] != ',' && indx != 0) indx--; ! 1171: } else { ! 1172: (void) strcat(mess, "The World"); ! 1173: indx = strlen(friendly_base_path) - 1; ! 1174: } ! 1175: ! 1176: (void) strcat(mess, (char *) (friendly_base_path+indx)); ! 1177: (void) sprintf (string, ! 1178: "List size limit exceeded. Only %d items displayed.", ! 1179: sizelimit); ! 1180: ! 1181: create_new_list(dnseq, ! 1182: mess, ! 1183: string); ! 1184: ! 1185: if (listmode == one) showseq = dnseq; ! 1186: dnseq = 0; ! 1187: break; ! 1188: case nothingfound: ! 1189: dnseq = 0; ! 1190: entry_number = 0; ! 1191: dir_error("Nothing found!\nClick on this window to continue"); ! 1192: break; ! 1193: case localdsaerror: ! 1194: dnseq = 0; ! 1195: entry_number = 0; ! 1196: dir_error("Problem with local directory server.\nClick on this window to continue"); ! 1197: break; ! 1198: case remotedsaerror: ! 1199: dnseq = 0; ! 1200: entry_number = 0; ! 1201: dir_error("Requested data unavailable at present.\n Click on this window to continue"); ! 1202: break; ! 1203: case duaerror: ! 1204: dnseq = 0; ! 1205: entry_number = 0; ! 1206: dir_error("Internal error. Sorry!\nClick on this window to continue"); ! 1207: break; ! 1208: case security: ! 1209: dnseq = 0; ! 1210: entry_number = 0; ! 1211: dir_error("You do not have the access privileges required\nto make this request!\nClick on this window to continue"); ! 1212: break; ! 1213: case namerror: ! 1214: dnseq = 0; ! 1215: entry_number = 0; ! 1216: dir_error("Invalid directory position!\nClick on this window to continue"); ! 1217: break; ! 1218: case attributerror: ! 1219: dnseq = 0; ! 1220: entry_number = 0; ! 1221: dir_error("Faulty data found in database!\nClick on this window to continue"); ! 1222: break; ! 1223: case Okay: ! 1224: (void) strcpy(mess, "Results of list under "); ! 1225: ! 1226: if (strlen(base_path) > 3) { ! 1227: indx = strlen(friendly_base_path); ! 1228: while (friendly_base_path[indx] != ',' && indx != 0) indx--; ! 1229: (void) strcat(mess, (char *) (friendly_base_path+indx)); ! 1230: } else { ! 1231: (void) strcat(mess, "The World"); ! 1232: indx = 0; ! 1233: } ! 1234: ! 1235: create_new_list(dnseq, mess, ""); ! 1236: if (listmode == one) showseq = dnseq; ! 1237: dnseq = 0; ! 1238: break; ! 1239: } ! 1240: } ! 1241: ! 1242: /*ARGSUSED*/ ! 1243: static void ! 1244: ListSelect(w, object, calldata) ! 1245: Widget w; ! 1246: XtPointer object, calldata; ! 1247: { ! 1248: char *string, parent[1024]; ! 1249: ! 1250: string = (char *) object; ! 1251: ! 1252: (void) strcpy(parent, base_path); ! 1253: (void) strcpy(base_path, string); ! 1254: make_friendly(friendly_base_path, base_path); ! 1255: Read((Widget) 0, (XtPointer) 0, (XtPointer) 0); ! 1256: (void) strcpy(base_path, parent); ! 1257: make_friendly(friendly_base_path, base_path); ! 1258: ! 1259: if (!isleaf(string)) { ! 1260: (void) strcpy(selection, string); ! 1261: ! 1262: sel_widget = w; ! 1263: ! 1264: Move((Widget) 0, (XtPointer) string, (XtPointer) 0); ! 1265: } ! 1266: } ! 1267: ! 1268: /*ARGSUSED*/ ! 1269: static void ! 1270: DMove(w, rdnlevel, calldata) ! 1271: Widget w; ! 1272: XtPointer rdnlevel, calldata; ! 1273: { ! 1274: Widget search_area; ! 1275: char *end; ! 1276: ! 1277: search_area = XtNameToWidget(outer, ! 1278: "PosForm.PosScrolledWindow.PosWindow"); ! 1279: ! 1280: end = base_path; ! 1281: if (rdnlevel == 0) *base_path = '\0'; ! 1282: else if (rdn_number > (int) (rdnlevel+1)) { ! 1283: while (rdnlevel) { ! 1284: while (*end != '@') end++; ! 1285: if (*end == '@') end++; ! 1286: rdnlevel--; ! 1287: } ! 1288: *--end = '\0'; ! 1289: } ! 1290: goto_addr(); ! 1291: set_search_area(search_area); ! 1292: SetType((Widget) 0, (XtPointer) typeindx, (XtPointer) 0); ! 1293: kill_photo(); ! 1294: refresh(); ! 1295: (void) rd_start(); ! 1296: } ! 1297: ! 1298: /*ARGSUSED*/ ! 1299: static void ! 1300: Move(w, clientdata, calldata) ! 1301: Widget w; ! 1302: XtPointer clientdata, calldata; ! 1303: { ! 1304: Widget search_area; ! 1305: char *string; ! 1306: ! 1307: if (!sel_widget) return; ! 1308: ! 1309: search_area = XtNameToWidget(outer, ! 1310: "PosForm.PosScrolledWindow.PosWindow"); ! 1311: ! 1312: string = (char *) clientdata; ! 1313: ! 1314: (void) strcpy(base_path, string); ! 1315: ! 1316: make_friendly(friendly_base_path, base_path); ! 1317: set_search_area(search_area); ! 1318: goto_addr(); ! 1319: SetType((Widget) 0, (XtPointer) typeindx, (XtPointer) 0); ! 1320: } ! 1321: ! 1322: create_mess_popup() ! 1323: { ! 1324: /* To please lint*/ ! 1325: Arg args[1]; ! 1326: ! 1327: popup = XtCreatePopupShell("OK. Chugging along.", ! 1328: transientShellWidgetClass, ! 1329: toplevel, args, 0); ! 1330: ! 1331: (void) XtCreateManagedWidget("standby", labelWidgetClass, ! 1332: popup, args, 0); ! 1333: } ! 1334: ! 1335: create_error_popup() ! 1336: { ! 1337: Widget text; ! 1338: /* To please lint*/ ! 1339: Arg args[1]; ! 1340: ! 1341: error_popup = XtCreatePopupShell("<Directory Error>", ! 1342: transientShellWidgetClass, ! 1343: toplevel, args, 0); ! 1344: ! 1345: text = XtCreateManagedWidget("text", commandWidgetClass, ! 1346: error_popup, args, 0); ! 1347: XtAddCallback(text, XtNcallback, killError, (XtPointer) 0); ! 1348: } ! 1349: ! 1350: dir_error(mess) ! 1351: String mess; ! 1352: { ! 1353: Arg args[10]; ! 1354: int count; ! 1355: Widget text; ! 1356: int win_x, win_y, root_x, root_y; ! 1357: Window a, b; ! 1358: Cardinal buttons; ! 1359: ! 1360: XQueryPointer(dpy, XtWindow(outer), &a, &b, ! 1361: &root_x, &root_y, &win_x, &win_y, &buttons); ! 1362: ! 1363: text = XtNameToWidget(error_popup, "text"); ! 1364: XtMoveWidget(error_popup, root_x, root_y); ! 1365: ! 1366: count = 0; ! 1367: XtSetArg(args[count], XtNborderWidth, 1); count++; ! 1368: XtSetArg(args[count], XtNlabel, mess); count++; ! 1369: XtSetValues(text, args, count); ! 1370: ! 1371: XtPopup(error_popup, XtGrabNone); ! 1372: } ! 1373: ! 1374: /*ARGSUSED*/ ! 1375: static void ! 1376: killError(w, calldata, clientdata) ! 1377: Widget w; ! 1378: XtPointer calldata, clientdata; ! 1379: { ! 1380: kill_error(); ! 1381: } ! 1382: ! 1383: kill_error() ! 1384: { ! 1385: XtPopdown(error_popup); ! 1386: } ! 1387: ! 1388: message(mess) ! 1389: String mess; ! 1390: { ! 1391: Arg args[10]; ! 1392: int count; ! 1393: Widget text; ! 1394: int win_x, win_y, root_x, root_y; ! 1395: Window a, b; ! 1396: Cardinal buttons; ! 1397: XEvent event; ! 1398: ! 1399: XQueryPointer(dpy, XtWindow(outer), &a, &b, ! 1400: &root_x, &root_y, &win_x, &win_y, &buttons); ! 1401: ! 1402: text = XtNameToWidget(popup, "standby"); ! 1403: XtMoveWidget(popup, root_x, root_y); ! 1404: ! 1405: count = 0; ! 1406: XtSetArg(args[count], XtNborderWidth, 1); count++; ! 1407: XtSetArg(args[count], XtNlabel, mess); count++; ! 1408: XtSetValues(text, args, count); ! 1409: ! 1410: XtPopup(popup, XtGrabExclusive); ! 1411: while (!XCheckTypedWindowEvent(dpy, ! 1412: XtWindow(text), ! 1413: Expose, &event)); ! 1414: XtDispatchEvent(&event); ! 1415: XFlush(dpy); ! 1416: } ! 1417: ! 1418: kill_message() ! 1419: { ! 1420: XtPopdown(popup); ! 1421: } ! 1422: ! 1423: create_help_popup() ! 1424: { ! 1425: Widget popup_help, popup_help_button, popup_quit_button, ! 1426: popup_help_form, popup_help_scrolwin; ! 1427: ! 1428: Arg args[15]; ! 1429: int count; ! 1430: ! 1431: count = 0; ! 1432: popup_help = XtCreatePopupShell("Pod Help Screen", topLevelShellWidgetClass, ! 1433: toplevel, args, count); ! 1434: ! 1435: count = 0; ! 1436: popup_help_form = XtCreateManagedWidget("popup_help_form", formWidgetClass, ! 1437: popup_help, args, count); ! 1438: ! 1439: count = 0; ! 1440: XtSetArg(args[count], XtNheight, Close_height); count++; ! 1441: XtSetArg(args[count], XtNwidth, Close_width); count++; ! 1442: popup_quit_button = XtCreateManagedWidget("popup_help_quit", ! 1443: commandWidgetClass, ! 1444: popup_help_form, args, count); ! 1445: ! 1446: XtAddCallback(popup_quit_button, XtNcallback, QuitFromHelp, (XtPointer) 0); ! 1447: ! 1448: count = 0; ! 1449: XtSetArg(args[count], XtNheight, About_height); count++; ! 1450: XtSetArg(args[count], XtNwidth, About_width); count++; ! 1451: popup_help_button = XtCreateManagedWidget("popup_help_general", ! 1452: commandWidgetClass, ! 1453: popup_help_form, args, count); ! 1454: ! 1455: XtAddCallback(popup_help_button, XtNcallback, InsertHelp, ! 1456: (XtPointer) "general"); ! 1457: ! 1458: count = 0; ! 1459: popup_help_scrolwin = XtCreateManagedWidget("popup_help_scrolwin", ! 1460: viewportWidgetClass, ! 1461: popup_help_form, args, count); ! 1462: ! 1463: count = 0; ! 1464: XtSetArg(args[count], XtNsensitive, FALSE); count++; ! 1465: (void) XtCreateManagedWidget("popup_help_text", ! 1466: asciiTextWidgetClass, ! 1467: popup_help_scrolwin, args, count); ! 1468: XtRealizeWidget(popup_help); ! 1469: ! 1470: CreateBackgroundPixmap(popup_help_button, About_bits, ! 1471: About_width, About_height); ! 1472: ! 1473: CreateBackgroundPixmap(popup_quit_button, Close_bits, ! 1474: Close_width, Close_height); ! 1475: ! 1476: if (DefaultDepthOfScreen(screen) == 1) { ! 1477: CreateBackgroundPixmap(popup_help_form, gray_bits, ! 1478: gray_width, gray_height); ! 1479: } ! 1480: } ! 1481: ! 1482: /*ARGSUSED*/ ! 1483: static void ! 1484: Help(w, calldata, clientdata) ! 1485: Widget w; ! 1486: XtPointer calldata, clientdata; ! 1487: { ! 1488: Widget help_popup; ! 1489: ! 1490: help_popup = XtNameToWidget(toplevel, "Pod Help Screen"); ! 1491: ! 1492: XtPopup(help_popup, XtGrabNone); ! 1493: InsertHelp((Widget) 0, (XtPointer) "help", (XtPointer) 0); ! 1494: XFlush(dpy); ! 1495: help_up = TRUE; ! 1496: } ! 1497: ! 1498: /*ARGSUSED*/ ! 1499: static void ! 1500: QuitFromHelp(w, calldata, clientdata) ! 1501: Widget w; ! 1502: XtPointer calldata, clientdata; ! 1503: { ! 1504: Widget help_popup; ! 1505: ! 1506: help_up = FALSE; ! 1507: help_popup = XtNameToWidget(toplevel, "Pod Help Screen"); ! 1508: XtPopdown(help_popup); ! 1509: } ! 1510: ! 1511: /*ARGSUSED*/ ! 1512: static void ! 1513: InsertHelp(w, calldata, clientdata) ! 1514: Widget w; ! 1515: XtPointer calldata, clientdata; ! 1516: { ! 1517: Widget text, scrolwin; ! 1518: FILE *file; ! 1519: char filename[1024]; ! 1520: char help_buf[4024]; ! 1521: int count; ! 1522: Arg args[10]; ! 1523: Dimension width, height; ! 1524: XFontStruct *font; ! 1525: ! 1526: scrolwin = XtNameToWidget(toplevel, ! 1527: "Pod Help Screen.popup_help_form.popup_help_scrolwin"); ! 1528: ! 1529: text = XtNameToWidget(scrolwin, "popup_help_text"); ! 1530: ! 1531: count = 0; ! 1532: XtSetArg(args[count], XtNwidth, &width); count++; ! 1533: XtGetValues(scrolwin, args, count); ! 1534: ! 1535: (void) strcpy(filename, dua_help_dir); ! 1536: (void) strcat(filename, (String) calldata); ! 1537: ! 1538: count = 0; ! 1539: XtSetArg(args[count], XtNfont, &font); count++; ! 1540: XtGetValues(text, args, count); ! 1541: ! 1542: height = FONTHEIGHT(font); ! 1543: count = 0; ! 1544: XtSetArg(args[count], XtNheight, height); count++; ! 1545: XtSetValues(text, args, count); ! 1546: ! 1547: height = 0; ! 1548: if (!(file = fopen(filename, "r"))) { ! 1549: (void) strcpy(filename, "./Xd/podHelpdir/"); ! 1550: (void) strcat(filename, (String) calldata); ! 1551: if (!(file = fopen(filename, "r"))) (void) printf("Helpfile not found"); ! 1552: } ! 1553: ! 1554: if (file) { ! 1555: (void) strcpy(help_buf, "\0"); ! 1556: while (fgets(help_string, 1000, file)) { ! 1557: height += (FONTHEIGHT(font)); ! 1558: (void) strcat(help_buf, help_string); ! 1559: } ! 1560: ! 1561: (void) fclose(file); ! 1562: count = 0; ! 1563: XtSetArg(args[count], XtNstring, ""); count++; ! 1564: XtSetValues(text, args, count); ! 1565: ! 1566: count = 0; ! 1567: XtSetArg(args[count], XtNwidth, width - 18); count++; ! 1568: XtSetArg(args[count], XtNheight, height); count++; ! 1569: XtSetArg(args[count], XtNstring, help_buf); count++; ! 1570: XtSetValues(text, args, count); ! 1571: } ! 1572: } ! 1573: ! 1574: ! 1575: void CreateBackgroundPixmap(widget, bits, ! 1576: width, height) ! 1577: Widget widget; ! 1578: char bits[]; ! 1579: Cardinal width, height; ! 1580: { ! 1581: Arg args[15]; ! 1582: int count; ! 1583: Pixmap bitmap; ! 1584: ! 1585: bitmap = XCreatePixmapFromBitmapData(dpy, ! 1586: XtWindow(widget), bits, ! 1587: width, height, ! 1588: BlackPixelOfScreen(screen), ! 1589: WhitePixelOfScreen(screen), ! 1590: DefaultDepthOfScreen(screen)); ! 1591: ! 1592: count = 0; ! 1593: XtSetArg(args[count], XtNbackgroundPixmap, bitmap); count++; ! 1594: XtSetArg(args[count], XtNresizable, FALSE); count++; ! 1595: XtSetValues(widget, args, count); ! 1596: } ! 1597: ! 1598: /*ARGSUSED*/ ! 1599: static void ! 1600: ListDestroy(w, list_seq, calldata) ! 1601: Widget w; ! 1602: XtPointer calldata, list_seq; ! 1603: { ! 1604: free_seq((D_seq) list_seq); ! 1605: XtDestroyWidget(w); ! 1606: } ! 1607: ! 1608: /*ARGSUSED*/ ! 1609: static void ! 1610: Close(w, shellwidget, calldata) ! 1611: Widget w; ! 1612: XtPointer calldata, shellwidget; ! 1613: { ! 1614: XtDestroyWidget((Widget) shellwidget); ! 1615: } ! 1616: ! 1617: static void ! 1618: create_history_popup(list_seq, mess) ! 1619: D_seq list_seq; ! 1620: char *mess; ! 1621: { ! 1622: int count = 0; ! 1623: Widget shell, swindow, HistoryForm, ListWindow, closeButton; ! 1624: Arg args[15]; ! 1625: ! 1626: count = 0; ! 1627: shell = XtCreatePopupShell("Session History", topLevelShellWidgetClass, ! 1628: toplevel, args, 0); ! 1629: count = 0; ! 1630: HistoryForm = XtCreateManagedWidget("HistoryForm", formWidgetClass, ! 1631: shell, args, count); ! 1632: ! 1633: count = 0; ! 1634: XtSetArg(args[count], XtNheight, Close_height); count++; ! 1635: XtSetArg(args[count], XtNwidth, Close_width); count++; ! 1636: closeButton = XtCreateManagedWidget("closeButton", ! 1637: commandWidgetClass, ! 1638: HistoryForm, args, count); ! 1639: ! 1640: XtAddCallback(closeButton, XtNcallback, ! 1641: (XtCallbackProc) popdownHistory, (XtPointer) shell); ! 1642: ! 1643: count = 0; ! 1644: XtSetValues(closeButton, args, count); ! 1645: ! 1646: count = 0; ! 1647: XtSetArg(args[count], XtNlabel, "History Window"); count++; ! 1648: (void) XtCreateManagedWidget("ListTitle", labelWidgetClass, ! 1649: HistoryForm, args, count); ! 1650: ! 1651: count = 0; ! 1652: swindow = XtCreateManagedWidget("ListScrolledWindow", viewportWidgetClass, ! 1653: HistoryForm, args, count); ! 1654: ! 1655: count = 0; ! 1656: ListWindow = XtCreateManagedWidget("ListWindow", formWidgetClass, ! 1657: swindow, args, count); ! 1658: ! 1659: count = 0; ! 1660: XtSetArg(args[count], XtNlabel, mess); count++; ! 1661: (void) XtCreateManagedWidget("ListMessage", labelWidgetClass, ! 1662: HistoryForm, args, count); ! 1663: ! 1664: XtAddCallback(ListWindow, XtNdestroyCallback, ! 1665: ListDestroy, (XtPointer) list_seq); ! 1666: ! 1667: AddNewList(ListWindow, list_seq); ! 1668: XtRealizeWidget(shell); ! 1669: ! 1670: CreateBackgroundPixmap(closeButton, Close_bits, Close_width, Close_height); ! 1671: if (DefaultDepthOfScreen(screen) == 1) ! 1672: CreateBackgroundPixmap(HistoryForm, gray_bits, gray_width, gray_height); ! 1673: } ! 1674: ! 1675: /*ARGSUSED*/ ! 1676: static void ! 1677: popupHistory(w, clientdata, calldata) ! 1678: Widget w; ! 1679: XtPointer clientdata, calldata; ! 1680: { ! 1681: Widget history_popup; ! 1682: ! 1683: history_popup = XtNameToWidget(toplevel, "Session History"); ! 1684: XtPopup(history_popup, XtGrabNone); ! 1685: } ! 1686: ! 1687: /*ARGSUSED*/ ! 1688: static void ! 1689: popdownHistory(w, clientdata, calldata) ! 1690: Widget w; ! 1691: XtPointer clientdata, calldata; ! 1692: { ! 1693: Widget history_popup; ! 1694: ! 1695: history_popup = XtNameToWidget(toplevel, "Session History"); ! 1696: XtPopdown(history_popup); ! 1697: } ! 1698: ! 1699: ! 1700: /*ARGSUSED*/ ! 1701: static void ! 1702: ChangeHelp(w, event, params, num_params) ! 1703: Widget w; ! 1704: XEvent *event; ! 1705: String *params; ! 1706: int num_params; ! 1707: { ! 1708: if ((help_up) && strcmp(params[0], curr_help)) { ! 1709: InsertHelp((Widget) 0, (XtPointer) params[0], (XtPointer) 0); ! 1710: (void) strcpy(curr_help, params[0]); ! 1711: } ! 1712: } ! 1713: ! 1714: ! 1715: /*ARGSUSED*/ ! 1716: static void ! 1717: buttonPress(w, event, params, num_params) ! 1718: Widget w; ! 1719: XEvent *event; ! 1720: String *params; ! 1721: int num_params; ! 1722: { ! 1723: if (!strcmp(params[0], "search")) ! 1724: CreateBackgroundPixmap(w, SearchPress_bits, ! 1725: SearchPress_width, SearchPress_height); ! 1726: else if (!strcmp(params[0], "help")) ! 1727: CreateBackgroundPixmap(w, HelpPress_bits, ! 1728: HelpPress_width, HelpPress_height); ! 1729: else if (!strcmp(params[0], "quit")) ! 1730: CreateBackgroundPixmap(w, QuitPress_bits, ! 1731: QuitPress_width, QuitPress_height); ! 1732: else if (!strcmp(params[0], "list")) ! 1733: CreateBackgroundPixmap(w, ListPress_bits, ! 1734: ListPress_width, ListPress_height); ! 1735: else if (!strcmp(params[0], "history")) ! 1736: CreateBackgroundPixmap(w, HistoryPress_bits, ! 1737: HistoryPress_width, HistoryPress_height); ! 1738: else if (!strcmp(params[0], "close")) ! 1739: CreateBackgroundPixmap(w, ClosePress_bits, ! 1740: ClosePress_width, ClosePress_height); ! 1741: else if (!strcmp(params[0], "about")) ! 1742: CreateBackgroundPixmap(w, AboutPress_bits, ! 1743: AboutPress_width, AboutPress_height); ! 1744: else if (!strcmp(params[0], "okay")) ! 1745: CreateBackgroundPixmap(w, OkayPress_bits, ! 1746: OkayPress_width, OkayPress_height); ! 1747: ! 1748: ! 1749: XFlush(dpy); ! 1750: XtCallCallbacks(w, XtNcallback, NULL); ! 1751: ! 1752: if (!strcmp(params[0], "search")) ! 1753: CreateBackgroundPixmap(w, Search_bits, ! 1754: Search_width, Search_height); ! 1755: else if (!strcmp(params[0], "help")) ! 1756: CreateBackgroundPixmap(w, Help_bits, ! 1757: Help_width, Help_height); ! 1758: else if (!strcmp(params[0], "quit")) ! 1759: CreateBackgroundPixmap(w, Quit_bits, ! 1760: Quit_width, Quit_height); ! 1761: else if (!strcmp(params[0], "list")) ! 1762: CreateBackgroundPixmap(w, List_bits, ! 1763: List_width, List_height); ! 1764: else if (!strcmp(params[0], "history")) ! 1765: CreateBackgroundPixmap(w, History_bits, ! 1766: History_width, History_height); ! 1767: else if (!strcmp(params[0], "close")) ! 1768: CreateBackgroundPixmap(w, Close_bits, ! 1769: Close_width, Close_height); ! 1770: else if (!strcmp(params[0], "okay")) ! 1771: CreateBackgroundPixmap(w, Okay_bits, ! 1772: Okay_width, Okay_height); ! 1773: else if (!strcmp(params[0], "about")) ! 1774: CreateBackgroundPixmap(w, About_bits, ! 1775: About_width, About_height); ! 1776: XFlush(dpy); ! 1777: } ! 1778: ! 1779:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.