From 934af04705ba18f39d5ac91008332c9738b3cf8c Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de> Date: Tue, 7 Mar 2017 21:58:37 +0100 Subject: [PATCH] start modification of gp, gf. Aim: enable appending. --- pub/lib/commands.cpp | 16 +++++++++------- pub/plot/dualplot.cpp | 3 ++- pub/plot/dualplot.hpp | 4 ++-- pub/share/g3.ps | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pub/lib/commands.cpp b/pub/lib/commands.cpp index 1d41a879..810e24a4 100644 --- a/pub/lib/commands.cpp +++ b/pub/lib/commands.cpp @@ -303,9 +303,8 @@ bool frida_command(string cmd) " gd graphic dialog (feed commands to gnuplot)\n" "Save for print:\n" " gp plot to complete .ps file\n" - " gP ditto, no automatic file name\n" " gf plot to short .psX file\n" - " gF ditto, no automatic file name\n" + " gfa append plot to existing .ps or .psa file\n" "Change window:\n" " gw list of plot windows\n" " g<n> switch to plot window <n>\n" @@ -351,15 +350,18 @@ bool frida_command(string cmd) SPloWin::instance()->current()->refine = bask( "Allow iterative refinement for curve plotting", SPloWin::instance()->current()->refine); - } else if (cmd == "gp" || cmd == "gP" || cmd == "gf" || cmd == "gF") { + } else if (cmd == "gp" || cmd == "gf" || cmd == "gfa") { string ps_outdir = CNode::eval("psdir")->to_s(); string ps_head = CNode::eval("pshead")->to_s(); - string ps_dict = (cmd == "gp"||cmd == "gP") ? CNode::eval("psdict")->to_s() : ""; - string fname = "&auto"; - if (cmd == "gP" || cmd == "gF") + string ps_dict = (cmd == "gp") ? CNode::eval("psdict")->to_s() : ""; + static string fname = ""; + if (cmd != "gfa") fname = sask("Graphic file name (without extension)"); + else + fname = sask("Graphic file name", fname); if (fname != "") - SPloWin::instance()->current()->write_postscript(fname, ps_outdir, ps_head, ps_dict); + SPloWin::instance()->current()->write_postscript( + cmd=="gfa", fname, ps_outdir, ps_head, ps_dict); } else if (cmd == "gw") { SPloWin::instance()->display_list(); } else if (sscanf(cmd.c_str(), "g%i", &i) == 1) { diff --git a/pub/plot/dualplot.cpp b/pub/plot/dualplot.cpp index 53abe03b..647b5e39 100644 --- a/pub/plot/dualplot.cpp +++ b/pub/plot/dualplot.cpp @@ -317,7 +317,8 @@ void CPlot::doc_CvTxLine(const string& line, int num) //! Write buffered plot to postscript file. void CPlot::write_postscript( - const string& fname, const string& ps_outdir, const string& ps_head, const string& ps_dict) + const bool append, const string& fname, const string& ps_outdir, + const string& ps_head, const string& ps_dict) { // construct output file name: string ext = string(".") + (ps_dict == "" ? "psa" : "ps"); diff --git a/pub/plot/dualplot.hpp b/pub/plot/dualplot.hpp index 84bf6639..b03879cd 100644 --- a/pub/plot/dualplot.hpp +++ b/pub/plot/dualplot.hpp @@ -40,8 +40,8 @@ public: void doc_PtTxLine(const std::string& line, int num); void doc_CvTxLine(const std::string& line, int num); void write_postscript( - const std::string& fname, const std::string& ps_outdir, const std::string& ps_head, - const std::string& ps_dict); + const bool append, const std::string& fname, const std::string& ps_outdir, + const std::string& ps_head, const std::string& ps_dict); void set_aux(const std::string& cmd); std::string info() const; diff --git a/pub/share/g3.ps b/pub/share/g3.ps index a4737749..768bdd2c 100644 --- a/pub/share/g3.ps +++ b/pub/share/g3.ps @@ -11,7 +11,7 @@ iFrame 0 eq 10 dup autolabel defsiz 1 dup geld stdred 2 -11 setnewpage newpage -1 1 13 -14 setpagegrid +2 4 13 -14 setpagegrid 2 8 24 abcset % usage: {(text)} abc /EndFrame { nextFrame end } def -- GitLab