void do_ss_frame(Widget w, XtPointer client_data, XtPointer call_data) /* * Gte the selected set and call the routine to open up an Xbae widget */ { EditPoints *ep; int gno = cg; int setno = GetSelectedSet(editp_set_item); if (setno == SET_SELECT_ERROR) { errwin("No set selected"); return; } if( setno == SET_SELECT_NEXT ) { if( (setno=nextset(gno)) != -1 ) { add_point(gno, setno, 0., 0., 0, 0, SET_XY); add_point(gno, setno, 1, 1, 0, 0, SET_XY); setcomment( gno, setno, "editor" ); update_set_status( gno, setno ); } else { errwin("No set selected"); return; } } if (isactive_set(gno, setno)) { if (((ep = (EditPoints *) geteditpoints(gno, setno)) != NULL) && (ep->top != NULL)) { XtRaise(ep->top); } else { ep = newep(gno, setno); create_ss_frame(ep); } } else { errwin("Set not active"); } }
void define_autos(int aon, int au, int ap, int ameth, int antx, int anty) { int i, ming, maxg; if (au >= 0 && !isactive_set(cg, au)) { errmsg("Set not active"); return; } if (ap) { ming = 0; maxg = maxgraph - 1; } else { ming = cg; maxg = cg; } if (ming == cg && maxg == cg) { if (!isactive_graph(cg)) { errmsg("Current graph is not active!"); return; } } for (i = ming; i <= maxg; i++) { if (isactive_graph(i)) { if (ameth == 0) { g[i].auto_type = TYPE_AUTO; } else { g[i].auto_type = TYPE_SPEC; } g[i].t[0].t_num = antx + 2; g[i].t[1].t_num = anty + 2; if (aon > -4) { /* -4 == just set parameters but don't * autoscale */ if (au >= 0 && isactive_set(i, au)) { autoscale_set(i, au, aon); } else { autoscale_graph(i, aon); } } } } if (aon != -4) { #ifndef NONE_GUI drawgraph(); #endif } }
void do_autoscale_set(int gno, int setno) { if (isactive_set(gno, setno)) { defaultsetgraph(gno, setno); default_axis(gno, g[gno].auto_type, X_AXIS); default_axis(gno, g[gno].auto_type, ZX_AXIS); default_axis(gno, g[gno].auto_type, Y_AXIS); default_axis(gno, g[gno].auto_type, ZY_AXIS); update_all(gno); drawgraph(); } }
/* * delete the selected row */ void del_point_cb(Widget w, XtPointer client_data, XtPointer call_data) { EditPoints *ep = (EditPoints *)client_data; int i,j; XbaeMatrixGetCurrentCell( ep->mw, &i, &j ); if( i>=ep->nrows || j>=ep->ncols ){ errwin( "Selected cell out of range" ); return; } del_point( ep->gno, ep->setno, i+1 ); update_set_status( ep->gno, ep->setno ); if( isactive_set( ep->gno, ep->setno ) ){ update_cells( NULL, (XtPointer)ep, 0 ); } }
void TransformFourier::updateDialog() { int setno = setNumber->currentIndex(); bool noSet = !isactive_set(cg, setno); // destination->setDisabled(noSet); // destinationLabel->setDisabled(noSet); windowLabel->setDisabled(noSet); loadLabel->setDisabled(noSet); loadXLabel->setDisabled(noSet); dataTypeLabel->setDisabled(noSet); operationLabel->setDisabled(noSet); windowType->setDisabled(noSet); loadType->setDisabled(noSet); loadX->setDisabled(noSet); dataType->setDisabled(noSet); operation->setDisabled(noSet); }
/* * Start up editor using GR_EDITOR variable * Note the change to the GR_EDITOR variable: If it requires a text * terminal it must provide it explicitly with an xterm -e prefix */ void do_ext_editor(Widget w, XtPointer client_data, XtPointer call_data) { char buf[256], tbuf[256], *fname, *mktemp(char *); char ebuf[256], *s; int setno = GetSelectedSet(editp_set_item), curgraph=cg; if (setno == SET_SELECT_ERROR) { errwin("No set selected"); return; } strcpy(tbuf, "/tmp/xmgrXXXXXX"); fname = mktemp(tbuf); if( setno == SET_SELECT_NEXT ){ if( (setno=nextset(curgraph)) == -1 ){ errwin("Not enough sets"); return; } activateset( curgraph, setno ); do_writesets(curgraph, setno, 0, fname, sformat); } else do_writesets(curgraph, setno, 0, fname, sformat); if ((s = getenv("GR_EDITOR")) != NULL) { strcpy(ebuf, s); } else { strcpy(ebuf, "xterm -e vi"); } sprintf(buf, "%s %s", ebuf, fname); system(buf); if( isactive_set( curgraph, setno ) ) { softkillset( curgraph, setno ); getdata(curgraph, fname, SOURCE_DISK, dataset_type( curgraph, setno ) ); } else { setcomment( curgraph, setno, "editor" ); getdata(curgraph, fname, SOURCE_DISK, SET_XY ); } sprintf(buf, "rm %s", fname); system(buf); update_all( curgraph ); doforce_redraw(); }
/* * add a point to a set by copying the selected cell and placing it after it */ void add_pt_cb(Widget w, XtPointer client_data, XtPointer call_data) { EditPoints *ep = (EditPoints *)client_data; int i,j, k; double vals[MAX_SET_COLS]; XbaeMatrixGetCurrentCell( ep->mw, &i, &j ); if( i>=ep->nrows || j>=ep->ncols || i<0 || j<0 ){ errwin( "Selected cell out of range" ); return; } for( k=0; k<ep->ncols; k++ ) vals[k] = *(getcol( ep->gno, ep->setno, k )+i ); for( ;k<MAX_SET_COLS; k++ ) vals[k] = 0.; add_point_at( ep->gno, ep->setno, i, 1, vals[0], vals[1], vals[2], vals[3], g[ep->gno].p[ep->setno].type ); update_set_status( ep->gno, ep->setno ); if( isactive_set( ep->gno, ep->setno ) ) { update_cells( NULL, (XtPointer)ep, 0 ); } }
void defaultx(int gno, int setno) { int i, first = 1; double xgmin, xgmax, xmax, xmin, tmp; xgmin = xgmax = 0.0; if (setno < 0) { for (i = 0; i < g[gno].maxplot; i++) { if (isactive_set(gno, i)) { getsetminmax(gno, i, &xmin, &xmax, &tmp, &tmp); if (first) { xgmin = xmin; xgmax = xmax; first = 0; } else { xgmin = (xmin < xgmin) ? xmin : xgmin; xgmax = (xmax > xgmax) ? xmax : xgmax; } } } } else { if (isactive_set(gno, setno)) { getsetminmax(gno, setno, &xgmin, &xgmax, &tmp, &tmp); } else { return; } } if (xgmin != xgmax) { g[gno].w.xg2 = xgmax; g[gno].w.xg1 = xgmin; } else { if ((xgmin == 0.0) && (xgmax == 0.0)) { xgmin = 1.0; } g[gno].w.xg1 = xgmin - 0.1 * fabs(xgmin); g[gno].w.xg2 = xgmin + 0.1 * fabs(xgmin); } switch (g[gno].type) { case BAR: case STACKEDBAR: g[gno].w.xg1 -= 0.5; g[gno].w.xg2 += 0.5; if (g[gno].w.yg1 > 0.0) { g[gno].w.yg1 = 0.0; } break; case HBAR: case STACKEDHBAR: if (g[gno].w.xg1 > 0.0) { g[gno].w.xg1 = 0.0; } break; case LOGX: if (g[gno].w.xg1 <= 0.0) { errwin("can't set graph type to log-linear, X minimum = 0.0"); g[gno].type = XY; } break; case LOGY: if (g[gno].w.yg1 <= 0.0) { errwin("can't set graph type to linear-log, Y minimum = 0.0"); g[gno].type = XY; } break; case LOGXY: if (g[gno].w.xg1 <= 0.0) { errwin("can't set graph to log-log, X minimum <= 0.0"); g[gno].type = XY; } else if (g[gno].w.yg1 <= 0.0) { errwin("can't set graph type to log-log, Y minimum <= 0.0"); g[gno].type = XY; } break; } }
void defaultgraph(int gno) { double x1, x2, y1, y2; double xgmax, xgmin, ygmax, ygmin; int i, first = 1; xgmax = xgmin = ygmax = ygmin = 0.0; for (i = 0; i < g[gno].maxplot; i++) { if (isactive_set(gno, i)) { getsetminmax(gno, i, &x1, &x2, &y1, &y2); if (g[gno].type == STACKEDBAR) { if (first) { xgmin = x1; xgmax = x2; ygmin = y1; ygmax = y2; first = 0; } else { xgmin = (x1 < xgmin) ? x1 : xgmin; xgmax = (x2 > xgmax) ? x2 : xgmax; ygmin = (y1 < ygmin) ? y1 : ygmin; ygmax += y2; } } else if (g[gno].type == STACKEDHBAR) { if (first) { xgmin = x1; xgmax = x2; ygmin = y1; ygmax = y2; first = 0; } else { ygmin = (y1 < ygmin) ? y1 : ygmin; ygmax = (y2 > ygmax) ? y2 : ygmax; xgmin = (x1 < xgmin) ? x1 : xgmin; xgmax += x2; } } else { if (first) { xgmin = x1; xgmax = x2; ygmin = y1; ygmax = y2; first = 0; } else { xgmin = (x1 < xgmin) ? x1 : xgmin; xgmax = (x2 > xgmax) ? x2 : xgmax; ygmin = (y1 < ygmin) ? y1 : ygmin; ygmax = (y2 > ygmax) ? y2 : ygmax; } } } } if (xgmin != xgmax) { g[gno].w.xg2 = xgmax; g[gno].w.xg1 = xgmin; } else { g[gno].w.xg1 = xgmin - 1.0; g[gno].w.xg2 = xgmin + 1.0; } if (ygmin != ygmax) { g[gno].w.yg2 = ygmax; g[gno].w.yg1 = ygmin; } else { g[gno].w.yg1 = ygmin - 1.0; g[gno].w.yg2 = ygmin + 1.0; } switch (g[gno].type) { case BAR: g[gno].w.xg1 -= (g[gno].w.xg2 - g[gno].w.xg1) * 0.05; g[gno].w.xg2 += (g[gno].w.xg2 - g[gno].w.xg1) * 0.05; if (g[gno].w.yg1 > 0.0) { g[gno].w.yg1 = 0.0; } break; case HBAR: g[gno].w.yg1 -= (g[gno].w.yg2 - g[gno].w.yg1) * 0.05; g[gno].w.yg2 += (g[gno].w.yg2 - g[gno].w.yg1) * 0.05; if (g[gno].w.xg1 > 0.0) { g[gno].w.xg1 = 0.0; } break; case STACKEDBAR: g[gno].w.xg1 -= (g[gno].w.xg2 - g[gno].w.xg1) * 0.05; g[gno].w.xg2 += (g[gno].w.xg2 - g[gno].w.xg1) * 0.05; if (g[gno].w.yg1 > 0.0) { g[gno].w.yg1 = 0.0; } break; case STACKEDHBAR: g[gno].w.yg1 -= (g[gno].w.yg2 - g[gno].w.yg1) * 0.05; g[gno].w.yg2 += (g[gno].w.yg2 - g[gno].w.yg1) * 0.05; if (g[gno].w.xg1 > 0.0) { g[gno].w.xg1 = 0.0; } break; case LOGX: if (g[gno].w.xg1 <= 0.0) { errwin("can't set graph type to log-linear, X minimum = 0.0"); g[gno].type = XY; } break; case LOGY: if (g[gno].w.yg1 <= 0.0) { errwin("can't set graph type to linear-log, Y minimum = 0.0"); g[gno].type = XY; } break; case LOGXY: if (g[gno].w.xg1 <= 0.0) { errwin("can't set graph to log-log, X minimum <= 0.0"); g[gno].type = XY; } else if (g[gno].w.yg1 <= 0.0) { errwin("can't set graph type to log-log, Y minimum <= 0.0"); g[gno].type = XY; } break; } }
void defaulty(int gno, int setno) { int i, first = 1; double ygmax, ygmin, ymin, ymax, tmp; ygmin = ygmax = 0.0; if (setno < 0) { for (i = 0; i < g[gno].maxplot; i++) { if (isactive_set(gno, i)) { if (g[gno].type == STACKEDBAR) { } else { getsetminmax(gno, i, &tmp, &tmp, &ymin, &ymax); if (first) { ygmin = ymin; ygmax = ymax; first = 0; } else { ygmin = (ymin < ygmin) ? ymin : ygmin; ygmax = (ymax > ygmax) ? ymax : ygmax; } } } } } else { if (isactive_set(gno, setno)) { getsetminmax(gno, setno, &tmp, &tmp, &ygmin, &ygmax); } else { return; } } if (ygmin != ygmax) { g[gno].w.yg2 = ygmax; g[gno].w.yg1 = ygmin; } else { if ((ygmin == 0.0) && (ygmax == 0.0)) { ygmin = 1.0; } g[gno].w.yg1 = ygmin - 0.1 * fabs(ygmin); g[gno].w.yg2 = ygmin + 0.1 * fabs(ygmin); } switch (g[gno].type) { case BAR: case STACKEDBAR: if (g[gno].w.yg1 > 0.0) { g[gno].w.yg1 = 0.0; } break; case HBAR: case STACKEDHBAR: g[gno].w.yg1 -= 0.5; g[gno].w.yg2 += 0.5; if (g[gno].w.xg1 > 0.0) { g[gno].w.xg1 = 0.0; } break; case LOGX: if (g[gno].w.xg1 <= 0.0) { errwin("can't set graph type to log-linear, X minimum = 0.0"); g[gno].type = XY; } break; case LOGY: if (g[gno].w.yg1 <= 0.0) { errwin("can't set graph type to linear-log, Y minimum = 0.0"); g[gno].type = XY; } break; case LOGXY: if (g[gno].w.xg1 <= 0.0) { errwin("can't set graph to log-log, X minimum <= 0.0"); g[gno].type = XY; } else if (g[gno].w.yg1 <= 0.0) { errwin("can't set graph type to log-log, Y minimum <= 0.0"); g[gno].type = XY; } break; } if (g[gno].type == BAR || g[gno].type == STACKEDBAR) { if (g[gno].w.yg1 > 0.0) { g[gno].w.yg1 = 0.0; } } }
void fext_routine( int gto, int feature, int abs_src, int abs_set, int abs_graph ) { int i, cs, ns, fts, ncurves, extract_err; double datum, dummy, *absy; double y1, y2; int iy1, iy2; char tbuf[1024]; float *abscissa; abscissa = (float *)malloc( maxplot*sizeof(float) ); if( !isactive_graph( gto ) ){ errwin("Graph for results must be active"); return; } if( (ns=nextset( gto ) )== -1 ) { errwin("Choose a new graph or kill sets!"); return; } ncurves = nactive(cg); switch( abs_src ) { case 0: /* use index */ for( i=0; i<ncurves; i++ ) abscissa[i] = i+1; break; case 1: /* use legend label */ cs = 0; for( i=0; i<ncurves; i++ ){ while( !isactive_set( cg, cs ) ) cs++; if(!sscanf( g[cg].p[cs].lstr, "%f", &abscissa[i])) break; cs++; } if( i != ncurves ) { errwin("Bad legend label"); return; } break; case 2: /* use X from set */ if( !isactive_set( abs_graph, abs_set ) ){ errwin("Abscissa set not active"); return; } if( getsetlength( abs_graph, abs_set ) < ncurves ) { errwin("Not enough points in set"); return; } absy = getx( abs_graph, abs_set ); for( i=0; i<ncurves; i++ ) abscissa[i] = absy[i]; break; case 3: /* use Y from set */ if( !isactive_set( abs_graph, abs_set ) ){ errwin("Abscissa set not active"); return; } if( getsetlength( abs_graph, abs_set ) < ncurves ) { errwin("Not enough points in set"); return; } absy = gety( abs_graph, abs_set ); for( i=0; i<ncurves; i++ ) abscissa[i] = absy[i]; break; } cs = 0; tbuf[0] = '\0'; for( i=0; i<ncurves; i++ ) { while( !isactive_set( cg, cs ) ) cs++; extract_err = 0; switch( feature ) { case 0: /* Y minimum */ datum = g[cg].p[cs].ymin; break; case 1: /* Y maximum */ datum = g[cg].p[cs].ymax; break; case 2: /* Y mean */ stasum(gety(cg, cs), getsetlength(cg, cs), &datum, &dummy, 0); break; case 3: /* Y std dev */ stasum(gety(cg, cs), getsetlength(cg, cs), &dummy, &datum, 0); break; case 4: /* Y median */ getmedian( cg, cs, DATA_Y, &datum ); break; case 5: /* X minimum */ datum = g[cg].p[cs].xmin; break; case 6: /* X maximum */ datum = g[cg].p[cs].xmax; break; case 7: /* X mean */ stasum(getx(cg, cs), getsetlength(cg, cs), &datum, &dummy, 0); break; case 8: /* X std dev */ stasum(getx(cg, cs), getsetlength(cg, cs), &dummy, &datum, 0); break; case 9: /* X median */ getmedian( cg, cs, DATA_X, &datum ); break; case 10: /* frequency and period */ case 11: if ( ilog2(getsetlength(cg, cs)) <= 0) /* only DFT */ do_fourier(0, cs, 0, 1, 0, 0, 0); else /* FFT */ do_fourier(1, cs, 0, 1, 0, 0, 0); sprintf( tbuf, "FT of set %d", cs ); fts = 0; while( strcmp( tbuf, g[cg].p[fts].comments+1 ) ) fts++; minmax(gety(cg, fts), getsetlength(cg, fts),&y1,&y2,&iy1,&iy2); if( feature == 8 ) datum = g[cg].p[fts].ex[0][iy2-1]; else datum = 1./g[cg].p[fts].ex[0][iy2-1]; killset( cg, fts ); /* get rid of Fourier set */ break; case 12: /* first zero crossing */ if( get_zero_crossing( getsetlength( cg, cs ), getx( cg, cs ),gety( cg, cs ), &datum ) ){ sprintf( tbuf+strlen(tbuf), "Unable to find zero crossing of set %d\n", cs ); errwin( tbuf ); extract_err = 1; } break; case 13: /* rise time */ if( get_rise_time( getsetlength(cg,cs), getx(cg,cs), gety(cg,cs), g[cg].p[cs].ymin, g[cg].p[cs].ymax, &datum ) ){ sprintf( tbuf+strlen(tbuf), "Unable to find rise time of set %d\n", cs ); errwin( tbuf ); extract_err = 1; } break; case 14: /* fall time */ if( get_fall_time( getsetlength(cg,cs), getx(cg,cs), gety(cg,cs), g[cg].p[cs].ymin, g[cg].p[cs].ymax, &datum ) ){ sprintf( tbuf+strlen(tbuf), "Unable to find fall time of set %d\n", cs ); extract_err = 1; errwin( tbuf ); } break; case 15: /* slope */ if( mute_linear_regression( getsetlength( cg, cs ), getx( cg, cs ),gety( cg, cs ), &datum, &dummy ) ) { sprintf( tbuf+strlen(tbuf), "Unable to find slope of set %d\n", cs ); errwin( tbuf ); extract_err = 1; } break; case 16: /* Y intercept */ if( mute_linear_regression( getsetlength( cg, cs ), getx( cg, cs ), gety( cg, cs ), &dummy, &datum ) ) { sprintf( tbuf+strlen(tbuf), "Unable to find y-intercept of set %d\n", cs ); errwin( tbuf ); extract_err = 1; } break; case 17: /* set length */ datum = getsetlength( cg, cs ); break; case 18: /* half maximal widths */ if( get_half_max_width(getsetlength( cg, cs ), getx(cg,cs), gety(cg,cs), g[cg].p[cs].ymin, g[cg].p[cs].ymax,&datum) ) { sprintf( tbuf+strlen(tbuf), "Unable to find half maximal width of set %d\n", cs ); extract_err = 1; errwin( tbuf ); } break; case 19: /* Barycenter X */ get_barycenter( getsetlength( cg, cs ), gety(cg,cs), getx(cg,cs), &datum ); break; case 20: /* Barycenter Y */ get_barycenter( getsetlength( cg, cs ), getx(cg,cs), gety(cg,cs), &datum ); break; case 21: /* X of Maximum Y */ get_max_pos( gety(cg, cs), getx( cg, cs ), getsetlength( cg, cs ), g[cg].p[cs].ymax, &datum ); break; case 22: /* Y of Maximum X */ get_max_pos( getx(cg, cs), gety( cg, cs ), getsetlength( cg, cs ), g[cg].p[cs].xmax, &datum ); break; } if( !extract_err ) add_point( gto, ns, abscissa[i], datum, 0, 0, SET_XY ); cs++; } /* set comment */ switch( feature ) { case 0: /* Y minimum */ sprintf(tbuf,"Y minima of graph %d",cg); break; case 1: /* Y maximum */ sprintf(tbuf,"Y maxima of graph %d",cg); break; case 2: /* Y mean */ sprintf(tbuf,"Y means of graph %d",cg); break; case 3: /* Y std dev */ sprintf(tbuf,"Y std. dev.'s of graph %d",cg); break; case 4: /* Y median */ sprintf(tbuf,"Y medians of graph %d",cg); break; case 5: /* X minimum */ sprintf(tbuf,"X minima of graph %d",cg); break; case 6: /* X maximum */ sprintf(tbuf,"X maxima of graph %d",cg); break; case 7: /* X mean */ sprintf(tbuf,"X means of graph %d",cg); break; case 8: /* X std dev */ sprintf(tbuf,"X std. dev.'s of graph %d",cg); break; case 9: /* X median */ sprintf(tbuf,"X medians of graph %d",cg); break; case 10: /* frequency and period */ sprintf(tbuf,"frequencies of graph %d",cg); break; case 11: sprintf(tbuf,"periods of graph %d",cg); break; case 12: /* first zero crossing */ sprintf(tbuf,"zero crossings of graph %d",cg); break; case 13: /* rise time */ sprintf(tbuf,"rise times of graph %d",cg); break; case 14: /* fall time */ sprintf(tbuf,"fall times of graph %d",cg); break; case 15: /* slopes */ sprintf(tbuf,"slopes of graph %d",cg); break; case 16: /* Y intercepts */ sprintf(tbuf,"Y intercepts of graph %d",cg); break; case 17: /* set lengths */ sprintf(tbuf,"set lengths of graph %d",cg); break; case 18: /* 1/2 maximal widths */ sprintf(tbuf,"half maximal widths of graph %d",cg); break; case 19: /* barycenter X */ sprintf(tbuf,"X barycenters of graph %d",cg); break; case 20: /* barycenter Y */ sprintf(tbuf,"Y barycenters of graph %d",cg); break; case 21: /* X of maximum Y */ sprintf(tbuf,"X positions of maximum Y's of graph %d",cg); break; case 22: /* Y of maximum X */ sprintf(tbuf,"Y positions of maximum X's of graph %d",cg); break; } setcomment( gto, ns, tbuf ); free( abscissa ); plotone( gto ); }
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); } } }