changeset 19062:c419e5487d0d

Fix set_currentpoint in FLTK that figures units property is respected. * __init_fltk__.cc: Use map_from_boundingbox which respects the units figure property for set_currentpoint. * plot.txi: Document figure property currentpoint (not to be confused with axes property currentpoint) and units.
author Andreas Weber <andy.weber.aw@gmail.com>
date Mon, 18 Aug 2014 23:44:25 +0200
parents 0ee9daa71273
children 8c648c3a2c8f
files doc/interpreter/plot.txi libinterp/dldfcn/__init_fltk__.cc
diffstat 2 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/plot.txi	Mon Aug 18 21:25:39 2014 +0200
+++ b/doc/interpreter/plot.txi	Mon Aug 18 23:44:25 2014 +0200
@@ -1441,10 +1441,22 @@
 @item currentobject
 
 @item currentpoint
-Holds the coordinates of the point over which the mouse pointer was when
-the mouse button was pressed.  If a mouse callback function is defined,
-@qcode{"currentpoint"} holds the coordinates of the point over which the
-mouse pointer is when the function gets called.
+An 1-by-2 matrix which holds the coordinates of the point over which
+the mouse pointer was when a mouse event occurred.  The x and y
+coordinates are in units defined by the figures @qcode{"units"} property
+and their origin is the lower left corner of the plotting area.
+
+Events which sets @qcode{"currentpoint"} are
+@table @asis
+@item A mouse button was pressed
+always
+
+@item A mouse button was released
+only if the figures callback @qcode{"windowbuttonupfcn"} is defined
+
+@item The pointer was moved while pressing mouse button (drag)
+only if the figures callback @qcode{"windowbuttonmotionfcn"} is defined
+@end table
 
 @item deletefcn
 
@@ -1572,6 +1584,11 @@
 @item type
 
 @item units
+--- Values: @qcode{"inches"}, @qcode{"centimeters"}, @qcode{"normalized"},
+@qcode{"points"}, @qcode{"pixels"} [default], @qcode{"characters"}.
+
+Specifies the units which are used for @qcode{"position"},
+@qcode{"outerposition"} and @qcode{"currentpoint"}.
 
 @item userdata
 
--- a/libinterp/dldfcn/__init_fltk__.cc	Mon Aug 18 21:25:39 2014 +0200
+++ b/libinterp/dldfcn/__init_fltk__.cc	Mon Aug 18 23:44:25 2014 +0200
@@ -1134,10 +1134,7 @@
   {
     if (!fp.is_beingdeleted ())
       {
-        // FIXME: consider figures units property
-        Matrix pos (1,2,0);
-        pos(0) = px;
-        pos(1) = h () - (py + status_h + menu_dy ());
+        Matrix pos = fp.map_from_boundingbox (px, py);
         fp.set_currentpoint (pos);
         graphics_object robj = gh_manager::get_object (fp.get_parent ());
         root_figure::properties& rp =