fix computation of Text bounding box to respect _clamped_width
[ardour.git] / gtk2_ardour / time_axis_view_item.h
index 2f4e5f465d64abf8235d608f69da41878e63a1ba..6a81080e96fe65007383c016d964a9a120a71acd 100644 (file)
@@ -21,6 +21,7 @@
 #define __gtk_ardour_time_axis_view_item_h__
 
 #include <string>
+#include <gdk/gdk.h>
 #include <gdkmm/color.h>
 #include <pangomm/fontdescription.h>
 #include "pbd/signals.h"
@@ -33,6 +34,7 @@ namespace ArdourCanvas {
        class Rectangle;
        class Item;
        class Group;
+       class Text;
 }
 
 using ARDOUR::framepos_t;
@@ -72,10 +74,11 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
        void set_y (double);
        void set_color (Gdk::Color const &);
 
+        uint32_t get_fill_color () const;
+
        ArdourCanvas::Item* get_canvas_frame();
        ArdourCanvas::Group* get_canvas_group();
        ArdourCanvas::Item* get_name_highlight();
-       ArdourCanvas::Pixbuf* get_name_pixbuf();
 
        virtual void set_samples_per_pixel (double);
 
@@ -156,16 +159,19 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
 
        TimeAxisViewItem (const TimeAxisViewItem&);
 
-       void init (const std::string&, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
+        void init (ArdourCanvas::Group*, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
+
+        virtual bool canvas_group_event (GdkEvent*);
 
        virtual void compute_colors (Gdk::Color const &);
        virtual void set_colors();
        virtual void set_frame_color();
+       virtual void set_frame_gradient ();
        void set_trim_handle_colors();
 
        virtual void reset_width_dependent_items (double);
        void reset_name_width (double);
-       void update_name_pixbuf_visibility ();
+       void update_name_text_visibility ();
 
        static gint idle_remove_this_item(TimeAxisViewItem*, void*);
 
@@ -228,7 +234,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
        uint32_t lock_handle_color_g;
        uint32_t lock_handle_color_b;
        uint32_t last_item_width;
-       int name_pixbuf_width;
+       int name_text_width;
        bool wide_enough_for_name;
        bool high_enough_for_name;
         bool rect_visible;
@@ -236,13 +242,15 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
        ArdourCanvas::Group*      group;
        ArdourCanvas::Rectangle* vestigial_frame;
        ArdourCanvas::Rectangle* frame;
-       ArdourCanvas::Pixbuf*     name_pixbuf;
+       ArdourCanvas::Text*      name_text;
        ArdourCanvas::Rectangle* name_highlight;
 
        /* with these two values, if frame_handle_start == 0 then frame_handle_end will also be 0 */
        ArdourCanvas::Rectangle* frame_handle_start; ///< `frame' (fade) handle for the start of the item, or 0
        ArdourCanvas::Rectangle* frame_handle_end; ///< `frame' (fade) handle for the end of the item, or 0
 
+        bool frame_handle_crossing (GdkEvent*, ArdourCanvas::Rectangle*);
+
        double _height;
        Visibility visibility;
        bool _recregion;