UserBundle: Allow adding/removing ports

Clean up internal API confusion
- can_add_channels_proxy () -- checks presence of io
- can_add_channel_proxy () -- checks io->can_add_port()

UserBundle don't have a PortGroup::_bundle reference
that can be used to lookup the IO via io_from_bundle().

While BundleEditorMatrix::can_add_channels_proxy() was overriden
to allow adding I/Os, can_add_channel_proxy() later prevented that.

This further prevents removing the last port, preventing empty bundles.
This commit is contained in:
Robin Gareus 2021-02-26 14:06:04 +01:00
parent 017b272864
commit 4716f34c28
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 28 additions and 10 deletions

View file

@ -153,6 +153,7 @@ public:
virtual bool can_rename_channels (boost::shared_ptr<ARDOUR::Bundle>) const {
return false;
}
virtual bool can_add_port (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType t) const;
virtual void rename_channel (ARDOUR::BundleChannel) {}
virtual std::string disassociation_verb () const = 0;
virtual std::string channel_noun () const;
@ -183,7 +184,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;
bool can_add_port_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);