help-octave
[Top][All Lists]
Advanced

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

Re: units updater for figures is broken when using fltk


From: Michael Goffioul
Subject: Re: units updater for figures is broken when using fltk
Date: Tue, 7 Feb 2012 15:40:49 +0000

On Sun, Feb 5, 2012 at 5:00 PM, Ben Abbott <address@hidden> wrote:
>> I think the problem is not in get_boundingbox, but in the incorrect
>> interpretation of the position property in the FLTK code. Moreover,
>> the code is probably not robust against feedback loops when changing
>> properties, like:
>> 1) the user change figure position
>> 2) the backend is notified and move/resize the figure window
>> 3) as in any toolkit, moving/resizing the window triggers corresponding 
>> events
>> 4) the backend receives events and propagates the changes back to the
>> figure position (this is needed as the move/resize could be the result
>> of a user action with the mouse)
>> 5) if the newly computed position does not match the previous one, goto 1)
>>
>> Step 4) above should not happen when the position change is coming
>> from octave, but I suspect it does, which can explain the infinite
>> loop you're seeing.
>>
>> Michael.
>
> The loop may have been due to my not understanding what I was doing. I used 
> ...
>
>        Matrix pos = fp.get_boundingbox (true);
>
> But I don't understand what the boolean arg is intended for. In graphics.cc 
> (figure::properties::get_boundingbox) the boolean is named "internal" and is 
> references in the snippet below.
>
>        Matrix pos = (internal ?
>                      get_position ().matrix_value () :
>                      get_outerposition ().matrix_value ());
>
> I choose get_boundingbox (true) because I don't know the purpose of the 
> outerposition property for figures (there's none in Matlab). I notice you 
> added it  below.
>
>        
> http://hg.savannah.gnu.org/hgweb/octave/annotate/d99aa455296e/src/graphics.cc
>
> What is the figure's outerposition property for ?

http://www.mathworks.co.uk/help/techdoc/ref/figure_props.html#OuterPosition

> Back to the need to obtain the figure position property in pixels, I 
> attempted the change below, but ran into scoping problems.
>
>  void draw (void)
>  {
>    Matrix screen_size = screen_size_pixels ();
>    Matrix pos = fp.get_position ().matrix_value ();
>    pos = convert_position (pos, get_units (), "pixels", screen_size);
>    Fl_Window::resize (pos(0), pos(1), pos(2), pos(3) + status_h + menu_h);
>
>    return Fl_Window::draw ();
>  }

The code above does not flip the Y axis. If you also flip the Y-axis,
it will be equivalent to get_boundingbox(true) and you'll probably run
into the same endless loop.

> DLD-FUNCTIONS/__init_fltk__.cc: In member function 'virtual void 
> plot_window::draw()':
> DLD-FUNCTIONS/__init_fltk__.cc:1180:46: error: 'screen_size_pixels' was not 
> declared in this scope
> DLD-FUNCTIONS/__init_fltk__.cc:1182:72: error: 'convert_position' was not 
> declared in this scope
>
> I can resolved the scoping problem with convert_position by calling 
> get_boundingbox and then modifying the result, but I still need to obtain the 
> screensize in pixels, which I haven't figured out how to do. I may be in over 
> my head, so if you're inclined ... feel free take this on.

display_info::width ()
display_info::height ()

or

graphics_object root = gh_manager::get_object (0);
Matrix screen = root.get ("screensize").matrix_value ();

> On a related note, many properties are changed during the print() process. 
> These changes would trigger listeners set up by the user (figure position, 
> and fontname, fontsize properties can be modified). Would it make sense be 
> able to "disable" and "enable" user specified listeners to avoid any 
> unexpected craziness? If so, that feature would be useful here as well.

The problem is that some listeners are installed by regular m-files,
so it'll be difficult to distinct them from user-defined listeners.

Michael.


reply via email to

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