summaryrefslogtreecommitdiff
path: root/gtk2_ardour/panner_interface.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-12-26 14:30:35 +0000
committerCarl Hetherington <carl@carlh.net>2011-12-26 14:30:35 +0000
commit2adb3fb579068b5a278df2ac96d131fe5f40f169 (patch)
tree8e5f59b70813fb506a9935f08b8851e7380cc3b9 /gtk2_ardour/panner_interface.cc
parent6e79521e8b7709458b8ee093e2d0dc6440ffea2c (diff)
Show panner drag information tool-tip style, and also show
it when the button is pressed to start a drag (#4584 and #4585). git-svn-id: svn://localhost/ardour2/branches/3.0@11072 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/panner_interface.cc')
-rw-r--r--gtk2_ardour/panner_interface.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk2_ardour/panner_interface.cc b/gtk2_ardour/panner_interface.cc
index 95e1e4e7ff..53a7535f4d 100644
--- a/gtk2_ardour/panner_interface.cc
+++ b/gtk2_ardour/panner_interface.cc
@@ -24,6 +24,7 @@
#include "i18n.h"
+using namespace std;
using namespace Gtk;
using namespace ARDOUR;
using namespace Gtkmm2ext;
@@ -32,6 +33,7 @@ PannerInterface::PannerInterface (boost::shared_ptr<Panner> p)
: _panner (p)
, _drag_data_window (0)
, _drag_data_label (0)
+ , _dragging (false)
{
set_flags (Gtk::CAN_FOCUS);
@@ -69,6 +71,8 @@ PannerInterface::show_drag_data_window ()
_drag_data_window->set_transient_for (*toplevel);
}
}
+
+ set_drag_data ();
if (!_drag_data_window->is_visible ()) {
/* move the window a little away from the mouse */
@@ -79,11 +83,29 @@ PannerInterface::show_drag_data_window ()
}
}
+void
+PannerInterface::hide_drag_data_window ()
+{
+ if (_drag_data_window) {
+ _drag_data_window->hide ();
+ }
+}
+
bool
PannerInterface::on_enter_notify_event (GdkEventCrossing *)
{
grab_focus ();
Keyboard::magic_widget_grab_focus ();
+
+ _drag_data_timeout = Glib::signal_timeout().connect (sigc::mem_fun (*this, &PannerInterface::drag_data_timeout), 500);
+
+ return false;
+}
+
+bool
+PannerInterface::drag_data_timeout ()
+{
+ show_drag_data_window ();
return false;
}
@@ -91,6 +113,12 @@ bool
PannerInterface::on_leave_notify_event (GdkEventCrossing *)
{
Keyboard::magic_widget_drop_focus ();
+
+ _drag_data_timeout.disconnect ();
+ if (!_dragging) {
+ hide_drag_data_window ();
+ }
+
return false;
}