add GUI support to create tape/destructive tracks
[ardour.git] / gtk2_ardour / automation_time_axis.cc
index 5339b0a02e41fb9eb9c5198c3a48e8c5c90313e4..9fbb9d92329699e648c491cadecdfe2a9bb6f41f 100644 (file)
@@ -4,13 +4,13 @@
 #include "automation_time_axis.h"
 #include "automation_line.h"
 #include "public_editor.h"
-#include "canvas-simplerect.h"
-#include "canvas-waveview.h"
+#include "simplerect.h"
 #include "selection.h"
 #include "ghostregion.h"
 #include "rgb_macros.h"
 #include "automation_selectable.h"
 #include "point_selection.h"
+#include "canvas_impl.h"
 
 #include "i18n.h"
 
@@ -34,10 +34,12 @@ static const gchar * small_x_xpm[] = {
 "           ",
 "           "};
 
-AutomationTimeAxisView::AutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& rent, Widget* p, std::string nom, std::string state_name, std::string nomparent)
+AutomationTimeAxisView::AutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& rent, 
+                                               ArdourCanvas::Canvas& canvas, const string & nom, 
+                                               const string & state_name, const string & nomparent)
 
        : AxisView (s), 
-         TimeAxisView (s, e, &rent, p),
+         TimeAxisView (s, e, &rent, canvas),
          route (r),
          _name (nom),
          _state_name (state_name),
@@ -63,14 +65,14 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, Route& r, PublicEdit
        //                       "outline_what", (guint32) (0x1|0x2|0x8),
        //                       "fill_color_rgba", color_map[cAutomationTrackFill],
        //                       NULL);
-       base_rect = new Gnome::Canvas::SimpleRect(*canvas_display);
-       base_rect->set_property ("x1", 0.0);
-       base_rect->set_property ("y1", 0.0);
-       base_rect->set_property ("x2", 1000000.0);
-       base_rect->set_property ("outline_color_rgba", color_map[cAutomationTrackOutline]);
+       base_rect = new SimpleRect(*canvas_display);
+       base_rect->property_x1() = 0.0;
+       base_rect->property_y1() = 0.0;
+       base_rect->property_x2() = 1000000.0;
+       base_rect->property_outline_color_rgba() = color_map[cAutomationTrackOutline];
        /* outline ends and bottom */
-       base_rect->set_property ("outline_what", (guint32) (0x1|0x2|0x8));
-       base_rect->set_property ("fill_color_rgba", color_map[cAutomationTrackFill]);
+       base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);
+       base_rect->property_fill_color_rgba() = color_map[cAutomationTrackFill];
        
        base_rect->set_data ("trackview", this);
 
@@ -95,7 +97,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, Route& r, PublicEdit
           life easier and remove them.
        */
 
-       name_hbox.remove (name_entry);
+       hide_name_entry();
 
        /* move the name label over a bit */
 
@@ -298,7 +300,7 @@ AutomationTimeAxisView::set_height (TrackHeight h)
        controls_table.show_all ();
 
        TimeAxisView::set_height (h);
-       gtk_object_set (GTK_OBJECT(base_rect), "y2", (double) h, NULL);
+       base_rect->property_y2() = h;
 
        for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) {
                (*i)->set_height (h);
@@ -324,7 +326,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
                        controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                }
                controls_table.show_all ();
-               name_label.show ();
+               hide_name_entry ();
+               show_name_label ();
                break;
 
        case Large:
@@ -341,7 +344,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
                        controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                }
                controls_table.show_all ();
-               name_label.show ();
+               hide_name_entry ();
+               show_name_label ();
                break;
 
        case Larger:
@@ -358,7 +362,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
                        controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                }
                controls_table.show_all ();
-               name_label.show ();
+               hide_name_entry ();
+               show_name_label ();
                break;
 
        case Normal:
@@ -376,7 +381,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
                        controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                }
                controls_table.show_all ();
-               name_label.show ();
+               hide_name_entry ();
+               show_name_label ();
                break;
 
        case Smaller:
@@ -390,6 +396,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
                }
                controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                controls_table.hide_all ();
+               hide_name_entry ();
+               show_name_label ();
                name_hbox.show_all ();
                controls_table.show ();
                break;
@@ -405,6 +413,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
                } 
                controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                controls_table.hide_all ();
+               hide_name_entry ();
+               show_name_label ();
                name_hbox.show_all ();
                controls_table.show ();
                break;
@@ -433,7 +443,6 @@ AutomationTimeAxisView::hide_clicked ()
        hide ();
 }
 
-
 void
 AutomationTimeAxisView::build_display_menu ()
 {