diff --git a/gtk2_ardour/mixer_bridge_view.cc b/gtk2_ardour/mixer_bridge_view.cc index 4c65193449..677d2b06eb 100644 --- a/gtk2_ardour/mixer_bridge_view.cc +++ b/gtk2_ardour/mixer_bridge_view.cc @@ -92,6 +92,8 @@ MixerBridgeView::MixerBridgeView (const std::string& mixer_bridge_script_name, c signal_configure_event().connect (sigc::mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler)); Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&MixerBridgeView::sync_order_keys, this), gui_context()); MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&MixerBridgeView::remove_strip, this, _1), gui_context()); + MixerStrip::EndStripNameEdit.connect (*this, invalidator (*this), boost::bind (&MixerBridgeView::begin_strip_name_edit, this, _1, _2), gui_context()); + if (dynamic_cast (&_mixer_strips_home)) { _mixer_strips_home.get_parent()->signal_size_allocate().connect (sigc::mem_fun(*this, &MixerBridgeView::parent_on_size_allocate)); @@ -200,6 +202,8 @@ MixerBridgeView::add_strips (RouteList& routes) bool set_gain_slider_visible = Config->get_output_auto_connect() & AutoConnectMaster; strip->gain_slider_set_visible (set_gain_slider_visible); + //strip->EndStripNameEdit.connect (*this, invalidator (*this), (sigc::bind (sigc::mem_fun(*this, &MixerBridgeView::begin_strip_name_edit), strip)), gui_context()); + _strips [route] = strip; strip->show(); } @@ -500,3 +504,31 @@ void MixerBridgeView::select_none () { /* does nothing in Tracks */ } + +void +MixerBridgeView::begin_strip_name_edit (MixerStrip::TabToStrip edit_next, const MixerStrip* cur_strip) +{ + std::vector strips = _mixer_strips_home.get_children(); + if (edit_next == MixerStrip::TabToNext) { + for (std::vector::iterator it = strips.begin (); it != strips.end (); ++it) { + if (*it == cur_strip) { + if (++it != strips.end ()) { + MixerStrip* strip = dynamic_cast (*it); + strip->begin_name_edit (); + } + break; + } + } + } else { // MixerStrip::TabToPrev + for (std::vector::iterator it = strips.begin (); it != strips.end (); ++it) { + if (*it == cur_strip) { + if (it != strips.begin ()) { + --it; + MixerStrip* strip = dynamic_cast (*it); + strip->begin_name_edit (); + } + break; + } + } + } +} diff --git a/gtk2_ardour/mixer_bridge_view.h b/gtk2_ardour/mixer_bridge_view.h index f9dfa6512e..8740460335 100644 --- a/gtk2_ardour/mixer_bridge_view.h +++ b/gtk2_ardour/mixer_bridge_view.h @@ -79,6 +79,7 @@ class MixerBridgeView : void follow_editor_selection (); bool strip_button_release_event (GdkEventButton*, MixerStrip*); void parent_on_size_allocate (Gtk::Allocation&); + void begin_strip_name_edit (MixerStrip::TabToStrip, const MixerStrip*); MixerStrip* strip_by_route (boost::shared_ptr route); MixerStrip* strip_under_pointer (); diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index eac39e18fb..63d971243d 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -85,6 +85,7 @@ using namespace ArdourMeter; int MixerStrip::scrollbar_height = 0; PBD::Signal1 MixerStrip::CatchDeletion; +PBD::Signal2 MixerStrip::EndStripNameEdit; MixerStrip::MixerStrip (Session* sess, const std::string& layout_script_file, size_t max_name_size) : AxisView(sess) @@ -301,7 +302,7 @@ MixerStrip::controls_ebox_button_press (GdkEventButton* event) _name_button_home.translate_coordinates (name_button, event->x, event->y, nlx, nly); Gtk::Allocation a = name_button.get_allocation (); if (nlx > 0 && nlx < a.get_width() && nly > 0 && nly < a.get_height()) { - begin_name_edit (); + _begin_name_edit (); return true; } } @@ -373,8 +374,9 @@ MixerStrip::name_entry_focus_out (GdkEventFocus*) return false; } + void -MixerStrip::begin_name_edit () +MixerStrip::_begin_name_edit () { if (!_route) return; @@ -416,6 +418,9 @@ MixerStrip::on_record_state_changed () void MixerStrip::end_name_edit (int response) { + bool edit_next = false; + bool edit_prev = false; + switch (response) { case RESPONSE_CANCEL: break; @@ -424,8 +429,10 @@ MixerStrip::end_name_edit (int response) break; case RESPONSE_ACCEPT: name_entry_changed (); + edit_next = true; case RESPONSE_APPLY: name_entry_changed (); + edit_prev = true; } // _name_entry's text and _route->name must be synchronized @@ -435,6 +442,12 @@ MixerStrip::end_name_edit (int response) name_button.show (); _name_entry.hide (); _name_entry_eventbox.hide (); + if (edit_next) { + EndStripNameEdit (TabToNext, this); //EMIT SIGNAL + } + else if (edit_prev) { + EndStripNameEdit (TabToPrev, this); //EMIT SIGNAL + } } void diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 2578ade7e0..3fc2ad3720 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -77,6 +77,7 @@ class ArdourWindow; class MixerStrip : public RouteUI { public: + enum TabToStrip { TabToPrev, TabToNext }; MixerStrip (ARDOUR::Session*, boost::shared_ptr, const std::string& layout_script_file, size_t max_name_size = 0); MixerStrip (ARDOUR::Session*, const std::string& layout_script_file, size_t max_name_size = 0); ~MixerStrip (); @@ -112,6 +113,9 @@ class MixerStrip : public RouteUI PBD::Signal1 > DeliveryChanged; static PBD::Signal1 CatchDeletion; + + // name of next(true) or prev(false) MixerStrip should be changed + static PBD::Signal2 EndStripNameEdit; std::string state_id() const; @@ -129,6 +133,7 @@ class MixerStrip : public RouteUI void route_rec_enable_changed(); void route_color_changed (); + void begin_name_edit () { _begin_name_edit(); } protected: void set_packed (bool yn); @@ -176,7 +181,7 @@ class MixerStrip : public RouteUI Gtk::Entry& _name_entry; Gtk::EventBox& _name_entry_eventbox; - void begin_name_edit (); + void _begin_name_edit (); void end_name_edit (int); bool name_entry_key_release (GdkEventKey *ev);