13
0

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
This commit is contained in:
Paul Davis 2011-01-07 22:18:53 +00:00
parent cb8f069e77
commit 41264273ec
3 changed files with 29 additions and 2 deletions

View File

@ -375,8 +375,6 @@ PannerUI::setup_pan ()
uint32_t const nouts = _panner->nouts(); uint32_t const nouts = _panner->nouts();
uint32_t const npans = _panner->npanners(); 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) { if (int32_t (nouts) == _current_nouts && int32_t (npans) == _current_npans) {
return; return;
} }
@ -421,6 +419,20 @@ PannerUI::setup_pan ()
_stereo_panner->set_size_request (-1, pan_bar_height); _stereo_panner->set_size_request (-1, pan_bar_height);
panning_viewport.add (*_stereo_panner); panning_viewport.add (*_stereo_panner);
boost::shared_ptr<AutomationControl> ac;
ac = _panner->direction_control();
_stereo_panner->StartPositionGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch),
boost::weak_ptr<AutomationControl> (ac)));
_stereo_panner->StopPositionGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch),
boost::weak_ptr<AutomationControl>(ac)));
ac = _panner->width_control();
_stereo_panner->StartWidthGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch),
boost::weak_ptr<AutomationControl> (ac)));
_stereo_panner->StopWidthGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch),
boost::weak_ptr<AutomationControl>(ac)));
} else { } else {
/* N-in/2out - just use a set of single-channel panners */ /* N-in/2out - just use a set of single-channel panners */

View File

@ -363,6 +363,7 @@ StereoPanner::on_button_press_event (GdkEventButton* ev)
if (ev->y < 20) { if (ev->y < 20) {
/* top section of widget is for position drags */ /* top section of widget is for position drags */
dragging_position = true; dragging_position = true;
StartPositionGesture ();
} else { } else {
/* lower section is for dragging width */ /* lower section is for dragging width */
@ -388,6 +389,7 @@ StereoPanner::on_button_press_event (GdkEventButton* ev)
dragging_right = true; dragging_right = true;
} }
} }
StartWidthGesture ();
} }
dragging = true; dragging = true;
@ -403,6 +405,8 @@ StereoPanner::on_button_release_event (GdkEventButton* ev)
return false; return false;
} }
bool dp = dragging_position;
dragging = false; dragging = false;
dragging_position = false; dragging_position = false;
dragging_left = false; dragging_left = false;
@ -418,6 +422,12 @@ StereoPanner::on_button_release_event (GdkEventButton* ev)
/* reset to default */ /* reset to default */
position_control->set_value (0.5); position_control->set_value (0.5);
width_control->set_value (1.0); width_control->set_value (1.0);
} else {
if (dp) {
StopPositionGesture ();
} else {
StopWidthGesture ();
}
} }
return true; return true;

View File

@ -37,6 +37,11 @@ class StereoPanner : public Gtk::DrawingArea
StereoPanner (boost::shared_ptr<PBD::Controllable> pos, boost::shared_ptr<PBD::Controllable> width); StereoPanner (boost::shared_ptr<PBD::Controllable> pos, boost::shared_ptr<PBD::Controllable> width);
~StereoPanner (); ~StereoPanner ();
sigc::signal<void> StartPositionGesture;
sigc::signal<void> StopPositionGesture;
sigc::signal<void> StartWidthGesture;
sigc::signal<void> StopWidthGesture;
protected: protected:
bool on_expose_event (GdkEventExpose*); bool on_expose_event (GdkEventExpose*);
bool on_button_press_event (GdkEventButton*); bool on_button_press_event (GdkEventButton*);