# HG changeset patch # User Ben Abbott # Date 1237642535 14400 # Node ID cc916241e811e37187e85ff60006364699f5caac # Parent dc07bc4157b83e523f7cc4c376c9d637748ff2d3 print.m: Restore the old behavior for -S,. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-03-21 Ben Abbott + + * plot/print.m: Restore the behavior for option -S,. + 2009-03-19 Jaroslav Hajek * optimization/fsolve.m (guarded_eval): Simplify & fix missing diff --git a/scripts/plot/print.m b/scripts/plot/print.m --- 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", ""); + 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);