From help-octave-request at bevo dot che dot wisc dot edu Wed Jan 7 16:30:05 2004 Subject: Re: Octave/OS X Aquaterm problems (bugs or me?) From: Per Persson To: "John W. Eaton" Cc: help-octave at bevo dot che dot wisc dot edu Date: Wed, 7 Jan 2004 23:29:54 +0100 --Apple-Mail-5-718114203 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On Jan 7, 2004, at 23:00, John W. Eaton wrote: > On 7-Jan-2004, Per Persson wrote: > > | the modified figure.m for OS X _should_ work if you set the default > | gnuplot term to aqua. > > If the figure.m file for OS X is different from the version > distributed with Octave, can you please submit a patch that will > integrate whatever changes are necessary for OS X with the Octave > sources? diff gives (save for the missing docs): --- /opt/local/share/octave/2.1.50/m/plot/figure.m Tue Jan 6 17:11:28 2004 +++ /opt/local/share/octave/2.1.50/site/m/octave-forge/MacOSX/figure.m Tue Dec 23 22:26:45 2003 at @ -39,7 +39,11 @@ if (nargin < 2) if (gnuplot_has_frames) - if (! isempty (getenv ("DISPLAY"))) + if (! isempty (gnuterm=getenv ("GNUTERM"))) + oneplot (); + figure_list = union (figure_list, f); + eval (sprintf ("gset term %s %d\n",gnuterm, f)); + elseif (! isempty (getenv ("DISPLAY"))) oneplot (); figure_list = union (figure_list, f); eval (sprintf ("gset term x11 %d\n", f)); I'm not sure however that this is the best, or even a good, solution to the problem that OS X users might want to use aquaterm as well as X11 with gnuplot and still be able to use figure(n) from octave. If only X11 is used on OS X, there is nothing to change in figure.m To me it seems like a good compromise that the file is distributed with octave-forge and only installed on OS X. > > If there are other files that need modification to work better for > OS X (or other strange operating systems like, say, Windows) then I > think it would be best to also do the same for those files rather than > having modified versions of files floating around. This is also part of octave-forge but may be OK for inclusion in octave base. The changes are not necessary for it to work on OS X, but makes the behavior more mac-like. I've attached a patch. /Per --Apple-Mail-5-718114203 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="image.m.patch" Content-Disposition: attachment; filename=image.m.patch --- /opt/local/share/octave/2.1.50/m/image/image.m Tue Jan 6 17:11:26 2004 +++ /opt/local/share/octave/2.1.50/site/m/octave-forge/MacOSX/image.m Tue Dec 23 22:26:45 2003 at @ -25,7 +25,7 @@ ## length of the colormap. If at var{zoom} is omitted, the image will be ## scaled to fit within 600x350 (to a max of 4). ## -## It first tries to use at code{display} from @code{ImageMagick} then +## It first tries to use at code{convert} to make a TIFF representation which is then sent to the application set to handle images (default is Preview.app), if that fails it subsequently tries @code{display} from @code{ImageMagick} then ## at code{xv} and then @code{xloadimage}. ## ## The axis values corresponding to the matrix elements are specified in at @ -71,21 +71,24 @@ saveimage (ppm_name, A, "ppm"); - ## Start the viewer. Try display, xv, then xloadimage. + ## Start the viewer. Try xv, then xloadimage. - xv = sprintf ("xv -raw -expand %f %s", zoom, ppm_name); + xv = sprintf ("xv -expand %f %s", zoom, ppm_name); xloadimage = sprintf ("xloadimage -zoom %f %s", zoom*100, ppm_name); ## ImageMagick: im_display = sprintf ("display -geometry %f%% %s", zoom*100, ppm_name); + ## MacOSX: + mac = sprintf("convert -geometry %f%% %s %s.tiff;open %s.tiff", zoom*100, ppm_name,ppm_name,ppm_name); + rm = sprintf ("rm -f %s", ppm_name); ## Need to let the shell clean up the tmp file because we are putting ## the viewer in the background. - system (sprintf ("( %s || %s || %s && %s ) > /dev/null 2>&1 &", - im_display, xv, xloadimage, rm)); + system (sprintf ("( %s || %s || %s || %s && %s ) > /dev/null 2>&1 &", mac, im_display, xv, xloadimage, rm)); + endfunction --Apple-Mail-5-718114203-- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------