void copy_graph_sets_only(int from, int to) { int i, j; kill_graph(to); set_graph_active(to); /* TODO compare maxplots */ for (i = 0; i < g[from].maxplot; i++) { for (j = 0; j < MAX_SET_COLS; j++) { g[to].p[i].ex[j] = NULL; } g[to].p[i].active = OFF; if (isactive(from, i)) { do_copyset(from, i, to, i); } } }
void arrange_graphs2(int grows, int gcols, double vgap, double hgap, double sx, double sy, double wx, double wy, int applyto) { int i, j; int gtmp = 0; if (gcols != 1 || grows != 1) { for (i = 0; i < gcols; i++) { for (j = 0; j < grows; j++) { g[gtmp].v.xv1 = sx + i * hgap + i * wx; g[gtmp].v.xv2 = sx + i * hgap + (i + 1) * wx; g[gtmp].v.yv1 = sy + j * vgap + j * wy; g[gtmp].v.yv2 = sy + j * vgap + (j + 1) * wy; if (!isactive_graph(gtmp)) { set_graph_active(gtmp); } gtmp++; } } } }
void copy_graph(int from, int to) { int i, j; plotarr *p; kill_graph(to); p = g[to].p; memcpy(&g[to], &g[from], sizeof(graph)); g[to].p = p; set_graph_active(to); /* TODO compare maxplots */ for (i = 0; i < g[from].maxplot; i++) { for (j = 0; j < MAX_SET_COLS; j++) { g[to].p[i].ex[j] = NULL; } g[to].p[i].active = OFF; if (isactive(from, i)) { do_copyset(from, i, to, i); } } }
void arrange_graphs(int grows, int gcols) { int i, j; double dvx = 0.9 / gcols; double dvy = 0.9 / grows; int gtmp = 0; if (gcols != 1 || grows != 1) { for (i = 0; i < gcols; i++) { for (j = 0; j < grows; j++) { g[gtmp].v.xv1 = 0.1 + i * dvx; g[gtmp].v.xv2 = 0.1 + ((i + 1) * dvx); g[gtmp].v.xv2 -= 0.07; g[gtmp].v.yv1 = 0.1 + j * dvy; g[gtmp].v.yv2 = 0.1 + ((j + 1) * dvy); g[gtmp].v.yv2 -= 0.07; set_graph_active(gtmp); update_all(cg); gtmp++; } } } }
static void rdata_proc(Widget, XtPointer, XtPointer) { int graphno, autoflag; Arg args; XmString list_item; char *s; XtSetArg(args, XmNtextString, &list_item); XtGetValues(rdata_dialog, &args, 1); XmStringGetLtoR(list_item, charset, &s); graphno = GetChoice(read_graph_item) - 1; autoflag = XmToggleButtonGetState(read_auto_item); if (graphno == -1) { graphno = cg; } if (g[graphno].active == OFF) { set_graph_active(graphno); } set_type_proc(GetChoice(read_ftype_item)); set_wait_cursor(); if (getdata(graphno, s, cursource, curtype)) { if (autoscale_onread || autoflag) { autoscale_proc((Widget)NULL, (XtPointer)0, (XtPointer)NULL); } else { drawgraph(); } } XtFree(s); unset_wait_cursor(); }
static void eblock_accept_notify_proc(Widget, XtPointer, XtPointer) { int i = 0; char buf[256]; int setno, graphno; int cx, cy, c1 = 0, c2 = 0, c3 = 0, c4 = 0; //d1, double *tx, *ty, *t2, *t3, *t4, *t5; //d1 = (int) GetChoice(eblock_type_choice_item); cx = (int)GetChoice(eblock_x_choice_item) - 1; cy = (int)GetChoice(eblock_y_choice_item); if (cx >= 0 && cx >= blockncols) { errwin("Column for X exceeds the number of columns in block data"); return; } if (cy >= blockncols) { errwin("Column for Y exceeds the number of columns in block data"); return; } switch (block_curtype) { case XY: break; case XYRT: case XYDX: case XYDY: case XYZ: c1 = (int)GetChoice(eblock_e1_choice_item); if (c1 >= blockncols) { errwin("Column for E1 exceeds the number of columns in block data"); return; } break; case XYDXDX: case XYDYDY: case XYDXDY: c1 = (int)GetChoice(eblock_e1_choice_item); c2 = (int)GetChoice(eblock_e2_choice_item); if (c1 >= blockncols) { errwin("Column for E1 exceeds the number of columns in block data"); return; } if (c2 >= blockncols) { errwin("Column for E2 exceeds the number of columns in block data"); return; } break; case XYHILO: case XYBOX: c1 = (int)GetChoice(eblock_e1_choice_item); c2 = (int)GetChoice(eblock_e2_choice_item); c3 = (int)GetChoice(eblock_e3_choice_item); if (c1 >= blockncols) { errwin("Column for E1 exceeds the number of columns in block data"); return; } if (c2 >= blockncols) { errwin("Column for E2 exceeds the number of columns in block data"); return; } if (c3 >= blockncols) { errwin("Column for E3 exceeds the number of columns in block data"); return; } break; case XYBOXPLOT: c1 = (int)GetChoice(eblock_e1_choice_item); c2 = (int)GetChoice(eblock_e2_choice_item); c3 = (int)GetChoice(eblock_e3_choice_item); c4 = (int)GetChoice(eblock_e4_choice_item); if (c1 >= blockncols) { errwin("Column for E1 exceeds the number of columns in block data"); return; } if (c2 >= blockncols) { errwin("Column for E2 exceeds the number of columns in block data"); return; } if (c3 >= blockncols) { errwin("Column for E3 exceeds the number of columns in block data"); return; } if (c4 >= blockncols) { errwin("Column for E4 exceeds the number of columns in block data"); return; } } setno = -1; graphno = (int)GetChoice(eblock_graph_choice_item) - 1; if (graphno == -1) { graphno = cg; } if (setno == -1) { setno = nextset(graphno); } if (setno == -1) { return; } if (g[graphno].active == OFF) { set_graph_active(graphno); } activateset(graphno, setno); settype(graphno, setno, block_curtype); tx = (double *)calloc(blocklen, sizeof(double)); if (tx == NULL) { errwin("Can't allocate memory for X"); return; } ty = (double *)calloc(blocklen, sizeof(double)); if (ty == NULL) { cfree(tx); errwin("Can't allocate memory for Y"); return; } for (i = 0; i < blocklen; i++) { if (cx == -1) { tx[i] = i + 1; } else { tx[i] = blockdata[cx][i]; } ty[i] = blockdata[cy][i]; } setcol(graphno, tx, setno, blocklen, 0); setcol(graphno, ty, setno, blocklen, 1); switch (block_curtype) { case XY: sprintf(buf, "Cols %d %d", cx + 1, cy + 1); break; case XYRT: case XYDX: case XYDY: case XYZ: sprintf(buf, "Cols %d %d %d", cx + 1, cy + 1, c1 + 1); t2 = (double *)calloc(blocklen, sizeof(double)); for (i = 0; i < blocklen; i++) { t2[i] = blockdata[c1][i]; } setcol(graphno, t2, setno, blocklen, 2); break; case XYDXDX: case XYDYDY: case XYDXDY: sprintf(buf, "Cols %d %d %d %d", cx + 1, cy + 1, c1 + 1, c2 + 1); t2 = (double *)calloc(blocklen, sizeof(double)); t3 = (double *)calloc(blocklen, sizeof(double)); for (i = 0; i < blocklen; i++) { t2[i] = blockdata[c1][i]; t3[i] = blockdata[c2][i]; } setcol(graphno, t2, setno, blocklen, 2); setcol(graphno, t3, setno, blocklen, 3); break; case XYHILO: case XYBOX: sprintf(buf, "Cols %d %d %d %d %d", cx + 1, cy + 1, c1 + 1, c2 + 1, c3 + 1); t2 = (double *)calloc(blocklen, sizeof(double)); t3 = (double *)calloc(blocklen, sizeof(double)); t4 = (double *)calloc(blocklen, sizeof(double)); for (i = 0; i < blocklen; i++) { t2[i] = blockdata[c1][i]; t3[i] = blockdata[c2][i]; t4[i] = blockdata[c3][i]; } setcol(graphno, t2, setno, blocklen, 2); setcol(graphno, t3, setno, blocklen, 3); setcol(graphno, t4, setno, blocklen, 4); break; case XYBOXPLOT: sprintf(buf, "Cols %d %d %d %d %d %d", cx + 1, cy + 1, c1 + 1, c2 + 1, c3 + 1, c4 + 1); t2 = (double *)calloc(blocklen, sizeof(double)); t3 = (double *)calloc(blocklen, sizeof(double)); t4 = (double *)calloc(blocklen, sizeof(double)); t5 = (double *)calloc(blocklen, sizeof(double)); for (i = 0; i < blocklen; i++) { t2[i] = blockdata[c1][i]; t3[i] = blockdata[c2][i]; t4[i] = blockdata[c3][i]; t5[i] = blockdata[c4][i]; } setcol(graphno, t2, setno, blocklen, 2); setcol(graphno, t3, setno, blocklen, 3); setcol(graphno, t4, setno, blocklen, 4); setcol(graphno, t5, setno, blocklen, 5); break; } setcomment(graphno, setno, buf); updatesetminmax(graphno, setno); update_status_popup(NULL, NULL, NULL); drawgraph(); }