Add a menu option and key press (F) in port matrices to flip the selected row and columns in the matrix.
git-svn-id: svn://localhost/ardour2/branches/3.0@12804 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
7a76e8ae96
commit
85c2fd2b69
@ -221,6 +221,8 @@ BundleEditor::BundleEditor (Session* session, boost::shared_ptr<UserBundle> bund
|
|||||||
|
|
||||||
add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_ACCEPT);
|
add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_ACCEPT);
|
||||||
show_all ();
|
show_all ();
|
||||||
|
|
||||||
|
signal_key_press_event().connect (sigc::mem_fun (_matrix, &BundleEditorMatrix::key_press));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -160,6 +160,8 @@ GlobalPortMatrixWindow::GlobalPortMatrixWindow (Session* s, DataType t)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal_key_press_event().connect (sigc::mem_fun (_port_matrix, &PortMatrix::key_press));
|
||||||
|
|
||||||
add (_port_matrix);
|
add (_port_matrix);
|
||||||
_port_matrix.show ();
|
_port_matrix.show ();
|
||||||
}
|
}
|
||||||
|
@ -504,12 +504,16 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
items.push_back (MenuElem (_("Rescan"), sigc::mem_fun (*this, &PortMatrix::setup_all_ports)));
|
items.push_back (MenuElem (_("Rescan"), sigc::mem_fun (*this, &PortMatrix::setup_all_ports)));
|
||||||
|
|
||||||
items.push_back (CheckMenuElem (_("Show individual ports"), sigc::mem_fun (*this, &PortMatrix::toggle_show_only_bundles)));
|
items.push_back (CheckMenuElem (_("Show individual ports"), sigc::mem_fun (*this, &PortMatrix::toggle_show_only_bundles)));
|
||||||
CheckMenuItem* i = dynamic_cast<CheckMenuItem*> (&items.back());
|
CheckMenuItem* i = dynamic_cast<CheckMenuItem*> (&items.back());
|
||||||
_inhibit_toggle_show_only_bundles = true;
|
_inhibit_toggle_show_only_bundles = true;
|
||||||
i->set_active (!_show_only_bundles);
|
i->set_active (!_show_only_bundles);
|
||||||
_inhibit_toggle_show_only_bundles = false;
|
_inhibit_toggle_show_only_bundles = false;
|
||||||
|
|
||||||
|
items.push_back (MenuElem (_("Flip"), sigc::mem_fun (*this, &PortMatrix::flip)));
|
||||||
|
items.back().set_sensitive (can_flip ());
|
||||||
|
|
||||||
_menu->popup (1, t);
|
_menu->popup (1, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1122,3 +1126,75 @@ PortMatrix::bundle_with_channels (boost::shared_ptr<ARDOUR::Bundle> b)
|
|||||||
{
|
{
|
||||||
return b && b->nchannels() != ARDOUR::ChanCount::ZERO;
|
return b && b->nchannels() != ARDOUR::ChanCount::ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** See if a `flip' is possible.
|
||||||
|
* @return If flip is possible, the new (row, column) notebook indices that
|
||||||
|
* should be selected; otherwise, (-1, -1)
|
||||||
|
*/
|
||||||
|
pair<int, int>
|
||||||
|
PortMatrix::check_flip () const
|
||||||
|
{
|
||||||
|
/* Look for the row's port group name in the columns */
|
||||||
|
|
||||||
|
int new_column = 0;
|
||||||
|
boost::shared_ptr<const PortGroup> r = visible_ports (_row_index);
|
||||||
|
PortGroupList::List::const_iterator i = _ports[_column_index].begin();
|
||||||
|
while (i != _ports[_column_index].end() && (*i)->name != r->name) {
|
||||||
|
++i;
|
||||||
|
++new_column;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == _ports[_column_index].end ()) {
|
||||||
|
return make_pair (-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look for the column's port group name in the rows */
|
||||||
|
|
||||||
|
int new_row = 0;
|
||||||
|
boost::shared_ptr<const PortGroup> c = visible_ports (_column_index);
|
||||||
|
i = _ports[_row_index].begin();
|
||||||
|
while (i != _ports[_row_index].end() && (*i)->name != c->name) {
|
||||||
|
++i;
|
||||||
|
++new_row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == _ports[_row_index].end ()) {
|
||||||
|
return make_pair (-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_arrangement == LEFT_TO_BOTTOM) {
|
||||||
|
new_row = _ports[_row_index].size() - new_row - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return make_pair (new_row, new_column);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PortMatrix::can_flip () const
|
||||||
|
{
|
||||||
|
return check_flip().first != -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Flip the column and row pages around, if possible */
|
||||||
|
void
|
||||||
|
PortMatrix::flip ()
|
||||||
|
{
|
||||||
|
pair<int, int> n = check_flip ();
|
||||||
|
if (n.first == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vnotebook.set_current_page (n.first);
|
||||||
|
_hnotebook.set_current_page (n.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PortMatrix::key_press (GdkEventKey* k)
|
||||||
|
{
|
||||||
|
if (k->keyval == GDK_f) {
|
||||||
|
flip ();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -130,6 +130,9 @@ public:
|
|||||||
|
|
||||||
PortMatrixNode::State get_association (PortMatrixNode) const;
|
PortMatrixNode::State get_association (PortMatrixNode) const;
|
||||||
|
|
||||||
|
void flip ();
|
||||||
|
bool key_press (GdkEventKey *);
|
||||||
|
|
||||||
/** @param c Channels; where c[0] is from _ports[0] and c[1] is from _ports[1].
|
/** @param c Channels; where c[0] is from _ports[0] and c[1] is from _ports[1].
|
||||||
* @param s New state.
|
* @param s New state.
|
||||||
*/
|
*/
|
||||||
@ -199,10 +202,12 @@ private:
|
|||||||
void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int, int);
|
void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int, int);
|
||||||
void port_connected_or_disconnected ();
|
void port_connected_or_disconnected ();
|
||||||
void update_tab_highlighting ();
|
void update_tab_highlighting ();
|
||||||
|
std::pair<int, int> check_flip () const;
|
||||||
|
bool can_flip () const;
|
||||||
|
|
||||||
Gtk::Window* _parent;
|
Gtk::Window* _parent;
|
||||||
|
|
||||||
/// port type that we are working with, or NIL if we are working with all of them
|
/** port type that we are working with, or NIL if we are working with all of them */
|
||||||
ARDOUR::DataType _type;
|
ARDOUR::DataType _type;
|
||||||
PBD::ScopedConnectionList _route_connections;
|
PBD::ScopedConnectionList _route_connections;
|
||||||
PBD::ScopedConnectionList _changed_connections;
|
PBD::ScopedConnectionList _changed_connections;
|
||||||
|
Loading…
Reference in New Issue
Block a user