From 7d9062f1f9607bf0f0018e995fd2f098f7d772d6 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 7 Feb 2020 22:44:36 +0100 Subject: [PATCH] add variable ticchar, allow an arbitrary character as ticmark --- src/frontend/plotting/graf.c | 18 ++++++------------ src/include/ngspice/graph.h | 1 + 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index e5fde6f95..29fd2b9e3 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -120,6 +120,10 @@ int gr_init(double *xlims, double *ylims, /* The size of the screen. */ } } + if (!cp_getvar("ticchar", CP_STRING, graph->ticchar, 1)) { + strcpy(graph->ticchar, "X"); + } + if (cp_getvar("ticlist", CP_LIST, ticlist, 0)) { wl = vareval("ticlist"); ticlist = wl_flatten(wl); @@ -300,26 +304,16 @@ void gr_point(struct dvec *dv, if ((tics = currentgraph->ticdata) != NULL) { for (; *tics < HUGE; tics++) if (*tics == (double) np) { - DevDrawText("x", (int) (tox - currentgraph->fontwidth / 2), + DevDrawText(currentgraph->ticchar, (int) (tox - currentgraph->fontwidth / 2), (int) (toy - currentgraph->fontheight / 2), 0); - /* gr_redraw will redraw this w/o our having to save it - Guenther Roehrich 22-Jan-99 */ - /* SaveText(currentgraph, "x", - (int) (tox - currentgraph->fontwidth / 2), - (int) (toy - currentgraph->fontheight / 2)); */ break; } } else if ((currentgraph->ticmarks >0) && (np > 0) && (np % currentgraph->ticmarks == 0)) { /* Draw an 'x' */ - DevDrawText("x", (int) (tox - currentgraph->fontwidth / 2), + DevDrawText(currentgraph->ticchar, (int) (tox - currentgraph->fontwidth / 2), (int) (toy - currentgraph->fontheight / 2), 0); - /* gr_redraw will redraw this w/o our having to save it - Guenther Roehrich 22-Jan-99 */ - /* SaveText(currentgraph, "x", - (int) (tox - currentgraph->fontwidth / 2), - (int) (toy - currentgraph->fontheight / 2)); */ } break; case PLOT_COMB: diff --git a/src/include/ngspice/graph.h b/src/include/ngspice/graph.h index b682f377f..2fd05471d 100644 --- a/src/include/ngspice/graph.h +++ b/src/include/ngspice/graph.h @@ -61,6 +61,7 @@ struct graph { int ticmarks; /* mark every ticmark'th point */ double *ticdata; + char ticchar[2]; int fontwidth, fontheight; /* for use in grid */ PLOTTYPE plottype; /* defined in FTEconstant.h */