Restore add channel option to port matrix context menu.
git-svn-id: svn://localhost/ardour2/branches/3.0@5383 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
6da5dd6d41
commit
c6509b8f86
|
@ -80,8 +80,14 @@ BundleEditorMatrix::get_state (ARDOUR::BundleChannel c[2]) const
|
|||
return PortMatrixNode::ASSOCIATED;
|
||||
}
|
||||
|
||||
std::string
|
||||
BundleEditorMatrix::add_channel_name () const
|
||||
{
|
||||
return _bundle->name ();
|
||||
}
|
||||
|
||||
void
|
||||
BundleEditorMatrix::add_channel (boost::shared_ptr<ARDOUR::Bundle> b)
|
||||
BundleEditorMatrix::add_channel ()
|
||||
{
|
||||
NameChannelDialog d;
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
@ -178,20 +184,6 @@ BundleEditor::BundleEditor (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::
|
|||
get_vbox()->pack_start (_matrix);
|
||||
get_vbox()->set_spacing (4);
|
||||
|
||||
/* Add Channel button */
|
||||
Gtk::Button* add_channel_button = Gtk::manage (new Gtk::Button (_("Add Channel")));
|
||||
add_channel_button->set_name ("IOSelectorButton");
|
||||
add_channel_button->set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::ADD, Gtk::ICON_SIZE_BUTTON)));
|
||||
get_action_area()->pack_start (*add_channel_button, false, false);
|
||||
add_channel_button->signal_clicked().connect (sigc::bind (sigc::mem_fun (_matrix, &BundleEditorMatrix::add_channel), boost::shared_ptr<ARDOUR::Bundle> ()));
|
||||
|
||||
if (add) {
|
||||
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
add_button (Gtk::Stock::ADD, Gtk::RESPONSE_ACCEPT);
|
||||
} else {
|
||||
add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_ACCEPT);
|
||||
}
|
||||
|
||||
show_all ();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ class BundleEditorMatrix : public PortMatrix
|
|||
|
||||
void set_state (ARDOUR::BundleChannel c[2], bool s);
|
||||
PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const;
|
||||
void add_channel (boost::shared_ptr<ARDOUR::Bundle>);
|
||||
std::string add_channel_name () const;
|
||||
void add_channel ();
|
||||
bool can_remove_channels (int d) const {
|
||||
return d == OURS;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public:
|
|||
void set_state (ARDOUR::BundleChannel c[2], bool);
|
||||
PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const;
|
||||
|
||||
void add_channel (boost::shared_ptr<ARDOUR::Bundle>) {}
|
||||
bool can_remove_channels (int d) const {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -145,11 +145,15 @@ IOSelector::n_io_ports () const
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
IOSelector::add_channel (boost::shared_ptr<ARDOUR::Bundle> b)
|
||||
string
|
||||
IOSelector::add_channel_name () const
|
||||
{
|
||||
return _io->name ();
|
||||
}
|
||||
|
||||
void
|
||||
IOSelector::add_channel ()
|
||||
{
|
||||
/* we ignore the bundle parameter, as we know what it is that we're adding to */
|
||||
|
||||
// The IO selector only works for single typed IOs
|
||||
const ARDOUR::DataType t = _io->default_type ();
|
||||
|
||||
|
@ -197,6 +201,8 @@ IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<
|
|||
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), this));
|
||||
|
||||
resize (32768, 32768);
|
||||
|
||||
_selector.MaxSizeChanged.connect (mem_fun (*this, &IOSelectorWindow::max_size_changed));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -226,7 +232,12 @@ void
|
|||
IOSelectorWindow::on_realize ()
|
||||
{
|
||||
Window::on_realize ();
|
||||
set_max_size ();
|
||||
}
|
||||
|
||||
void
|
||||
IOSelectorWindow::set_max_size ()
|
||||
{
|
||||
pair<uint32_t, uint32_t> const m = _selector.max_size ();
|
||||
|
||||
GdkGeometry g;
|
||||
|
@ -236,6 +247,14 @@ IOSelectorWindow::on_realize ()
|
|||
set_geometry_hints (*this, g, Gdk::HINT_MAX_SIZE);
|
||||
}
|
||||
|
||||
void
|
||||
IOSelectorWindow::max_size_changed ()
|
||||
{
|
||||
set_max_size ();
|
||||
resize (32768, 32768);
|
||||
}
|
||||
|
||||
|
||||
|
||||
PortInsertUI::PortInsertUI (ARDOUR::Session& sess, boost::shared_ptr<ARDOUR::PortInsert> pi)
|
||||
: input_selector (sess, pi->input())
|
||||
|
|
|
@ -36,10 +36,14 @@ class IOSelector : public PortMatrix
|
|||
void set_state (ARDOUR::BundleChannel c[2], bool);
|
||||
PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const;
|
||||
|
||||
void add_channel (boost::shared_ptr<ARDOUR::Bundle>);
|
||||
std::string add_channel_name () const;
|
||||
|
||||
void add_channel ();
|
||||
|
||||
bool can_remove_channels (int d) const {
|
||||
return d == _ours;
|
||||
}
|
||||
|
||||
void remove_channel (ARDOUR::BundleChannel);
|
||||
bool can_rename_channels (int d) const {
|
||||
return false;
|
||||
|
@ -67,7 +71,7 @@ class IOSelector : public PortMatrix
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
int _other;
|
||||
int _ours;
|
||||
boost::shared_ptr<ARDOUR::IO> _io;
|
||||
|
@ -90,6 +94,8 @@ class IOSelectorWindow : public Gtk::Window
|
|||
IOSelector _selector;
|
||||
|
||||
void io_name_changed (void *src);
|
||||
void set_max_size ();
|
||||
void max_size_changed ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -264,6 +264,12 @@ PortMatrix::popup_menu (
|
|||
|
||||
char buf [64];
|
||||
|
||||
std::string const n = add_channel_name ();
|
||||
if (!n.empty()) {
|
||||
snprintf (buf, sizeof (buf), _("Add channel to '%s'"), n.c_str());
|
||||
items.push_back (MenuElem (buf, mem_fun (*this, &PortMatrix::add_channel)));
|
||||
}
|
||||
|
||||
for (int dim = 0; dim < 2; ++dim) {
|
||||
|
||||
if (pg[dim]) {
|
||||
|
@ -289,36 +295,28 @@ PortMatrix::popup_menu (
|
|||
}
|
||||
|
||||
if (bc[dim].bundle) {
|
||||
bool have_one = false;
|
||||
|
||||
if (can_rename_channels (dim)) {
|
||||
snprintf (buf, sizeof (buf), _("Rename '%s'..."), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
|
||||
boost::weak_ptr<ARDOUR::Bundle> w (bc[dim].bundle);
|
||||
items.push_back (
|
||||
MenuElem (
|
||||
buf,
|
||||
bind (mem_fun (*this, &PortMatrix::rename_channel_proxy), w, bc[dim].channel)
|
||||
)
|
||||
);
|
||||
|
||||
have_one = true;
|
||||
}
|
||||
|
||||
boost::weak_ptr<ARDOUR::Bundle> w (bc[dim].bundle);
|
||||
|
||||
if (can_remove_channels (dim)) {
|
||||
snprintf (buf, sizeof (buf), _("Remove '%s'"), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
|
||||
boost::weak_ptr<ARDOUR::Bundle> w (bc[dim].bundle);
|
||||
items.push_back (
|
||||
MenuElem (
|
||||
buf,
|
||||
bind (mem_fun (*this, &PortMatrix::remove_channel_proxy), w, bc[dim].channel)
|
||||
)
|
||||
);
|
||||
|
||||
have_one = true;
|
||||
}
|
||||
|
||||
if (can_rename_channels (dim)) {
|
||||
snprintf (buf, sizeof (buf), _("Rename '%s'..."), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
|
||||
items.push_back (
|
||||
MenuElem (
|
||||
buf,
|
||||
bind (mem_fun (*this, &PortMatrix::rename_channel_proxy), w, bc[dim].channel)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
boost::weak_ptr<ARDOUR::Bundle> w (bc[dim].bundle);
|
||||
|
||||
if (_show_only_bundles) {
|
||||
snprintf (buf, sizeof (buf), _("%s all from '%s'"), disassociation_verb().c_str(), bc[dim].bundle->name().c_str());
|
||||
} else {
|
||||
|
@ -349,7 +347,6 @@ PortMatrix::popup_menu (
|
|||
_menu->popup (1, t);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PortMatrix::remove_channel_proxy (boost::weak_ptr<ARDOUR::Bundle> b, uint32_t c)
|
||||
{
|
||||
|
|
|
@ -124,7 +124,12 @@ public:
|
|||
virtual PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const = 0;
|
||||
virtual bool list_is_global (int) const = 0;
|
||||
|
||||
virtual void add_channel (boost::shared_ptr<ARDOUR::Bundle>) = 0;
|
||||
/** If adding a channel is allowed in this situation, return the name of the
|
||||
* thing that it would be added to.
|
||||
* @return Name.
|
||||
*/
|
||||
virtual std::string add_channel_name () const { return ""; }
|
||||
virtual void add_channel () {}
|
||||
virtual bool can_remove_channels (int) const = 0;
|
||||
virtual void remove_channel (ARDOUR::BundleChannel) = 0;
|
||||
virtual bool can_rename_channels (int) const = 0;
|
||||
|
|
|
@ -93,7 +93,6 @@ public:
|
|||
return (dim == OTHER);
|
||||
}
|
||||
|
||||
void add_channel (boost::shared_ptr<ARDOUR::Bundle>) {}
|
||||
bool can_remove_channels (int) const {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue