Mercurial > hg > octave-nkf
changeset 16095:1339c964b527
Fix warning when using "termoption dashed" with gnuplot 4.2.X (bug #38370)
* scripts/plot/__gnuplot_drawnow__.m: Test whether gnuplot is new enough
to have "termoption dashed". If not, set the dashed option directly when
the terminal is set.
test for "has_termoption_dashed".
author | Rik <rik@octave.org> |
---|---|
date | Sun, 24 Feb 2013 07:25:56 -0800 |
parents | 8899c785cc99 |
children | 9720ecf8d257 |
files | scripts/plot/__gnuplot_drawnow__.m scripts/plot/private/__gnuplot_has_feature__.m |
diffstat | 2 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/__gnuplot_drawnow__.m +++ b/scripts/plot/__gnuplot_drawnow__.m @@ -297,6 +297,16 @@ term_str = sprintf ("%s %s", term_str, size_str); endif endif + if (! __gnuplot_has_feature__ ("has_termoption_dashed")) + ## If "set termoption dashed" isn't available add "dashed" option + ## to the "set terminal ..." command, if it is supported. + if (any (strcmpi (term, {"aqua", "cgm", "eepic", "emf", "epslatex", \ + "fig", "pcl5", "mp", "next", "openstep", "pdf", \ + "pdfcairo", "pngcairo", "postscript", \ + "pslatex", "pstext", "svg", "tgif", "x11"}))) + term_str = sprintf ("%s dashed", term_str); + endif + end ## Work around the gnuplot feature of growing the x11 window and ## flickering window (x11, windows, & wxt) when the mouse and @@ -321,7 +331,9 @@ endif endif endif - fprintf (plot_stream, "set termoption dashed\n") + if (__gnuplot_has_feature__ ("has_termoption_dashed")) + fprintf (plot_stream, "set termoption dashed\n") + endif else ## gnuplot will pick up the GNUTERM environment variable itself ## so no need to set the terminal type if not also setting the
--- a/scripts/plot/private/__gnuplot_has_feature__.m +++ b/scripts/plot/private/__gnuplot_has_feature__.m @@ -35,7 +35,8 @@ "screen_coordinates_for_{lrtb}margin", "variable_GPVAL_TERMINALS", "key_has_font_properties", - "windows_figure_position"}; + "windows_figure_position", + "has_termoption_dashed"}; if (isempty (has_features)) try @@ -44,8 +45,8 @@ ## Don't throw an error if gnuplot isn't installed gnuplot_version = "0.0.0"; end_try_catch - versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4"}; - operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="}; + versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3"}; + operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="}; have_features = logical (zeros (size (features))); for n = 1 : numel (have_features) has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});