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: Rik
Subject: [Octave-bug-tracker] [bug #52940] Regression with "PaperPosition" and printing
Date: Wed, 24 Jan 2018 10:37:37 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

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

Looking at your patch, I wonder if we can simplify it by borrowing from
screen_size_pixels in graphics.cc?

Your code:


    const figure::properties& figProps =
      dynamic_cast<const figure::properties&> (fig.get_properties ());
    Matrix lpos = figProps.get_position ().matrix_value ();
    rend.set_viewport (lpos(2), lpos(3));


And here is screen_size_pixels in graphics.cc


// This function always returns the screensize in pixels
static Matrix
screen_size_pixels (void)
{
  graphics_object obj = gh_manager::get_object (0);
  Matrix sz = obj.get ("screensize").matrix_value ();
  return convert_position (sz, obj.get ("units").string_value (), "pixels",
                           sz.extract_n (0, 2, 1, 2)).extract_n (0, 2, 1, 2);
}


As a first simplification, you already have a graphics_object so I don't think
you need to get the full property list and then use the special get_position()
function to extract one of them.  Just use get() along with the object.


    Matrix pos = fig.get ("position").matrix_value ();
    rend.set_viewport (pos(2), pos(3));


The second simplification, might be to use convert_position in C++ to
calculate the size you want rather than using the m-file code and the
listeners on the position and units 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]