diff options
author | Carl Hetherington <carl@carlh.net> | 2009-08-29 23:31:59 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-08-29 23:31:59 +0000 |
commit | 95c4046ff90404cc4bc2ae54dde9e61188fd9a65 (patch) | |
tree | 78f5fc8bf6b06dce9fb3c52b41b9f55094e31e2f /gtk2_ardour | |
parent | 7c49119be05c2a0fc324f6a13e91720ac66a5957 (diff) |
Set route remote control IDs from a dialog rather than a menu. I think this is
more practical (especially with large track counts), and also prevents a N-entry
menu being built for each of N tracks every time the mixer strip order is changed,
which speeds some operations up.
git-svn-id: svn://localhost/ardour2/branches/3.0@5605 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 99 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.h | 8 |
4 files changed, 33 insertions, 83 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 8ab7454ab8..53411c1336 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1165,9 +1165,8 @@ MixerStrip::build_route_ops_menu () denormal_menu_item->set_active (_route->denormal_protection()); if (!Profile->get_sae()) { - build_remote_control_menu (); items.push_back (SeparatorElem()); - items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu)); + items.push_back (MenuElem (_("Remote Control ID..."), mem_fun (*this, &RouteUI::open_remote_control_id_dialog))); } items.push_back (SeparatorElem()); @@ -1193,8 +1192,6 @@ MixerStrip::list_route_operations () if (route_ops_menu == 0) { build_route_ops_menu (); } - - refresh_remote_control_menu(); } void diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index b929385f53..be114e6be0 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -475,8 +475,7 @@ RouteTimeAxisView::build_display_menu () items.push_back (SeparatorElem()); if (!Profile->get_sae()) { - build_remote_control_menu (); - items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu)); + items.push_back (MenuElem (_("Remote Control ID..."), mem_fun (*this, &RouteUI::open_remote_control_id_dialog))); /* rebuild this every time */ build_automation_action_menu (); items.push_back (MenuElem (_("Automation"), *automation_action_menu)); @@ -2400,4 +2399,3 @@ RouteTimeAxisView::set_button_names () mute_button_label.set_text (_("m")); } - diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index ad63daad5d..6d21de844e 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -84,7 +84,6 @@ RouteUI::~RouteUI() delete solo_menu; delete mute_menu; - delete remote_control_menu; delete sends_menu; } @@ -95,7 +94,6 @@ RouteUI::init () xml_node = 0; mute_menu = 0; solo_menu = 0; - remote_control_menu = 0; sends_menu = 0; ignore_toggle = false; wait_for_release = false; @@ -215,8 +213,6 @@ RouteUI::set_route (boost::shared_ptr<Route> rp) solo_button->show(); } - connections.push_back (_route->RemoteControlIDChanged.connect (mem_fun(*this, &RouteUI::refresh_remote_control_menu))); - /* map the current state */ mute_changed (0); @@ -776,72 +772,6 @@ RouteUI::update_rec_display () } void -RouteUI::build_remote_control_menu () -{ - remote_control_menu = new Menu; - refresh_remote_control_menu (); -} - -void -RouteUI::refresh_remote_control_menu () -{ - ENSURE_GUI_THREAD (mem_fun (*this, &RouteUI::refresh_remote_control_menu)); - - // only refresh the menu if it has been instantiated - - if (remote_control_menu == 0) { - return; - } - - using namespace Menu_Helpers; - - RadioMenuItem::Group rc_group; - CheckMenuItem* rc_active; - uint32_t limit = _session.ntracks() + _session.nbusses(); - char buf[32]; - - MenuList& rc_items = remote_control_menu->items(); - rc_items.clear (); - - /* note that this menu list starts at zero, not 1, because zero - is a valid, if useless, ID. - */ - - limit += 4; /* leave some breathing room */ - - rc_items.push_back (RadioMenuElem (rc_group, _("None"))); - if (_route->remote_control_id() == 0) { - rc_active = dynamic_cast<CheckMenuItem*> (&rc_items.back()); - rc_active->set_active (); - } - - for (uint32_t i = 1; i < limit; ++i) { - snprintf (buf, sizeof (buf), "%u", i); - rc_items.push_back (RadioMenuElem (rc_group, buf)); - rc_active = dynamic_cast<RadioMenuItem*>(&rc_items.back()); - if (_route->remote_control_id() == i) { - rc_active = dynamic_cast<CheckMenuItem*> (&rc_items.back()); - rc_active->set_active (); - } - rc_active->signal_activate().connect (bind (mem_fun (*this, &RouteUI::set_remote_control_id), i, rc_active)); - } -} - -void -RouteUI::set_remote_control_id (uint32_t id, CheckMenuItem* item) -{ - /* this is called when the radio menu item is toggled, and so - is actually invoked twice per menu selection. we only - care about the invocation for the item that was being - marked active. - */ - - if (item->get_active()) { - _route->set_remote_control_id (id); - } -} - -void RouteUI::build_solo_menu (void) { using namespace Menu_Helpers; @@ -1448,3 +1378,32 @@ RouteUI::page_gain_down () { _route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.5), this); } + +void +RouteUI::open_remote_control_id_dialog () +{ + ArdourDialog dialog (_("Remote Control ID")); + + uint32_t const limit = _session.ntracks() + _session.nbusses () + 4; + + HBox* hbox = manage (new HBox); + hbox->set_spacing (6); + hbox->pack_start (*manage (new Label (_("Remote control ID:")))); + SpinButton* spin = manage (new SpinButton); + spin->set_digits (0); + spin->set_increments (1, 10); + spin->set_range (0, limit); + spin->set_value (_route->remote_control_id()); + hbox->pack_start (*spin); + dialog.get_vbox()->pack_start (*hbox); + + dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL); + dialog.add_button (Stock::APPLY, RESPONSE_ACCEPT); + + dialog.show_all (); + int const r = dialog.run (); + + if (r == RESPONSE_ACCEPT) { + _route->set_remote_control_id (spin->get_value_as_int ()); + } +} diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index c2f03eb394..1ac87a0404 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -97,7 +97,6 @@ class RouteUI : public virtual AxisView Gtk::Menu* mute_menu; Gtk::Menu* solo_menu; - Gtk::Menu* remote_control_menu; Gtk::Menu* sends_menu; XMLNode *xml_node; @@ -133,9 +132,7 @@ class RouteUI : public virtual AxisView void route_rec_enable_changed(); void session_rec_enable_changed(); - void build_solo_menu (void); - void build_remote_control_menu (void); - void refresh_remote_control_menu (); + void build_solo_menu (); void solo_isolated_toggle (void*, Gtk::CheckMenuItem*); void toggle_solo_isolated (Gtk::CheckMenuItem*); @@ -185,13 +182,12 @@ class RouteUI : public virtual AxisView virtual void map_frozen (); - void set_remote_control_id (uint32_t id, Gtk::CheckMenuItem* item); - void reversibly_apply_route_boolean (std::string name, void (ARDOUR::Route::*func)(bool, void*), bool, void *); void reversibly_apply_track_boolean (std::string name, void (ARDOUR::Track::*func)(bool, void*), bool, void *); void adjust_latency (); void save_as_template (); + void open_remote_control_id_dialog (); protected: std::vector<sigc::connection> connections; |