static void accept_axisbar_proc(Widget w, XtPointer client_data, XtPointer call_data) { tickmarks t; get_graph_tickmarks(cg, &t, curaxis); t.t_drawbarcolor = GetChoice(barcolor); t.t_drawbarlinew = GetChoice(barlinew) + 1; t.t_drawbarlines = GetChoice(barlines) + 1; set_graph_tickmarks(cg, &t, curaxis); drawgraph(); set_dirtystate(); }
void default_axis(int gno, int method, int axis) { int cx; tickmarks t; world w; double llim, ulim; get_graph_tickmarks(gno, &t, axis); get_graph_world(gno, &w); if (axis % 2) { llim = w.yg1; ulim = w.yg2; } else { llim = w.xg1; ulim = w.xg2; } t.tmajor = (ulim - llim) / t.t_num; t.tminor = t.tmajor / 2.0; cx = (int)(log10(t.tmajor)); t.tl_prec = ((cx < 0) ? -cx + 1 : 1); if (t.tl_prec > 9) { t.tl_prec = 2; t.tl_format = EXPONENTIAL; } set_graph_tickmarks(gno, &t, axis); if (method == AUTO) { default_ticks(gno, axis, &llim, &ulim); if (axis % 2) { w.yg1 = llim; w.yg2 = ulim; } else { w.xg1 = llim; w.xg2 = ulim; } set_graph_world(gno, &w); } if (g[gno].type == XYFIXED) { setfixedscale(g[gno].v.xv1, g[gno].v.yv1, g[gno].v.xv2, g[gno].v.yv2, &g[gno].w.xg1, &g[gno].w.yg1, &g[gno].w.xg2, &g[gno].w.yg2); } }
static void accept_axis_proc(Widget w, XtPointer client_data, XtPointer call_data) { tickmarks t; get_graph_tickmarks(cg, &t, curaxis); t.alt = FALSE; t.tmin = 0.0; t.tmax = 1.0; t.offsx = atof((char *) xv_getstr(offx)); t.offsy = atof((char *) xv_getstr(offy)); set_graph_tickmarks(cg, &t, curaxis); drawgraph(); set_dirtystate(); }
static void accept_special_proc(Widget w, XtPointer client_data, XtPointer call_data) { tickmarks t; int iv, i; get_graph_tickmarks(cg, &t, curaxis); t.t_type = XmToggleButtonGetState(specticks) ? TYPE_SPEC : TYPE_AUTO; t.tl_type = XmToggleButtonGetState(specticklabels) ? TYPE_SPEC : TYPE_AUTO; iv = atoi((char *) xv_getstr(nspec)); if (iv > MAX_TICK_LABELS) { sprintf(buf, "Number of ticks/tick labels exceeds %d", MAX_TICK_LABELS); errwin(buf); return; } t.t_spec = iv; for (i = 0; i < MAX_TICK_LABELS; i++) { t.t_specloc[i] = atof((char *) xv_getstr(specloc[i])); set_plotstr_string(&t.t_speclab[i], (char *) xv_getstr(speclabel[i])); } set_graph_tickmarks(cg, &t, curaxis); drawgraph(); set_dirtystate(); }
static void accept_axislabel_proc(Widget w, XtPointer client_data, XtPointer call_data) { Arg a; tickmarks t; int iv; get_graph_tickmarks(cg, &t, curaxis); t.label_layout = GetChoice(axislabellayout) ? LAYOUT_PERPENDICULAR : LAYOUT_PARALLEL; t.label_place = GetChoice(axislabelplace) ? TYPE_SPEC : TYPE_AUTO; if (t.label_place == TYPE_SPEC) { char buf[128]; strcpy(buf, xv_getstr(axislabelspec)); sscanf(buf, "%lf %lf", &t.label.x, &t.label.y); } t.label.font = GetChoice(axislabelfont); t.label.color = GetChoice(axislabelcolor); t.label.linew = GetChoice(axislabellinew) + 1; XtSetArg(a, XmNvalue, &iv); XtGetValues(axislabelcharsize, &a, 1); t.label.charsize = iv / 100.0; set_graph_tickmarks(cg, &t, curaxis); drawgraph(); set_dirtystate(); }
void default_ticks(int gno, int axis, double *gmin, double *gmax) { tickmarks t; double range, d, tmpmax = *gmax, tmpmin = *gmin; get_graph_tickmarks(gno, &t, axis); if (axis % 2 && (g[gno].type == LOGY || g[gno].type == LOGXY)) { tmpmax = ceil(log10(tmpmax)); tmpmin = floor(log10(tmpmin)); } else if ((axis % 2 == 0) && (g[gno].type == LOGX || g[gno].type == LOGXY)) { tmpmax = ceil(log10(tmpmax)); tmpmin = floor(log10(tmpmin)); } range = nicenum(tmpmax - tmpmin, 0); d = nicenum(range / (t.t_num - 1), 1); tmpmin = floor(tmpmin / d) * d; tmpmax = ceil(tmpmax / d) * d; if (axis % 2 && (g[gno].type == LOGY || g[gno].type == LOGXY)) { *gmax = pow(10.0, tmpmax); *gmin = pow(10.0, tmpmin); t.tmajor = (int)d; if (t.tmajor == 0.0) { t.tmajor = 1.0; } if ((int)t.tmajor < 2) { t.tminor = 1.0; } else { t.tminor = 0.0; } if (fabs(tmpmax) > 6.0 || fabs(tmpmin) > 6.0) { t.tl_format = POWER; t.tl_prec = 0; } else { t.tl_format = DECIMAL; t.tl_prec = 0; } } else if ((axis % 2 == 0) && (g[gno].type == LOGX || g[gno].type == LOGXY)) { *gmax = pow(10.0, tmpmax); *gmin = pow(10.0, tmpmin); t.tmajor = (int)d; if (t.tmajor == 0.0) { t.tmajor = 1.0; } if (fabs(tmpmax) > 6.0 || fabs(tmpmin) > 6.0) { t.tl_format = POWER; t.tl_prec = 0; } else { t.tl_format = DECIMAL; t.tl_prec = 0; } if ((int)t.tmajor < 2) { t.tminor = 1.0; } else { t.tminor = 0.0; } } else { *gmax = tmpmax; *gmin = tmpmin; t.tmajor = d; t.tminor = d * 0.5; } set_graph_tickmarks(gno, &t, axis); }
static void accept_ticklabel_proc(Widget w, XtPointer client_data, XtPointer call_data) { Arg a; tickmarks t; int iv; int i, j, applyto, gstart, gstop, astart, astop;; applyto = GetChoice(ticklabel_applyto); switch (applyto) { case 0: gstart = gstop = cg; astart = astop = curaxis; break; case 1: gstart = gstop = cg; astart = 0; astop = MAXAXES - 1; break; case 2: gstart = 0; gstop = maxgraph - 1; astart = astop = curaxis; break; case 3: gstart = 0; gstop = maxgraph - 1; astart = 0; astop = MAXAXES - 1; break; default: /* error */ gstart = gstop = astart = astop = 0; errmsg("Internal error, accept_ticklabel_proc called with wrong argument"); } for (i = gstart; i <= gstop; i++) { for (j = astart; j <= astop; j++) { get_graph_tickmarks(i, &t, j); t.tl_font = GetChoice(tlfont); t.tl_color = GetChoice(tlcolor); t.tl_linew = GetChoice(tllinew) + 1; t.tl_skip = GetChoice(tlskip); t.tl_prec = GetChoice(tlprec); t.tl_staggered = (int) GetChoice(tlstagger); strcpy(t.tl_appstr, xv_getstr(tlappstr)); strcpy(t.tl_prestr, xv_getstr(tlprestr)); t.tl_starttype = (int) GetChoice(tlstarttype) == 0 ? TYPE_AUTO : TYPE_SPEC; if (t.tl_starttype == TYPE_SPEC) { t.tl_start = atof((char *) xv_getstr(tlstart)); } t.tl_stoptype = (int) GetChoice(tlstoptype) == 0 ? TYPE_AUTO : TYPE_SPEC; if (t.tl_stoptype == TYPE_SPEC) { t.tl_stop = atof((char *) xv_getstr(tlstop)); } t.tl_format = format_types[(int) GetChoice(tlform)]; switch (GetChoice(ticklop)) { case 0: if (j % 2) { t.tl_op = PLACE_LEFT; } else { t.tl_op = PLACE_BOTTOM; } break; case 1: if (j % 2) { t.tl_op = PLACE_RIGHT; } else { t.tl_op = PLACE_TOP; } break; case 2: t.tl_op = PLACE_BOTH; break; } switch ((int) GetChoice(tlsign)) { case 0: t.tl_sign = SIGN_NORMAL; break; case 1: t.tl_sign = SIGN_ABSOLUTE; break; case 2: t.tl_sign = SIGN_NEGATE; break; } switch ((int) GetChoice(tllayout)) { case 0: t.tl_layout = TICKS_HORIZONTAL; break; case 1: t.tl_layout = TICKS_VERTICAL; break; case 2: t.tl_layout = TYPE_SPEC; XtSetArg(a, XmNvalue, &iv); XtGetValues(tlangle, &a, 1); t.tl_angle = iv; break; } switch ((int) GetChoice(tlloc)) { case 0: t.tl_loc = LABEL_ONTICK; break; case 1: t.tl_loc = LABEL_BETWEEN; break; } XtSetArg(a, XmNvalue, &iv); XtGetValues(tlcharsize, &a, 1); t.tl_charsize = iv / 100.0; set_graph_tickmarks(i, &t, j); } } drawgraph(); set_dirtystate(); }
static void accept_tickmark_proc(Widget w, XtPointer client_data, XtPointer call_data) { Arg a; tickmarks t; int iv; int i, j, applyto, gstart, gstop, astart, astop;; applyto = GetChoice(tick_applyto); switch (applyto) { case 0: gstart = gstop = cg; astart = astop = curaxis; break; case 1: gstart = gstop = cg; astart = 0; astop = MAXAXES - 1; break; case 2: gstart = 0; gstop = maxgraph - 1; astart = astop = curaxis; break; case 3: gstart = 0; gstop = maxgraph - 1; astart = 0; astop = MAXAXES - 1; break; default: /* error */ gstart = gstop = astart = astop = 0; errmsg("Internal error, accept_tickmark_proc called with wrong argument"); } for (i = gstart; i <= gstop; i++) { for (j = astart; j <= astop; j++) { get_graph_tickmarks(i, &t, j); switch ((int) GetChoice(tinout)) { case 0: t.t_inout = TICKS_IN; break; case 1: t.t_inout = TICKS_OUT; break; case 2: t.t_inout = TICKS_BOTH; break; } switch (GetChoice(tickop)) { case 0: if (j % 2) { t.t_op = PLACE_LEFT; } else { t.t_op = PLACE_BOTTOM; } break; case 1: if (j % 2) { t.t_op = PLACE_RIGHT; } else { t.t_op = PLACE_TOP; } break; case 2: t.t_op = PLACE_BOTH; break; } t.t_color = GetChoice(tgridcol); t.t_linew = GetChoice(tgridlinew) + 1; t.t_lines = GetChoice(tgridlines) + 1; t.t_mcolor = GetChoice(tmgridcol); t.t_mlinew = GetChoice(tmgridlinew) + 1; t.t_mlines = GetChoice(tmgridlines) + 1; XtSetArg(a, XmNvalue, &iv); XtGetValues(tlen, &a, 1); t.t_size = iv / 100.0; XtSetArg(a, XmNvalue, &iv); XtGetValues(tmlen, &a, 1); t.t_msize = iv / 100.0; t.t_gridflag = XmToggleButtonGetState(tgrid) ? TRUE : FALSE; t.t_mgridflag = XmToggleButtonGetState(tmgrid) ? TRUE : FALSE; set_graph_tickmarks(i, &t, j); } } drawgraph(); set_dirtystate(); }