Support midnam files with a channel (not patch) NoteNameList.
[ardour.git] / gtk2_ardour / time_axis_view.cc
index 059776bd92606326561f855021d0f67c6661fee8..a5d91c7bc269f8cd9577a4e3286feb69f5f598d1 100644 (file)
@@ -58,6 +58,7 @@ using namespace std;
 using namespace Gtk;
 using namespace Gdk;
 using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Editing;
 using namespace ArdourCanvas;
@@ -97,16 +98,16 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
                compute_heights ();
        }
 
-       _canvas_display = new Group (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0));
+       _canvas_display = new ArdourCanvas::Container (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0));
        CANVAS_DEBUG_NAME (_canvas_display, "main for TAV");
        _canvas_display->hide(); // reveal as needed
 
-       selection_group = new Group (_canvas_display);
+       selection_group = new ArdourCanvas::Container (_canvas_display);
        CANVAS_DEBUG_NAME (selection_group, "selection for TAV");
        selection_group->set_data (X_("timeselection"), (void *) 1);
        selection_group->hide();
-
-       _ghost_group = new Group (_canvas_display);
+       
+       _ghost_group = new ArdourCanvas::Container (_canvas_display);
        CANVAS_DEBUG_NAME (_ghost_group, "ghost for TAV");
        _ghost_group->lower_to_bottom();
        _ghost_group->show();
@@ -287,6 +288,36 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
 bool
 TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
 {
+       switch (ev->direction) {
+       case GDK_SCROLL_UP:
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
+                       /* See Editor::_stepping_axis_view for notes on this hack */
+                       Editor& e = dynamic_cast<Editor&> (_editor);
+                       if (!e.stepping_axis_view ()) {
+                               e.set_stepping_axis_view (this);
+                       }
+                       e.stepping_axis_view()->step_height (false);
+                       return true;
+               } 
+               break;
+
+       case GDK_SCROLL_DOWN:
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
+                       /* See Editor::_stepping_axis_view for notes on this hack */
+                       Editor& e = dynamic_cast<Editor&> (_editor);
+                       if (!e.stepping_axis_view ()) {
+                               e.set_stepping_axis_view (this);
+                       }
+                       e.stepping_axis_view()->step_height (true);
+                       return true;
+               } 
+               break;
+
+       default:
+               /* no handling for left/right, yet */
+               break;
+       }
+
        /* Just forward to the normal canvas scroll method. The coordinate
           systems are different but since the canvas is always larger than the
           track headers, and aligned with the trackview area, this will work.
@@ -294,7 +325,7 @@ TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
           In the not too distant future this layout is going away anyway and
           headers will be on the canvas.
        */
-       return _editor.canvas_scroll_event (ev);
+       return _editor.canvas_scroll_event (ev, false);
 }
 
 bool
@@ -644,7 +675,7 @@ TimeAxisView::end_name_edit (int response)
                }
 
                if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
-                       _editor.ensure_time_axis_view_is_visible (**i);
+                       _editor.ensure_time_axis_view_is_visible (**i, false);
                        (*i)->begin_name_edit ();
                } 
 
@@ -675,7 +706,7 @@ TimeAxisView::end_name_edit (int response)
                }
                
                if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
-                       _editor.ensure_time_axis_view_is_visible (**i);
+                       _editor.ensure_time_axis_view_is_visible (**i, false);
                        (*i)->begin_name_edit ();
                } 
        }
@@ -816,9 +847,9 @@ TimeAxisView::show_selection (TimeSelection& ts)
 
                x1 = _editor.sample_to_pixel (start);
                x2 = _editor.sample_to_pixel (start + cnt - 1);
-               y2 = current_height();
+               y2 = current_height() - 1;
 
-               rect->rect->set (ArdourCanvas::Rect (x1, 1, x2, y2));
+               rect->rect->set (ArdourCanvas::Rect (x1, 0, x2, y2));
 
                // trim boxes are at the top for selections
 
@@ -925,12 +956,12 @@ TimeAxisView::get_selection_rect (uint32_t id)
                rect->rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectionRect());
 
                rect->start_trim = new ArdourCanvas::Rectangle (selection_group);
-               CANVAS_DEBUG_NAME (rect->rect, "selection rect start trim");
+               CANVAS_DEBUG_NAME (rect->start_trim, "selection rect start trim");
                rect->start_trim->set_outline (false);
                rect->start_trim->set_fill (false);
 
                rect->end_trim = new ArdourCanvas::Rectangle (selection_group);
-               CANVAS_DEBUG_NAME (rect->rect, "selection rect end trim");
+               CANVAS_DEBUG_NAME (rect->end_trim, "selection rect end trim");
                rect->end_trim->set_outline (false);
                rect->end_trim->set_fill (false);