From 2b905607c3a232d1bf21e76b0aa8c5bb51d7d676 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 6 Mar 2020 14:51:39 +0100 Subject: [PATCH] make flag 'nolegend' localfor each plot --- src/frontend/plotting/graf.c | 7 +++++-- src/include/ngspice/graph.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 6c427daeb..683f720b0 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -134,6 +134,8 @@ int gr_init(double *xlims, double *ylims, /* The size of the screen. */ graph->ticdata = NULL; } + cp_getvar("nolegend", CP_BOOL, &(graph->nolegend), 0); + if (!xlims || !ylims) { internalerror("gr_init: no range specified"); return FALSE; @@ -184,6 +186,7 @@ int gr_init(double *xlims, double *ylims, /* The size of the screen. */ strcpy(graph->ticchar, pgraph->ticchar); graph->ticdata = pgraph->ticdata; graph->ticmarks = pgraph->ticmarks; + graph->nolegend = pgraph->nolegend; } /* layout decisions */ @@ -434,7 +437,7 @@ static void gr_start_internal(struct dvec *dv, bool copyvec) } /* Put the legend entry on the screen. */ - if (!cp_getvar("nolegend", CP_BOOL, NULL, 0)) + if (!currentgraph->nolegend) drawlegend(currentgraph, cur.plotno++, dv); } @@ -610,7 +613,7 @@ void gr_redraw(GRAPH *graph) cur.plotno = 0; for (link = graph->plotdata; link; link = link->next) { /* redraw legend */ - if (!cp_getvar("nolegend", CP_BOOL, NULL, 0)) + if (!graph->nolegend) drawlegend(graph, cur.plotno++, link->vector); /* replot data diff --git a/src/include/ngspice/graph.h b/src/include/ngspice/graph.h index e7b64d615..22dbeb9d8 100644 --- a/src/include/ngspice/graph.h +++ b/src/include/ngspice/graph.h @@ -33,6 +33,8 @@ struct graph { int currentcolor; int linestyle; + bool nolegend; + struct { int height, width; } viewport;