Beispiel #1
0
static void label_define_notify_proc(Widget w, XtPointer client_data, XtPointer call_data)
{
    set_plotstr_string(&g[cg].labs.title, (char *) xv_getstr(label_title_text_item));
    set_plotstr_string(&g[cg].labs.stitle, (char *) xv_getstr(label_subtitle_text_item));
    drawgraph();
    set_dirtystate();
}
Beispiel #2
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();
}
Beispiel #3
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();
}
Beispiel #4
0
static void labelprops_define_notify_proc(Widget w, XtPointer client_data, XtPointer call_data)
{
    Arg a;
    int value;

    g[cg].labs.title.font = (int) GetChoice(title_font_item);
    g[cg].labs.title.color = (int) GetChoice(title_color_item);
    g[cg].labs.title.linew = (int) GetChoice(title_linew_item) + 1;
    XtSetArg(a, XmNvalue, &value);
    XtGetValues(title_size_item, &a, 1);
    g[cg].labs.title.charsize = value / 100.0;

    g[cg].labs.stitle.font = (int) GetChoice(stitle_font_item);
    g[cg].labs.stitle.color = (int) GetChoice(stitle_color_item);
    g[cg].labs.stitle.linew = (int) GetChoice(stitle_linew_item) + 1;
    XtSetArg(a, XmNvalue, &value);
    XtGetValues(stitle_size_item, &a, 1);
    g[cg].labs.stitle.charsize = value / 100.0;
    drawgraph();
    set_dirtystate();
}
Beispiel #5
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();
}
Beispiel #6
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();
}
Beispiel #7
0
void define_arrange(int nrows, int ncols, int pack,
       double vgap, double hgap, double sx, double sy, double wx, double wy)
{
    int i, j, k, gno, applyto = 0;

    if (nrows * ncols > maxgraph) {
	errmsg("Too many rows and columns");
	return;
    }
    switch (pack) {
    case 0:
	for (j = 0; j < ncols; j++) {
	    for (i = 0; i < nrows; i++) {
		gno = i + j * nrows;
		for (k = 0; k < 2; k++) {
		    g[gno].t[k].tl_flag = TRUE;
		}
	    }
	}
	break;
    case 1:
	hgap = 0.0;
	for (j = 1; j < ncols; j++) {
	    for (i = 0; i < nrows; i++) {
		gno = i + j * nrows;
		for (k = 1; k < 6; k += 2) {
		    g[gno].t[k].tl_flag = FALSE;
		}
	    }
	}
	break;
    case 2:
	vgap = 0.0;
	for (j = 0; j < ncols; j++) {
	    for (i = 1; i < nrows; i++) {
		gno = i + j * nrows;
		for (k = 0; k < 6; k += 2) {
		    g[gno].t[k].tl_flag = FALSE;
		}
	    }
	}
	break;
    case 3:
	hgap = 0.0;
	vgap = 0.0;
	for (j = 1; j < ncols; j++) {
	    for (i = 0; i < nrows; i++) {
		gno = i + j * nrows;
		for (k = 1; k < 6; k += 2) {
		    g[gno].t[k].tl_flag = FALSE;
		}
	    }
	}
	for (j = 0; j < ncols; j++) {
	    for (i = 1; i < nrows; i++) {
		gno = i + j * nrows;
		for (k = 0; k < 6; k += 2) {
		    g[gno].t[k].tl_flag = FALSE;
		}
	    }
	}
	break;
    }
    arrange_graphs2(nrows, ncols, vgap, hgap, sx, sy, wx, wy, applyto);
#ifndef NONE_GUI
    drawgraph();
#endif
    set_dirtystate();
}
/*
 * set two digits years handling
 */
void allow_two_digits_years(int allowed)
{
    two_digits_years_flag = allowed ? TRUE : FALSE;
    set_dirtystate();
}
Beispiel #9
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();
}
Beispiel #10
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();
}
Beispiel #11
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();
}