Browse Source

command 'setplot': add predefined 'previous' and 'next' parameters

to switch to the previous or next plot. A warning results if this
is not possible, then the currnt plot is not changed.
pre-master-46
Holger Vogt 8 years ago
parent
commit
c5b5190199
  1. 22
      src/frontend/vectors.c

22
src/frontend/vectors.c

@ -966,6 +966,28 @@ plot_setcur(char *name)
plot_cur = pl;
return;
}
/* plots are listed in pl in reverse order */
else if (cieq(name, "previous")) {
if (plot_cur->pl_next)
plot_cur = plot_cur->pl_next;
else
fprintf(cp_err, "Warning: Switching to previous plot not possible, stay with current plot (%s)\n", plot_cur->pl_typename);
return;
}
else if (cieq(name, "next")) {
struct plot *prev_pl = NULL;
for (pl = plot_list; pl; pl = pl->pl_next) {
if (pl == plot_cur)
break;
prev_pl = pl;
}
if (!prev_pl) {
fprintf(cp_err, "Warning: Switching to next plot not possible, stay with current plot (%s)\n", plot_cur->pl_typename);
return;
}
plot_cur = prev_pl;
return;
}
for (pl = plot_list; pl; pl = pl->pl_next)
if (plot_prefix(name, pl->pl_typename))
break;

Loading…
Cancel
Save