13
0

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
This commit is contained in:
Paul Davis 2011-12-01 16:57:29 +00:00
parent 8480cf69ce
commit 28c721bbfe
3 changed files with 27 additions and 0 deletions

View File

@ -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;

View File

@ -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 ();
@ -1498,6 +1503,16 @@ MixerStrip::set_selected (bool yn)
global_frame.queue_draw ();
}
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 ()
{
@ -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

View File

@ -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 ();