diff --git a/gtk2_ardour/icons/fader_touch_cursor.png b/gtk2_ardour/icons/fader_touch_cursor.png new file mode 100644 index 0000000000..1fbe812659 Binary files /dev/null and b/gtk2_ardour/icons/fader_touch_cursor.png differ diff --git a/gtk2_ardour/ui/inspector_gain_meter.xml b/gtk2_ardour/ui/inspector_gain_meter.xml index f9a993abfa..4f3507f007 100644 --- a/gtk2_ardour/ui/inspector_gain_meter.xml +++ b/gtk2_ardour/ui/inspector_gain_meter.xml @@ -33,6 +33,7 @@ underlaysource="slider_controller_fader_underlay.png" handlesource="slider_controller_fader_handle.png" activehandlesource="slider_controller_fader_handle.png" + touchcursor="fader_touch_cursor.png" minposx="10" minposy="196" maxposx="10" diff --git a/gtk2_ardour/ui/meter_strip_gain_meter.xml b/gtk2_ardour/ui/meter_strip_gain_meter.xml index 37c8640b3c..0869a23ad7 100644 --- a/gtk2_ardour/ui/meter_strip_gain_meter.xml +++ b/gtk2_ardour/ui/meter_strip_gain_meter.xml @@ -47,6 +47,7 @@ underlaysource="slider_controller_fader_underlay.png" handlesource="slider_controller_fader_handle.png" activehandlesource="slider_controller_fader_handle.png" + touchcursor="fader_touch_cursor.png" minposx="10" minposy="196" maxposx="10" diff --git a/gtk2_ardour/ui/mixer_gain_meter.xml b/gtk2_ardour/ui/mixer_gain_meter.xml index 9256028a42..fcf70abe51 100644 --- a/gtk2_ardour/ui/mixer_gain_meter.xml +++ b/gtk2_ardour/ui/mixer_gain_meter.xml @@ -33,6 +33,7 @@ underlaysource="slider_controller_fader_underlay.png" handlesource="slider_controller_fader_handle.png" activehandlesource="slider_controller_fader_handle.png" + touchcursor="fader_touch_cursor.png" minposx="10" minposy="196" maxposx="10" diff --git a/gtk2_ardour/waves_ui.cc b/gtk2_ardour/waves_ui.cc index 3fd2108216..57776ec7b5 100644 --- a/gtk2_ardour/waves_ui.cc +++ b/gtk2_ardour/waves_ui.cc @@ -592,6 +592,14 @@ WavesUI::set_attributes (Gtk::Widget& widget, const XMLNode& definition, const X event_box->set_visible_window (visible_window); } + Gtkmm2ext::Fader* fader = dynamic_cast (&widget); + if (fader) { + property = xml_property (definition, "touchcursor", styles, ""); + if (!property.empty ()) { + fader->set_touch_cursor (property); + } + } + Gtk::Label* label = dynamic_cast (&widget); if (label) { property = xml_property (definition, "justify", styles, "left"); diff --git a/libs/gtkmm2ext/fader.cc b/libs/gtkmm2ext/fader.cc index 84adfd259f..b1c1fe5a7c 100755 --- a/libs/gtkmm2ext/fader.cc +++ b/libs/gtkmm2ext/fader.cc @@ -140,6 +140,8 @@ Fader::Fader (Gtk::Adjustment& adj, , _default_value (adjustment.get_value()) , _dragging (false) , _read_only (read_only) + , _grab_window (0) + , _touch_cursor (0) { PBD::Searchpath spath(ARDOUR::ardour_data_search_path()); @@ -262,6 +264,10 @@ Fader::on_button_press_event (GdkEventButton* ev) return false; } + if (_touch_cursor) { + get_window()->set_cursor (*_touch_cursor); + } + double hx; double hy; get_handle_position (hx, hy); @@ -313,6 +319,10 @@ Fader::on_button_release_event (GdkEventButton* ev) return false; } + if (_touch_cursor) { + get_window()->set_cursor (); + } + if (_dragging) { //temp remove_modal_grab(); _dragging = false; @@ -458,6 +468,26 @@ Fader::set_default_value (float d) update_unity_position (); } +void +Fader::set_touch_cursor (const std::string& icon_name) +{ + PBD::Searchpath spath(ARDOUR::ardour_data_search_path()); + + spath.add_subdirectory_to_paths ("icons"); + + std::string icon_file_path; + + if (PBD::find_file_in_search_path (spath, icon_name, icon_file_path)) { + _touch_cursor = new Gdk::Cursor (Gdk::Display::get_default(), + Gdk::Pixbuf::create_from_file (icon_file_path), + 12, + 12); + } else { + throw failed_constructor(); + } +} + + void Fader::update_unity_position () { diff --git a/libs/gtkmm2ext/gtkmm2ext/fader.h b/libs/gtkmm2ext/gtkmm2ext/fader.h index ea8e73768b..9ca64b7269 100755 --- a/libs/gtkmm2ext/gtkmm2ext/fader.h +++ b/libs/gtkmm2ext/gtkmm2ext/fader.h @@ -52,8 +52,8 @@ class LIBGTKMM2EXT_API Fader : public CairoWidget virtual ~Fader (); void set_controllable (boost::shared_ptr c) { binding_proxy.set_controllable (c); } - void set_default_value (float); + void set_touch_cursor (const std::string& icon_name); protected: void get_handle_position (double& x, double& y); @@ -88,6 +88,8 @@ class LIBGTKMM2EXT_API Fader : public CairoWidget bool _hovering; GdkWindow* _grab_window; + Gdk::Cursor *_touch_cursor; + double _grab_loc_x; double _grab_loc_y; double _grab_start_x;