示例#1
0
static void update_special_items(int gno)
{
    tickmarks t;

    if (special_frame) {
	get_graph_tickmarks(gno, &t, curaxis);
	XmToggleButtonSetState(specticks, t.t_type == TYPE_SPEC, False);
	XmToggleButtonSetState(specticklabels, t.tl_type == TYPE_SPEC, False);
    }
}
示例#2
0
static void update_axisbar_items(int gno)
{
    tickmarks t;

    if (axisbar_frame) {
	get_graph_tickmarks(gno, &t, curaxis);
	SetChoice(barcolor, t.t_drawbarcolor);
	SetChoice(barlinew, t.t_drawbarlinew - 1);
	SetChoice(barlines, t.t_drawbarlines - 1);
    }
}
示例#3
0
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();
}
示例#4
0
static void update_axis_items(int gno)
{
    tickmarks t;

    if (axis_frame) {
	get_graph_tickmarks(gno, &t, curaxis);
	sprintf(buf, "%.5g", t.offsx);
	XmTextSetString(offx, buf);
	sprintf(buf, "%.5g", t.offsy);
	XmTextSetString(offy, buf);
    }
}
示例#5
0
static void update_tickmark_items(int gno)
{
    Arg a;
    tickmarks t;
    int iv;

    if (tickmark_frame) {
	get_graph_tickmarks(gno, &t, curaxis);
	switch (t.t_inout) {
	case TICKS_IN:
	    SetChoice(tinout, 0);
	    break;
	case TICKS_OUT:
	    SetChoice(tinout, 1);
	    break;
	case TICKS_BOTH:
	    SetChoice(tinout, 2);
	    break;
	}
	switch (t.t_op) {
	case PLACE_LEFT:
	    SetChoice(tickop, 0);
	    break;
	case PLACE_RIGHT:
	    SetChoice(tickop, 1);
	    break;
	case PLACE_BOTTOM:
	    SetChoice(tickop, 0);
	    break;
	case PLACE_TOP:
	    SetChoice(tickop, 1);
	    break;
	case PLACE_BOTH:
	    SetChoice(tickop, 2);
	    break;
	}
	SetChoice(tgridcol, t.t_color);
	SetChoice(tgridlinew, t.t_linew - 1);
	SetChoice(tgridlines, t.t_lines - 1);
	SetChoice(tmgridcol, t.t_mcolor);
	SetChoice(tmgridlinew, t.t_mlinew - 1);
	SetChoice(tmgridlines, t.t_mlines - 1);
	iv = (int) (100 * t.t_size);
	XtSetArg(a, XmNvalue, iv);
	XtSetValues(tlen, &a, 1);
	iv = (int) (100 * t.t_msize);
	XtSetArg(a, XmNvalue, iv);
	XtSetValues(tmlen, &a, 1);
	XmToggleButtonSetState(tgrid, t.t_gridflag == TRUE, False);
	XmToggleButtonSetState(tmgrid, t.t_mgridflag == TRUE, False);
    }
}
示例#6
0
void update_ticks_items(int gno)
{
    tickmarks t;

    if (ticks_frame) {
	SetChoice(editaxis, curaxis);
	get_graph_tickmarks(gno, &t, curaxis);
	XmToggleButtonSetState(tlonoff, t.tl_flag == TRUE, False);
	XmToggleButtonSetState(tonoff, t.t_flag == TRUE, False);
	XmToggleButtonSetState(baronoff, t.t_drawbar == TRUE, False);
	XmTextSetString(axislabel, t.label.s);

	if (islogx(gno) && (curaxis % 2 == 0)) {
	    t.tmajor = (int) t.tmajor;
	    if (t.tmajor == 0) {
		t.tmajor = 1;
	    }
	    sprintf(buf, "%.0f", t.tmajor);
	} else if (islogy(gno) && (curaxis % 2 == 1)) {
	    t.tmajor = (int) t.tmajor;
	    if (t.tmajor == 0) {
		t.tmajor = 1;
	    }
	    sprintf(buf, "%.0f", t.tmajor);
	} else if (t.tmajor > 0) {
	    sprintf(buf, "%.5g", t.tmajor);
	} else {
	    strcpy(buf, "UNDEFINED");
	}
	XmTextSetString(tmajor, buf);
	if (islogx(gno) && (curaxis % 2 == 0)) {
	    t.tminor = (int) t.tminor;
	    if (t.tminor < 0 || t.tminor > 5) {
		t.tminor = 0;
	    }
	    sprintf(buf, "%.0f", t.tminor);
	} else if (islogy(gno) && (curaxis % 2 == 1)) {
	    t.tminor = (int) t.tminor;
	    if (t.tminor < 0 || t.tminor > 5) {
		t.tminor = 0;
	    }
	    sprintf(buf, "%.0f", t.tminor);
	} else if (t.tminor > 0) {
	    sprintf(buf, "%.5g", t.tminor);
	} else {
	    strcpy(buf, "UNDEFINED");
	}
	XmTextSetString(tminor, buf);
    }
}
示例#7
0
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();
}
示例#8
0
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);
    }
}
示例#9
0
static void load_special(int gno, int a)
{
    int i;
    char buf[128];
    tickmarks t;

    if (special_frame) {
	get_graph_tickmarks(gno, &t, a);
	sprintf(buf, "%d", t.t_spec);
	xv_setstr(nspec, buf);
	for (i = 0; i < t.t_spec; i++) {
	    sprintf(buf, "%f", t.t_specloc[i]);
	    xv_setstr(specloc[i], buf);
	    if (t.t_speclab[i].s != NULL) {
		xv_setstr(speclabel[i], t.t_speclab[i].s);
	    }
	}
    }
}
示例#10
0
static void update_axislabel_items(int gno)
{
    Arg a;
    tickmarks t;
    int iv;
    char buf[128];

    if (axislabel_frame) {
	get_graph_tickmarks(gno, &t, curaxis);
	SetChoice(axislabellayout, t.label_layout == LAYOUT_PERPENDICULAR ? 1 : 0);
	SetChoice(axislabelplace, t.label_place == TYPE_AUTO ? 0 : 1);
	sprintf(buf, "%.2f %.2f", t.label.x, t.label.y);
	xv_setstr(axislabelspec, buf);
	SetChoice(axislabelfont, t.label.font);
	SetChoice(axislabelcolor, t.label.color);
	SetChoice(axislabellinew, t.label.linew - 1);
	iv = (int) (100 * t.label.charsize);
	XtSetArg(a, XmNvalue, iv);
	XtSetValues(axislabelcharsize, &a, 1);
    }
}
示例#11
0
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();
}
示例#12
0
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();
}
示例#13
0
文件: params.cpp 项目: nixz/covise
void putparms(int gno, FILE *pp, int imbed)
{
    int i, j, k, ming, maxg;
    int ps, pt, gh, gl, gt, fx, fy, px, py;
    double dsx, dsy;
    char imbedstr[2], tmpstr1[128], tmpstr2[128];
    // defaults d;
    framep f;
    legend leg;
    labels lab;
    plotarr p;
    tickmarks t;
    world w;
    view v;

    if (imbed)
    {
        strcpy(imbedstr, "@");
    }
    else
    {
        imbedstr[0] = 0;
    }
    fprintf(pp, "# ACE/gr parameter file\n");
    fprintf(pp, "#\n");
    fprintf(pp, "#\n");
    fprintf(pp, "%spage %d\n", imbedstr, (int)(scrollper * 100));
    fprintf(pp, "%spage inout %d\n", imbedstr, (int)(shexper * 100));
    fprintf(pp, "%slink page %s\n", imbedstr, scrolling_islinked ? "on" : "off");

    fprintf(pp, "%sdefault linestyle %d\n", imbedstr, grdefaults.lines);
    fprintf(pp, "%sdefault linewidth %d\n", imbedstr, grdefaults.linew);
    fprintf(pp, "%sdefault color %d\n", imbedstr, grdefaults.color);
    fprintf(pp, "%sdefault char size %lf\n", imbedstr, grdefaults.charsize);
    fprintf(pp, "%sdefault font %d\n", imbedstr, grdefaults.font);
    fprintf(pp, "%sdefault font source %d\n", imbedstr, grdefaults.fontsrc);
    fprintf(pp, "%sdefault symbol size %lf\n", imbedstr, grdefaults.symsize);
    put_annotation(gno, pp, imbed);
    put_region(gno, pp, imbed);
    if (gno == -1)
    {
        maxg = maxgraph - 1;
        ming = 0;
    }
    else
    {
        maxg = gno;
        ming = gno;
    }
    for (k = ming; k <= maxg; k++)
    {
        if (isactive_graph(k))
        {
            gno = k;
            gh = g[gno].hidden;
            gl = g[gno].label;
            gt = g[gno].type;
            ps = g[gno].pointset;
            pt = g[gno].pt_type;
            dsx = g[gno].dsx;
            dsy = g[gno].dsy;
            fx = g[gno].fx;
            fy = g[gno].fy;
            px = g[gno].px;
            py = g[gno].py;

            fprintf(pp, "%swith g%1d\n", imbedstr, gno);

            fprintf(pp, "%sg%1d %s\n", imbedstr, gno, on_or_off(g[gno].active));
            fprintf(pp, "%sg%1d label %s\n", imbedstr, gno, on_or_off(gl));
            fprintf(pp, "%sg%1d hidden %s\n", imbedstr, gno, gh ? "true" : "false");
            fprintf(pp, "%sg%1d type %s\n", imbedstr, gno, graph_types(g[gno].type, 1));
            fprintf(pp, "%sg%1d autoscale type %s\n", imbedstr, gno, g[gno].auto_type == AUTO ? "AUTO" : "SPEC");
            fprintf(pp, "%sg%1d fixedpoint %s\n", imbedstr, gno, on_or_off(ps));
            fprintf(pp, "%sg%1d fixedpoint type %d\n", imbedstr, gno, pt);
            fprintf(pp, "%sg%1d fixedpoint xy %lf, %lf\n", imbedstr, gno, dsx, dsy);
            strcpy(tmpstr1, getFormat_types(fx));
            strcpy(tmpstr2, getFormat_types(fy));
            fprintf(pp, "%sg%1d fixedpoint format %s %s\n", imbedstr, gno, tmpstr1, tmpstr2);
            fprintf(pp, "%sg%1d fixedpoint prec %d, %d\n", imbedstr, gno, px, py);

            get_graph_world(gno, &w);
            fprintf(pp, "%s    world xmin %.12lg\n", imbedstr, w.xg1);
            fprintf(pp, "%s    world xmax %.12lg\n", imbedstr, w.xg2);
            fprintf(pp, "%s    world ymin %.12lg\n", imbedstr, w.yg1);
            fprintf(pp, "%s    world ymax %.12lg\n", imbedstr, w.yg2);

            for (i = 0; i < g[gno].ws_top; i++)
            {
                fprintf(pp, "%s    stack world %.9lg, %.9lg, %.9lg, %.9lg tick %lg, %lg, %lg, %lg\n", imbedstr,
                        g[gno].ws[i].w.xg1, g[gno].ws[i].w.xg2, g[gno].ws[i].w.yg1, g[gno].ws[i].w.yg2,
                        g[gno].ws[i].t[0].xg1, g[gno].ws[i].t[0].xg2, g[gno].ws[i].t[0].yg1, g[gno].ws[i].t[0].yg2);
            }

            get_graph_view(gno, &v);
            fprintf(pp, "%s    view xmin %lf\n", imbedstr, v.xv1);
            fprintf(pp, "%s    view xmax %lf\n", imbedstr, v.xv2);
            fprintf(pp, "%s    view ymin %lf\n", imbedstr, v.yv1);
            fprintf(pp, "%s    view ymax %lf\n", imbedstr, v.yv2);

            get_graph_labels(gno, &lab);
            fprintf(pp, "%s    title \"%s\"\n", imbedstr, lab.title.s);
            fprintf(pp, "%s    title font %d\n", imbedstr, lab.title.font);
            fprintf(pp, "%s    title size %lf\n", imbedstr, lab.title.charsize);
            fprintf(pp, "%s    title color %d\n", imbedstr, lab.title.color);
            fprintf(pp, "%s    title linewidth %d\n", imbedstr, lab.title.linew);
            fprintf(pp, "%s    subtitle \"%s\"\n", imbedstr, lab.stitle.s);
            fprintf(pp, "%s    subtitle font %d\n", imbedstr, lab.stitle.font);
            fprintf(pp, "%s    subtitle size %lf\n", imbedstr, lab.stitle.charsize);
            fprintf(pp, "%s    subtitle color %d\n", imbedstr, lab.stitle.color);
            fprintf(pp, "%s    subtitle linewidth %d\n", imbedstr, lab.title.linew);

            for (i = 0; i < g[gno].maxplot; i++)
            {
                get_graph_plotarr(gno, i, &p);
                if (isactive_set(gno, i))
                {
                    fprintf(pp, "%s    s%1d type %s\n", imbedstr, i, (char *)set_types(p.type));
                    fprintf(pp, "%s    s%1d symbol %d\n", imbedstr, i, p.sym);
                    fprintf(pp, "%s    s%1d symbol size %lf\n", imbedstr, i, p.symsize);
                    fprintf(pp, "%s    s%1d symbol fill %d\n", imbedstr, i, p.symfill);
                    fprintf(pp, "%s    s%1d symbol color %d\n", imbedstr, i, p.symcolor);
                    fprintf(pp, "%s    s%1d symbol linewidth %d\n", imbedstr, i, p.symlinew);
                    fprintf(pp, "%s    s%1d symbol linestyle %d\n", imbedstr, i, p.symlines);
                    fprintf(pp, "%s    s%1d symbol center %s\n", imbedstr, i, p.symdot ? "true" : "false");
                    fprintf(pp, "%s    s%1d symbol char %d\n", imbedstr, i, p.symchar);
                    fprintf(pp, "%s    s%1d skip %d\n", imbedstr, i, p.symskip);
                    fprintf(pp, "%s    s%1d linestyle %d\n", imbedstr, i, p.lines);
                    fprintf(pp, "%s    s%1d linewidth %d\n", imbedstr, i, p.linew);
                    fprintf(pp, "%s    s%1d color %d\n", imbedstr, i, p.color);
                    fprintf(pp, "%s    s%1d fill %d\n", imbedstr, i, p.fill);
                    fprintf(pp, "%s    s%1d fill with %s\n", imbedstr, i,
                            p.fillusing == COLOR ? "color" : "pattern");
                    fprintf(pp, "%s    s%1d fill color %d\n", imbedstr, i, p.fillcolor);
                    fprintf(pp, "%s    s%1d fill pattern %d\n", imbedstr, i, p.fillpattern);
                    switch (p.errbarxy)
                    {
                    case TOP:
                        fprintf(pp, "%s    s%1d errorbar type TOP\n", imbedstr, i);
                        break;
                    case BOTTOM:
                        fprintf(pp, "%s    s%1d errorbar type BOTTOM\n", imbedstr, i);
                        break;
                    case LEFT:
                        fprintf(pp, "%s    s%1d errorbar type LEFT\n", imbedstr, i);
                        break;
                    case RIGHT:
                        fprintf(pp, "%s    s%1d errorbar type RIGHT\n", imbedstr, i);
                        break;
                    case BOTH:
                        fprintf(pp, "%s    s%1d errorbar type BOTH\n", imbedstr, i);
                        break;
                    }
                    fprintf(pp, "%s    s%1d errorbar length %lf\n", imbedstr, i, p.errbarper);
                    fprintf(pp, "%s    s%1d errorbar linewidth %d\n", imbedstr, i, p.errbar_linew);
                    fprintf(pp, "%s    s%1d errorbar linestyle %d\n", imbedstr, i, p.errbar_lines);
                    fprintf(pp, "%s    s%1d errorbar riser %s\n", imbedstr, i, p.errbar_riser == ON ? "on" : "off");
                    fprintf(pp, "%s    s%1d errorbar riser linewidth %d\n", imbedstr, i, p.errbar_riser_linew);
                    fprintf(pp, "%s    s%1d errorbar riser linestyle %d\n", imbedstr, i, p.errbar_riser_lines);
                    fprintf(pp, "%s    s%1d xyz %lf, %lf\n", imbedstr, i, p.zmin, p.zmax);
                    if (is_hotlinked(gno, i))
                    {
                        fprintf(pp, "%s    s%1d link %s \"%s\"\n", imbedstr, i,
                                p.hotsrc == DISK ? "disk" : "pipe", p.hotfile);
                    }
                    fprintf(pp, "%s    s%1d comment \"%s\"\n", imbedstr, i, p.comments);
                }
            }

            for (i = 0; i < MAXAXES; i++)
            {
                switch (i)
                {
                case 0:
                    get_graph_tickmarks(gno, &t, X_AXIS);
                    if (t.active == OFF)
                    {
                        fprintf(pp, "%s    xaxis off\n", imbedstr);
                        continue;
                    }
                    sprintf(buf, "%s    xaxis ", imbedstr);
                    break;
                case 1:
                    get_graph_tickmarks(gno, &t, Y_AXIS);
                    if (t.active == OFF)
                    {
                        fprintf(pp, "%s    yaxis off\n", imbedstr);
                        continue;
                    }
                    sprintf(buf, "%s    yaxis ", imbedstr);
                    break;
                case 2:
                    get_graph_tickmarks(gno, &t, ZX_AXIS);
                    if (t.active == OFF)
                    {
                        fprintf(pp, "%s    zeroxaxis off\n", imbedstr);
                        continue;
                    }
                    sprintf(buf, "%s    zeroxaxis ", imbedstr);
                    break;
                case 3:
                    get_graph_tickmarks(gno, &t, ZY_AXIS);
                    if (t.active == OFF)
                    {
                        fprintf(pp, "%s    zeroyaxis off\n", imbedstr);
                        continue;
                    }
                    sprintf(buf, "%s    zeroyaxis ", imbedstr);
                    break;
                }

                fprintf(pp, "%s tick %s\n", buf, on_or_off(t.active));
                fprintf(pp, "%s tick major %.12lg\n", buf, t.tmajor);
                fprintf(pp, "%s tick minor %.12lg\n", buf, t.tminor);
                fprintf(pp, "%s tick offsetx %lf\n", buf, t.offsx);
                fprintf(pp, "%s tick offsety %lf\n", buf, t.offsy);
                /* DEFUNCT
                  fprintf(pp, "%s tick alt %s\n", buf, on_or_off(t.alt));
                  fprintf(pp, "%s tick min %.12lg\n", buf, t.tmin);
                  fprintf(pp, "%s tick max %.12lg\n", buf, t.tmax);
            */

                fprintf(pp, "%s label \"%s\"\n", buf, t.label.s);
                if (t.label_layout == PERP)
                {
                    fprintf(pp, "%s label layout perp\n", buf);
                }
                else
                {
                    fprintf(pp, "%s label layout para\n", buf);
                }
                if (t.label_place == AUTO)
                {
                    fprintf(pp, "%s label place auto\n", buf);
                }
                else
                {
                    fprintf(pp, "%s label place spec\n", buf);
                }
                fprintf(pp, "%s label char size %lf\n", buf, t.label.charsize);
                fprintf(pp, "%s label font %d\n", buf, t.label.font);
                fprintf(pp, "%s label color %d\n", buf, t.label.color);
                fprintf(pp, "%s label linewidth %d\n", buf, t.label.linew);

                fprintf(pp, "%s ticklabel %s\n", buf, on_or_off(t.tl_flag));
                if (t.tl_type == AUTO)
                {
                    fprintf(pp, "%s ticklabel type auto\n", buf);
                }
                else
                {
                    fprintf(pp, "%s ticklabel type spec\n", buf);
                }
                fprintf(pp, "%s ticklabel prec %d\n", buf, t.tl_prec);
                fprintf(pp, "%s ticklabel format %s\n", buf, getFormat_types(t.tl_format));
                fprintf(pp, "%s ticklabel append \"%s\"\n", buf, t.tl_appstr);
                fprintf(pp, "%s ticklabel prepend \"%s\"\n", buf, t.tl_prestr);
                switch (t.tl_layout)
                {
                case HORIZONTAL:
                    fprintf(pp, "%s ticklabel layout horizontal\n", buf);
                    break;
                case VERTICAL:
                    fprintf(pp, "%s ticklabel layout vertical\n", buf);
                    break;
                case SPEC:
                    fprintf(pp, "%s ticklabel layout spec\n", buf);
                    fprintf(pp, "%s ticklabel angle %d\n", buf, t.tl_angle);
                    break;
                }
                fprintf(pp, "%s ticklabel skip %d\n", buf, t.tl_skip);
                fprintf(pp, "%s ticklabel stagger %d\n", buf, t.tl_staggered);
                switch (t.tl_op)
                {
                case TOP:
                    fprintf(pp, "%s ticklabel op top\n", buf);
                    break;
                case BOTTOM:
                    fprintf(pp, "%s ticklabel op bottom\n", buf);
                    break;
                case LEFT:
                    fprintf(pp, "%s ticklabel op left\n", buf);
                    break;
                case RIGHT:
                    fprintf(pp, "%s ticklabel op right\n", buf);
                    break;
                case BOTH:
                    fprintf(pp, "%s ticklabel op both\n", buf);
                    break;
                }
                switch (t.tl_sign)
                {
                case NORMAL:
                    fprintf(pp, "%s ticklabel sign normal\n", buf);
                    break;
                case ABSOLUTE:
                    fprintf(pp, "%s ticklabel sign absolute\n", buf);
                    break;
                case NEGATE:
                    fprintf(pp, "%s ticklabel sign negate\n", buf);
                    break;
                }
                fprintf(pp, "%s ticklabel start type %s\n", buf, t.tl_starttype == AUTO ? "auto" : "spec");
                fprintf(pp, "%s ticklabel start %lf\n", buf, t.tl_start);
                fprintf(pp, "%s ticklabel stop type %s\n", buf, t.tl_stoptype == AUTO ? "auto" : "spec");
                fprintf(pp, "%s ticklabel stop %lf\n", buf, t.tl_stop);
                fprintf(pp, "%s ticklabel char size %lf\n", buf, t.tl_charsize);
                fprintf(pp, "%s ticklabel font %d\n", buf, t.tl_font);
                fprintf(pp, "%s ticklabel color %d\n", buf, t.tl_color);
                fprintf(pp, "%s ticklabel linewidth %d\n", buf, t.tl_linew);

                fprintf(pp, "%s tick major %s\n", buf, on_or_off(t.t_flag));
                fprintf(pp, "%s tick minor %s\n", buf, on_or_off(t.t_mflag));
                fprintf(pp, "%s tick default %d\n", buf, t.t_num);
                switch (t.t_inout)
                {
                case IN:
                    fprintf(pp, "%s tick in\n", buf);
                    break;
                case OUT:
                    fprintf(pp, "%s tick out\n", buf);
                    break;
                case BOTH:
                    fprintf(pp, "%s tick both\n", buf);
                    break;
                }
                fprintf(pp, "%s tick major color %d\n", buf, t.t_color);
                fprintf(pp, "%s tick major linewidth %d\n", buf, t.t_linew);
                fprintf(pp, "%s tick major linestyle %d\n", buf, t.t_lines);
                fprintf(pp, "%s tick minor color %d\n", buf, t.t_mcolor);
                fprintf(pp, "%s tick minor linewidth %d\n", buf, t.t_mlinew);
                fprintf(pp, "%s tick minor linestyle %d\n", buf, t.t_mlines);
                fprintf(pp, "%s tick log %s\n", buf, on_or_off(t.t_log));
                fprintf(pp, "%s tick size %lf\n", buf, t.t_size);
                fprintf(pp, "%s tick minor size %lf\n", buf, t.t_msize);
                fprintf(pp, "%s bar %s\n", buf, on_or_off(t.t_drawbar));
                fprintf(pp, "%s bar color %d\n", buf, t.t_drawbarcolor);
                fprintf(pp, "%s bar linestyle %d\n", buf, t.t_drawbarlines);
                fprintf(pp, "%s bar linewidth %d\n", buf, t.t_drawbarlinew);
                fprintf(pp, "%s tick major grid %s\n", buf, on_or_off(t.t_gridflag));
                fprintf(pp, "%s tick minor grid %s\n", buf, on_or_off(t.t_mgridflag));
                switch (t.t_op)
                {
                case TOP:
                    fprintf(pp, "%s tick op top\n", buf);
                    break;
                case BOTTOM:
                    fprintf(pp, "%s tick op bottom\n", buf);
                    break;
                case LEFT:
                    fprintf(pp, "%s tick op left\n", buf);
                    break;
                case RIGHT:
                    fprintf(pp, "%s tick op right\n", buf);
                    break;
                case BOTH:
                    fprintf(pp, "%s tick op both\n", buf);
                    break;
                }
                if (t.t_type == AUTO)
                {
                    fprintf(pp, "%s tick type auto\n", buf);
                }
                else
                {
                    fprintf(pp, "%s tick type spec\n", buf);
                }
                fprintf(pp, "%s tick spec %d\n", buf, t.t_spec);
                for (j = 0; j < t.t_spec; j++)
                {
                    fprintf(pp, "%s tick %d, %lg\n", buf, j, t.t_specloc[j]);
                    fprintf(pp, "%s ticklabel %d, \"%s\"\n", buf, j, t.t_speclab[j].s);
                }
            }

            get_graph_legend(gno, &leg);
            fprintf(pp, "%s    legend %s\n", imbedstr, on_or_off(leg.active));
            fprintf(pp, "%s    legend loctype %s\n", imbedstr, w_or_v(leg.loctype));
            fprintf(pp, "%s    legend layout %d\n", imbedstr, leg.layout);
            fprintf(pp, "%s    legend vgap %d\n", imbedstr, leg.vgap);
            fprintf(pp, "%s    legend hgap %d\n", imbedstr, leg.hgap);
            fprintf(pp, "%s    legend length %d\n", imbedstr, leg.len);
            fprintf(pp, "%s    legend box %s\n", imbedstr, on_or_off(leg.box));
            fprintf(pp, "%s    legend box fill %s\n", imbedstr, on_or_off(leg.box));
            fprintf(pp, "%s    legend box fill with %s\n", imbedstr, leg.boxfillusing == COLOR ? "color" : "pattern");
            fprintf(pp, "%s    legend box fill color %d\n", imbedstr, leg.boxfillcolor);
            fprintf(pp, "%s    legend box fill pattern %d\n", imbedstr, leg.boxfillpat);
            fprintf(pp, "%s    legend box color %d\n", imbedstr, leg.boxlcolor);
            fprintf(pp, "%s    legend box linewidth %d\n", imbedstr, leg.boxlinew);
            fprintf(pp, "%s    legend box linestyle %d\n", imbedstr, leg.boxlines);
            fprintf(pp, "%s    legend x1 %.12lg\n", imbedstr, leg.legx);
            fprintf(pp, "%s    legend y1 %.12lg\n", imbedstr, leg.legy);
            fprintf(pp, "%s    legend font %d\n", imbedstr, leg.font);
            fprintf(pp, "%s    legend char size %lf\n", imbedstr, leg.charsize);
            fprintf(pp, "%s    legend linestyle %d\n", imbedstr, leg.lines);
            fprintf(pp, "%s    legend linewidth %d\n", imbedstr, leg.linew);
            fprintf(pp, "%s    legend color %d\n", imbedstr, leg.color);
            for (i = 0; i < MAXPLOT; i++)
            {
                if (isactive_set(gno, i))
                {
                    if (strlen(leg.str[i].s))
                    {
                        fprintf(pp, "%s    legend string %d \"%s\"\n", imbedstr, i, leg.str[i].s);
                    }
                }
            }

            get_graph_framep(gno, &f);
            fprintf(pp, "%s    frame %s\n", imbedstr, on_or_off(f.active));
            fprintf(pp, "%s    frame type %d\n", imbedstr, f.type);
            fprintf(pp, "%s    frame linestyle %d\n", imbedstr, f.lines);
            fprintf(pp, "%s    frame linewidth %d\n", imbedstr, f.linew);
            fprintf(pp, "%s    frame color %d\n", imbedstr, f.color);
            fprintf(pp, "%s    frame fill %s\n", imbedstr, on_or_off(f.fillbg));
            fprintf(pp, "%s    frame background color %d\n", imbedstr, f.bgcolor);
        }
    }
}
示例#14
0
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);
}
示例#15
0
static void update_ticklabel_items(int gno)
{
    Arg a;
    tickmarks t;
    int iv;

    if (ticklabel_frame) {
	get_graph_tickmarks(gno, &t, curaxis);
	SetChoice(tlfont, t.tl_font);
	SetChoice(tlcolor, t.tl_color);
	SetChoice(tllinew, t.tl_linew - 1);
	SetChoice(tlskip, t.tl_skip);
	SetChoice(tlstagger, t.tl_staggered);
	xv_setstr(tlappstr, t.tl_appstr);
	xv_setstr(tlprestr, t.tl_prestr);
	SetChoice(tlstarttype, t.tl_starttype == TYPE_SPEC);
	if (t.tl_starttype == TYPE_SPEC) {
	    sprintf(buf, "%f", t.tl_start);
	    xv_setstr(tlstart, buf);
	    sprintf(buf, "%f", t.tl_stop);
	    xv_setstr(tlstop, buf);
	}
	SetChoice(tlstoptype, t.tl_stoptype == TYPE_SPEC);
	if (t.tl_stoptype == TYPE_SPEC) {
	    sprintf(buf, "%f", t.tl_stop);
	    xv_setstr(tlstop, buf);
	}
	iv = get_format_index(t.tl_format);
	SetChoice(tlform, iv);
	switch (t.tl_op) {
	case PLACE_LEFT:
	    SetChoice(ticklop, 0);
	    break;
	case PLACE_RIGHT:
	    SetChoice(ticklop, 1);
	    break;
	case PLACE_BOTTOM:
	    SetChoice(ticklop, 0);
	    break;
	case PLACE_TOP:
	    SetChoice(ticklop, 1);
	    break;
	case PLACE_BOTH:
	    SetChoice(ticklop, 2);
	    break;
	}
	switch (t.tl_sign) {
	case SIGN_NORMAL:
	    SetChoice(tlsign, 0);
	    break;
	case SIGN_ABSOLUTE:
	    SetChoice(tlsign, 1);
	    break;
	case SIGN_NEGATE:
	    SetChoice(tlsign, 2);
	    break;
	}
	SetChoice(tlprec, t.tl_prec);
	iv = (int) (100 * t.tl_charsize);
	XtSetArg(a, XmNvalue, iv);
	XtSetValues(tlcharsize, &a, 1);
	switch (t.tl_layout) {
	case TICKS_HORIZONTAL:
	    SetChoice(tllayout, 0);
	    break;
	case TICKS_VERTICAL:
	    SetChoice(tllayout, 1);
	    break;
	case TYPE_SPEC:
	    SetChoice(tllayout, 2);
	    break;
	}
	switch (t.tl_loc) {
	case LABEL_ONTICK:
	    SetChoice(tlloc, 0);
	    break;
	case LABEL_BETWEEN:
	    SetChoice(tlloc, 1);
	    break;
	}
	iv = (int) t.tl_angle % 360;
	XtSetArg(a, XmNvalue, iv);
	XtSetValues(tlangle, &a, 1);
    }
}
示例#16
0
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();
}
示例#17
0
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();
}
示例#18
0
/*
 * define tick marks
 */
