void update_graph_ui(GraphUI *ui, Quark *q) { if (q && quark_fid_get(q) == QFlavorGraph) { char buf[32]; world w; GLocator *locator; graph_get_world(q, &w); locator = graph_get_locator(q); SetOptionChoice(ui->graph_type, graph_get_type(q)); SetToggleButtonState(ui->stacked, graph_is_stacked(q)); SetToggleButtonState(ui->flip_xy, graph_get_xyflip(q)); sprintf(buf, "%.9g", w.xg1); xv_setstr(ui->start_x, buf); sprintf(buf, "%.9g", w.xg2); xv_setstr(ui->stop_x, buf); SetOptionChoice(ui->scale_x, graph_get_xscale(q)); SetToggleButtonState(ui->invert_x, graph_is_xinvert(q)); sprintf(buf, "%.9g", w.yg1); xv_setstr(ui->start_y, buf); sprintf(buf, "%.9g", w.yg2); xv_setstr(ui->stop_y, buf); SetOptionChoice(ui->scale_y, graph_get_yscale(q)); SetToggleButtonState(ui->invert_y, graph_is_yinvert(q)); sprintf(buf, "%g", graph_get_znorm(q)); xv_setstr(ui->znorm, buf); SetSpinChoice(ui->bargap, graph_get_bargap(q)); SetToggleButtonState(ui->fixedp, locator->pointset); SetOptionChoice(ui->loc_type, locator->type); SetFormatChoice(ui->loc_fx, &locator->fx); SetFormatChoice(ui->loc_fy, &locator->fy); sprintf(buf, "%g", locator->origin.x); xv_setstr(ui->locx, buf); sprintf(buf, "%g", locator->origin.y); xv_setstr(ui->locy, buf); } }
/* * Fill 'Axes' dialog with values */ void update_axisgrid_ui(AGridUI *ui, Quark *q) { tickmarks *t = axisgrid_get_data(q); if (t && ui) { char buf[128]; int i; Widget vbar; SetOptionChoice(ui->type, t->type); if (is_log_axis(q)) { if (t->tmajor <= 1.0) { t->tmajor = 10.0; } sprintf(buf, "%g", t->tmajor); } else if (is_logit_axis(q)) { if (t->tmajor <= 0.0) { t->tmajor = 0.1; } else if (t->tmajor >= 0.5) { t->tmajor = 0.4; } sprintf(buf, "%g", t->tmajor); } else if (t->tmajor > 0) { sprintf(buf, "%g", t->tmajor); } else { strcpy(buf, "UNDEFINED"); } TextSetString(ui->tmajor, buf); SpinChoiceSetValue(ui->nminor, t->nminor); SetOptionChoice(ui->tlfont, t->tl_tprops.font); SetOptionChoice(ui->tlcolor, t->tl_tprops.color); SetOptionChoice(ui->tlskip, t->tl_skip); SetOptionChoice(ui->tlstagger, t->tl_staggered); TextSetString(ui->tlappstr, t->tl_appstr); TextSetString(ui->tlprestr, t->tl_prestr); SetOptionChoice(ui->tlstarttype, t->tl_starttype == TYPE_SPEC); if (t->tl_starttype == TYPE_SPEC) { sprintf(buf, "%f", t->tl_start); TextSetString(ui->tlstart, buf); sprintf(buf, "%f", t->tl_stop); TextSetString(ui->tlstop, buf); } SetOptionChoice(ui->tlstoptype, t->tl_stoptype == TYPE_SPEC); if (t->tl_stoptype == TYPE_SPEC) { sprintf(buf, "%f", t->tl_stop); TextSetString(ui->tlstop, buf); } SetFormatChoice(ui->tlform, &t->tl_format); TextSetString(ui->tlformula, t->tl_formula); sprintf(buf, "%.2f", t->tl_gap.x); TextSetString(ui->tlgap_para, buf); sprintf(buf, "%.2f", t->tl_gap.y); TextSetString(ui->tlgap_perp, buf); SpinChoiceSetValue(ui->tlcharsize, t->tl_tprops.charsize); SetAngleChoice(ui->tlangle, t->tl_tprops.angle); SetOptionChoice(ui->autonum, t->t_autonum - 2); ToggleButtonSetState(ui->tround, t->t_round); ToggleButtonSetState(ui->tgrid, t->gprops.onoff); SetPenChoice(ui->tgridpen, &t->gprops.line.pen); SpinChoiceSetValue(ui->tgridlinew, t->gprops.line.width); SetOptionChoice(ui->tgridlines, t->gprops.line.style); ToggleButtonSetState(ui->tmgrid, t->mgprops.onoff); SetPenChoice(ui->tmgridpen, &t->mgprops.line.pen); SpinChoiceSetValue(ui->tmgridlinew, t->mgprops.line.width); SetOptionChoice(ui->tmgridlines, t->mgprops.line.style); SetPenChoice(ui->barpen, &t->bar.pen); SpinChoiceSetValue(ui->barlinew, t->bar.width); SetOptionChoice(ui->barlines, t->bar.style); SetOptionChoice(ui->tinout, t->props.inout); SpinChoiceSetValue(ui->tlen, t->props.size); SetPenChoice(ui->tpen, &t->props.line.pen); SpinChoiceSetValue(ui->tlinew, t->props.line.width); SetOptionChoice(ui->tlines, t->props.line.style); SetOptionChoice(ui->tminout, t->mprops.inout); SpinChoiceSetValue(ui->tmlen, t->mprops.size); SetPenChoice(ui->tmpen, &t->mprops.line.pen); SpinChoiceSetValue(ui->tmlinew, t->mprops.line.width); SetOptionChoice(ui->tmlines, t->mprops.line.style); SetOptionChoice(ui->specticks, t->t_spec); SpinChoiceSetValue(ui->nspec, t->nticks); for (i = 0; i < t->nticks; i++) { sprintf(buf, "%.9g", t->tloc[i].wtpos); TextSetString(ui->specloc[i], buf); if (t->tloc[i].type == TICK_TYPE_MAJOR) { TextSetString(ui->speclabel[i], t->tloc[i].label); } else { TextSetString(ui->speclabel[i], ""); } } /* set reasonable scrolling */ vbar = GetVerticalScrollBar(ui->sw); if (vbar) { int maxval; GetScrollBarValues(vbar, NULL, &maxval, NULL, NULL); SetScrollBarIncrement(vbar, (int) rint(maxval/MAX_TICKS)); } } }