From: Paul Davis Date: Fri, 7 Jan 2011 22:18:53 +0000 (+0000) Subject: add gesture control for position+width controls of a 2in/2out panner - not used,... X-Git-Tag: 3.0-alpha5~873 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=41264273ec2a88599263c2506f7b886813472380;p=ardour.git add gesture control for position+width controls of a 2in/2out panner - not used, since there is no way to create automation for these controls at present git-svn-id: svn://localhost/ardour2/branches/3.0@8479 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 61247d26cc..52ae16a648 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -375,8 +375,6 @@ PannerUI::setup_pan () uint32_t const nouts = _panner->nouts(); uint32_t const npans = _panner->npanners(); - cerr << "Pan setup, outs == " << nouts << " pans = " << npans << endl; - if (int32_t (nouts) == _current_nouts && int32_t (npans) == _current_npans) { return; } @@ -421,6 +419,20 @@ PannerUI::setup_pan () _stereo_panner->set_size_request (-1, pan_bar_height); panning_viewport.add (*_stereo_panner); + boost::shared_ptr ac; + + ac = _panner->direction_control(); + _stereo_panner->StartPositionGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch), + boost::weak_ptr (ac))); + _stereo_panner->StopPositionGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch), + boost::weak_ptr(ac))); + + ac = _panner->width_control(); + _stereo_panner->StartWidthGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch), + boost::weak_ptr (ac))); + _stereo_panner->StopWidthGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch), + boost::weak_ptr(ac))); + } else { /* N-in/2out - just use a set of single-channel panners */ diff --git a/gtk2_ardour/stereo_panner.cc b/gtk2_ardour/stereo_panner.cc index 70190cc859..4e715c49ee 100644 --- a/gtk2_ardour/stereo_panner.cc +++ b/gtk2_ardour/stereo_panner.cc @@ -363,6 +363,7 @@ StereoPanner::on_button_press_event (GdkEventButton* ev) if (ev->y < 20) { /* top section of widget is for position drags */ dragging_position = true; + StartPositionGesture (); } else { /* lower section is for dragging width */ @@ -388,6 +389,7 @@ StereoPanner::on_button_press_event (GdkEventButton* ev) dragging_right = true; } } + StartWidthGesture (); } dragging = true; @@ -403,6 +405,8 @@ StereoPanner::on_button_release_event (GdkEventButton* ev) return false; } + bool dp = dragging_position; + dragging = false; dragging_position = false; dragging_left = false; @@ -418,6 +422,12 @@ StereoPanner::on_button_release_event (GdkEventButton* ev) /* reset to default */ position_control->set_value (0.5); width_control->set_value (1.0); + } else { + if (dp) { + StopPositionGesture (); + } else { + StopWidthGesture (); + } } return true; diff --git a/gtk2_ardour/stereo_panner.h b/gtk2_ardour/stereo_panner.h index 52abb30687..86a53eccf7 100644 --- a/gtk2_ardour/stereo_panner.h +++ b/gtk2_ardour/stereo_panner.h @@ -37,6 +37,11 @@ class StereoPanner : public Gtk::DrawingArea StereoPanner (boost::shared_ptr pos, boost::shared_ptr width); ~StereoPanner (); + sigc::signal StartPositionGesture; + sigc::signal StopPositionGesture; + sigc::signal StartWidthGesture; + sigc::signal StopWidthGesture; + protected: bool on_expose_event (GdkEventExpose*); bool on_button_press_event (GdkEventButton*);