# HG changeset patch # User Rik # Date 1361719556 28800 # Node ID 1339c964b5275fcb620e3ad813058f3055211929 # Parent 8899c785cc992067a185729c6bb5709a5bffc79a 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". diff -r 8899c785cc99 -r 1339c964b527 scripts/plot/__gnuplot_drawnow__.m --- a/scripts/plot/__gnuplot_drawnow__.m Sun Feb 24 07:16:22 2013 -0800 +++ b/scripts/plot/__gnuplot_drawnow__.m Sun Feb 24 07:25:56 2013 -0800 @@ -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 diff -r 8899c785cc99 -r 1339c964b527 scripts/plot/private/__gnuplot_has_feature__.m --- a/scripts/plot/private/__gnuplot_has_feature__.m Sun Feb 24 07:16:22 2013 -0800 +++ b/scripts/plot/private/__gnuplot_has_feature__.m Sun Feb 24 07:25:56 2013 -0800 @@ -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});