subtle but important changes to IO Selector widgets etc.
git-svn-id: svn://localhost/ardour2/branches/3.0@3830 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
474f8bc376
commit
e8869b28a2
@ -41,16 +41,17 @@ using namespace Gtk;
|
|||||||
|
|
||||||
IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool offer_inputs)
|
IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool offer_inputs)
|
||||||
: PortMatrix (
|
: PortMatrix (
|
||||||
session, io->default_type(), !offer_inputs,
|
session, io->default_type(), offer_inputs,
|
||||||
PortGroupList::Mask (PortGroupList::BUSS | PortGroupList::SYSTEM | PortGroupList::OTHER)
|
PortGroupList::Mask (PortGroupList::BUSS |
|
||||||
),
|
PortGroupList::SYSTEM |
|
||||||
|
PortGroupList::OTHER)),
|
||||||
_io (io)
|
_io (io)
|
||||||
{
|
{
|
||||||
/* Listen for ports changing on the IO */
|
/* Listen for ports changing on the IO */
|
||||||
if (_offer_inputs) {
|
if (_offer_inputs) {
|
||||||
_io->input_changed.connect (mem_fun(*this, &IOSelector::ports_changed));
|
|
||||||
} else {
|
|
||||||
_io->output_changed.connect (mem_fun(*this, &IOSelector::ports_changed));
|
_io->output_changed.connect (mem_fun(*this, &IOSelector::ports_changed));
|
||||||
|
} else {
|
||||||
|
_io->input_changed.connect (mem_fun(*this, &IOSelector::ports_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this got lost in a merge from 2.0 */
|
/* this got lost in a merge from 2.0 */
|
||||||
@ -68,8 +69,6 @@ IOSelector::ports_changed (ARDOUR::IOChange change, void *src)
|
|||||||
redisplay ();
|
redisplay ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IOSelector::set_state (int r, std::string const & p, bool s)
|
IOSelector::set_state (int r, std::string const & p, bool s)
|
||||||
{
|
{
|
||||||
@ -146,12 +145,20 @@ IOSelector::minimum_rows () const
|
|||||||
std::string
|
std::string
|
||||||
IOSelector::row_name (int r) const
|
IOSelector::row_name (int r) const
|
||||||
{
|
{
|
||||||
|
string n;
|
||||||
|
string::size_type pos;
|
||||||
|
|
||||||
if (!_offer_inputs) {
|
if (!_offer_inputs) {
|
||||||
return _io->input(r)->name();
|
n = _io->input(r)->short_name();
|
||||||
} else {
|
} else {
|
||||||
return _io->output(r)->name();
|
n = _io->output(r)->short_name();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((pos = n.find ('/')) != string::npos) {
|
||||||
|
return n.substr (pos+1);
|
||||||
|
} else {
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -257,6 +264,7 @@ IOSelectorWindow::IOSelectorWindow (
|
|||||||
)
|
)
|
||||||
: ArdourDialog ("I/O selector"),
|
: ArdourDialog ("I/O selector"),
|
||||||
_selector (session, io, !for_input),
|
_selector (session, io, !for_input),
|
||||||
|
add_button (_("Add Port")),
|
||||||
ok_button (can_cancel ? _("OK"): _("Close")),
|
ok_button (can_cancel ? _("OK"): _("Close")),
|
||||||
cancel_button (_("Cancel")),
|
cancel_button (_("Cancel")),
|
||||||
rescan_button (_("Rescan"))
|
rescan_button (_("Rescan"))
|
||||||
@ -272,23 +280,31 @@ IOSelectorWindow::IOSelectorWindow (
|
|||||||
title = string_compose(_("%1 output"), io->name());
|
title = string_compose(_("%1 output"), io->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
ok_button.set_name ("IOSelectorButton");
|
if (_selector.maximum_rows() > _selector.n_rows()) {
|
||||||
if (!can_cancel) {
|
add_button.set_name ("IOSelectorButton");
|
||||||
ok_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON)));
|
add_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::ADD, Gtk::ICON_SIZE_BUTTON)));
|
||||||
|
get_action_area()->pack_start (add_button, false, false);
|
||||||
|
add_button.signal_clicked().connect (sigc::mem_fun (_selector, &IOSelector::add_row));
|
||||||
|
} else {
|
||||||
|
add_button.hide ();
|
||||||
}
|
}
|
||||||
cancel_button.set_name ("IOSelectorButton");
|
|
||||||
rescan_button.set_name ("IOSelectorButton");
|
rescan_button.set_name ("IOSelectorButton");
|
||||||
rescan_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::REFRESH, Gtk::ICON_SIZE_BUTTON)));
|
rescan_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::REFRESH, Gtk::ICON_SIZE_BUTTON)));
|
||||||
|
|
||||||
get_action_area()->pack_start (rescan_button, false, false);
|
get_action_area()->pack_start (rescan_button, false, false);
|
||||||
|
|
||||||
if (can_cancel) {
|
if (can_cancel) {
|
||||||
|
cancel_button.set_name ("IOSelectorButton");
|
||||||
cancel_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::CANCEL, Gtk::ICON_SIZE_BUTTON)));
|
cancel_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::CANCEL, Gtk::ICON_SIZE_BUTTON)));
|
||||||
get_action_area()->pack_start (cancel_button, false, false);
|
get_action_area()->pack_start (cancel_button, false, false);
|
||||||
} else {
|
} else {
|
||||||
cancel_button.hide();
|
cancel_button.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ok_button.set_name ("IOSelectorButton");
|
||||||
|
if (!can_cancel) {
|
||||||
|
ok_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON)));
|
||||||
|
}
|
||||||
get_action_area()->pack_start (ok_button, false, false);
|
get_action_area()->pack_start (ok_button, false, false);
|
||||||
|
|
||||||
get_vbox()->set_spacing (8);
|
get_vbox()->set_spacing (8);
|
||||||
|
@ -38,10 +38,9 @@ class IOSelector : public PortMatrix {
|
|||||||
std::string row_descriptor () const;
|
std::string row_descriptor () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void ports_changed (ARDOUR::IOChange, void*);
|
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::IO> _io;
|
boost::shared_ptr<ARDOUR::IO> _io;
|
||||||
|
|
||||||
|
void ports_changed (ARDOUR::IOChange, void*);
|
||||||
};
|
};
|
||||||
|
|
||||||
class IOSelectorWindow : public ArdourDialog
|
class IOSelectorWindow : public ArdourDialog
|
||||||
@ -60,6 +59,7 @@ class IOSelectorWindow : public ArdourDialog
|
|||||||
|
|
||||||
/* overall operation buttons */
|
/* overall operation buttons */
|
||||||
|
|
||||||
|
Gtk::Button add_button;
|
||||||
Gtk::Button ok_button;
|
Gtk::Button ok_button;
|
||||||
Gtk::Button cancel_button;
|
Gtk::Button cancel_button;
|
||||||
Gtk::Button rescan_button;
|
Gtk::Button rescan_button;
|
||||||
|
@ -91,7 +91,7 @@ PortGroupUI::PortGroupUI (PortMatrix& m, PortGroup& g)
|
|||||||
_table.attach (*b, j, j + 1, i, i + 1);
|
_table.attach (*b, j, j + 1, i, i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_table_box.add (_table);
|
_table_box.add (_table);
|
||||||
|
|
||||||
_ignore_check_button_toggle = true;
|
_ignore_check_button_toggle = true;
|
||||||
@ -177,11 +177,11 @@ PortGroupUI::setup_visibility ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_visibility_checkbutton.get_active () != _port_group.visible) {
|
if (_visibility_checkbutton.get_active () != _port_group.visible) {
|
||||||
|
|
||||||
_visibility_checkbutton.set_active (_port_group.visible);
|
_visibility_checkbutton.set_active (_port_group.visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RotatedLabelSet::RotatedLabelSet (PortGroupList& g)
|
RotatedLabelSet::RotatedLabelSet (PortGroupList& g)
|
||||||
: Glib::ObjectBase ("RotatedLabelSet"), Gtk::Widget (), _port_group_list (g), _base_width (128)
|
: Glib::ObjectBase ("RotatedLabelSet"), Gtk::Widget (), _port_group_list (g), _base_width (128)
|
||||||
{
|
{
|
||||||
@ -390,7 +390,7 @@ PortMatrix::PortMatrix (ARDOUR::Session& session, ARDOUR::DataType type, bool of
|
|||||||
_scrolled_window.add (*Gtk::manage (a));
|
_scrolled_window.add (*Gtk::manage (a));
|
||||||
_overall_hbox.pack_start (_scrolled_window);
|
_overall_hbox.pack_start (_scrolled_window);
|
||||||
_side_vbox[1].pack_start (*Gtk::manage (new Gtk::Label ("")));
|
_side_vbox[1].pack_start (*Gtk::manage (new Gtk::Label ("")));
|
||||||
_overall_hbox.pack_start (_side_vbox[1]);
|
// _overall_hbox.pack_start (_side_vbox[1]);
|
||||||
pack_start (_overall_hbox);
|
pack_start (_overall_hbox);
|
||||||
|
|
||||||
_port_group_hbox.signal_size_allocate().connect (sigc::hide (sigc::mem_fun (*this, &IOSelector::setup_dimensions)));
|
_port_group_hbox.signal_size_allocate().connect (sigc::hide (sigc::mem_fun (*this, &IOSelector::setup_dimensions)));
|
||||||
@ -509,23 +509,22 @@ PortMatrix::setup ()
|
|||||||
/* Checkbutton tables and visibility checkbuttons */
|
/* Checkbutton tables and visibility checkbuttons */
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (PortGroupList::iterator i = _port_group_list.begin(); i != _port_group_list.end(); ++i) {
|
for (PortGroupList::iterator i = _port_group_list.begin(); i != _port_group_list.end(); ++i) {
|
||||||
if ((*i)->visible) {
|
|
||||||
PortGroupUI* t = new PortGroupUI (*this, **i);
|
|
||||||
|
|
||||||
/* XXX: this is a bit of a hack; should probably use a configurable colour here */
|
PortGroupUI* t = new PortGroupUI (*this, **i);
|
||||||
Gdk::Color alt_bg = get_style()->get_bg (Gtk::STATE_NORMAL);
|
|
||||||
alt_bg.set_rgb (alt_bg.get_red() + 4096, alt_bg.get_green() + 4096, alt_bg.get_blue () + 4096);
|
/* XXX: this is a bit of a hack; should probably use a configurable colour here */
|
||||||
if ((n % 2) == 0) {
|
Gdk::Color alt_bg = get_style()->get_bg (Gtk::STATE_NORMAL);
|
||||||
t->get_table().modify_bg (Gtk::STATE_NORMAL, alt_bg);
|
alt_bg.set_rgb (alt_bg.get_red() + 4096, alt_bg.get_green() + 4096, alt_bg.get_blue () + 4096);
|
||||||
}
|
if ((n % 2) == 0) {
|
||||||
|
t->get_table().modify_bg (Gtk::STATE_NORMAL, alt_bg);
|
||||||
_port_group_ui.push_back (t);
|
}
|
||||||
_port_group_hbox.pack_start (t->get_table(), false, false);
|
|
||||||
|
_port_group_ui.push_back (t);
|
||||||
_visibility_checkbutton_box.pack_start (t->get_visibility_checkbutton(), false, false);
|
_port_group_hbox.pack_start (t->get_table(), false, false);
|
||||||
++n;
|
|
||||||
}
|
_visibility_checkbutton_box.pack_start (t->get_visibility_checkbutton(), false, false);
|
||||||
}
|
++n;
|
||||||
|
}
|
||||||
|
|
||||||
show_all ();
|
show_all ();
|
||||||
|
|
||||||
@ -620,24 +619,23 @@ PortGroupList::refresh ()
|
|||||||
other.ports.clear ();
|
other.ports.clear ();
|
||||||
|
|
||||||
/* Find the ports provided by ardour; we can't derive their type just from their
|
/* Find the ports provided by ardour; we can't derive their type just from their
|
||||||
names, so we'll have to be more devious. */
|
names, so we'll have to be more devious.
|
||||||
|
*/
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::Session::RouteList> routes = _session.get_routes ();
|
boost::shared_ptr<ARDOUR::Session::RouteList> routes = _session.get_routes ();
|
||||||
|
|
||||||
for (ARDOUR::Session::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
|
for (ARDOUR::Session::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
|
||||||
|
|
||||||
PortGroup* g = 0;
|
PortGroup* g = 0;
|
||||||
if (_type == ARDOUR::DataType::AUDIO && dynamic_cast<ARDOUR::AudioTrack*> ((*i).get())) {
|
|
||||||
/* Audio track for an audio IO */
|
|
||||||
g = &track;
|
|
||||||
} else if (_type == ARDOUR::DataType::MIDI && dynamic_cast<ARDOUR::MidiTrack*> ((*i).get())) {
|
|
||||||
/* Midi track for a MIDI IO */
|
|
||||||
g = &track;
|
|
||||||
} else if (_type == ARDOUR::DataType::AUDIO && dynamic_cast<ARDOUR::MidiTrack*> ((*i).get()) == 0) {
|
|
||||||
/* Non-MIDI track for an Audio IO; must be an audio buss */
|
|
||||||
g = &buss;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (_type == ARDOUR::DataType::AUDIO && boost::dynamic_pointer_cast<ARDOUR::AudioTrack> (*i)) {
|
||||||
|
g = &track;
|
||||||
|
} else if (_type == ARDOUR::DataType::MIDI && boost::dynamic_pointer_cast<ARDOUR::MidiTrack> (*i)) {
|
||||||
|
g = &track;
|
||||||
|
} else if (_type == ARDOUR::DataType::AUDIO && boost::dynamic_pointer_cast<ARDOUR::Route> (*i)) {
|
||||||
|
g = &buss;
|
||||||
|
}
|
||||||
|
|
||||||
if (g) {
|
if (g) {
|
||||||
ARDOUR::PortSet const & p = _offer_inputs ? ((*i)->inputs()) : ((*i)->outputs());
|
ARDOUR::PortSet const & p = _offer_inputs ? ((*i)->inputs()) : ((*i)->outputs());
|
||||||
for (uint32_t j = 0; j < p.num_ports(); ++j) {
|
for (uint32_t j = 0; j < p.num_ports(); ++j) {
|
||||||
@ -648,18 +646,22 @@ PortGroupList::refresh ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* XXX: inserts, sends, plugin inserts? */
|
/* XXX: inserts, sends, plugin inserts? */
|
||||||
|
|
||||||
/* Now we need to find the non-ardour ports; we do this by first
|
/* Now we need to find the non-ardour ports; we do this by first
|
||||||
finding all the ports that we can connect to. */
|
finding all the ports that we can connect to.
|
||||||
const char **ports = _session.engine().get_ports (
|
*/
|
||||||
"", _type.to_jack_type(), _offer_inputs ? JackPortIsInput : JackPortIsOutput
|
|
||||||
);
|
|
||||||
|
|
||||||
|
const char **ports = _session.engine().get_ports ("", _type.to_jack_type(), _offer_inputs ?
|
||||||
|
JackPortIsInput : JackPortIsOutput);
|
||||||
if (ports) {
|
if (ports) {
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
string client_matching_string;
|
||||||
|
|
||||||
|
client_matching_string = _session.engine().client_name();
|
||||||
|
client_matching_string += ':';
|
||||||
|
|
||||||
while (ports[n]) {
|
while (ports[n]) {
|
||||||
std::string const p = ports[n];
|
std::string const p = ports[n];
|
||||||
|
|
||||||
@ -667,7 +669,7 @@ PortGroupList::refresh ()
|
|||||||
/* system: prefix */
|
/* system: prefix */
|
||||||
system.add (p);
|
system.add (p);
|
||||||
} else {
|
} else {
|
||||||
if (p.substr(0, strlen("ardour:")) != "ardour:") {
|
if (p.substr(0, client_matching_string.length()) != client_matching_string) {
|
||||||
/* other (non-ardour) prefix */
|
/* other (non-ardour) prefix */
|
||||||
other.add (p);
|
other.add (p);
|
||||||
}
|
}
|
||||||
@ -675,11 +677,13 @@ PortGroupList::refresh ()
|
|||||||
|
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free (ports);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
push_back (&system);
|
||||||
push_back (&buss);
|
push_back (&buss);
|
||||||
push_back (&track);
|
push_back (&track);
|
||||||
push_back (&system);
|
|
||||||
push_back (&other);
|
push_back (&other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user