From 57b362cf99c068bf88fd066838460a63b0342610 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 9 Sep 2010 01:38:21 +0000 Subject: [PATCH] nframes64_t -> frame{pos,cnt}_t git-svn-id: svn://localhost/ardour2/branches/3.0@7759 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_drag.cc | 146 ++++++++++++++++++------------------- gtk2_ardour/editor_drag.h | 26 +++---- 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index e75bfba576..f48a8ccc92 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -257,10 +257,10 @@ Drag::end_grab (GdkEvent* event) return _move_threshold_passed; } -nframes64_t -Drag::adjusted_frame (nframes64_t f, GdkEvent const * event, bool snap) const +framepos_t +Drag::adjusted_frame (framepos_t f, GdkEvent const * event, bool snap) const { - nframes64_t pos = 0; + framepos_t pos = 0; if (f > _pointer_frame_offset) { pos = f - _pointer_frame_offset; @@ -273,7 +273,7 @@ Drag::adjusted_frame (nframes64_t f, GdkEvent const * event, bool snap) const return pos; } -nframes64_t +framepos_t Drag::adjusted_current_frame (GdkEvent const * event, bool snap) const { return adjusted_frame (_drags->current_pointer_frame (), event, snap); @@ -288,7 +288,7 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll) return false; } - pair const threshold = move_threshold (); + pair const threshold = move_threshold (); bool const old_move_threshold_passed = _move_threshold_passed; @@ -424,15 +424,15 @@ RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) } double -RegionMotionDrag::compute_x_delta (GdkEvent const * event, nframes64_t* pending_region_position) +RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_region_position) { /* compute the amount of pointer motion in frames, and where the region would be if we moved it by that much. */ *pending_region_position = adjusted_current_frame (event); - nframes64_t sync_frame; - nframes64_t sync_offset; + framepos_t sync_frame; + framecnt_t sync_offset; int32_t sync_dir; sync_offset = _primary->region()->sync_offset (sync_dir); @@ -758,7 +758,7 @@ RegionMoveDrag::finished (GdkEvent *, bool movement_occurred) _x_constrained = !_x_constrained; } - bool const changed_position = (_last_frame_position != (nframes64_t) (_primary->region()->position())); + bool const changed_position = (_last_frame_position != _primary->region()->position()); bool const changed_tracks = (_time_axis_views[_views.front().time_axis_view] != &_views.front().view->get_time_axis_view()); framecnt_t const drag_delta = _primary->region()->position() - _last_frame_position; @@ -818,7 +818,7 @@ RegionMoveDrag::finished_copy ( continue; } - nframes64_t where; + framepos_t where; if (changed_position && !_x_constrained) { where = i->view->region()->position() - drag_delta; @@ -897,7 +897,7 @@ RegionMoveDrag::finished_no_copy ( continue; } - nframes64_t where; + framepos_t where; if (changed_position && !_x_constrained) { where = rv->region()->position() - drag_delta; @@ -1162,7 +1162,7 @@ RegionMoveDrag::RegionMoveDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, speed = rtv->track()->speed (); } - _last_frame_position = static_cast (_primary->region()->position() / speed); + _last_frame_position = static_cast (_primary->region()->position() / speed); } void @@ -1173,7 +1173,7 @@ RegionMoveDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) _pointer_frame_offset = raw_grab_frame() - _last_frame_position; } -RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr r, RouteTimeAxisView* v, nframes64_t pos) +RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr r, RouteTimeAxisView* v, framepos_t pos) : RegionMotionDrag (e, 0, 0, list (), false) { assert ((boost::dynamic_pointer_cast (r) && dynamic_cast (v)) || @@ -1271,7 +1271,7 @@ RegionSpliceDrag::motion (GdkEvent* event, bool) RegionSelectionByPosition cmp; copy.sort (cmp); - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); for (RegionSelection::iterator i = copy.begin(); i != copy.end(); ++i) { @@ -1474,11 +1474,11 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) speed = tv->track()->speed(); } - nframes64_t const region_start = (nframes64_t) (_primary->region()->position() / speed); - nframes64_t const region_end = (nframes64_t) (_primary->region()->last_frame() / speed); - nframes64_t const region_length = (nframes64_t) (_primary->region()->length() / speed); + framepos_t const region_start = (framepos_t) (_primary->region()->position() / speed); + framepos_t const region_end = (framepos_t) (_primary->region()->last_frame() / speed); + framecnt_t const region_length = (framecnt_t) (_primary->region()->length() / speed); - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { _operation = ContentsTrim; @@ -1528,7 +1528,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) speed = tv->track()->speed(); } - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); if (first_move) { @@ -1598,7 +1598,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) swap_direction = true; } - nframes64_t frame_delta = 0; + framecnt_t frame_delta = 0; bool left_direction = false; if (last_pointer_frame() > pf) { @@ -1620,10 +1620,10 @@ TrimDrag::motion (GdkEvent* event, bool first_move) switch (_operation) { case StartTrim: - _editor->show_verbose_time_cursor((nframes64_t) (rv->region()->position()/speed), 10); + _editor->show_verbose_time_cursor((framepos_t) (rv->region()->position()/speed), 10); break; case EndTrim: - _editor->show_verbose_time_cursor((nframes64_t) (rv->region()->last_frame()/speed), 10); + _editor->show_verbose_time_cursor((framepos_t) (rv->region()->last_frame()/speed), 10); break; case ContentsTrim: _editor->show_verbose_time_cursor (pf, 10); @@ -1724,7 +1724,7 @@ MeterMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) void MeterMarkerDrag::motion (GdkEvent* event, bool) { - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); _marker->set_position (pf); @@ -1814,7 +1814,7 @@ TempoMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) void TempoMarkerDrag::motion (GdkEvent* event, bool) { - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); _marker->set_position (pf); _editor->show_verbose_time_cursor (pf, 10); } @@ -1875,7 +1875,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) if (!_stop) { - nframes64_t where = _editor->event_frame (event, 0, 0); + framepos_t where = _editor->event_frame (event, 0, 0); _editor->snap_to_with_modifier (where, event); _editor->playhead_cursor->set_position (where); @@ -1899,7 +1899,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) s->request_suspend_timecode_transmission (); if (s->timecode_transmission_suspended ()) { - nframes64_t const f = _editor->playhead_cursor->current_frame; + framepos_t const f = _editor->playhead_cursor->current_frame; s->send_mmc_locate (f); s->send_full_time_code (f); } @@ -1914,7 +1914,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) void CursorDrag::motion (GdkEvent* event, bool) { - nframes64_t const adjusted_frame = adjusted_current_frame (event); + framepos_t const adjusted_frame = adjusted_current_frame (event); if (adjusted_frame == last_pointer_frame()) { return; @@ -1926,7 +1926,7 @@ CursorDrag::motion (GdkEvent* event, bool) Session* s = _editor->session (); if (s && _item == &_editor->playhead_cursor->canvas_item && s->timecode_transmission_suspended ()) { - nframes64_t const f = _editor->playhead_cursor->current_frame; + framepos_t const f = _editor->playhead_cursor->current_frame; s->send_mmc_locate (f); s->send_full_time_code (f); } @@ -1984,18 +1984,18 @@ FadeInDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) AudioRegionView* arv = dynamic_cast (_primary); boost::shared_ptr const r = arv->audio_region (); - _pointer_frame_offset = raw_grab_frame() - ((nframes64_t) r->fade_in()->back()->when + r->position()); + _pointer_frame_offset = raw_grab_frame() - ((framecnt_t) r->fade_in()->back()->when + r->position()); _editor->show_verbose_duration_cursor (r->position(), r->position() + r->fade_in()->back()->when, 10); - arv->show_fade_line((nframes64_t) r->fade_in()->back()->when); + arv->show_fade_line((framepos_t) r->fade_in()->back()->when); } void FadeInDrag::motion (GdkEvent* event, bool) { - nframes64_t fade_length; + framecnt_t fade_length; - nframes64_t const pos = adjusted_current_frame (event); + framepos_t const pos = adjusted_current_frame (event); boost::shared_ptr region = _primary->region (); @@ -2016,7 +2016,7 @@ FadeInDrag::motion (GdkEvent* event, bool) } tmp->reset_fade_in_shape_width (fade_length); - tmp->show_fade_line((nframes64_t) fade_length); + tmp->show_fade_line((framecnt_t) fade_length); } _editor->show_verbose_duration_cursor (region->position(), region->position() + fade_length, 10); @@ -2029,9 +2029,9 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred) return; } - nframes64_t fade_length; + framecnt_t fade_length; - nframes64_t const pos = adjusted_current_frame (event); + framepos_t const pos = adjusted_current_frame (event); boost::shared_ptr region = _primary->region (); @@ -2096,7 +2096,7 @@ FadeOutDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) AudioRegionView* arv = dynamic_cast (_primary); boost::shared_ptr r = arv->audio_region (); - _pointer_frame_offset = raw_grab_frame() - (r->length() - (nframes64_t) r->fade_out()->back()->when + r->position()); + _pointer_frame_offset = raw_grab_frame() - (r->length() - (framecnt_t) r->fade_out()->back()->when + r->position()); _editor->show_verbose_duration_cursor (r->last_frame() - r->fade_out()->back()->when, r->last_frame(), 10); arv->show_fade_line(r->length() - r->fade_out()->back()->when); @@ -2105,9 +2105,9 @@ FadeOutDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) void FadeOutDrag::motion (GdkEvent* event, bool) { - nframes64_t fade_length; + framecnt_t fade_length; - nframes64_t const pos = adjusted_current_frame (event); + framepos_t const pos = adjusted_current_frame (event); boost::shared_ptr region = _primary->region (); @@ -2143,9 +2143,9 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred) return; } - nframes64_t fade_length; + framecnt_t fade_length; - nframes64_t const pos = adjusted_current_frame (event); + framepos_t const pos = adjusted_current_frame (event); boost::shared_ptr region = _primary->region (); @@ -2260,7 +2260,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) { Locations::LocationList ll; list to_add; - nframes64_t s, e; + framepos_t s, e; _editor->selection->markers.range (s, e); s = min (_marker->position(), s); e = max (_marker->position(), e); @@ -2302,16 +2302,16 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) void MarkerDrag::motion (GdkEvent* event, bool) { - nframes64_t f_delta = 0; + framecnt_t f_delta = 0; bool is_start; bool move_both = false; Marker* marker; Location *real_location; Location *copy_location = 0; - nframes64_t const newframe = adjusted_current_frame (event); + framepos_t const newframe = adjusted_current_frame (event); - nframes64_t next = newframe; + framepos_t next = newframe; if (newframe == last_pointer_frame()) { return; @@ -2398,8 +2398,8 @@ MarkerDrag::motion (GdkEvent* event, bool) } else { - nframes64_t new_start = copy_location->start() + f_delta; - nframes64_t new_end = copy_location->end() + f_delta; + framepos_t new_start = copy_location->start() + f_delta; + framepos_t new_end = copy_location->end() + f_delta; if (is_start) { // start-of-range marker @@ -2671,7 +2671,7 @@ LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/) _line->parent_group().w2i (cx, cy); - nframes64_t const frame_within_region = (nframes64_t) floor (cx * _editor->frames_per_unit); + framecnt_t const frame_within_region = (framecnt_t) floor (cx * _editor->frames_per_unit); uint32_t before; uint32_t after; @@ -2822,14 +2822,14 @@ RubberbandSelectDrag::start_grab (GdkEvent* event, Gdk::Cursor *) void RubberbandSelectDrag::motion (GdkEvent* event, bool) { - nframes64_t start; - nframes64_t end; + framepos_t start; + framepos_t end; double y1; double y2; - nframes64_t const pf = adjusted_current_frame (event, Config->get_rubberbanding_snaps_to_grid ()); + framepos_t const pf = adjusted_current_frame (event, Config->get_rubberbanding_snaps_to_grid ()); - nframes64_t grab = grab_frame (); + framepos_t grab = grab_frame (); if (Config->get_rubberbanding_snaps_to_grid ()) { _editor->snap_to_with_modifier (grab, event); } @@ -2933,7 +2933,7 @@ TimeFXDrag::motion (GdkEvent* event, bool) { RegionView* rv = _primary; - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); if (pf > rv->region()->position()) { rv->get_time_axis_view().show_timestretch (rv->region()->position(), pf); @@ -2956,7 +2956,7 @@ TimeFXDrag::finished (GdkEvent* /*event*/, bool movement_occurred) return; } - nframes64_t newlen = last_pointer_frame() - _primary->region()->position(); + framecnt_t newlen = last_pointer_frame() - _primary->region()->position(); float percentage = (double) newlen / (double) _primary->region()->length(); @@ -3026,8 +3026,8 @@ SelectionDrag::SelectionDrag (Editor* e, ArdourCanvas::Item* i, Operation o) void SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*) { - nframes64_t start = 0; - nframes64_t end = 0; + framepos_t start = 0; + framepos_t end = 0; if (_editor->session() == 0) { return; @@ -3083,16 +3083,16 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*) void SelectionDrag::motion (GdkEvent* event, bool first_move) { - nframes64_t start = 0; - nframes64_t end = 0; - nframes64_t length; + framepos_t start = 0; + framepos_t end = 0; + framecnt_t length; pair const pending_time_axis = _editor->trackview_by_y_position (_drags->current_pointer_y ()); if (pending_time_axis.first == 0) { return; } - nframes64_t const pending_position = adjusted_current_frame (event); + framepos_t const pending_position = adjusted_current_frame (event); /* only alter selection if things have changed */ @@ -3103,7 +3103,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) switch (_operation) { case CreateSelection: { - nframes64_t grab = grab_frame (); + framepos_t grab = grab_frame (); if (first_move) { _editor->snap_to (grab); @@ -3319,8 +3319,8 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *) void RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) { - nframes64_t start = 0; - nframes64_t end = 0; + framepos_t start = 0; + framepos_t end = 0; ArdourCanvas::SimpleRect *crect; switch (_operation) { @@ -3339,10 +3339,10 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) break; } - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); if (_operation == CreateRangeMarker || _operation == CreateTransportMarker || _operation == CreateCDMarker) { - nframes64_t grab = grab_frame (); + framepos_t grab = grab_frame (); _editor->snap_to (grab); if (pf < grab_frame()) { @@ -3436,8 +3436,8 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred) if (Keyboard::no_modifier_keys_pressed (&event->button) && _operation != CreateCDMarker) { - nframes64_t start; - nframes64_t end; + framepos_t start; + framepos_t end; _editor->session()->locations()->marks_either_side (grab_frame(), start, end); @@ -3495,12 +3495,12 @@ MouseZoomDrag::start_grab (GdkEvent* event, Gdk::Cursor *) void MouseZoomDrag::motion (GdkEvent* event, bool first_move) { - nframes64_t start; - nframes64_t end; + framepos_t start; + framepos_t end; - nframes64_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event); - nframes64_t grab = grab_frame (); + framepos_t grab = grab_frame (); _editor->snap_to_with_modifier (grab, event); /* base start and end on initial click position */ @@ -3722,12 +3722,12 @@ AutomationRangeDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) /* fade into and out of the region that we're dragging; 64 samples length plucked out of thin air. */ - nframes64_t const h = (j->start + j->end) / 2; - nframes64_t a = j->start + 64; + framecnt_t const h = (j->start + j->end) / 2; + framepos_t a = j->start + 64; if (a > h) { a = h; } - nframes64_t b = j->end - 64; + framepos_t b = j->end - 64; if (b < h) { b = h; } diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 7f17a22838..cacf6343c7 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -88,7 +88,7 @@ public: } /** @return current pointer frame */ - nframes64_t current_pointer_frame () const { + ARDOUR::framepos_t current_pointer_frame () const { return _current_pointer_frame; } @@ -98,7 +98,7 @@ private: bool _ending; ///< true if end_grab or abort is in progress, otherwise false double _current_pointer_x; ///< trackview x of the current pointer double _current_pointer_y; ///< trackview y of the current pointer - nframes64_t _current_pointer_frame; ///< frame that the pointer is now at + ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at }; /** Abstract base class for dragging of things within the editor */ @@ -121,8 +121,8 @@ public: bool motion_handler (GdkEvent*, bool); void abort (); - nframes64_t adjusted_frame (nframes64_t, GdkEvent const *, bool snap = true) const; - nframes64_t adjusted_current_frame (GdkEvent const *, bool snap = true) const; + ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const; + ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const; /** Called to start a grab of an item. * @param e Event that caused the grab to start. @@ -157,7 +157,7 @@ public: } /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */ - virtual std::pair move_threshold () const { + virtual std::pair move_threshold () const { return std::make_pair (1, 1); } @@ -209,7 +209,7 @@ protected: DragManager* _drags; ArdourCanvas::Item* _item; ///< our item /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */ - nframes64_t _pointer_frame_offset; + ARDOUR::framecnt_t _pointer_frame_offset; bool _x_constrained; ///< true if x motion is constrained, otherwise false bool _y_constrained; ///< true if y motion is constrained, otherwise false bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false @@ -222,8 +222,8 @@ private: double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0 - nframes64_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0 - nframes64_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred + ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0 + ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred }; class RegionDrag; @@ -290,11 +290,11 @@ public: protected: - double compute_x_delta (GdkEvent const *, nframes64_t *); + double compute_x_delta (GdkEvent const *, ARDOUR::framecnt_t *); bool y_movement_allowed (int, ARDOUR::layer_t) const; bool _brushing; - nframes64_t _last_frame_position; ///< last position of the thing being dragged + ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged double _total_x_delta; int _last_pointer_time_axis_view; ARDOUR::layer_t _last_pointer_layer; @@ -319,7 +319,7 @@ public: return true; } - std::pair move_threshold () const { + std::pair move_threshold () const { return std::make_pair (4, 4); } @@ -364,7 +364,7 @@ private: class RegionInsertDrag : public RegionMotionDrag { public: - RegionInsertDrag (Editor *, boost::shared_ptr, RouteTimeAxisView*, nframes64_t); + RegionInsertDrag (Editor *, boost::shared_ptr, RouteTimeAxisView*, ARDOUR::framepos_t); void finished (GdkEvent *, bool); void aborted (); @@ -708,7 +708,7 @@ public: void finished (GdkEvent *, bool); void aborted (); - std::pair move_threshold () const { + std::pair move_threshold () const { return std::make_pair (8, 1); } };