summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-01 16:57:29 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-01 16:57:29 +0000
commit28c721bbfee4de92fed4f8ec10403f9f51022fad (patch)
tree08210e0aa7f4ec8cad30f3f6df346a1fe52d8e39 /gtk2_ardour
parent8480cf69ce693e7effeb677d791fbe1d5ea004cb (diff)
expose Pango::Layout member of ArdourButton; set ellipsizing behaviour for mixer strip name button; add full name tooltip to name button
git-svn-id: svn://localhost/ardour2/branches/3.0@10847 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_button.h2
-rw-r--r--gtk2_ardour/mixer_strip.cc23
-rw-r--r--gtk2_ardour/mixer_strip.h2
3 files changed, 27 insertions, 0 deletions
diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h
index 695d31e419..a1ee715f9c 100644
--- a/gtk2_ardour/ardour_button.h
+++ b/gtk2_ardour/ardour_button.h
@@ -72,6 +72,8 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
void set_led_left (bool yn);
void set_distinct_led_click (bool yn);
+ Glib::RefPtr<Pango::Layout> layout() const { return _layout; }
+
sigc::signal<void> signal_led_clicked;
sigc::signal<void> signal_clicked;
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index a77cc87d8b..5cf0a1365a 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -249,6 +249,10 @@ MixerStrip::init ()
bottom_button_table.attach (group_button, 0, 1, 0, 1);
name_button.set_name ("mixer strip name button");
+ name_button.set_text (" "); /* non empty text, forces creation of the layout */
+ name_button.set_text (""); /* back to empty */
+ name_button.layout()->set_ellipsize (Pango::ELLIPSIZE_END);
+ name_button.signal_size_allocate().connect (sigc::mem_fun (*this, &MixerStrip::name_button_resized));
Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
@@ -504,6 +508,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
}
_route->comment_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
+ _route->PropertyChanged.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::property_changed, this, _1), gui_context());
set_stuff_from_route ();
@@ -1499,6 +1504,16 @@ MixerStrip::set_selected (bool yn)
}
void
+MixerStrip::property_changed (const PropertyChange& what_changed)
+{
+ RouteUI::property_changed (what_changed);
+
+ if (what_changed.contains (ARDOUR::Properties::name)) {
+ name_changed ();
+ }
+}
+
+void
MixerStrip::name_changed ()
{
switch (_width) {
@@ -1509,6 +1524,14 @@ MixerStrip::name_changed ()
name_button.set_text (PBD::short_version (_route->name(), 5));
break;
}
+
+ ARDOUR_UI::instance()->set_tip (name_button, _route->name());
+}
+
+void
+MixerStrip::name_button_resized (Gtk::Allocation& alloc)
+{
+ name_button.layout()->set_width (alloc.get_width() * PANGO_SCALE);
}
bool
diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h
index 09b5c150d0..e5df59565c 100644
--- a/gtk2_ardour/mixer_strip.h
+++ b/gtk2_ardour/mixer_strip.h
@@ -265,6 +265,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
void route_color_changed ();
void show_passthru_color ();
+ void property_changed (const PBD::PropertyChange&);
+ void name_button_resized (Gtk::Allocation&);
void name_changed ();
void update_speed_display ();
void map_frozen ();