X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fpanner_ui.cc;h=433b5b0c0258685b48393301eedc36a82335d174;hb=3e59452fa0182ace7785c62acef83cb0d213cc86;hp=2a69d73251b8d49f797284078075f2a9c2a9fa06;hpb=75abb09f32c3c4f39e1356bd2caac44182febb02;p=ardour.git diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 2a69d73251..433b5b0c02 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -18,13 +18,17 @@ #include -#include "ardour/io.h" -#include "ardour/dB.h" #include #include + #include "midi++/manager.h" #include "pbd/fastlog.h" +#include "ardour/pannable.h" +#include "ardour/panner.h" +#include "ardour/panner_shell.h" +#include "ardour/session.h" + #include "ardour_ui.h" #include "panner_ui.h" #include "panner2d.h" @@ -33,13 +37,6 @@ #include "stereo_panner.h" #include "mono_panner.h" -#include "ardour/delivery.h" -#include "ardour/session.h" -#include "ardour/panner.h" -#include "ardour/pannable.h" -#include "ardour/panner_shell.h" -#include "ardour/route.h" - #include "i18n.h" using namespace std; @@ -64,6 +61,7 @@ PannerUI::PannerUI (Session* s) pan_astyle_menu = 0; in_pan_update = false; _stereo_panner = 0; + _mono_panner = 0; _ignore_width_change = false; _ignore_position_change = false; @@ -119,7 +117,6 @@ PannerUI::set_panner (boost::shared_ptr ps, boost::shared_ptrChanged.connect (connections, invalidator (*this), boost::bind (&PannerUI::panshell_changed, this), gui_context()); - _panner->StateChanged.connect (connections, invalidator (*this), boost::bind (&PannerUI::update_pan_state, this), gui_context()); /* new panner object, force complete reset of panner GUI */ @@ -144,9 +141,12 @@ PannerUI::build_astate_menu () pan_astate_menu->items().clear (); } - pan_astate_menu->items().push_back (MenuElem (_("Manual"), sigc::bind ( + /** TRANSLATORS: this is `Manual' in the sense of automation not being played, + so that changes to pan must be done by hand. + */ + pan_astate_menu->items().push_back (MenuElem (S_("Automation|Manual"), sigc::bind ( sigc::mem_fun (_panner.get(), &Panner::set_automation_state), - (AutoState) Off))); + (AutoState) ARDOUR::Off))); pan_astate_menu->items().push_back (MenuElem (_("Play"), sigc::bind ( sigc::mem_fun (_panner.get(), &Panner::set_automation_state), (AutoState) Play))); @@ -175,13 +175,6 @@ PannerUI::build_astyle_menu () pan_astyle_menu->items().push_back (MenuElem (_("Abs"))); } -boost::shared_ptr -PannerUI::get_controllable() -{ - assert (!pan_bars.empty()); - return pan_bars[0]->get_controllable(); -} - void PannerUI::on_size_allocate (Allocation& a) { @@ -196,19 +189,15 @@ PannerUI::set_width (Width w) PannerUI::~PannerUI () { - for (vector::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) { - delete (*i); - } - delete twod_panner; delete big_window; delete pan_menu; delete pan_astyle_menu; delete pan_astate_menu; delete _stereo_panner; + delete _mono_panner; } - void PannerUI::panshell_changed () { @@ -216,23 +205,13 @@ PannerUI::panshell_changed () setup_pan (); } -void -PannerUI::update_pan_state () -{ - /* currently nothing to do */ -} - void PannerUI::setup_pan () { - if (!_panner) { - return; - } - - uint32_t const nouts = _panner->out().n_audio(); - uint32_t const nins = _panner->in().n_audio(); + int const nouts = _panner ? _panner->out().n_audio() : -1; + int const nins = _panner ? _panner->in().n_audio() : -1; - if (int32_t (nouts) == _current_nouts && int32_t (nins) == _current_nins) { + if (nouts == _current_nouts && nins == _current_nins) { return; } @@ -245,17 +224,23 @@ PannerUI::setup_pan () twod_panner = 0; delete _stereo_panner; _stereo_panner = 0; + delete _mono_panner; + _mono_panner = 0; - if (nouts == 0 || nouts == 1) { + if (!_panner) { + return; + } - delete _stereo_panner; - delete twod_panner; + if (nouts == 0 || nouts == 1) { /* stick something into the panning viewport so that it redraws */ EventBox* eb = manage (new EventBox()); pan_vbox.pack_start (*eb, false, false); + delete big_window; + big_window = 0; + } else if (nouts == 2) { if (nins == 2) { @@ -271,48 +256,50 @@ PannerUI::setup_pan () boost::shared_ptr ac; ac = pannable->pan_azimuth_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))); + _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 = pannable->pan_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))); + _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))); + _stereo_panner->signal_button_release_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event)); } else if (nins == 1) { /* 1-in/2out */ - - MonoPanner* mp; + boost::shared_ptr pannable = _panner->pannable(); boost::shared_ptr ac = pannable->pan_azimuth_control; - - mp = new MonoPanner (ac); - - mp->StartGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch), + + _mono_panner = new MonoPanner (_panner); + + _mono_panner->StartGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch), boost::weak_ptr (ac))); - mp->StopGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch), + _mono_panner->StopGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch), boost::weak_ptr(ac))); - - mp->signal_button_release_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event)); - - mp->set_size_request (-1, pan_bar_height); - + + _mono_panner->signal_button_release_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event)); + + _mono_panner->set_size_request (-1, pan_bar_height); + update_pan_sensitive (); - pan_vbox.pack_start (*mp, false, false); + pan_vbox.pack_start (*_mono_panner, false, false); } else { warning << string_compose (_("No panner user interface is currently available for %1-in/2out tracks/busses"), nins) << endmsg; } + delete big_window; + big_window = 0; } else { if (!twod_panner) { - twod_panner = new Panner2d (_panner, 61); + twod_panner = new Panner2d (_panshell, 61); twod_panner->set_name ("MixerPanZone"); twod_panner->show (); twod_panner->signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event), false); @@ -360,7 +347,7 @@ PannerUI::pan_button_event (GdkEventButton* ev) case 1: if (twod_panner && ev->type == GDK_2BUTTON_PRESS) { if (!big_window) { - big_window = new Panner2dWindow (_panner, 400, _panner->in().n_audio()); + big_window = new Panner2dWindow (_panshell, 400, _panner->in().n_audio()); } big_window->show (); return true; @@ -396,17 +383,28 @@ PannerUI::build_pan_menu () /* set state first, connect second */ - bypass_menu_item->set_active (_panner->bypassed()); + bypass_menu_item->set_active (_panshell->bypassed()); bypass_menu_item->signal_toggled().connect (sigc::mem_fun(*this, &PannerUI::pan_bypass_toggle)); items.push_back (MenuElem (_("Reset"), sigc::mem_fun (*this, &PannerUI::pan_reset))); + items.push_back (MenuElem (_("Edit..."), sigc::mem_fun (*this, &PannerUI::pan_edit))); } void PannerUI::pan_bypass_toggle () { - if (bypass_menu_item && (_panner->bypassed() != bypass_menu_item->get_active())) { - _panner->set_bypassed (!_panner->bypassed()); + if (bypass_menu_item && (_panshell->bypassed() != bypass_menu_item->get_active())) { + _panshell->set_bypassed (!_panshell->bypassed()); + } +} + +void +PannerUI::pan_edit () +{ + if (_mono_panner) { + _mono_panner->edit (); + } else if (_stereo_panner) { + _stereo_panner->edit (); } } @@ -423,11 +421,7 @@ PannerUI::effective_pan_display () _stereo_panner->queue_draw (); } else if (twod_panner) { twod_panner->queue_draw (); - } else { - for (vector::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) { - (*i)->queue_draw (); - } - } + } } void @@ -435,9 +429,8 @@ PannerUI::update_pan_sensitive () { bool const sensitive = !(_panner->pannable()->automation_state() & Play); -#ifdef PANNER_HACKS pan_vbox.set_sensitive (sensitive); -#endif + if (big_window) { big_window->set_sensitive (sensitive); } @@ -515,8 +508,8 @@ PannerUI::pan_automation_state_changed () break; } - bool x = (pannable->automation_state() != Off); - + bool x = (pannable->automation_state() != ARDOUR::Off); + if (pan_automation_state_button.get_active() != x) { ignore_toggle = true; pan_automation_state_button.set_active (x); @@ -524,11 +517,11 @@ PannerUI::pan_automation_state_changed () } update_pan_sensitive (); - + /* start watching automation so that things move */ - + pan_watching.disconnect(); - + if (x) { pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (sigc::mem_fun (*this, &PannerUI::effective_pan_display)); } @@ -552,7 +545,7 @@ PannerUI::_astate_string (AutoState state, bool shrt) string sstr; switch (state) { - case Off: + case ARDOUR::Off: sstr = (shrt ? "M" : _("M")); break; case Play: