diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-09-28 17:23:52 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-09-28 17:23:52 +0000 |
commit | 93c7aeba048f19df5abee5e4325ef8b0ef62c279 (patch) | |
tree | 5bc2149d17fb5272c5b6284f7e902faad39a92f7 /gtk2_ardour/editor_ops.cc | |
parent | 3e6feb62ae37cbf98364ccb36e9be47a52ceb8bf (diff) |
fixes for destructive track offsets of various kinds; move from jack_nframes_t -> nframes_t
git-svn-id: svn://localhost/ardour2/trunk@933 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 236 |
1 files changed, 118 insertions, 118 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 9c100521a7..4a6f69bec9 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -91,7 +91,7 @@ Editor::redo (uint32_t n) } int -Editor::ensure_cursor (jack_nframes_t *pos) +Editor::ensure_cursor (nframes_t *pos) { *pos = edit_cursor->current_frame; return 0; @@ -104,13 +104,13 @@ Editor::split_region () } void -Editor::split_region_at (jack_nframes_t where) +Editor::split_region_at (nframes_t where) { split_regions_at (where, selection->regions); } void -Editor::split_regions_at (jack_nframes_t where, RegionSelection& regions) +Editor::split_regions_at (nframes_t where, RegionSelection& regions) { begin_reversible_command (_("split")); @@ -210,7 +210,7 @@ Editor::select_region_for_operation (int dir, TimeAxisView **tv) { RegionView* rv; boost::shared_ptr<Region> region; - jack_nframes_t start = 0; + nframes_t start = 0; if (selection->time.start () == selection->time.end_frame ()) { @@ -253,7 +253,7 @@ Editor::extend_selection_to_end_of_region (bool next) { TimeAxisView *tv; boost::shared_ptr<Region> region; - jack_nframes_t start; + nframes_t start; if ((region = select_region_for_operation (next ? 1 : 0, &tv)) == 0) { return; @@ -281,7 +281,7 @@ Editor::extend_selection_to_start_of_region (bool previous) { TimeAxisView *tv; boost::shared_ptr<Region> region; - jack_nframes_t end; + nframes_t end; if ((region = select_region_for_operation (previous ? -1 : 0, &tv)) == 0) { return; @@ -308,8 +308,8 @@ Editor::extend_selection_to_start_of_region (bool previous) void Editor::nudge_forward (bool next) { - jack_nframes_t distance; - jack_nframes_t next_distance; + nframes_t distance; + nframes_t next_distance; if (!session) return; @@ -343,8 +343,8 @@ Editor::nudge_forward (bool next) void Editor::nudge_backward (bool next) { - jack_nframes_t distance; - jack_nframes_t next_distance; + nframes_t distance; + nframes_t next_distance; if (!session) return; @@ -389,7 +389,7 @@ Editor::nudge_backward (bool next) void Editor::nudge_forward_capture_offset () { - jack_nframes_t distance; + nframes_t distance; if (!session) return; @@ -416,7 +416,7 @@ Editor::nudge_forward_capture_offset () void Editor::nudge_backward_capture_offset () { - jack_nframes_t distance; + nframes_t distance; if (!session) return; @@ -462,7 +462,7 @@ Editor::move_to_end () void Editor::build_region_boundary_cache () { - jack_nframes_t pos = 0; + nframes_t pos = 0; RegionPoint point; boost::shared_ptr<Region> r; TrackViewList tracks; @@ -518,7 +518,7 @@ Editor::build_region_boundary_cache () } } - jack_nframes_t rpos; + nframes_t rpos; switch (snap_type) { case SnapToRegionStart: @@ -561,20 +561,20 @@ Editor::build_region_boundary_cache () } boost::shared_ptr<Region> -Editor::find_next_region (jack_nframes_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack) +Editor::find_next_region (nframes_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack) { TrackViewList::iterator i; - jack_nframes_t closest = max_frames; + nframes_t closest = max_frames; boost::shared_ptr<Region> ret; - jack_nframes_t rpos = 0; + nframes_t rpos = 0; float track_speed; - jack_nframes_t track_frame; + nframes_t track_frame; AudioTimeAxisView *atav; for (i = tracks.begin(); i != tracks.end(); ++i) { - jack_nframes_t distance; + nframes_t distance; boost::shared_ptr<Region> r; track_speed = 1.0f; @@ -626,7 +626,7 @@ void Editor::cursor_to_region_point (Cursor* cursor, RegionPoint point, int32_t dir) { boost::shared_ptr<Region> r; - jack_nframes_t pos = cursor->current_frame; + nframes_t pos = cursor->current_frame; if (!session) { return; @@ -705,7 +705,7 @@ Editor::cursor_to_previous_region_point (Cursor* cursor, RegionPoint point) void Editor::cursor_to_selection_start (Cursor *cursor) { - jack_nframes_t pos = 0; + nframes_t pos = 0; switch (mouse_mode) { case MouseObject: if (!selection->regions.empty()) { @@ -733,7 +733,7 @@ Editor::cursor_to_selection_start (Cursor *cursor) void Editor::cursor_to_selection_end (Cursor *cursor) { - jack_nframes_t pos = 0; + nframes_t pos = 0; switch (mouse_mode) { case MouseObject: @@ -762,8 +762,8 @@ Editor::cursor_to_selection_end (Cursor *cursor) void Editor::playhead_backward () { - jack_nframes_t pos; - jack_nframes_t cnt; + nframes_t pos; + nframes_t cnt; float prefix; bool was_floating; @@ -771,15 +771,15 @@ Editor::playhead_backward () cnt = 1; } else { if (was_floating) { - cnt = (jack_nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes_t) floor (prefix * session->frame_rate ()); } else { - cnt = (jack_nframes_t) prefix; + cnt = (nframes_t) prefix; } } pos = playhead_cursor->current_frame; - if ((jack_nframes_t) pos < cnt) { + if ((nframes_t) pos < cnt) { pos = 0; } else { pos -= cnt; @@ -796,8 +796,8 @@ Editor::playhead_backward () void Editor::playhead_forward () { - jack_nframes_t pos; - jack_nframes_t cnt; + nframes_t pos; + nframes_t cnt; bool was_floating; float prefix; @@ -805,9 +805,9 @@ Editor::playhead_forward () cnt = 1; } else { if (was_floating) { - cnt = (jack_nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes_t) floor (prefix * session->frame_rate ()); } else { - cnt = (jack_nframes_t) floor (prefix); + cnt = (nframes_t) floor (prefix); } } @@ -836,8 +836,8 @@ Editor::cursor_align (bool playhead_to_edit) void Editor::edit_cursor_backward () { - jack_nframes_t pos; - jack_nframes_t cnt; + nframes_t pos; + nframes_t cnt; float prefix; bool was_floating; @@ -845,15 +845,15 @@ Editor::edit_cursor_backward () cnt = 1; } else { if (was_floating) { - cnt = (jack_nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes_t) floor (prefix * session->frame_rate ()); } else { - cnt = (jack_nframes_t) prefix; + cnt = (nframes_t) prefix; } } pos = edit_cursor->current_frame; - if ((jack_nframes_t) pos < cnt) { + if ((nframes_t) pos < cnt) { pos = 0; } else { pos -= cnt; @@ -865,8 +865,8 @@ Editor::edit_cursor_backward () void Editor::edit_cursor_forward () { - jack_nframes_t pos; - jack_nframes_t cnt; + nframes_t pos; + nframes_t cnt; bool was_floating; float prefix; @@ -874,9 +874,9 @@ Editor::edit_cursor_forward () cnt = 1; } else { if (was_floating) { - cnt = (jack_nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes_t) floor (prefix * session->frame_rate ()); } else { - cnt = (jack_nframes_t) floor (prefix); + cnt = (nframes_t) floor (prefix); } } @@ -889,16 +889,16 @@ Editor::goto_frame () { float prefix; bool was_floating; - jack_nframes_t frame; + nframes_t frame; if (get_prefix (prefix, was_floating)) { return; } if (was_floating) { - frame = (jack_nframes_t) floor (prefix * session->frame_rate()); + frame = (nframes_t) floor (prefix * session->frame_rate()); } else { - frame = (jack_nframes_t) floor (prefix); + frame = (nframes_t) floor (prefix); } session->request_locate (frame); @@ -907,19 +907,19 @@ Editor::goto_frame () void Editor::scroll_backward (float pages) { - jack_nframes_t frame; - jack_nframes_t one_page = (jack_nframes_t) rint (canvas_width * frames_per_unit); + nframes_t frame; + nframes_t one_page = (nframes_t) rint (canvas_width * frames_per_unit); bool was_floating; float prefix; - jack_nframes_t cnt; + nframes_t cnt; if (get_prefix (prefix, was_floating)) { - cnt = (jack_nframes_t) floor (pages * one_page); + cnt = (nframes_t) floor (pages * one_page); } else { if (was_floating) { - cnt = (jack_nframes_t) floor (prefix * session->frame_rate()); + cnt = (nframes_t) floor (prefix * session->frame_rate()); } else { - cnt = (jack_nframes_t) floor (prefix * one_page); + cnt = (nframes_t) floor (prefix * one_page); } } @@ -935,19 +935,19 @@ Editor::scroll_backward (float pages) void Editor::scroll_forward (float pages) { - jack_nframes_t frame; - jack_nframes_t one_page = (jack_nframes_t) rint (canvas_width * frames_per_unit); + nframes_t frame; + nframes_t one_page = (nframes_t) rint (canvas_width * frames_per_unit); bool was_floating; float prefix; - jack_nframes_t cnt; + nframes_t cnt; if (get_prefix (prefix, was_floating)) { - cnt = (jack_nframes_t) floor (pages * one_page); + cnt = (nframes_t) floor (pages * one_page); } else { if (was_floating) { - cnt = (jack_nframes_t) floor (prefix * session->frame_rate()); + cnt = (nframes_t) floor (prefix * session->frame_rate()); } else { - cnt = (jack_nframes_t) floor (prefix * one_page); + cnt = (nframes_t) floor (prefix * one_page); } } @@ -1042,17 +1042,17 @@ Editor::temporal_zoom (gdouble fpu) { if (!session) return; - jack_nframes_t current_page = current_page_frames(); - jack_nframes_t current_leftmost = leftmost_frame; - jack_nframes_t current_rightmost; - jack_nframes_t current_center; - jack_nframes_t new_page; - jack_nframes_t leftmost_after_zoom = 0; + nframes_t current_page = current_page_frames(); + nframes_t current_leftmost = leftmost_frame; + nframes_t current_rightmost; + nframes_t current_center; + nframes_t new_page; + nframes_t leftmost_after_zoom = 0; double nfpu; nfpu = fpu; - new_page = (jack_nframes_t) floor (canvas_width * nfpu); + new_page = (nframes_t) floor (canvas_width * nfpu); switch (zoom_focus) { case ZoomFocusLeft: @@ -1116,8 +1116,8 @@ Editor::temporal_zoom_selection () return; } - jack_nframes_t start = selection->time[clicked_selection].start; - jack_nframes_t end = selection->time[clicked_selection].end; + nframes_t start = selection->time[clicked_selection].start; + nframes_t end = selection->time[clicked_selection].end; temporal_zoom_by_frame (start, end, "zoom to selection"); } @@ -1133,7 +1133,7 @@ Editor::temporal_zoom_session () } void -Editor::temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const string & op) +Editor::temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op) { if (!session) return; @@ -1141,7 +1141,7 @@ Editor::temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const return; } - jack_nframes_t range = end - start; + nframes_t range = end - start; double new_fpu = (double)range / (double)canvas_width; // double p2 = 1.0; @@ -1151,9 +1151,9 @@ Editor::temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const // } // new_fpu = p2; - jack_nframes_t new_page = (jack_nframes_t) floor (canvas_width * new_fpu); - jack_nframes_t middle = (jack_nframes_t) floor( (double)start + ((double)range / 2.0f )); - jack_nframes_t new_leftmost = (jack_nframes_t) floor( (double)middle - ((double)new_page/2.0f)); + nframes_t new_page = (nframes_t) floor (canvas_width * new_fpu); + nframes_t middle = (nframes_t) floor( (double)start + ((double)range / 2.0f )); + nframes_t new_leftmost = (nframes_t) floor( (double)middle - ((double)new_page/2.0f)); if (new_leftmost > middle) new_leftmost = 0; @@ -1166,7 +1166,7 @@ Editor::temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const } void -Editor::temporal_zoom_to_frame (bool coarser, jack_nframes_t frame) +Editor::temporal_zoom_to_frame (bool coarser, nframes_t frame) { if (!session) return; @@ -1185,7 +1185,7 @@ Editor::temporal_zoom_to_frame (bool coarser, jack_nframes_t frame) if (new_fpu == frames_per_unit) return; - jack_nframes_t new_leftmost = frame - (jack_nframes_t)range_before; + nframes_t new_leftmost = frame - (nframes_t)range_before; if (new_leftmost > frame) new_leftmost = 0; @@ -1208,8 +1208,8 @@ Editor::add_location_from_selection () return; } - jack_nframes_t start = selection->time[clicked_selection].start; - jack_nframes_t end = selection->time[clicked_selection].end; + nframes_t start = selection->time[clicked_selection].start; + nframes_t end = selection->time[clicked_selection].end; Location *location = new Location (start, end, "selection"); @@ -1224,7 +1224,7 @@ Editor::add_location_from_selection () void Editor::add_location_from_playhead_cursor () { - jack_nframes_t where = session->audible_frame(); + nframes_t where = session->audible_frame(); Location *location = new Location (where, where, "mark", Location::IsMark); session->begin_reversible_command (_("add marker")); @@ -1333,7 +1333,7 @@ Editor::invert_selection () } bool -Editor::select_all_within (jack_nframes_t start, jack_nframes_t end, double top, double bot, Selection::Operation op) +Editor::select_all_within (nframes_t start, nframes_t end, double top, double bot, Selection::Operation op) { list<Selectable *> touched; @@ -1427,8 +1427,8 @@ Editor::select_all_selectables_using_time_selection () return; } - jack_nframes_t start = selection->time[clicked_selection].start; - jack_nframes_t end = selection->time[clicked_selection].end; + nframes_t start = selection->time[clicked_selection].start; + nframes_t end = selection->time[clicked_selection].end; if (end - start < 1) { return; @@ -1494,8 +1494,8 @@ Editor::select_all_selectables_using_loop() void Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after) { - jack_nframes_t start; - jack_nframes_t end; + nframes_t start; + nframes_t end; list<Selectable *> touched; if (after) { @@ -1525,8 +1525,8 @@ Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after) void Editor::select_all_selectables_between_cursors (Cursor *cursor, Cursor *other_cursor) { - jack_nframes_t start; - jack_nframes_t end; + nframes_t start; + nframes_t end; list<Selectable *> touched; bool other_cursor_is_first = cursor->current_frame > other_cursor->current_frame; @@ -1644,7 +1644,7 @@ Editor::jump_backward_to_mark () void Editor::set_mark () { - jack_nframes_t pos; + nframes_t pos; float prefix; bool was_floating; @@ -1652,9 +1652,9 @@ Editor::set_mark () pos = session->audible_frame (); } else { if (was_floating) { - pos = (jack_nframes_t) floor (prefix * session->frame_rate ()); + pos = (nframes_t) floor (prefix * session->frame_rate ()); } else { - pos = (jack_nframes_t) floor (prefix); + pos = (nframes_t) floor (prefix); } } @@ -1715,7 +1715,7 @@ Editor::insert_region_list_drag (boost::shared_ptr<AudioRegion> region, int x, i double wx, wy; double cx, cy; TimeAxisView *tv; - jack_nframes_t where; + nframes_t where; AudioTimeAxisView *atv = 0; Playlist *playlist; @@ -2096,17 +2096,17 @@ Editor::region_from_selection () return; } - jack_nframes_t start = selection->time[clicked_selection].start; - jack_nframes_t end = selection->time[clicked_selection].end; + nframes_t start = selection->time[clicked_selection].start; + nframes_t end = selection->time[clicked_selection].end; - jack_nframes_t selection_cnt = end - start + 1; + nframes_t selection_cnt = end - start + 1; for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { boost::shared_ptr<AudioRegion> current; boost::shared_ptr<Region> current_r; Playlist *pl; - jack_nframes_t internal_start; + nframes_t internal_start; string new_name; if ((pl = (*i)->playlist()) == 0) { @@ -2134,15 +2134,15 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<AudioRegion> >& n return; } - jack_nframes_t start = selection->time[clicked_selection].start; - jack_nframes_t end = selection->time[clicked_selection].end; + nframes_t start = selection->time[clicked_selection].start; + nframes_t end = selection->time[clicked_selection].end; for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { boost::shared_ptr<AudioRegion> current; boost::shared_ptr<Region> current_r; Playlist* playlist; - jack_nframes_t internal_start; + nframes_t internal_start; string new_name; if ((playlist = (*i)->playlist()) == 0) { @@ -2220,7 +2220,7 @@ Editor::separate_region_from_selection () double speed = atv->get_diskstream()->speed(); for (list<AudioRange>::iterator t = selection->time.begin(); t != selection->time.end(); ++t) { - playlist->partition ((jack_nframes_t)((*t).start * speed), (jack_nframes_t)((*t).end * speed), true); + playlist->partition ((nframes_t)((*t).start * speed), (nframes_t)((*t).end * speed), true); } if (doing_undo) @@ -2273,7 +2273,7 @@ Editor::separate_regions_using_location (Location& loc) double speed = atv->get_diskstream()->speed(); - playlist->partition ((jack_nframes_t)(loc.start() * speed), (jack_nframes_t)(loc.end() * speed), true); + playlist->partition ((nframes_t)(loc.start() * speed), (nframes_t)(loc.end() * speed), true); if (doing_undo) session->add_command(new MementoCommand<Playlist>(*playlist, before, &playlist->get_state())); } @@ -2322,9 +2322,9 @@ Editor::crop_region_to_selection () if (!playlists.empty()) { - jack_nframes_t start; - jack_nframes_t end; - jack_nframes_t cnt; + nframes_t start; + nframes_t end; + nframes_t cnt; begin_reversible_command (_("trim to selection")); @@ -2359,7 +2359,7 @@ Editor::crop_region_to_selection () void Editor::region_fill_track () { - jack_nframes_t end; + nframes_t end; if (!session || selection->regions.empty()) { return; @@ -2419,8 +2419,8 @@ Editor::region_fill_selection () TreeModel::iterator i = region_list_display.get_selection()->get_selected(); boost::shared_ptr<Region> region = (*i)[region_list_columns.region]; - jack_nframes_t start = selection->time[clicked_selection].start; - jack_nframes_t end = selection->time[clicked_selection].end; + nframes_t start = selection->time[clicked_selection].start; + nframes_t end = selection->time[clicked_selection].end; Playlist *playlist; @@ -2428,7 +2428,7 @@ Editor::region_fill_selection () return; } - jack_nframes_t selection_length = end - start; + nframes_t selection_length = end - start; float times = (float)selection_length / region->length(); begin_reversible_command (_("fill selection")); @@ -2448,7 +2448,7 @@ Editor::region_fill_selection () } void -Editor::set_a_regions_sync_position (boost::shared_ptr<Region> region, jack_nframes_t position) +Editor::set_a_regions_sync_position (boost::shared_ptr<Region> region, nframes_t position) { if (!region->covers (position)) { @@ -2533,14 +2533,14 @@ struct RegionSortByTime { }; void -Editor::align_selection_relative (RegionPoint point, jack_nframes_t position) +Editor::align_selection_relative (RegionPoint point, nframes_t position) { if (selection->regions.empty()) { return; } - jack_nframes_t distance; - jack_nframes_t pos = 0; + nframes_t distance; + nframes_t pos = 0; int dir; list<RegionView*> sorted; @@ -2592,7 +2592,7 @@ Editor::align_selection_relative (RegionPoint point, jack_nframes_t position) } void -Editor::align_selection (RegionPoint point, jack_nframes_t position) +Editor::align_selection (RegionPoint point, nframes_t position) { if (selection->regions.empty()) { return; @@ -2608,7 +2608,7 @@ Editor::align_selection (RegionPoint point, jack_nframes_t position) } void -Editor::align_region (boost::shared_ptr<Region> region, RegionPoint point, jack_nframes_t position) +Editor::align_region (boost::shared_ptr<Region> region, RegionPoint point, nframes_t position) { begin_reversible_command (_("align region")); align_region_internal (region, point, position); @@ -2616,7 +2616,7 @@ Editor::align_region (boost::shared_ptr<Region> region, RegionPoint point, jack_ } void -Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint point, jack_nframes_t position) +Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint point, nframes_t position) { XMLNode &before = region->playlist()->get_state(); @@ -2774,9 +2774,9 @@ Editor::bounce_range_selection () TrackViewList *views = get_valid_views (selection->time.track, selection->time.group); - jack_nframes_t start = selection->time[clicked_selection].start; - jack_nframes_t end = selection->time[clicked_selection].end; - jack_nframes_t cnt = end - start + 1; + nframes_t start = selection->time[clicked_selection].start; + nframes_t end = selection->time[clicked_selection].end; + nframes_t cnt = end - start + 1; begin_reversible_command (_("bounce range")); @@ -2908,7 +2908,7 @@ Editor::cut_copy_regions (CutCopyOp op) { typedef std::map<AudioPlaylist*,AudioPlaylist*> PlaylistMapping; PlaylistMapping pmap; - jack_nframes_t first_position = max_frames; + nframes_t first_position = max_frames; set<Playlist*> freezelist; pair<set<Playlist*>::iterator,bool> insert_result; @@ -3019,13 +3019,13 @@ Editor::mouse_paste () event.button.x = wx; event.button.y = wy; - jack_nframes_t where = event_frame (&event, 0, 0); + nframes_t where = event_frame (&event, 0, 0); snap_to (where); paste_internal (where, 1); } void -Editor::paste_internal (jack_nframes_t position, float times) +Editor::paste_internal (nframes_t position, float times) { bool commit = false; @@ -3231,9 +3231,9 @@ void Editor::nudge_track (bool use_edit_cursor, bool forwards) { Playlist *playlist; - jack_nframes_t distance; - jack_nframes_t next_distance; - jack_nframes_t start; + nframes_t distance; + nframes_t next_distance; + nframes_t start; if (use_edit_cursor) { start = edit_cursor->current_frame; @@ -3444,7 +3444,7 @@ Editor::external_edit_region () } void -Editor::brush (jack_nframes_t pos) +Editor::brush (nframes_t pos) { RegionSelection sel; snap_to (pos); |