octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52940] Regression with "PaperPosition" and pr


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #52940] Regression with "PaperPosition" and printing
Date: Wed, 24 Jan 2018 03:54:46 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #25, bug #52940 (project octave):

On the matter of the OpenGL window (Qt or FLTK) momentarily changing size, it
looks like this is simply a matter of having the computed coordinates done
inside a script file (___print_parse_opts___.m) which must then be relayed to
some C++ compiled op-code (gl2ps_print.cc).  That's a big part of the
issue--the print.m routine is using some properties temporarily as data
transfer mechanism.

Inside ___print_parse_opts___.m is the following code:


function [papersize, paperposition] = gs_papersize (hfig, paperorientation)
  persistent papertypes papersizes;

  if (isempty (papertypes))
[snip]
  endif

  papertype = get (hfig, "papertype");
  paperunits = get (hfig, "paperunits");
  paperposition = get (hfig, "paperposition");
  if (strcmp (papertype, "<custom>"))
    papersize = get (hfig, "papersize");
    papersize = convert2points (papersize , paperunits);
  else
    papersize = papersizes (strcmp (papertypes, papertype), :);
  endif
[snip]
endfunction


which contains the important logic for translating printing paperposition to
point-size values.  This script file will return that information in the
opts.canvas_size field.

Here is how print() treats that information:


function print (varargin)

  opts = __print_parse_opts__ (varargin{:});

[snip]
    ## graphics toolkit translates figure position to eps bbox (points)
    fpos = get (opts.figure, "position");
    props(end+1).h = opts.figure;
    props(end).name = "position";
    props(end).value = {fpos};
[the above is temporary storage]
    fpos(3:4) = opts.canvas_size;
    set (opts.figure, "position", fpos);
[the above is using "position" as a means of communication]
[snip]


and further along after the off-screen print is complete all those "props" are
restored.  The problem is that something like "position" has a listener that
will redraw the on-screen figure in response to the above "set (opts.figure,
"position", fpos)".  That's where the on-screen contortions are coming from.

This notion of using the properties temporarily to pass along info isn't so
nice.  I'm sitting here thinking that instead of property "position" one could
use "paperposition" as a temporary holder because that then won't affect the
on-screen figure window.  But still, that's not the best because these things
could have listeners and such as well.  Can anyone think of a better scheme? 
Couldn't there be some Octave function interface that just passes "opts"
information directly in rather than use figure properties?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52940>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]