void create_browse_panel(Widget w) { Widget file, beside, below; XFontStruct *temp_font; static Boolean actions_added=False; XtTranslateCoords(w, (Position) 0, (Position) 0, &xposn, &yposn); FirstArg(XtNx, xposn); NextArg(XtNy, yposn + 50); NextArg(XtNtitle, "Xfig: Browse files for picture import"); browse_popup = XtCreatePopupShell("xfig_browse_menu", transientShellWidgetClass, tool, Args, ArgCount); XtOverrideTranslations(browse_popup, XtParseTranslationTable(file_translations)); browse_panel = XtCreateManagedWidget("browse_panel", formWidgetClass, browse_popup, NULL, ZERO); FirstArg(XtNlabel, " Filename"); NextArg(XtNvertDistance, 15); NextArg(XtNborderWidth, 0); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); file = XtCreateManagedWidget("file_label", labelWidgetClass, browse_panel, Args, ArgCount); FirstArg(XtNfont, &temp_font); GetValues(file); FirstArg(XtNwidth, 250); NextArg(XtNheight, max_char_height(temp_font) * 2 + 4); NextArg(XtNeditType, "edit"); NextArg(XtNstring, browse_filename); NextArg(XtNinsertPosition, strlen(browse_filename)); NextArg(XtNfromHoriz, file); NextArg(XtNborderWidth, INTERNAL_BW); NextArg(XtNvertDistance, 15); NextArg(XtNfromVert, cfile_lab); NextArg(XtNscrollHorizontal, XawtextScrollWhenNeeded); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); browse_selfile = XtCreateManagedWidget("file_name", asciiTextWidgetClass, browse_panel, Args, ArgCount); XtOverrideTranslations(browse_selfile, XtParseTranslationTable(text_translations)); if (!actions_added) { XtAppAddActions(tool_app, file_actions, XtNumber(file_actions)); actions_added = True; /* add action to apply file */ XtAppAddActions(tool_app, file_name_actions, XtNumber(file_name_actions)); } create_dirinfo(False, browse_panel, browse_selfile, &beside, &below, &browse_mask, &browse_dir, &browse_flist, &browse_dlist, E_FILE_WIDTH, False); /* make <return> in the filename window apply the file */ XtOverrideTranslations(browse_selfile, XtParseTranslationTable(file_name_translations)); /* make <return> and a double click in the file list window apply the file and close */ XtAugmentTranslations(browse_flist, XtParseTranslationTable(file_list_translations)); FirstArg(XtNlabel, " Close "); NextArg(XtNvertDistance, 15); NextArg(XtNhorizDistance, 25); NextArg(XtNheight, 25); NextArg(XtNfromHoriz, beside); NextArg(XtNfromVert, below); NextArg(XtNborderWidth, INTERNAL_BW); NextArg(XtNtop, XtChainBottom); NextArg(XtNbottom, XtChainBottom); closebtn = XtCreateManagedWidget("close", commandWidgetClass, browse_panel, Args, ArgCount); XtAddEventHandler(closebtn, ButtonReleaseMask, False, (XtEventHandler)browse_panel_close, (XtPointer) NULL); FirstArg(XtNlabel, " Apply "); NextArg(XtNborderWidth, INTERNAL_BW); NextArg(XtNfromHoriz, closebtn); NextArg(XtNfromVert, below); NextArg(XtNvertDistance, 15); NextArg(XtNhorizDistance, 25); NextArg(XtNheight, 25); NextArg(XtNtop, XtChainBottom); NextArg(XtNbottom, XtChainBottom); apply = XtCreateManagedWidget("apply", commandWidgetClass, browse_panel, Args, ArgCount); XtAddEventHandler(apply, ButtonReleaseMask, False, (XtEventHandler)got_browse, (XtPointer) NULL); XtInstallAccelerators(browse_panel, closebtn); XtInstallAccelerators(browse_panel, apply); }
mo_status mo_post_history_win (mo_window *win) { if (!win->history_win) { Widget dialog_frame; Widget dialog_sep, buttons_form; Widget history_label; Widget history_form; XtTranslations listTable; static char listTranslations[] = "~Shift ~Ctrl ~Meta ~Alt <Btn2Down>: ListKbdSelectAll() ListBeginSelect() \n\ ~Shift ~Ctrl ~Meta ~Alt <Btn2Up>: ListEndSelect() ListKbdActivate()"; listTable = XtParseTranslationTable(listTranslations); /* Create it for the first time. */ XmxSetUniqid (win->id); win->history_win = XmxMakeFormDialog (win->base, "NCSA Mosaic: Window History" ); dialog_frame = XmxMakeFrame (win->history_win, XmxShadowOut); /* Constraints for base. */ XmxSetConstraints (dialog_frame, XmATTACH_FORM, XmATTACH_FORM, XmATTACH_FORM, XmATTACH_FORM, NULL, NULL, NULL, NULL); /* Main form. */ history_form = XmxMakeForm (dialog_frame); XmxSetArg (XmNalignment, XmALIGNMENT_BEGINNING); history_label = XmxMakeLabel (history_form, "Where you've been:" ); /* History list itself. */ XmxSetArg (XmNresizable, False); XmxSetArg (XmNscrollBarDisplayPolicy, XmSTATIC); XmxSetArg (XmNlistSizePolicy, XmCONSTANT); XmxSetArg (XmNwidth, 380); XmxSetArg (XmNheight, 184); win->history_list = XmxMakeScrolledList (history_form, history_list_cb, 0); XtAugmentTranslations (win->history_list, listTable); dialog_sep = XmxMakeHorizontalSeparator (history_form); buttons_form = XmxMakeFormAndThreeButtons(history_form, history_win_cb, "Mail To...", "Dismiss", "Help...", 1, 0, 2); /* Constraints for history_form. */ XmxSetOffsets (history_label, 8, 0, 10, 10); XmxSetConstraints (history_label, XmATTACH_FORM, XmATTACH_NONE, XmATTACH_FORM, XmATTACH_NONE, NULL, NULL, NULL, NULL); /* History list is stretchable. */ XmxSetOffsets (XtParent (win->history_list), 0, 10, 10, 10); XmxSetConstraints (XtParent (win->history_list), XmATTACH_WIDGET, XmATTACH_WIDGET, XmATTACH_FORM, XmATTACH_FORM, history_label, dialog_sep, NULL, NULL); XmxSetArg (XmNtopOffset, 10); XmxSetConstraints (dialog_sep, XmATTACH_NONE, XmATTACH_WIDGET, XmATTACH_FORM, XmATTACH_FORM, NULL, buttons_form, NULL, NULL); XmxSetConstraints (buttons_form, XmATTACH_NONE, XmATTACH_FORM, XmATTACH_FORM, XmATTACH_FORM, NULL, NULL, NULL, NULL); /* Go get the history up to this point set up... */ mo_load_history_list (win, win->history_list); }