Remove all use of nframes_t.
[ardour.git] / gtk2_ardour / time_axis_view.cc
index 741756f1b21c08aa92441f0068d0b310dd9d068e..a206b1a2313c5cbc60eb75bc4d30a8d83798051c 100644 (file)
@@ -40,6 +40,7 @@
 #include "ardour/location.h"
 
 #include "ardour_ui.h"
+#include "global_signals.h"
 #include "gui_thread.h"
 #include "public_editor.h"
 #include "time_axis_view.h"
@@ -87,6 +88,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        _canvas_display->hide(); // reveal as needed 
 
        selection_group = new Group (*_canvas_display);
+       selection_group->set_data (X_("timeselection"), (void *) 1);
        selection_group->hide();
 
        _ghost_group = new Group (*_canvas_display);
@@ -426,8 +428,12 @@ TimeAxisView::set_height (Height h)
 }
 
 void
-TimeAxisView::set_height(uint32_t h)
+TimeAxisView::set_height (uint32_t h)
 {
+       if (h < preset_height (HeightSmall)) {
+               h = preset_height (HeightSmall);
+       }
+       
        time_axis_vbox.property_height_request () = h;
        height = h;
 
@@ -666,7 +672,7 @@ TimeAxisView::set_samples_per_unit (double spu)
 }
 
 void
-TimeAxisView::show_timestretch (nframes_t start, nframes_t end)
+TimeAxisView::show_timestretch (framepos_t start, framepos_t end)
 {
        for (Children::iterator i = children.begin(); i != children.end(); ++i) {
                (*i)->show_timestretch (start, end);
@@ -708,7 +714,8 @@ TimeAxisView::show_selection (TimeSelection& ts)
        selection_group->raise_to_top();
 
        for (list<AudioRange>::iterator i = ts.begin(); i != ts.end(); ++i) {
-               nframes_t start, end, cnt;
+               framepos_t start, end;
+               framecnt_t cnt;
 
                start = (*i).start;
                end = (*i).end;
@@ -886,8 +893,15 @@ TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
        }
 }
 
+/** Get selectable things within a given range.
+ *  @param start Start time in session frames.
+ *  @param end End time in session frames.
+ *  @param top Top y range, in trackview coordinates (ie 0 is the top of the track view)
+ *  @param bot Bottom y range, in trackview coordinates (ie 0 is the top of the track view)
+ *  @param result Filled in with selectable things.
+ */
 void
-TimeAxisView::get_selectables (nframes_t /*start*/, nframes_t /*end*/, double /*top*/, double /*bot*/, list<Selectable*>& /*result*/)
+TimeAxisView::get_selectables (framepos_t /*start*/, framepos_t /*end*/, double /*top*/, double /*bot*/, list<Selectable*>& /*result*/)
 {
        return;
 }
@@ -1218,14 +1232,14 @@ TimeAxisView::resizer_motion (GdkEventMotion* ev)
 {
        if (_resize_drag_start >= 0) {
                /* (ab)use the DragManager to do autoscrolling; adjust the event coordinates
-                  into the trackview space that DragManager::motion_handler is expecting,
+                  into the world coordinate space that DragManager::motion_handler is expecting,
                   and then fake a DragManager motion event so that when maybe_autoscroll
                   asks DragManager for the current pointer position it will get the correct
                   answers.
                */
                int tx, ty;
                resizer.translate_coordinates (*control_parent, ev->x, ev->y, tx, ty);
-               ev->y = ty + _editor.get_canvas_timebars_vsize ();
+               ev->y = ty - _editor.get_trackview_group_vertical_offset();
                _editor.drags()->motion_handler ((GdkEvent *) ev, false);
                _editor.maybe_autoscroll (false, true);
 
@@ -1313,3 +1327,20 @@ TimeAxisView::preset_height (Height h)
        /* NOTREACHED */
        return 0;
 }
+
+/** @return Child time axis views that are not hidden */
+TimeAxisView::Children
+TimeAxisView::get_child_list ()
+{
+       Children c;
+
+       for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+               if (!(*i)->hidden()) {
+                       c.push_back(*i);
+               }
+       }
+       
+       return c;
+}
+
+