changeset 9000:cc916241e811

print.m: Restore the old behavior for -S<num>,<num>.
author Ben Abbott <bpabbott@mac.com>
date Sat, 21 Mar 2009 09:35:35 -0400
parents dc07bc4157b8
children b3268a0458f2
files scripts/ChangeLog scripts/plot/print.m
diffstat 2 files changed, 34 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+2009-03-21  Ben Abbott <bpabbott@mac.com>
+
+	* plot/print.m: Restore the behavior for option -S<num>,<num>.
+
 2009-03-19  Jaroslav Hajek <highegg@gmail.com>
 
 	* optimization/fsolve.m (guarded_eval): Simplify & fix missing
--- a/scripts/plot/print.m
+++ b/scripts/plot/print.m
@@ -427,11 +427,36 @@
     endif
     set (gcf, "__pixels_per_inch__", resolution)
 
-    if (debug)
-      drawnow (new_terminal, name, mono, debug_file);
-    else
-      drawnow (new_terminal, name, mono);
-    endif
+    unwind_protect
+      if (! isempty (size))
+        size_in_pixels = sscanf (size ,"%d, %d");
+        size_in_pixels = reshape (size_in_pixels, [1, numel(size_in_pixels)]);
+        size_in_inches = size_in_pixels ./ resolution;
+        p.paperunits = get (gcf, "paperunits");
+        p.papertype = get (gcf, "papertype");
+        p.papersize = get (gcf, "papersize");
+        p.paperposition = get (gcf, "paperposition");
+        p.paperpositionmode = get (gcf, "paperpositionmode");
+        set (gcf, "paperunits", "inches");
+        set (gcf, "papertype", "<custom>");
+        set (gcf, "papersize", size_in_inches);
+        set (gcf, "paperposition", [0, 0, size_in_inches]);
+        set (gcf, "paperpositionmode", "manual");
+      endif
+      if (debug)
+        drawnow (new_terminal, name, mono, debug_file);
+      else
+        drawnow (new_terminal, name, mono);
+      endif
+    unwind_protect_cleanup
+      ## FIXME - it would be preferred to delete the added properties here.
+      if (! isempty (size))
+        props = fieldnames (p);
+        for n = 1:numel(props)
+          set (gcf, props{n}, p.(props{n}))
+        endfor
+      endif
+    end_unwind_protect
 
     if (! isempty (convertname))
       command = sprintf ("convert '%s' '%s'", name, convertname);