comparison scripts/plot/__gnuplot_drawnow__.m @ 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 e4d380c01dcf
children 916ef285522a
comparison
equal deleted inserted replaced
15375:7366bedaeac1 15376:860b4edb0bea
72 plot_stream = __gnuplot_open_stream__ (2, h); 72 plot_stream = __gnuplot_open_stream__ (2, h);
73 new_stream = true; 73 new_stream = true;
74 else 74 else
75 new_stream = false; 75 new_stream = false;
76 endif 76 endif
77 term = gnuplot_default_term (); 77 term = gnuplot_default_term (plot_stream);
78 if (strcmp (term, "dumb")) 78 if (strcmp (term, "dumb"))
79 ## popen2 eats stdout of gnuplot, use temporary file instead 79 ## popen2 eats stdout of gnuplot, use temporary file instead
80 dumb_tmp_file = tmpnam (); 80 dumb_tmp_file = tmpnam ();
81 enhanced = gnuplot_set_term (plot_stream (1), new_stream, h, ... 81 enhanced = gnuplot_set_term (plot_stream (1), new_stream, h, ...
82 term, dumb_tmp_file); 82 term, dumb_tmp_file);
112 function enhanced = gnuplot_set_term (plot_stream, new_stream, h, term, file) 112 function enhanced = gnuplot_set_term (plot_stream, new_stream, h, term, file)
113 ## Generate the gnuplot "set terminal <term> ..." command. 113 ## Generate the gnuplot "set terminal <term> ..." command.
114 ## When "term" originates from print.m, it may include other options. 114 ## When "term" originates from print.m, it may include other options.
115 if (nargin < 4) 115 if (nargin < 4)
116 ## This supports the gnuplot graphics toolkit. 116 ## This supports the gnuplot graphics toolkit.
117 term = gnuplot_default_term (); 117 term = gnuplot_default_term (plot_stream);
118 opts_str = ""; 118 opts_str = "";
119 else 119 else
120 ## Get the one word terminal id and save the remaining as options to 120 ## Get the one word terminal id and save the remaining as options to
121 ## be passed on to gnuplot. The terminal may respect the graphics 121 ## be passed on to gnuplot. The terminal may respect the graphics
122 ## toolkit. 122 ## toolkit.
130 endif 130 endif
131 131
132 if (strfind (opts_str, "noenhanced")) 132 if (strfind (opts_str, "noenhanced"))
133 enhanced = false; 133 enhanced = false;
134 else 134 else
135 enhanced = gnuplot_is_enhanced_term (term); 135 enhanced = gnuplot_is_enhanced_term (plot_stream, term);
136 endif 136 endif
137 137
138 ## Set the terminal. 138 ## Set the terminal.
139 if (! isempty (term)) 139 if (! isempty (term))
140 140
327 ## figure title, enhanced mode, or position. 327 ## figure title, enhanced mode, or position.
328 endif 328 endif
329 329
330 endfunction 330 endfunction
331 331
332 function term = gnuplot_default_term () 332 function term = gnuplot_default_term (plot_stream)
333 term = getenv ("GNUTERM"); 333 term = getenv ("GNUTERM");
334 ## If not specified, guess the terminal type. 334 ## If not specified, guess the terminal type.
335 if (isempty (term)) 335 if (isempty (term) || ! __gnuplot_has_terminal__ (term, plot_stream))
336 if (ismac ()) 336 if (ismac ())
337 term = "aqua"; 337 term = "aqua";
338 elseif (! isunix ()) 338 elseif (! isunix ())
339 term = "windows"; 339 term = "windows";
340 elseif (! isempty (getenv ("DISPLAY"))) 340 elseif (! isempty (getenv ("DISPLAY")))
356 term = string(1:(n-1)); 356 term = string(1:(n-1));
357 opts = string((n+1):end); 357 opts = string((n+1):end);
358 endif 358 endif
359 endfunction 359 endfunction
360 360
361 function have_enhanced = gnuplot_is_enhanced_term (term) 361 function have_enhanced = gnuplot_is_enhanced_term (plot_stream, term)
362 persistent enhanced_terminals; 362 persistent enhanced_terminals;
363 if (isempty (enhanced_terminals)) 363 if (isempty (enhanced_terminals))
364 ## Don't include pstex, pslatex or epslatex here as the TeX commands 364 ## Don't include pstex, pslatex or epslatex here as the TeX commands
365 ## should not be interpreted in that case. 365 ## should not be interpreted in that case.
366 enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", "jpeg", ... 366 enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", "jpeg", ...
367 "pdf", "pdfcairo", "pm", "png", "pngcairo", ... 367 "pdf", "pdfcairo", "pm", "png", "pngcairo", ...
368 "postscript", "svg", "windows", "wxt", "x11"}; 368 "postscript", "qt", "svg", "windows", "wxt", "x11"};
369 endif 369 endif
370 if (nargin < 1) 370 if (nargin < 2)
371 ## Determine the default gnuplot terminal. 371 ## Determine the default gnuplot terminal.
372 term = gnuplot_default_term (); 372 term = gnuplot_default_term (plot_stream);
373 endif 373 endif
374 have_enhanced = any (strncmp (enhanced_terminals, term, min (numel (term), 3))); 374 have_enhanced = any (strncmp (enhanced_terminals, term, min (numel (term), 3)));
375 endfunction 375 endfunction
376 376
377 function ret = output_to_screen (term) 377 function ret = output_to_screen (term)
378 ret = any (strcmpi ({"aqua", "dumb", "wxt", "x11", "windows", "pm"}, term)); 378 ret = any (strcmpi ({"aqua", "dumb", "pm", "qt", "windows", "wxt", "x11"}, term));
379 endfunction 379 endfunction
380 380
381 function retval = have_non_legend_axes (h) 381 function retval = have_non_legend_axes (h)
382 retval = false; 382 retval = false;
383 all_axes = findall (h, "type", "axes"); 383 all_axes = findall (h, "type", "axes");