NOOP, re-indent, remove trailing whitespace, sort includes
[ardour.git] / gtk2_ardour / time_axis_view.cc
index 13b0546d46ff4d1febd18abe2f22e0c8b3780d01..2923f630761454ab405a0511dd7fd8817c0d28c1 100644 (file)
@@ -66,6 +66,8 @@ using namespace Editing;
 using namespace ArdourCanvas;
 using Gtkmm2ext::Keyboard;
 
+#define TOP_LEVEL_WIDGET controls_ebox
+
 const double trim_handle_size = 6.0; /* pixels */
 uint32_t TimeAxisView::button_height = 0;
 uint32_t TimeAxisView::extra_height = 0;
@@ -106,10 +108,16 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
                compute_heights ();
        }
 
-       _canvas_display = new ArdourCanvas::Container (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0));
+       _canvas_display = new ArdourCanvas::Container (ed.get_trackview_group (), ArdourCanvas::Duple (1.0, 0.0));
        CANVAS_DEBUG_NAME (_canvas_display, "main for TAV");
        _canvas_display->hide(); // reveal as needed
 
+       _canvas_separator = new ArdourCanvas::Line(ed.get_trackview_group ());
+       CANVAS_DEBUG_NAME (_canvas_separator, "separator for TAV");
+       _canvas_separator->set_outline_color(RGBA_TO_UINT (0, 0, 0, 255));
+       _canvas_separator->set_outline_width(1.0);
+       _canvas_separator->hide();
+
        selection_group = new ArdourCanvas::Container (_canvas_display);
        CANVAS_DEBUG_NAME (selection_group, "selection for TAV");
        selection_group->set_data (X_("timeselection"), (void *) 1);
@@ -135,7 +143,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        name_hbox.pack_end (name_label, true, true);
 
        // set min. track-header width if fader is not visible
-       name_hbox.set_size_request(name_width_px, 0);
+       name_hbox.set_size_request(name_width_px, -1);
 
        name_hbox.show ();
        name_label.show ();
@@ -145,9 +153,9 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        controls_table.set_border_width (2);
 
        if (ARDOUR::Profile->get_mixbus() ) {
-               controls_table.attach (name_hbox, 4, 5, 0, 2,  Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+               controls_table.attach (name_hbox, 4, 5, 0, 2,  Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK, 0, 0);
        } else {
-               controls_table.attach (name_hbox, 1, 2, 0, 2,  Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+               controls_table.attach (name_hbox, 1, 2, 0, 2,  Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK, 0, 0);
        }
        controls_table.show_all ();
        controls_table.set_no_show_all ();
@@ -158,7 +166,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        top_hbox.pack_start (controls_vbox, true, true);
        top_hbox.show ();
 
-       controls_ebox.add (top_hbox);
+       controls_ebox.add (time_axis_hbox);
        controls_ebox.add_events (Gdk::BUTTON_PRESS_MASK|
                                  Gdk::BUTTON_RELEASE_MASK|
                                  Gdk::POINTER_MOTION_MASK|
@@ -176,7 +184,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        controls_ebox.show ();
 
        time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE);
-       time_axis_frame.add(controls_ebox);
+       time_axis_frame.add(top_hbox);
        time_axis_frame.show();
 
        HSeparator* separator = manage (new HSeparator());
@@ -184,9 +192,11 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        separator->set_size_request(-1, 1);
        separator->show();
 
+       time_axis_vbox.pack_start (*separator, false, false);
        time_axis_vbox.pack_start (time_axis_frame, true, true);
-       time_axis_vbox.pack_end (*separator, false, false);
        time_axis_vbox.show();
+       time_axis_hbox.pack_start (time_axis_vbox, true, true);
+       time_axis_hbox.show();
 
        ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler));
 
@@ -220,6 +230,9 @@ TimeAxisView::~TimeAxisView()
        delete _canvas_display;
        _canvas_display = 0;
 
+       delete _canvas_separator;
+       _canvas_separator = 0;
+
        delete display_menu;
        display_menu = 0;
 
@@ -234,9 +247,10 @@ TimeAxisView::hide ()
        }
 
        _canvas_display->hide ();
+       _canvas_separator->hide ();
 
        if (control_parent) {
-               control_parent->remove (time_axis_vbox);
+               control_parent->remove (TOP_LEVEL_WIDGET);
                control_parent = 0;
        }
 
@@ -268,24 +282,27 @@ guint32
 TimeAxisView::show_at (double y, int& nth, VBox *parent)
 {
        if (control_parent) {
-               control_parent->reorder_child (time_axis_vbox, nth);
+               control_parent->reorder_child (TOP_LEVEL_WIDGET, nth);
        } else {
                control_parent = parent;
-               parent->pack_start (time_axis_vbox, false, false);
-               parent->reorder_child (time_axis_vbox, nth);
+               parent->pack_start (TOP_LEVEL_WIDGET, false, false);
+               parent->reorder_child (TOP_LEVEL_WIDGET, nth);
        }
 
        _order = nth;
 
        if (_y_position != y) {
-               _canvas_display->set_y_position (y);
+               _canvas_separator->set (ArdourCanvas::Duple(0, y), ArdourCanvas::Duple(ArdourCanvas::COORD_MAX, y));
+               _canvas_display->set_y_position (y + 1);
                _y_position = y;
-
        }
 
        _canvas_display->raise_to_top ();
        _canvas_display->show ();
 
+       _canvas_separator->raise_to_top ();
+       _canvas_separator->show ();
+
        _hidden = false;
 
        _effective_height = current_height ();
@@ -530,7 +547,7 @@ TimeAxisView::set_height (uint32_t h)
                h = preset_height (HeightSmall);
        }
 
-       time_axis_vbox.property_height_request () = h;
+       TOP_LEVEL_WIDGET.property_height_request () = h;
        height = h;
 
        char buf[32];
@@ -766,6 +783,10 @@ TimeAxisView::popup_display_menu (guint32 when)
 void
 TimeAxisView::set_selected (bool yn)
 {
+       if (can_edit_name() && name_entry && name_entry->get_visible()) {
+               end_name_edit (RESPONSE_CANCEL);
+       }
+
        if (yn == _selected) {
                return;
        }
@@ -884,7 +905,7 @@ TimeAxisView::show_selection (TimeSelection& ts)
                // trim boxes are at the top for selections
 
                if (x2 > x1) {
-                       rect->start_trim->set (ArdourCanvas::Rect (x1, 1, x1 + trim_handle_size, y2));
+                       rect->start_trim->set (ArdourCanvas::Rect (x1, 0, x1 + trim_handle_size, y2));
                        rect->end_trim->set (ArdourCanvas::Rect (x2 - trim_handle_size, 1, x2, y2));
 
                        rect->start_trim->show();
@@ -1126,6 +1147,7 @@ TimeAxisView::compute_heights ()
        window.add (one_row_table);
        test_button->set_name ("mute button");
        test_button->set_text (_("M"));
+       test_button->set_tweaks (ArdourButton::TrackHeader);
 
        one_row_table.set_border_width (border_width);
        one_row_table.set_row_spacings (2);