expose Pango::Layout member of ArdourButton; set ellipsizing behaviour for mixer...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 1 Dec 2011 16:57:29 +0000 (16:57 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 1 Dec 2011 16:57:29 +0000 (16:57 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10847 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_button.h
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h

index 695d31e419ec263a166fa2e568c7415943c76c31..a1ee715f9c83d5c1ae4c0db32346e96e6ba46ba2 100644 (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;
 
index a77cc87d8b5e56214c6487d8ac41f0698f802673..5cf0a1365a19b36026d6dd3dc6faa2e59255d1b2 100644 (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
index 09b5c150d024362d80a839f22c08799557518ba5..e5df59565c647b288637b79740d78881939385a6 100644 (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 ();