note about which version supports mackie
[ardour.git] / gtk2_ardour / time_axis_view_item.cc
index bd4afd200e9483d7fbd0a6afbe8edbb9ef3ffc99..87eac74ccfeb2a30ace0219e225bfa0e1a27f516 100644 (file)
@@ -88,13 +88,42 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
                layout->set_font_description (NAME_FONT);
                Gtkmm2ext::get_ink_pixel_size (layout, width, height);
 
-               NAME_Y_OFFSET = height + 4;
+               NAME_Y_OFFSET = height + 6;
                NAME_HIGHLIGHT_SIZE = height + 6;
                NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 2;
 
                have_name_font = true;
        }
 
+       group = new ArdourCanvas::Group (parent);
+       
+       init (it_name, spu, base_color, start, duration, vis);
+
+}
+
+TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
+       : trackview (other.trackview)
+{
+
+       Gdk::Color c;
+       int r,g,b,a;
+
+       UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
+       c.set_rgb_p (r/255.0, g/255.0, b/255.0);
+
+       /* share the other's parent, but still create a new group */
+
+       Gnome::Canvas::Group* parent = other.group->property_parent();
+       
+       group = new ArdourCanvas::Group (*parent);
+
+       init (other.item_name, other.samples_per_unit, c, other.frame_position, other.item_duration, other.visibility);
+}
+
+
+void
+TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_color, nframes_t start, nframes_t duration, Visibility vis)
+{
        item_name = it_name ;
        samples_per_unit = spu ;
        should_show_selection = true;
@@ -112,8 +141,6 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
                warning << "Time Axis Item Duration == 0" << endl ;
        }
 
-       group = new ArdourCanvas::Group (parent);
-
        vestigial_frame = new ArdourCanvas::SimpleRect (*group);
        vestigial_frame->property_x1() = (double) 0.0;
        vestigial_frame->property_y1() = (double) 1.0;
@@ -220,7 +247,6 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
        set_position (start, this) ;
 }
 
-
 /**
  * Destructor
  */