changeset 19055:9609f345823e

Implement figure property SelectionType for FLTK * graphics.in.h: Rename "alt" to "alternate" for Matlab compatibility * __init_fltk__.cc: Add selectiontype implementation * plot.txi: Add documentation for selectiontype
author Andreas Weber <andy.weber.aw@gmail.com>
date Sun, 17 Aug 2014 23:34:16 +0200
parents d74cdfc5d5c3
children cf24eef5051d
files doc/interpreter/plot.txi libinterp/corefcn/graphics.in.h libinterp/dldfcn/__init_fltk__.cc
diffstat 3 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/plot.txi	Sun Aug 17 22:34:37 2014 +0200
+++ b/doc/interpreter/plot.txi	Sun Aug 17 23:34:16 2014 +0200
@@ -1548,6 +1548,22 @@
 --- Values: @qcode{"on"}, @qcode{"off"}
 
 @item selectiontype
+Holds informations about the last mouse button press within the figure.
+May be one of
+@table @asis
+@item @qcode{"normal"}
+Left mouse button click.
+
+@item @qcode{"extend"}
+Shift + left mouse button click.
+
+@item @qcode{"alternate"}
+Ctrl + left mouse button click or right mouse button click.
+
+@item @qcode{"open"}
+Double-click with any mouse button.
+
+@end table
 
 @item tag
 
--- a/libinterp/corefcn/graphics.in.h	Sun Aug 17 22:34:37 2014 +0200
+++ b/libinterp/corefcn/graphics.in.h	Sun Aug 17 23:34:16 2014 +0200
@@ -3369,7 +3369,7 @@
       radio_property renderermode , "{auto}|manual"
       bool_property resize , "on"
       callback_property resizefcn , Matrix ()
-      radio_property selectiontype , "{normal}|open|alt|extend"
+      radio_property selectiontype , "{normal}|open|alternate|extend"
       radio_property toolbar , "none|{auto}|figure"
       radio_property units Su , "inches|centimeters|normalized|points|{pixels}|characters"
       callback_property windowbuttondownfcn , Matrix ()
--- a/libinterp/dldfcn/__init_fltk__.cc	Sun Aug 17 22:34:37 2014 +0200
+++ b/libinterp/dldfcn/__init_fltk__.cc	Sun Aug 17 23:34:16 2014 +0200
@@ -1426,6 +1426,18 @@
 
             set_currentpoint (pos_x, pos_y);
 
+            if (Fl::event_button () == FL_LEFT_MOUSE
+                && Fl::event_shift ())
+              fp.set_selectiontype ("extend");
+            else if ((Fl::event_button () == FL_LEFT_MOUSE
+                      && Fl::event_ctrl ())
+                      || Fl::event_button () == FL_RIGHT_MOUSE)
+              fp.set_selectiontype ("alternate");
+            else if (Fl::event_clicks ())
+              fp.set_selectiontype ("open");
+            else
+              fp.set_selectiontype ("normal");
+
             if (fp.get_windowbuttondownfcn ().is_defined ())
               fp.execute_windowbuttondownfcn (Fl::event_button ());