changeset 15376:860b4edb0bea

Set Qt as the default gnuplot terminal if using the GUI. * octave-gui.cc (octave_start_gui): Set GNUTERM to qt * __gnuplot_drawnow__.m: Add qt as one of the enhanced terminals. Check if GNUTERM is valid before attempting to assign it.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Thu, 13 Sep 2012 12:32:17 -0400
parents 7366bedaeac1
children e4ecc18a24cc
files libgui/src/octave-gui.cc scripts/plot/__gnuplot_drawnow__.m
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc	Wed Sep 12 20:50:18 2012 +0200
+++ b/libgui/src/octave-gui.cc	Thu Sep 13 12:32:17 2012 -0400
@@ -80,6 +80,8 @@
 {
   dissociate_terminal ();
 
+  setenv ("GNUTERM", "qt", 1);
+
   QApplication application (argc, argv);
 
   while (true)
--- a/scripts/plot/__gnuplot_drawnow__.m	Wed Sep 12 20:50:18 2012 +0200
+++ b/scripts/plot/__gnuplot_drawnow__.m	Thu Sep 13 12:32:17 2012 -0400
@@ -74,7 +74,7 @@
     else
       new_stream = false;
     endif
-    term = gnuplot_default_term ();
+    term = gnuplot_default_term (plot_stream);
     if (strcmp (term, "dumb"))
       ## popen2 eats stdout of gnuplot, use temporary file instead
       dumb_tmp_file = tmpnam ();
@@ -114,7 +114,7 @@
   ## When "term" originates from print.m, it may include other options.
   if (nargin < 4)
     ## This supports the gnuplot graphics toolkit.
-    term = gnuplot_default_term ();
+    term = gnuplot_default_term (plot_stream);
     opts_str = "";
   else
     ## Get the one word terminal id and save the remaining as options to
@@ -132,7 +132,7 @@
   if (strfind (opts_str, "noenhanced"))
     enhanced = false;
   else
-    enhanced = gnuplot_is_enhanced_term (term);
+    enhanced = gnuplot_is_enhanced_term (plot_stream, term);
   endif
 
   ## Set the terminal.
@@ -329,10 +329,10 @@
 
 endfunction
 
-function term = gnuplot_default_term ()
+function term = gnuplot_default_term (plot_stream)
   term = getenv ("GNUTERM");
   ## If not specified, guess the terminal type.
-  if (isempty (term))
+  if (isempty (term) || ! __gnuplot_has_terminal__ (term, plot_stream))
     if (ismac ())
       term = "aqua";
     elseif (! isunix ())
@@ -358,24 +358,24 @@
   endif
 endfunction
 
-function have_enhanced = gnuplot_is_enhanced_term (term)
+function have_enhanced = gnuplot_is_enhanced_term (plot_stream, term)
   persistent enhanced_terminals;
   if (isempty (enhanced_terminals))
     ## Don't include pstex, pslatex or epslatex here as the TeX commands
     ## should not be interpreted in that case.
     enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", "jpeg", ...
                           "pdf", "pdfcairo", "pm", "png", "pngcairo", ...
-                          "postscript", "svg", "windows", "wxt", "x11"};
+                          "postscript", "qt", "svg", "windows", "wxt", "x11"};
   endif
-  if (nargin < 1)
+  if (nargin < 2)
     ## Determine the default gnuplot terminal.
-    term = gnuplot_default_term ();
+    term = gnuplot_default_term (plot_stream);
   endif
   have_enhanced = any (strncmp (enhanced_terminals, term, min (numel (term), 3)));
 endfunction
 
 function ret = output_to_screen (term)
-  ret = any (strcmpi ({"aqua", "dumb", "wxt", "x11", "windows", "pm"}, term));
+  ret = any (strcmpi ({"aqua", "dumb", "pm", "qt", "windows", "wxt", "x11"}, term));
 endfunction
 
 function retval = have_non_legend_axes (h)