void fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (/* ??? */), Widget show_widget) { DeclareArgs(2); Position xposn, yposn; Widget widg; font_ps_sel = psfont_adr; font_latex_sel = latexfont_adr; flag_sel = psflag_adr; font_setimage = showfont_fn; font_widget = show_widget; if (first_fontmenu) { first_fontmenu = False; /* don't reposition it if user has already popped it */ XtTranslateCoords(tool, CANVAS_WD/4, CANVAS_HT/4, &xposn, &yposn); FirstArg(XtNx, xposn); /* position about 1/4 from upper-left corner of canvas */ NextArg(XtNy, yposn); SetValues(ps_fontmenu); SetValues(latex_fontmenu); } widg = *flag_sel ? ps_fontmenu : latex_fontmenu; XtPopup(widg, XtGrabExclusive); /* if the file message window is up add it to the grab */ file_msg_add_grab(); /* insure that the most recent colormap is installed */ set_cmap(XtWindow(widg)); XSetWMProtocols(tool_d, XtWindow(widg), &wm_delete_window, 1); }
static void handle_colormap_notify(const XColormapEvent *ev) { WClientWin *cwin; if(!ev->new) return; cwin=find_clientwin(ev->window); if(cwin!=NULL) set_cmap(cwin, ev->colormap); }
void popup_browse_panel(Widget w) { char *fval, *pval; set_temp_cursor(wait_cursor); XtSetSensitive(w, False); browse_parent = w; browse_up = True; file_viewed[0] = '\0'; if (!browse_popup) { get_directory(local_dir); } else { strcpy(local_dir, cur_browse_dir); } /* move to the file directory - if not the current dir and set up the file/directory values */ pval = (char*) panel_get_value( pic_name_panel ); fval = strrchr(pval, '/'); if ( !fval ) { /* no path in name so just use name */ strcpy(browse_filename, pval); } else { /* set us up in the same path as the file */ strcpy(local_dir, pval); strcpy(browse_filename, fval+1); local_dir[strlen(pval) - strlen(fval)] = '\0'; (void) change_directory(local_dir); } if (!browse_popup) { create_browse_panel(w); } FirstArg(XtNstring, local_dir); SetValues(browse_dir); FirstArg(XtNstring, browse_filename); SetValues(browse_selfile); XtPopup(browse_popup, XtGrabNonexclusive); Rescan(0, 0, 0, 0); (void) XSetWMProtocols(tool_d, XtWindow(browse_popup), &wm_delete_window, 1); /* if the file message window is up add it to the grab */ file_msg_add_grab(); set_cmap(XtWindow(browse_popup)); /* ensure most recent cmap is installed */ reset_cursor(); }
static void fontpane_swap(void) { Widget widg; XtPopdown(*flag_sel ? ps_fontmenu : latex_fontmenu); *flag_sel = 1 - *flag_sel; /* put image of font in indicator window */ (*font_setimage) (font_widget); widg = *flag_sel ? ps_fontmenu : latex_fontmenu; XtPopup(widg, XtGrabExclusive); /* if the file message window is up add it to the grab */ file_msg_add_grab(); /* insure that the most recent colormap is installed */ set_cmap(XtWindow(widg)); XSetWMProtocols(tool_d, XtWindow(widg), &wm_delete_window, 1); }
void popup_print_panel(Widget w) { char buf[30]; /* turn off Compose key LED */ setCompLED(0); set_temp_cursor(wait_cursor); if (print_popup) { /* the print popup already exists, but the magnification may have been changed in the export popup */ sprintf(buf,"%.1f",appres.magnification); FirstArg(XtNstring, buf); SetValues(print_mag_text); /* also the figure size (magnification * bounding_box) */ print_update_figure_size(); /* now set the color and name in the background button */ set_but_col(print_background_panel, export_background_color); /* and the background color menu */ XtDestroyWidget(background_menu); background_menu = make_color_popup_menu(print_background_panel, "Background Color", background_select, NO_TRANSP, INCL_BACKG); } else { create_print_panel(w); } XtPopup(print_popup, XtGrabNone); /* now that the popup is realized, put in the name of the first printer */ if (printer_names[0] != NULL) { FirstArg(XtNlabel, printer_names[0]); SetValues(printer_menu_button); } /* insure that the most recent colormap is installed */ set_cmap(XtWindow(print_popup)); (void) XSetWMProtocols(tool_d, XtWindow(print_popup), &wm_delete_window, 1); reset_cursor(); }
void popup_spell_check_panel(char **list, int nitems) { static Boolean actions_added = False; Widget form, dismiss_button, below, label; int x_val, y_val; /* if panel already exists, just replace the list of words */ if (spell_check_panel != None) { XawListChange(word_list, list, nitems, 0, False); } else { /* must create it */ get_pointer_root_xy(&x_val, &y_val); FirstArg(XtNx, (Position) x_val); NextArg(XtNy, (Position) y_val); NextArg(XtNcolormap, tool_cm); NextArg(XtNtitle, "Xfig: Misspelled words"); spell_check_panel = XtCreatePopupShell("spell_check_panel", transientShellWidgetClass, tool, Args, ArgCount); XtOverrideTranslations(spell_check_panel, XtParseTranslationTable(spell_panel_translations)); if (!actions_added) { XtAppAddActions(tool_app, spell_actions, XtNumber(spell_actions)); actions_added = True; } form = XtCreateManagedWidget("form", formWidgetClass, spell_check_panel, NULL, ZERO); /* make a label to report either "No misspelled words" or "Misspelled words:" */ FirstArg(XtNlabel, "Spell checker"); NextArg(XtNjustify, XtJustifyLeft); NextArg(XtNwidth, 375); NextArg(XtNheight, 20); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainRight); spell_msg_win = XtCreateManagedWidget("spell_msg_win", labelWidgetClass, form, Args, ArgCount); /* labels for list and correct word entry */ FirstArg(XtNlabel, "Misspelled words "); NextArg(XtNfromVert, spell_msg_win); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainRight); label = XtCreateManagedWidget("misspelled_label", labelWidgetClass, form, Args, ArgCount); below = label; FirstArg(XtNlabel, "Correction"); NextArg(XtNfromVert, spell_msg_win); NextArg(XtNfromHoriz, label); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainRight); label = XtCreateManagedWidget("correction_label", labelWidgetClass, form, Args, ArgCount); /* make a viewport to hold the list widget containing the misspelled words */ FirstArg(XtNallowVert, True); NextArg(XtNfromVert, below); NextArg(XtNvertDistance, 1); NextArg(XtNwidth, 150); NextArg(XtNheight, 200); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainBottom); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainRight); spell_viewport = XtCreateManagedWidget("spellvport", viewportWidgetClass, form, Args, ArgCount); /* now make the list widget */ FirstArg(XtNlist, list); NextArg(XtNnumberStrings, nitems); NextArg(XtNforceColumns, True); /* force to one column */ NextArg(XtNdefaultColumns, 1); /* ditto */ NextArg(XtNwidth, 150); NextArg(XtNheight, 200); word_list = XtCreateManagedWidget("word_list", figListWidgetClass, spell_viewport, Args, ArgCount); XtAddCallback(word_list, XtNcallback, spell_select_word, (XtPointer) NULL); /* now an ascii widget to put the correct word into */ FirstArg(XtNeditType, XawtextRead); /* make uneditable until user selects a misspelled word */ NextArg(XtNsensitive, False); /* start insensitive */ NextArg(XtNfromVert, below); NextArg(XtNvertDistance, 1); NextArg(XtNfromHoriz, spell_viewport); /* to the right of the viewport */ NextArg(XtNwidth, 150); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); correct_word = XtCreateManagedWidget("correct_word", asciiTextWidgetClass, form, Args, ArgCount); /* "Return" corrects word */ XtOverrideTranslations(correct_word, XtParseTranslationTable(spell_text_translations)); /* focus keyboard on text widget */ XtSetKeyboardFocus(form, correct_word); /* now "Correct" button to the right */ FirstArg(XtNlabel, "Correct"); NextArg(XtNsensitive, False); /* start insensitive */ NextArg(XtNfromVert, below); NextArg(XtNvertDistance, 1); NextArg(XtNfromHoriz, correct_word); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); correct_button = XtCreateManagedWidget("correct", commandWidgetClass, form, Args, ArgCount); XtAddCallback(correct_button, XtNcallback, (XtCallbackProc) spell_correct_word, (XtPointer) NULL); /* make a re-check spelling button at bottom of whole panel */ FirstArg(XtNlabel, "Recheck"); NextArg(XtNfromVert, spell_viewport); NextArg(XtNsensitive, False); /* insensitive to start */ NextArg(XtNtop, XtChainBottom); NextArg(XtNbottom, XtChainBottom); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); recheck_button = XtCreateManagedWidget("recheck", commandWidgetClass, form, Args, ArgCount); XtAddCallback(recheck_button, XtNcallback, (XtCallbackProc) spell_check, (XtPointer) NULL); /* make dismiss button to the right of the recheck button */ FirstArg(XtNlabel, "Dismiss"); NextArg(XtNfromVert, spell_viewport); NextArg(XtNfromHoriz, recheck_button); NextArg(XtNtop, XtChainBottom); NextArg(XtNbottom, XtChainBottom); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); dismiss_button = XtCreateManagedWidget("dismiss", commandWidgetClass, form, Args, ArgCount); XtAddCallback(dismiss_button, XtNcallback, (XtCallbackProc) spell_panel_dismiss, (XtPointer) NULL); /* install accelerators for the dismiss function */ XtInstallAccelerators(form, dismiss_button); XtInstallAccelerators(word_list, dismiss_button); } XtPopup(spell_check_panel, XtGrabExclusive); /* if the file message window is up add it to the grab */ file_msg_add_grab(); XSetWMProtocols(tool_d, XtWindow(spell_check_panel), &wm_delete_window, 1); set_cmap(XtWindow(spell_check_panel)); }
void popup_search_panel(void) { static Boolean actions_added = False; Widget below = None; Widget form, label, dismiss_button; int rx,ry; /* turn off Compose key LED */ setCompLED(0); /* don't paste if in the middle of drawing/editing */ if (check_action_on()) return; /* don't make another one if one already exists */ if (search_panel) { return; } put_msg("Search & Replace"); get_pointer_root_xy(&rx, &ry); FirstArg(XtNx, (Position) rx); NextArg(XtNy, (Position) ry); NextArg(XtNcolormap, tool_cm); NextArg(XtNtitle, "Xfig: Search & Replace"); search_panel = XtCreatePopupShell("search_panel", transientShellWidgetClass, tool, Args, ArgCount); XtOverrideTranslations(search_panel, XtParseTranslationTable(search_panel_translations)); if (!actions_added) { XtAppAddActions(tool_app, search_actions, XtNumber(search_actions)); actions_added = True; } form = XtCreateManagedWidget("form", formWidgetClass, search_panel, NULL, 0) ; FirstArg(XtNlabel, " Search for:"); NextArg(XtNborderWidth, 0); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); label = XtCreateManagedWidget("search_lab", labelWidgetClass, form, Args, ArgCount); FirstArg(XtNfromHoriz, label); NextArg(XtNeditType, XawtextEdit); NextArg(XtNwidth, 200); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); search_text_widget = XtCreateManagedWidget("search_text", asciiTextWidgetClass, form, Args, ArgCount); XtOverrideTranslations(search_text_widget, XtParseTranslationTable(search_text_translations)); /* search button */ FirstArg(XtNlabel, "Search "); NextArg(XtNfromHoriz, search_text_widget); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); search_button = XtCreateManagedWidget("search", commandWidgetClass, form, Args, ArgCount); XtAddCallback(search_button, XtNcallback, (XtCallbackProc) search_and_replace_text, (XtPointer) NULL); (void) CreateCheckbutton("Case sensitive", "case_sensitive", form, NULL, search_button, MANAGE, SMALL_CHK, &case_sensitive, 0, 0); below = label; FirstArg(XtNfromVert, below); NextArg(XtNvertDistance, 6); NextArg(XtNborderWidth, 0); NextArg(XtNlabel, "Replace with:"); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); replace_text_label = XtCreateManagedWidget("replace_lab", labelWidgetClass, form, Args, ArgCount); FirstArg(XtNfromVert, below); NextArg(XtNvertDistance, 6); NextArg(XtNfromHoriz, replace_text_label); NextArg(XtNeditType, XawtextEdit); NextArg(XtNwidth, 200); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); replace_text_widget = XtCreateManagedWidget("replace_text", asciiTextWidgetClass, form, Args, ArgCount); XtOverrideTranslations(replace_text_widget, XtParseTranslationTable(replace_text_translations)); FirstArg(XtNfromVert, below); NextArg(XtNfromHoriz, replace_text_widget); NextArg(XtNlabel, "Replace"); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); do_replace_button = XtCreateManagedWidget("do_replace", commandWidgetClass, form, Args, ArgCount); XtAddCallback(do_replace_button, XtNcallback, (XtCallbackProc) do_replace, (XtPointer) NULL); FirstArg(XtNfromVert, below); NextArg(XtNfromHoriz, do_replace_button); NextArg(XtNlabel, "UPDATE settings"); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); do_update_button = XtCreateManagedWidget("dismiss", commandWidgetClass, form, Args, ArgCount); XtAddCallback(do_update_button, XtNcallback, (XtCallbackProc) do_update, (XtPointer) NULL); below = replace_text_widget; /* make a label to report if no match for search */ FirstArg(XtNlabel, "Enter search string and press \"Search\""); NextArg(XtNfromVert, below); NextArg(XtNjustify, XtJustifyLeft); NextArg(XtNwidth, SEARCH_WIDTH); NextArg(XtNheight, 20); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainTop); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); search_msg_win = XtCreateManagedWidget("search_msg_win", labelWidgetClass, form, Args, ArgCount); below = search_msg_win; /* make a text window to hold search results */ FirstArg(XtNwidth, SEARCH_WIDTH); NextArg(XtNfromVert, below); NextArg(XtNheight, 200); NextArg(XtNeditType, XawtextRead); NextArg(XtNdisplayCaret, False); NextArg(XtNscrollHorizontal, XawtextScrollWhenNeeded); NextArg(XtNscrollVertical, XawtextScrollAlways); NextArg(XtNtop, XtChainTop); NextArg(XtNbottom, XtChainBottom); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); search_results_win = XtCreateManagedWidget("search_results_win", asciiTextWidgetClass, form, Args, ArgCount); XtOverrideTranslations(search_results_win, XtParseTranslationTable(search_results_translations)); below = search_results_win; /* make a dismiss button */ FirstArg(XtNfromVert, below); NextArg(XtNlabel, "Dismiss"); NextArg(XtNtop, XtChainBottom); NextArg(XtNbottom, XtChainBottom); NextArg(XtNleft, XtChainLeft); NextArg(XtNright, XtChainLeft); dismiss_button = XtCreateManagedWidget("dismiss", commandWidgetClass, form, Args, ArgCount); XtAddCallback(dismiss_button, XtNcallback, (XtCallbackProc) search_panel_dismiss, (XtPointer) NULL); /* make update/replace buttons insensitive to start */ XtSetSensitive(replace_text_label, False); XtSetSensitive(do_replace_button, False); XtSetSensitive(do_update_button, False); XtPopup(search_panel, XtGrabNone); XSetWMProtocols(tool_d, XtWindow(search_panel), &wm_delete_window, 1); set_cmap(XtWindow(search_panel)); }
static int vidcvideoioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) { struct vcons_data *vd = v; struct vidcvideo_softc *sc = vd->cookie; struct fb_devconfig *dc = sc->sc_dc; struct vcons_screen *ms = vd->active; int state; switch (cmd) { case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_VIDC; return 0; case WSDISPLAYIO_GINFO: if (ms == NULL) return ENODEV; #define wsd_fbip ((struct wsdisplay_fbinfo *)data) wsd_fbip->height = dc->dc_height; wsd_fbip->width = dc->dc_width; wsd_fbip->depth = dc->dc_depth; wsd_fbip->cmsize = CMAP_SIZE; #undef fbt return 0; case WSDISPLAYIO_GETCMAP: return get_cmap(sc, (struct wsdisplay_cmap *)data); case WSDISPLAYIO_PUTCMAP: return set_cmap(sc, (struct wsdisplay_cmap *)data); case WSDISPLAYIO_LINEBYTES: *(u_int *)data = dc->dc_rowbytes; return 0; case WSDISPLAYIO_SVIDEO: state = *(int *)data; dc->dc_blanked = (state == WSDISPLAYIO_VIDEO_OFF); vidcvideo_queue_dc_change(dc, WSDISPLAY_VIDEO_ONOFF); /* done on video blank */ return 0; case WSDISPLAYIO_GVIDEO: *(u_int *)data = dc->dc_blanked ? WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON; return 0; case WSDISPLAYIO_GCURPOS: *(struct wsdisplay_curpos *)data = dc->dc_cursor.cc_pos; return 0; case WSDISPLAYIO_SCURPOS: set_curpos(sc, (struct wsdisplay_curpos *)data); vidcvideo_queue_dc_change(dc, WSDISPLAY_CURSOR_DOPOS); return 0; case WSDISPLAYIO_GCURMAX: ((struct wsdisplay_curpos *)data)->x = CURSOR_MAX_WIDTH; ((struct wsdisplay_curpos *)data)->y = CURSOR_MAX_HEIGHT; return 0; case WSDISPLAYIO_GCURSOR: return get_cursor(sc, (struct wsdisplay_cursor *)data); case WSDISPLAYIO_SCURSOR: return set_cursor(sc, (struct wsdisplay_cursor *)data); case WSDISPLAYIO_SMODE: state = *(int *)data; if (state == WSDISPLAYIO_MODE_MAPPED) dc->dc_hwscroll_cookie = vidcvideo_hwscroll_reset(); if (state == WSDISPLAYIO_MODE_EMUL) vidcvideo_hwscroll_back(dc->dc_hwscroll_cookie); vidcvideo_progr_scroll(); return 0; } return EPASSTHROUGH; }