summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-11 19:45:02 +0100
committerRobin Gareus <robin@gareus.org>2015-03-11 20:06:41 +0100
commit0272c4f74941f96b8f0bd1c0c3f46649758ab9ce (patch)
tree5babdae456ec032130c403789e7911b0c2279868
parent087b5dc43b545262689f32b9065ac24a0cc2b33d (diff)
renice connection button labels
* pango ellipsize text * use pretty-names if available
-rw-r--r--gtk2_ardour/mixer_strip.cc69
-rw-r--r--gtk2_ardour/mixer_strip.h3
2 files changed, 58 insertions, 14 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index a1e0ebe91c..423b0044d5 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -316,9 +316,14 @@ MixerStrip::init ()
input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
input_button.signal_button_release_event().connect (sigc::mem_fun(*this, &MixerStrip::input_release), false);
+ input_button.signal_size_allocate().connect (sigc::mem_fun (*this, &MixerStrip::input_button_resized));
+
+ input_button.set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE);
+ output_button.set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE);
output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
output_button.signal_button_release_event().connect (sigc::mem_fun(*this, &MixerStrip::output_release), false);
+ output_button.signal_size_allocate().connect (sigc::mem_fun (*this, &MixerStrip::output_button_resized));
number_label.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::number_button_button_press), false);
@@ -1148,7 +1153,6 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
uint32_t other_connection_count = 0;
ostringstream label;
- string label_string;
bool have_label = false;
bool each_io_has_one_connection = true;
@@ -1193,12 +1197,20 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
if (!port_connections.empty()) {
for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
+ string pn = "";
string& connection_name (*i);
+ if (connection_name.find("system:") == 0) {
+ pn = AudioEngine::instance()->get_pretty_name_by_name (connection_name);
+ }
+
if (io_connection_count == 0) {
- tooltip << endl << Glib::Markup::escape_text(port->name().substr(port->name().find("/") + 1)) << " -> " << Glib::Markup::escape_text(connection_name);
+ tooltip << endl << Glib::Markup::escape_text(port->name().substr(port->name().find("/") + 1))
+ << " -> "
+ << Glib::Markup::escape_text( pn.empty() ? connection_name : pn );
} else {
- tooltip << ", " << Glib::Markup::escape_text(connection_name);
+ tooltip << ", "
+ << Glib::Markup::escape_text( pn.empty() ? connection_name : pn );
}
if (connection_name.find("ardour:") == 0) {
@@ -1213,6 +1225,32 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
if (connection_name.find(ardour_track_name) == 0) {
++ardour_connection_count;
}
+ } else if (!pn.empty()) {
+ if (system_ports.empty()) {
+ system_ports += pn;
+ } else {
+ system_ports += "/" + pn;
+ }
+ if (connection_name.find("system:") == 0) {
+ ++system_connection_count;
+ }
+ } else if (connection_name.find("system:midi_") == 0) {
+ if (for_input) {
+ // "system:midi_capture_123" -> "123"
+ system_port = connection_name.substr(20);
+ } else {
+ // "system:midi_playback_123" -> "123"
+ system_port = connection_name.substr(21);
+ }
+
+ if (system_ports.empty()) {
+ system_ports += system_port;
+ } else {
+ system_ports += "/" + system_port;
+ }
+
+ ++system_connection_count;
+
} else if (connection_name.find("system:") == 0) {
if (for_input) {
// "system:capture_123" -> "123"
@@ -1296,19 +1334,10 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
}
}
- switch (width) {
- case Wide:
- label_string = label.str().substr(0, 7);
- break;
- case Narrow:
- label_string = label.str().substr(0, 3);
- break;
- }
-
if (for_input) {
- input_button.set_text (label_string);
+ input_button.set_text (label.str());
} else {
- output_button.set_text (label_string);
+ output_button.set_text (label.str());
}
}
@@ -1626,6 +1655,18 @@ MixerStrip::name_changed ()
}
void
+MixerStrip::input_button_resized (Gtk::Allocation& alloc)
+{
+ input_button.set_layout_ellisize_width (alloc.get_width() * PANGO_SCALE);
+}
+
+void
+MixerStrip::output_button_resized (Gtk::Allocation& alloc)
+{
+ output_button.set_layout_ellisize_width (alloc.get_width() * PANGO_SCALE);
+}
+
+void
MixerStrip::name_button_resized (Gtk::Allocation& alloc)
{
name_button.set_layout_ellisize_width (alloc.get_width() * PANGO_SCALE);
diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h
index bd3c3a289b..46f5abd82f 100644
--- a/gtk2_ardour/mixer_strip.h
+++ b/gtk2_ardour/mixer_strip.h
@@ -183,6 +183,9 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
ArdourButton input_button;
ArdourButton output_button;
+ void input_button_resized (Gtk::Allocation&);
+ void output_button_resized (Gtk::Allocation&);
+
ArdourButton* midi_input_enable_button;
Gtk::HBox input_button_box;