diff options
author | Robin Gareus <robin@gareus.org> | 2019-07-11 22:58:27 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-07-11 22:58:27 +0200 |
commit | dc131da53b2603189dc0fb00109b77178c971fc4 (patch) | |
tree | 90279a03a80824bbf2d8809322e5ef5befd6620b /gtk2_ardour/mixer_strip.cc | |
parent | c6740b7cb06591f68851a3821a6cbc2b095e5bd0 (diff) |
Hide "Add MIDI Port" in the GUI if there is already one
Diffstat (limited to 'gtk2_ardour/mixer_strip.cc')
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 35801cbd0f..316430c7bc 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -934,10 +934,15 @@ MixerStrip::output_press (GdkEventButton *ev) citems.pop_back (); } - if (!ARDOUR::Profile->get_mixbus()) { - citems.push_back (SeparatorElem()); + citems.push_back (SeparatorElem()); + if (!ARDOUR::Profile->get_mixbus()) { + bool need_separator = false; for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) { + if (!_route->output()->can_add_port (*i)) { + continue; + } + need_separator = true; citems.push_back ( MenuElem ( string_compose (_("Add %1 port"), (*i).to_i18n_string()), @@ -945,9 +950,11 @@ MixerStrip::output_press (GdkEventButton *ev) ) ); } + if (need_separator) { + citems.push_back (SeparatorElem()); + } } - citems.push_back (SeparatorElem()); citems.push_back (MenuElem (_("Routing Grid"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::edit_output_configuration))); Gtkmm2ext::anchored_menu_popup(&output_menu, &output_button, "", @@ -1040,7 +1047,13 @@ MixerStrip::input_press (GdkEventButton *ev) } citems.push_back (SeparatorElem()); + + bool need_separator = false; for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) { + if (!_route->input()->can_add_port (*i)) { + continue; + } + need_separator = true; citems.push_back ( MenuElem ( string_compose (_("Add %1 port"), (*i).to_i18n_string()), @@ -1048,8 +1061,10 @@ MixerStrip::input_press (GdkEventButton *ev) ) ); } + if (need_separator) { + citems.push_back (SeparatorElem()); + } - citems.push_back (SeparatorElem()); citems.push_back (MenuElem (_("Routing Grid"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::edit_input_configuration))); Gtkmm2ext::anchored_menu_popup(&input_menu, &input_button, "", |