void build_stress_plotwin(Widget parent, Widget href, Widget vref) { Widget str_label; stress_form = XtVaCreateManagedWidget("Stress", formWidgetClass, parent, XtNfromHoriz, href, XtNfromVert, vref, NULL); if (mono) set_mono(stress_form); str_width = runPanelWidth + mdsPanelWidth + 15; str_label = XtVaCreateManagedWidget("Label", labelWidgetClass, stress_form, XtNlabel, "Stress function", XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainRight, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, XtNwidth, str_width, XtNborderWidth, 0, NULL); if (mono) set_mono(str_label); str_wksp = XtVaCreateManagedWidget("Stress", labelWidgetClass, stress_form, XtNfromVert, str_label, XtNresizable, (Boolean) True, XtNleft, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNright, (XtEdgeType) XtChainRight, XtNbottom, (XtEdgeType) XtChainBottom, XtNheight, str_height, XtNwidth, str_width, XtNlabel, (String) "", NULL); if (mono) set_mono(str_wksp); XtAddEventHandler(str_wksp, ExposureMask, FALSE, (XtEventHandler) str_expose_cback, (XtPointer) NULL); XtAddEventHandler(str_wksp, StructureNotifyMask, FALSE, (XtEventHandler) str_resize_cback, (XtPointer) NULL); }
/* ARGSUSED */ XtCallbackProc open_tform_popup_cback(Widget w, xgobidata *xg, XtPointer callback_data) { Widget close; Widget form0; Dimension width, height; register int j, k; Widget box_variables, box_varlabels, box_tforms; Widget power_form, reduce_exp_arr, exp_sbar; Widget increase_exp_arr; char str[64]; static char *domain_menu_str = "Domain adjustment:"; Widget domain_menu_box, domain_menu_lab, domain_menu; Widget vport, vport_child; /*Widget reset_vgroups_cmd;*/ Widget box_stage[4]; Boolean doit = false; Dimension maxwidth = 0; if (tpopup == NULL) { tform_cols = (int *) XtMalloc((Cardinal) (xg->ncols-1) * sizeof(int)); var_cbox = (Widget *) XtMalloc((Cardinal) (xg->ncols-1) * sizeof(Widget)); /* xg->sph_vars = (int *) XtMalloc((Cardinal) (xg->ncols-1) * sizeof(int));* sphere - moved back to tour_pp */ alloc_transform_tp(xg); if (popupx == -1 && popupy == -1) { XtVaGetValues(xg->workspace, XtNwidth, &width, XtNheight, &height, NULL); XtTranslateCoords(xg->workspace, (Position) width, (Position) (height/2), &popupx, &popupy); } tpopup = XtVaCreatePopupShell("Variable Transformation", topLevelShellWidgetClass, xg->shell, XtNx, popupx, XtNy, popupy, XtNinput, True, XtNtitle, "Transform variables", XtNiconName, "Tform", NULL); if (mono) set_mono(tpopup); /* * Create a paned widget so the 'Click here ...' * can be all across the bottom. */ tpane = XtVaCreateManagedWidget("Form", panedWidgetClass, tpopup, XtNorientation, (XtOrientation) XtorientVertical, XtNresizable, False, NULL); form0 = XtVaCreateManagedWidget("Form", formWidgetClass, tpane, XtNresizable, False, NULL); if (mono) set_mono(form0); box_tforms = XtVaCreateManagedWidget("Close", boxWidgetClass, form0, XtNorientation, (XtOrientation) XtorientVertical, XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, NULL); /* Stage 0: domain adjustment */ box_stage[0] = XtVaCreateManagedWidget("Close", boxWidgetClass, box_tforms, XtNorientation, (XtOrientation) XtorientHorizontal, NULL); domain_ind = DOMAIN_OK; build_labelled_menu(&domain_menu_box, &domain_menu_lab, domain_menu_str, &domain_menu_cmd, &domain_menu, domain_menu_btn, domain_menu_btn_label, domain_menu_btn_label, /* no nicknames */ NDOMAINBTNS, domain_ind, box_stage[0], NULL, XtorientHorizontal, appdata.font, "Transformations", xg); for (k=0; k<NDOMAINBTNS; k++) XtAddCallback(domain_menu_btn[k], XtNcallback, (XtCallbackProc) set_domain_incr_cback, (XtPointer) xg); /* Stage 1: most transformations */ box_stage[1] = XtVaCreateManagedWidget("Close", boxWidgetClass, box_tforms, NULL); XtVaCreateManagedWidget("Transformation Stage 1:", labelWidgetClass, box_stage[1], NULL); /* Power family */ power_form = XtVaCreateManagedWidget("Form", boxWidgetClass, box_stage[1], XtNresizable, False, XtNorientation, XtorientHorizontal, XtNhSpace, 1, XtNvSpace, 1, NULL); XtVaCreateManagedWidget("Label", labelWidgetClass, power_form, XtNlabel, (String) "Power (Box-Cox)", NULL); reduce_exp_arr = XtVaCreateManagedWidget("Icon", commandWidgetClass, power_form, XtNinternalHeight, (Dimension) 0, XtNinternalWidth, (Dimension) 0, XtNborderColor, (Pixel) appdata.fg, XtNbitmap, (Pixmap) leftarr, NULL); if (mono) set_mono(reduce_exp_arr); XtAddCallback(reduce_exp_arr, XtNcallback, (XtCallbackProc) reduce_exp_cback, (XtPointer) xg); sprintf(str, "Power Tformations"); width = XTextWidth(appdata.font, str, strlen(str)); exp_sbar = XtVaCreateManagedWidget("Scrollbar", scrollbarWidgetClass, power_form, XtNhorizDistance, (Dimension) 0, XtNwidth, (Dimension) width, XtNheight, (Dimension) 20, XtNorientation, (XtOrientation) XtorientHorizontal, NULL); if (mono) set_mono(exp_sbar); XtAddCallback(exp_sbar, XtNjumpProc, (XtCallbackProc) exp_sbar_cback, (XtPointer) xg); /* * -4,4 -> 0,1 */ XawScrollbarSetThumb(exp_sbar, (1. + 4)/8., -1.); increase_exp_arr = XtVaCreateManagedWidget("Icon", commandWidgetClass, power_form, XtNinternalHeight, (Dimension) 0, XtNinternalWidth, (Dimension) 0, XtNborderColor, (Pixel) appdata.fg, XtNhorizDistance, (Dimension) 0, XtNbitmap, (Pixmap) rightarr, NULL); if (mono) set_mono(increase_exp_arr); XtAddCallback(increase_exp_arr, XtNcallback, (XtCallbackProc) increase_exp_cback, (XtPointer) xg); (void) sprintf(str, "%1.2f", -9.99); width = XTextWidth(appdata.font, str, strlen(str) + 2*ASCII_TEXT_BORDER_WIDTH); (void) sprintf(str, "%4.2f", exponent); exponent_lbl = XtVaCreateManagedWidget("StdizeLabel", labelWidgetClass, power_form, XtNlabel, (String) str, XtNwidth, width, NULL); if (mono) set_mono(exponent_lbl); /* From Absolute Value to Normal Score */ for (j=0; j<N1TFORMS; j++) { if (j != 2) { stage1_tform_cmd[j] = CreateCommand(xg, stage1_tform_names[j], True, NULL, NULL, box_stage[1], "Transformations"); XtManageChild(stage1_tform_cmd[j]); XtAddCallback(stage1_tform_cmd[j], XtNcallback, (XtCallbackProc) stage1_tform_cback, (XtPointer) xg); } } /* Stage 2: permutation, sorting, sphering */ box_stage[2] = XtVaCreateManagedWidget("Close", boxWidgetClass, box_tforms, NULL); XtVaCreateManagedWidget("Transformation Stage 2:", labelWidgetClass, box_stage[2], NULL); for (j=0; j<N2TFORMS-1; j++) { stage2_tform_cmd[j] = CreateCommand(xg, stage2_tform_names[j], True, NULL, NULL, box_stage[2], "Transformations"); XtManageChild(stage2_tform_cmd[j]); XtAddCallback(stage2_tform_cmd[j], XtNcallback, (XtCallbackProc) stage2_tform_cback, (XtPointer) xg); } stage2_tform_cmd[SPHERE] = CreateCommand(xg, stage2_tform_names[SPHERE], True, NULL, NULL, box_stage[2], "Transformations"); XtManageChild(stage2_tform_cmd[SPHERE]); XtAddCallback(stage2_tform_cmd[SPHERE], XtNcallback, (XtCallbackProc) open_sphere_popup_cback, (XtPointer) xg); vport = XtVaCreateManagedWidget("ViewPort", viewportWidgetClass, form0, XtNallowHoriz, False, XtNallowVert, True, XtNfromHoriz, box_tforms, XtNleft, (XtEdgeType) XtChainLeft, XtNmappedWhenManaged, False, NULL); vport_child = XtVaCreateManagedWidget("Box", boxWidgetClass, vport, XtNorientation, (XtOrientation) XtorientHorizontal, NULL); box_variables = XtVaCreateManagedWidget("Box", formWidgetClass, vport_child, XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, NULL); for (j=0; j<xg->ncols-1; j++) { var_cbox[j] = CreateToggle(xg, xg->collab[j], True, NULL, NULL, NULL, False, ANY_OF_MANY, box_variables, "Transformations"); if (j>0) XtVaSetValues(var_cbox[j], XtNfromVert, var_cbox[j-1], NULL); XtAddCallback(var_cbox[j], XtNcallback, (XtCallbackProc) var_cback, (XtPointer) xg); } XtManageChildren(var_cbox, xg->ncols-1); /* * dfs: let's just hide this thing reset_vgroups_cmd = CreateCommand(xg, "Restore vgroups", True, box_tforms, vport, form0, "Transformations"); XtManageChild(reset_vgroups_cmd); XtAddCallback(reset_vgroups_cmd, XtNcallback, (XtCallbackProc) reset_vgroups_cback, (XtPointer) xg); */ box_varlabels = XtVaCreateManagedWidget("Form", formWidgetClass, vport_child, XtNorientation, (XtOrientation) XtorientVertical, XtNfromHoriz, box_variables, NULL); for (j=0; j<xg->ncols-1; j++) { sprintf(str, "%s(%s(%s)))", "Stdize", "Perm", xg->collab[j]); width = XTextWidth(appdata.font, str, strlen(str)) + 2*ASCII_TEXT_BORDER_WIDTH; if (width > maxwidth) maxwidth = width; } width = XTextWidth(appdata.font, "normsc()", strlen("normsc()")) + 2*ASCII_TEXT_BORDER_WIDTH; maxwidth += width; varlabel = (Widget *) XtMalloc((Cardinal) (xg->ncols-1) * sizeof(Widget)); for (j=0; j<xg->ncols-1; j++) { varlabel[j] = XtVaCreateWidget("Label", labelWidgetClass, box_varlabels, XtNlabel, (String) xg->collab_tform2[j], XtNfromVert, (j>0) ? varlabel[j-1] : NULL, XtNwidth, maxwidth, NULL); } XtManageChildren(varlabel, xg->ncols-1); close = XtVaCreateManagedWidget("Close", commandWidgetClass, tpane, XtNshowGrip, (Boolean) False, XtNskipAdjust, (Boolean) True, XtNlabel, (String) "Click here to dismiss", NULL); if (mono) set_mono(close); XtAddCallback(close, XtNcallback, (XtCallbackProc) close_cback, (XtPointer) xg); set_initial_variable(xg); doit = true; } XtPopup(tpopup, (XtGrabKind) XtGrabNone); set_wm_protocols(tpopup); XRaiseWindow(display, XtWindow(tpopup)); if (doit) { Dimension hgt; XtVaGetValues(box_tforms, XtNheight, &hgt, NULL); XtVaSetValues(vport, XtNheight, hgt, NULL); XtMapWidget(vport); } }
/* tuner abstraction layer: set something to the tuner */ int ipod_rmt_tuner_set(int setting, int value) { switch(setting) { case RADIO_SLEEP: { rmt_tuner_sleep(value); sleep(HZ/10); if(value) { tuner_frequency = 0; } break; } case RADIO_FREQUENCY: { rmt_tuner_set_freq(value); if (reply_timeout()) return 0; break; } case RADIO_SCAN_FREQUENCY: { const struct fm_region_data * const fmr = &fm_region_data[global_settings.fm_region]; /* case: scan for presets, back to beginning of the band */ if ((radio_tuned == 1) && (value == fmr->freq_min)) { tuner_set(RADIO_FREQUENCY,value); } /* scan through frequencies */ if (radio_tuned == 1) { if ((tuner_frequency <= fmr->freq_min) && (tuner_frequency >= fmr->freq_max)) { tuner_set(RADIO_FREQUENCY,value); } /* scan down */ if(value < tuner_frequency) rmt_tuner_scan(-1); /* scan up */ else rmt_tuner_scan(1); sleep(HZ/10); if (reply_timeout()) { tuner_set(RADIO_FREQUENCY,value); rmt_tuner_scan(1); if (reply_timeout() == true) return 0; } radio_tuned = 0; } if (tuner_frequency == value) { radio_tuned = 1; return 1; } else { radio_tuned = 0; return 0; } } case RADIO_MUTE: { /* mute flag sent to accessory */ /* rmt_tuner_mute(value); */ break; } case RADIO_REGION: { const struct rmt_tuner_region_data *rd = &rmt_tuner_region_data[value]; rmt_tuner_region(rd->band); set_deltafreq(rd->spacing); set_deemphasis(rd->deemphasis); rmt_tuner_set_param(tuner_param); break; } case RADIO_FORCE_MONO: { set_mono(value); break; } default: return -1; } return 1; }
void make_plot1d(xgobidata *xg) { /* * Plot1DPanel: plot1d_panel */ char str[35]; Dimension width, max_width; Widget ptype_box, cycle_box, ash_box; /* * Widest button label used in this panel. */ (void) sprintf(str, "ASH smoothness"); max_width = XTextWidth(appdata.font, str, strlen(str)); plot1d_panel = XtVaCreateManagedWidget("Plot1DPanel", boxWidgetClass, xg->box0, XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, XtNmappedWhenManaged, (Boolean) False, XtNorientation, (XtOrientation) XtorientVertical, NULL); if (mono) set_mono(plot1d_panel); ptype_box = XtVaCreateManagedWidget("Plot1DPanel", boxWidgetClass, plot1d_panel, XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, XtNorientation, (XtOrientation) XtorientVertical, NULL); if (mono) set_mono(ptype_box); plot1d_type_cmd[DOTPLOT] = CreateToggle(xg, "Plot1D", True, (Widget) NULL, (Widget) NULL, (Widget) NULL, (plot1d_type == DOTPLOT), ONE_OF_MANY, ptype_box, "Plot1D"); XtManageChild(plot1d_type_cmd[DOTPLOT]); XtAddCallback(plot1d_type_cmd[DOTPLOT], XtNcallback, (XtCallbackProc) ptype_dotplot_cback, (XtPointer) xg); plot1d_type_cmd[ASH] = CreateToggle(xg, "1D ASH", True, (Widget) NULL, (Widget) NULL, plot1d_type_cmd[DOTPLOT], (plot1d_type == ASH), ONE_OF_MANY, ptype_box, "Plot1D"); XtManageChild(plot1d_type_cmd[ASH]); XtAddCallback(plot1d_type_cmd[ASH], XtNcallback, (XtCallbackProc) ptype_ash_cback, (XtPointer) xg); /* ASH parameter */ ash_box = XtVaCreateManagedWidget("Plot1DPanel", boxWidgetClass, plot1d_panel, NULL); (void) XtVaCreateManagedWidget("Label", labelWidgetClass, ash_box, XtNlabel, "ASH smoothness", NULL); nASHes_sbar = XtVaCreateManagedWidget("Scrollbar", scrollbarWidgetClass, ash_box, XtNorientation, (XtOrientation) XtorientHorizontal, XtNwidth, (Dimension) max_width, NULL); if (mono) set_mono(nASHes_sbar); /* * range of the scrollbar: 0 to 1.0 * desired range: .01 + (0 to .5), which is nASHes/nbins * * (float) (nASHes) / (float) nbins = (slidepos+.01) / 2; * nASHes = (int) (nbins * (slidepos+.01) / 2.0); * slidepos = 2 * (float) nASHes / (float) nbins - .01; */ XawScrollbarSetThumb(nASHes_sbar, 2 * (float) nASHes / (float) nbins - .01, /*-- 2*20/200 - .01 --*/ -1.); XtAddCallback(nASHes_sbar, XtNjumpProc, (XtCallbackProc) nASHes_cback, (XtPointer) xg); add_sbar_help(&xg->nhelpids.sbar, nASHes_sbar, "Plot1D"); sprintf(str, "%1.4f", 0.9999); width = XTextWidth(appdata.font, str, strlen(str)); sprintf(str, "%1.3f", (float)nASHes/(float)nbins); nASHes_label = XtVaCreateManagedWidget("Plot1D", labelWidgetClass, ash_box, XtNlabel, str, XtNwidth, width, NULL); if (mono) set_mono(nASHes_label); /* */ cycle_box = XtVaCreateManagedWidget("Plot1DPanel", boxWidgetClass, plot1d_panel, NULL); plot1d_cycle_cmd = CreateToggle(xg, "Cycle", True, (Widget) NULL, (Widget) NULL, (Widget) NULL, False, ANY_OF_MANY, cycle_box, "Plot1D_Cycle"); XtManageChild(plot1d_cycle_cmd); XtAddCallback(plot1d_cycle_cmd, XtNcallback, (XtCallbackProc) plot1d_cycle_cback, (XtPointer) xg); plot1d_delay_sbar = XtVaCreateManagedWidget("Scrollbar", scrollbarWidgetClass, cycle_box, XtNorientation, (XtOrientation) XtorientHorizontal, XtNwidth, (Dimension) max_width, XtNfromVert, (Widget) plot1d_cycle_cmd, NULL); if (mono) set_mono(plot1d_delay_sbar); /* * delay = 1 / (2*slidepos + .2) * slidepos = 1 / (2*delay) - .1 */ XawScrollbarSetThumb(plot1d_delay_sbar, 1.0 / (2.0 * delay) - 0.1, -1.); XtAddCallback(plot1d_delay_sbar, XtNjumpProc, (XtCallbackProc) plot1d_cycle_delay_cback, (XtPointer) xg); add_sbar_help(&xg->nhelpids.sbar, plot1d_delay_sbar, "Plot1D_Cycle"); plot1d_chdir_cmd = CreateCommand(xg, "Change direction", True, (Widget) NULL, (Widget) NULL, cycle_box, "Plot1D_Cycle"); XtManageChild(plot1d_chdir_cmd); XtAddCallback(plot1d_chdir_cmd, XtNcallback, (XtCallbackProc) plot1d_chdir_cback, (XtPointer) NULL); }
/* ARGSUSED */ XtCallbackProc xgvis_help_input_file_formats_cback(Widget w, XtPointer client_data, XtPointer callback_data) { char fname[100]; char message[MSGLENGTH]; char *xgobidir; FILE *fp; extern xgobidata xgobi; /* defined in xgvis.c */ Dimension width, height; xgobidir = getenv("XGOBID"); if (xgobidir == NULL || strlen(xgobidir) == 0) { xgobidir = (char *) XtMalloc((Cardinal) 150 * sizeof(char)); (void) strcpy(xgobidir, XGOBI_DEFAULTDIR); if (xgobidir == NULL || strlen(xgobidir) == 0) { sprintf(message, "XGOBID is not defined in your environment, and\n"); strcat(message, "XGOBI_DEFAULTDIR is not defined in the XGobi Makefile;\n"); strcat(message, "see the person who installed XGobi for help.\n"); show_message(message, &xgobi); return; } else { (void) strcpy(fname, xgobidir); XtFree((XtPointer) xgobidir); } } else { (void) strcpy(fname, xgobidir); } /* * Check that the file is good. */ (void) strcat(fname, "/help/xgvis_input_file_formats"); if ((fp = fopen(fname, "r")) == NULL) { sprintf(message, "Unable to open %s.\n", fname); strcat(message, "Is the shell variable XGOBID the name of the directory\n"); strcat(message, "which contains the help subdirectory? \n"); show_message(message, &xgobi); return((XtCallbackProc) 0); } else { Widget hpopup, hframe, htext, hdone; /* 80 columns x 20 rows, I hope */ width = 45 * XTextWidth(appdata.helpFont, "M", 1) ; height = 30 * FONTHEIGHT(appdata.helpFont); /* * Create the popup itself. */ hpopup = XtVaCreatePopupShell("Help", topLevelShellWidgetClass, shell, XtNtitle, (String) "XGvis Help Window", XtNiconName, (String) "XGvis Help Window", NULL); if (mono) set_mono(hpopup); /* * Create the paned widget. */ hframe = XtVaCreateManagedWidget("Form", panedWidgetClass, hpopup, XtNorientation, (XtOrientation) XtorientVertical, NULL); if (mono) set_mono(hframe); /* * Create the text widget. */ htext = XtVaCreateManagedWidget("Text", asciiTextWidgetClass, hframe, XtNscrollVertical, (XawTextScrollMode) XawtextScrollAlways, XtNallowResize, (Boolean) True, XtNshowGrip, (Boolean) False, XtNtype, (XawAsciiType) XawAsciiFile, XtNstring, (String) fname, XtNdisplayCaret, (Boolean) False, XtNfont, (XFontStruct *) appdata.helpFont, XtNheight, (Dimension) height, XtNwidth, (Dimension) width, NULL); if (mono) set_mono(htext); /* * Create the Done button. */ hdone = XtVaCreateManagedWidget("Done", commandWidgetClass, hframe, XtNshowGrip, (Boolean) False, XtNskipAdjust, (Boolean) True, XtNlabel, (String) "Click here to dismiss", NULL); if (mono) set_mono(hdone); XtAddCallback(hdone, XtNcallback, (XtCallbackProc) xgvis_help_done_cback, (XtPointer) NULL); XtPopup(hpopup, XtGrabNone); XRaiseWindow(display, XtWindow(hpopup)); set_wm_protocols(hpopup); fclose(fp); } }
/* ARGSUSED */ XtCallbackProc xgvis_help_kruskal_shepard_cback(Widget w, XtPointer client_data, XtPointer callback_data) { char fname[100]; char message[MSGLENGTH]; char *xgobidir; FILE *fp; extern xgobidata xgobi; /* defined in xgvis.c */ /* Dimension height; */ xgobidir = getenv("XGOBID"); if (xgobidir == NULL || strlen(xgobidir) == 0) { xgobidir = (char *) XtMalloc((Cardinal) 150 * sizeof(char)); (void) strcpy(xgobidir, XGOBI_DEFAULTDIR); if (xgobidir == NULL || strlen(xgobidir) == 0) { sprintf(message, "XGOBID is not defined in your environment, and\n"); strcat(message, "XGOBI_DEFAULTDIR is not defined in the XGobi Makefile;\n"); strcat(message, "see the person who installed XGobi for help.\n"); show_message(message, &xgobi); return; } else { (void) strcpy(fname, xgobidir); XtFree((XtPointer) xgobidir); } } else { (void) strcpy(fname, xgobidir); } /* * Check that the file is good. */ (void) strcat(fname, "/bitmaps/stress_kruskal_shepard.xbm"); if ((fp = fopen(fname, "r")) == NULL) { sprintf(message, "Unable to open %s.\n", fname); strcat(message, "Is the shell variable XGOBID the name of the directory\n"); strcat(message, "which contains the help subdirectory? \n"); show_message(message, &xgobi); return((XtCallbackProc) 0); } else { Widget hpopup, hframe, hform, hfunc, hdone; Screen *scrn; Pixmap func_pix; Pixel funcfg, funcbg; /* * Read in the bitmap of the function. */ scrn = XtScreen(shell); funcbg = WhitePixelOfScreen(scrn); funcfg = BlackPixelOfScreen(scrn); func_pix = XCreatePixmapFromBitmapData(display, RootWindowOfScreen(scrn), stress_kruskal_shepard_bits, stress_kruskal_shepard_width, stress_kruskal_shepard_height, funcfg, funcbg, depth); /* 80 columns x 20 rows, I hope */ /* width = 85 * XTextWidth(appdata.helpFont, "M", 1) ; */ /* height = 20 * FONTHEIGHT(appdata.helpFont); */ /* * Create the popup itself. */ hpopup = XtVaCreatePopupShell("Help", topLevelShellWidgetClass, shell, XtNtitle, (String) "XGvis Help Window", XtNiconName, (String) "XGvis Help Window", NULL); if (mono) set_mono(hpopup); /* * Create the paned widget. */ hframe = XtVaCreateManagedWidget("Form", panedWidgetClass, hpopup, XtNorientation, (XtOrientation) XtorientVertical, NULL); if (mono) set_mono(hframe); /* * Create a form widget to hold the label and text. */ hform = XtVaCreateManagedWidget("Help", formWidgetClass, hframe, XtNbackground, funcbg, NULL); hfunc = XtVaCreateManagedWidget("Help", labelWidgetClass, hform, XtNinternalHeight, (Dimension) 0, XtNinternalWidth, (Dimension) 0, /* --------- bitmap goes here ---------------- */ XtNbitmap, (Pixmap) func_pix, XtNborderWidth, 0, NULL); /* * Create the Done button. */ hdone = XtVaCreateManagedWidget("Done", commandWidgetClass, hframe, XtNshowGrip, (Boolean) False, XtNskipAdjust, (Boolean) True, XtNlabel, (String) "Click here to dismiss", NULL); if (mono) set_mono(hdone); XtAddCallback(hdone, XtNcallback, (XtCallbackProc) xgvis_help_done_cback, (XtPointer) NULL); XtPopup(hpopup, XtGrabNone); XRaiseWindow(display, XtWindow(hpopup)); set_wm_protocols(hpopup); fclose(fp); } }
void fname_popup(Widget popup_pop, xgobidata *xg) { Widget fpopup, fform, flabel, ftext, fcancel; Dimension width, height; Position x, y; Cursor text_cursor = XCreateFontCursor(display, XC_xterm); String msg, initname; XtVaGetValues(popup_pop, XtNwidth, &width, XtNheight, &height, NULL); XtTranslateCoords(popup_pop, (Position) (width/2), (Position) (height/2), &x, &y); /* * Create the popup itself. */ fpopup = XtVaCreatePopupShell("FSavePopup", /* * If this is a topLevelShell, the user is asked to * place it; if it's transient, it pops up where we * tell it to. */ /*topLevelShellWidgetClass, popup_pop,*/ transientShellWidgetClass, popup_pop, XtNx, (Position) x, XtNy, (Position) y, XtNinput, (Boolean) True, XtNallowShellResize, (Boolean) True, XtNtitle, (String) "Solicit File Name", NULL); if (mono) set_mono(fpopup); /* * Create the form widget. */ fform = XtVaCreateManagedWidget("FSaveForm", formWidgetClass, fpopup, NULL); if (mono) set_mono(fform); /* * Create the label. */ msg = (String) XtMalloc((Cardinal) 100 * sizeof(char)); initname = (String) XtMalloc((Cardinal) 120 * sizeof(char)); strcpy(msg, ""); strcpy(initname, ""); if (strcmp(xg->save_type, SAVE_SPIN_COEFS) == 0) strcpy(msg, msg1); if (strcmp(xg->save_type, SAVE_SPIN_RMAT) == 0) strcpy(msg, msg1); if (strcmp(xg->save_type, READ_SPIN_RMAT) == 0) strcpy(msg, msg1); else if (strcmp(xg->save_type, SAVE_TOUR_COEFS) == 0) strcpy(msg, msg1); else if (strcmp(xg->save_type, SAVE_TOUR_HIST) == 0) strcpy(msg, msg1); else if (strcmp(xg->save_type, READ_TOUR_HIST) == 0) strcpy(msg, msg1); else if (strcmp(xg->save_type, OPEN_BITMAP_FILE) == 0) strcpy(msg, msg1); flabel = XtVaCreateManagedWidget("FSaveText", labelWidgetClass, fform, XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, XtNlabel, (String) msg, NULL); if (mono) set_mono(flabel); /* * Create the text widget to solicit the filename. */ ftext = XtVaCreateManagedWidget("FSaveName", asciiTextWidgetClass, fform, XtNfromVert, (Widget) flabel, XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainRight, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, XtNresizable, (Boolean) True, XtNeditType, (int) XawtextEdit, XtNresize, (XawTextResizeMode) XawtextResizeWidth, XtNstring, (String) initname, NULL); if (mono) set_mono(ftext); XtAddEventHandler(ftext, KeyPressMask, FALSE, (XtEventHandler) file_save_done, (XtPointer) xg); /* * Add a cancel button */ fcancel = (Widget) CreateCommand(xg, "Cancel", 1, (Widget) NULL, (Widget) ftext, fform, "FSaveCancel"); XtManageChild(fcancel); XtAddCallback(fcancel, XtNcallback, (XtCallbackProc) fcancel_cback, (XtPointer) xg); XtPopup(fpopup, XtGrabExclusive); XRaiseWindow(display, XtWindow(fpopup)); XDefineCursor(display, XtWindow(ftext), text_cursor); /* * Should do something more clever here -- get the size * of the window and place the cursor that way. */ XWarpPointer(display, None, XtWindow(ftext), 0,0,0,0, 10,40); XtFree(msg); XtFree(initname); }
void make_move_points(xgobidata *xg) { /* Widget use_groups_cmd;*/ Widget mpdir_box; int k; mp_panel = XtVaCreateManagedWidget("MvPtsPanel", boxWidgetClass, xg->box0, XtNleft, (XtEdgeType) XtChainLeft, XtNright, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNbottom, (XtEdgeType) XtChainTop, XtNmappedWhenManaged, (Boolean) False, NULL); if (mono) set_mono(mp_panel); build_labelled_menu(&mpdir_box, &mpdir_menu_label, "MotionDir:", &mpdir_menu_cmd, &mpdir_menu, mpdir_menu_btn, mpdir_menu_btn_label, mpdir_menu_btn_label, /* no nicknames */ 3, 0, mp_panel, mpdir_box, XtorientHorizontal, appdata.font, "MovePts", xg); for (k=0; k<3; k++) XtAddCallback(mpdir_menu_btn[k], XtNcallback, (XtCallbackProc) set_mpdir_cback, (XtPointer) xg); movePanel = XtVaCreateManagedWidget("Panel", boxWidgetClass, mp_panel, XtNhorizDistance, 5, XtNvertDistance, 5, XtNorientation, (XtOrientation) XtorientVertical, XtNleft, (XtEdgeType) XtChainLeft, XtNtop, (XtEdgeType) XtChainTop, XtNright, (XtEdgeType) XtChainLeft, XtNbottom, (XtEdgeType) XtChainTop, NULL); if (mono) set_mono(movePanel); move_type_cmd[0] = XtVaCreateWidget("XGVToggle", toggleWidgetClass, movePanel, XtNstate, (Boolean) True, XtNlabel, (String) "Move Point ", NULL); if (mono) set_mono(move_type_cmd[0]); move_type_cmd[1] = XtVaCreateWidget("XGVToggle", toggleWidgetClass, movePanel, XtNlabel, (String) "Move Group", XtNradioGroup, move_type_cmd[0], NULL); if (mono) set_mono(move_type_cmd[1]); move_type_cmd[2] = XtVaCreateWidget("XGVToggle", toggleWidgetClass, movePanel, XtNlabel, (String) "Move All ", XtNradioGroup, move_type_cmd[0], NULL); if (mono) set_mono(move_type_cmd[2]); XtManageChildren(move_type_cmd, 3); setToggleBitmap(move_type_cmd[0], True); setToggleBitmap(move_type_cmd[1], False); setToggleBitmap(move_type_cmd[2], False); XtAddCallback(move_type_cmd[0], XtNcallback, (XtCallbackProc) setMoveTypePointCback, (XtPointer) xg); XtAddCallback(move_type_cmd[1], XtNcallback, (XtCallbackProc) setMoveTypeGroupCback, (XtPointer) xg); XtAddCallback(move_type_cmd[2], XtNcallback, (XtCallbackProc) setMoveTypeAllCback, (XtPointer) xg); reset_all_cmd = CreateCommand(xg, "Reset all", True, (Widget) NULL, (Widget) NULL, mp_panel, "MP_Reset"); XtManageChild(reset_all_cmd); if (xg->progname == NULL) XtSetSensitive(reset_all_cmd, False); XtAddCallback(reset_all_cmd, XtNcallback, (XtCallbackProc) reset_all_cback, (XtPointer) xg); reset_one_cmd = CreateCommand(xg, "Undo last", True, (Widget) NULL, (Widget) NULL, mp_panel, "MP_Reset"); XtManageChild(reset_one_cmd); XtAddCallback(reset_one_cmd, XtNcallback, (XtCallbackProc) reset_one_cback, (XtPointer) xg); }