13
0

more cleanups of PannerUI, add start/end gesture support to mono panner

git-svn-id: svn://localhost/ardour2/branches/3.0@8478 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-01-07 21:38:22 +00:00
parent adf9ac516d
commit cb8f069e77
3 changed files with 17 additions and 28 deletions

View File

@ -301,9 +301,10 @@ MonoPanner::on_button_press_event (GdkEventButton* ev)
if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
/* handled by button release */
return true;
}
}
dragging = true;
StartGesture ();
}
return true;
@ -319,7 +320,7 @@ MonoPanner::on_button_release_event (GdkEventButton* ev)
dragging = false;
accumulated_delta = 0;
detented = false;
if (drag_data_window) {
drag_data_window->hide ();
}
@ -327,6 +328,8 @@ MonoPanner::on_button_release_event (GdkEventButton* ev)
if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
/* reset to default */
position_control->set_value (0.5);
} else {
StopGesture ();
}
return true;

View File

@ -39,6 +39,9 @@ class MonoPanner : public Gtk::DrawingArea
boost::shared_ptr<PBD::Controllable> get_controllable() const { return position_control; }
sigc::signal<void> StartGesture;
sigc::signal<void> StopGesture;
protected:
bool on_expose_event (GdkEventExpose*);
bool on_button_press_event (GdkEventButton*);

View File

@ -220,6 +220,7 @@ PannerUI::build_astyle_menu ()
boost::shared_ptr<PBD::Controllable>
PannerUI::get_controllable()
{
assert (!pan_bars.empty());
return pan_bars[0]->get_controllable();
}
@ -374,6 +375,8 @@ 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;
}
@ -424,35 +427,16 @@ PannerUI::setup_pan ()
while ((p = pan_bars.size()) < npans) {
float x, rx;
MonoPanner* mp;
boost::shared_ptr<AutomationControl> ac = _panner->pan_control (p);
/* initialize adjustment with 0.0 (L) or 1.0 (R) for the first and second panners,
which serves as a default, otherwise use current value
*/
rx = _panner->pan_control (p)->get_value();
if (npans == 1) {
x = 0.5;
} else if (p == 0) {
x = 0.0;
} else if (p == 1) {
x = 1.0;
} else {
x = rx;
}
mp = new MonoPanner (_panner->pan_control (p));
#if 0
if (asz) {
bc->StartGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch),
boost::weak_ptr<AutomationControl> (ac)));
bc->StopGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch),
boost::weak_ptr<AutomationControl>(ac)));
}
#endif
mp->StartGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch),
boost::weak_ptr<AutomationControl> (ac)));
mp->StopGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch),
boost::weak_ptr<AutomationControl>(ac)));
mp->signal_button_release_event().connect
(sigc::bind (sigc::mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) p));
@ -467,7 +451,6 @@ PannerUI::setup_pan ()
automation state.
*/
update_pan_sensitive ();
panning_viewport.add (pan_bar_packer);
}