static void ticks_define_notify_proc(Widget w, XtPointer client_data, XtPointer call_data)
{
    char val[80];
    int i, j;
    int applyto;
    extern double result;
    double x = (g[cg].w.xg2 - g[cg].w.xg1), y = (g[cg].w.yg2 - g[cg].w.yg1), a = g[cg].w.xg1, b = g[cg].w.yg1, c = g[cg].w.xg2, d = g[cg].w.yg2;
    int errpos;
    int axis_start, axis_stop, graph_start, graph_stop;
    tickmarks t;

    get_graph_tickmarks(cg, &t, curaxis);
    t.label.s = NULL;

    applyto = GetChoice(axis_applyto);
    strcpy(val, (char *) xv_getstr(tmajor));
    scanner(val, &x, &y, 1, &a, &b, &c, &d, 1, 0, 0, &errpos);
    if (errpos) {
	return;
    }
    t.tmajor = result;
    if (islogx(cg) && (curaxis % 2 == 0)) {
	t.tmajor = (int) t.tmajor;
    } else if (islogy(cg) && (curaxis % 2 == 1)) {
	t.tmajor = (int) t.tmajor;
    }
    strcpy(val, (char *) xv_getstr(tminor));
    scanner(val, &x, &y, 1, &a, &b, &c, &d, 1, 0, 0, &errpos);
    if (errpos) {
	return;
    }
    t.tminor = result;
    if (islogx(cg) && (curaxis % 2 == 0)) {
	t.tminor = (int) t.tminor;
	if (t.tminor < 0 || t.tminor > 5) {
	    t.tminor = 0;
	}
    } else if (islogy(cg) && (curaxis % 2 == 1)) {
	t.tminor = (int) t.tminor;
	if (t.tminor < 0 || t.tminor > 5) {
	    t.tminor = 0;
	}
    }
    t.tl_flag = XmToggleButtonGetState(tlonoff) ? TRUE : FALSE;
    t.t_flag = XmToggleButtonGetState(tonoff) ? TRUE : FALSE;
    t.t_drawbar = XmToggleButtonGetState(baronoff) ? TRUE : FALSE;
    set_plotstr_string(&t.label, (char *) xv_getstr(axislabel));
    
    switch (applyto) {
    case 0:			/* current axis */
        axis_start = curaxis;
        axis_stop  = curaxis;
        graph_start = cg;
        graph_stop  = cg;
        break;
    case 1:			/* all axes, current graph */
        axis_start = 0;
        axis_stop  = MAXAXES - 1;
        graph_start = cg;
        graph_stop  = cg;
        break;
    case 2:			/* current axis, all graphs */
        axis_start = curaxis;
        axis_stop  = curaxis;
        graph_start = 0;
        graph_stop  = maxgraph - 1;
        break;
    case 3:			/* all axes, all graphs */
        axis_start = 0;
        axis_stop  = MAXAXES - 1;
        graph_start = 0;
        graph_stop  = maxgraph - 1;
        break;
    default:
        axis_start = curaxis;
        axis_stop  = curaxis;
        graph_start = cg;
        graph_stop  = cg;
        break;        
    }
        
/*
 * 	set_graph_tickmarks(cg, &t, curaxis);
 * 	set_plotstr_string(&g[cg].t[curaxis].label, t.label.s);
 * 	break;
 */
    for (i = graph_start; i <= graph_stop; i++) {
        for (j = axis_start; j <= axis_stop; j++) {
            g[i].t[j].tl_flag = t.tl_flag;
            g[i].t[j].t_flag = t.t_flag;
            g[i].t[j].t_drawbar = t.t_drawbar;
            g[i].t[j].tmajor = t.tmajor;
            g[i].t[j].tminor = t.tminor;
            set_plotstr_string(&g[i].t[j].label, t.label.s);
        }
    }
    
    drawgraph();
    set_dirtystate();
}