Hide "Add MIDI Port" in the GUI if there is already one
This commit is contained in:
parent
c6740b7cb0
commit
dc131da53b
@ -934,10 +934,15 @@ MixerStrip::output_press (GdkEventButton *ev)
|
||||
citems.pop_back ();
|
||||
}
|
||||
|
||||
if (!ARDOUR::Profile->get_mixbus()) {
|
||||
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 (MenuElem (_("Routing Grid"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::edit_input_configuration)));
|
||||
|
||||
Gtkmm2ext::anchored_menu_popup(&input_menu, &input_button, "",
|
||||
|
@ -446,7 +446,7 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
|
||||
if (can_add_channels (bc[dim].bundle)) {
|
||||
/* Start off with options for the `natural' port type */
|
||||
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
||||
if (should_show (*i)) {
|
||||
if (should_show (*i) && can_add_channel_proxy (w, *i)) {
|
||||
snprintf (buf, sizeof (buf), _("Add %s %s"), (*i).to_i18n_string(), channel_noun().c_str());
|
||||
sub.push_back (MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::add_channel_proxy), w, *i)));
|
||||
}
|
||||
@ -454,7 +454,7 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
|
||||
|
||||
/* Now add other ones */
|
||||
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
||||
if (!should_show (*i)) {
|
||||
if (!should_show (*i) && can_add_channel_proxy (w, *i)) {
|
||||
snprintf (buf, sizeof (buf), _("Add %s %s"), (*i).to_i18n_string(), channel_noun().c_str());
|
||||
sub.push_back (MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::add_channel_proxy), w, *i)));
|
||||
}
|
||||
@ -790,6 +790,17 @@ PortMatrix::remove_all_channels (boost::weak_ptr<Bundle> w)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PortMatrix::can_add_channel_proxy (boost::weak_ptr<Bundle> w, DataType t) const
|
||||
{
|
||||
boost::shared_ptr<Bundle> b = w.lock ();
|
||||
if (!b) {
|
||||
return false;
|
||||
}
|
||||
boost::shared_ptr<IO> io = io_from_bundle (b);
|
||||
return io->can_add_port (t);
|
||||
}
|
||||
|
||||
void
|
||||
PortMatrix::add_channel_proxy (boost::weak_ptr<Bundle> w, DataType t)
|
||||
{
|
||||
|
@ -182,6 +182,7 @@ private:
|
||||
void routes_changed ();
|
||||
void reconnect_to_routes ();
|
||||
void select_arrangement ();
|
||||
bool can_add_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, ARDOUR::DataType) const;
|
||||
void add_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
|
||||
void remove_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, uint32_t);
|
||||
void rename_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, uint32_t);
|
||||
|
Loading…
Reference in New Issue
Block a user