expand bbox for Canvas::Line to get rid of artifacts caused when moving them around...
[ardour.git] / gtk2_ardour / time_axis_view_item.h
index e7384a8f85d2868670dd708da16394460ebc3fbb..f6f72b77bda6af0f5f8f70f82ae4a6eb1c603969 100644 (file)
 #define __gtk_ardour_time_axis_view_item_h__
 
 #include <string>
-
-#include <libgnomecanvasmm/pixbuf.h>
-
+#include <gdkmm/color.h>
+#include <pangomm/fontdescription.h>
 #include "pbd/signals.h"
-
 #include "selectable.h"
-#include "simplerect.h"
-#include "canvas.h"
 
 class TimeAxisView;
 
+namespace ArdourCanvas {
+       class Pixbuf;
+       class Rectangle;
+       class Item;
+       class Group;
+       class Text;
+}
+
 using ARDOUR::framepos_t;
 using ARDOUR::framecnt_t;
 
@@ -72,11 +76,14 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
        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_unit(double spu);
+       virtual void set_samples_per_pixel (double);
+
+       double get_samples_per_pixel () const;
 
-       double get_samples_per_unit();
+       virtual void drag_start() { _dragging = true; }
+       virtual void drag_end() { _dragging = false; }
+       bool dragging() const { return _dragging; }
 
        virtual void raise () { return; }
        virtual void raise_to_top () { return; }
@@ -90,10 +97,11 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
        bool name_active() const { return name_connected; }
 
        // Default sizes, font and spacing
-       static Pango::FontDescription* NAME_FONT;
+       static Pango::FontDescription NAME_FONT;
        static void set_constant_heights ();
        static const double NAME_X_OFFSET;
-       static const double GRAB_HANDLE_LENGTH;
+       static const double GRAB_HANDLE_TOP;
+       static const double GRAB_HANDLE_WIDTH;
 
        /* these are not constant, but vary with the pixel size
           of the font used to display the item name.
@@ -144,7 +152,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
 
   protected:
        TimeAxisViewItem(const std::string &, ArdourCanvas::Group&, TimeAxisView&, double, Gdk::Color const &,
-                        framepos_t, framepos_t, bool recording = false, bool automation = false, Visibility v = Visibility (0));
+                        framepos_t, framecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0));
 
        TimeAxisViewItem (const TimeAxisViewItem&);
 
@@ -153,11 +161,12 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
        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*);
 
@@ -185,8 +194,8 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
        /** indicates whether the min duration constraint is active */
        bool min_duration_active;
 
-       /** samples per canvas unit */
-       double samples_per_unit;
+       /** frames per canvas pixel */
+       double samples_per_pixel;
 
        /** should the item respond to events */
        bool _sensitive;
@@ -220,25 +229,26 @@ 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;
 
        ArdourCanvas::Group*      group;
-       ArdourCanvas::SimpleRect* vestigial_frame;
-       ArdourCanvas::SimpleRect* frame;
-       ArdourCanvas::Pixbuf*     name_pixbuf;
-       ArdourCanvas::SimpleRect* name_highlight;
+       ArdourCanvas::Rectangle* vestigial_frame;
+       ArdourCanvas::Rectangle* frame;
+       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::SimpleRect* frame_handle_start; ///< `frame' (fade) handle for the start of the item, or 0
-       ArdourCanvas::SimpleRect* frame_handle_end; ///< `frame' (fade) handle for the end of the item, or 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
 
        double _height;
        Visibility visibility;
        bool _recregion;
        bool _automation; ///< true if this is an automation region view
+       bool _dragging;
 
 private: