diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index bb0d6d2353..a7ed984a09 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -355,7 +355,7 @@ Editor::do_import (vector paths, boost::shared_ptr track; vector to_import; int nth = 0; - bool use_timestamp = (pos == -1); + bool use_timestamp = (pos == timepos_t::max (pos.time_domain())); std::string const& pgroup_id = Playlist::generate_pgroup_id (); /* XXX nutempo2: we will import markers using music (beat) time, which @@ -455,7 +455,7 @@ Editor::do_import (vector paths, /* have to reset this for every file we handle */ if (use_timestamp) { - pos = -1; + pos = timepos_t::max (pos.time_domain()); } ipw.show (); @@ -510,7 +510,7 @@ Editor::do_embed (vector paths, ImportDisposition import_as, ImportMode vector to_embed; bool multi = paths.size() > 1; int nth = 0; - bool use_timestamp = (pos == -1); + bool use_timestamp = (pos == timepos_t::max (pos.time_domain())); std::string const& pgroup_id = Playlist::generate_pgroup_id (); switch (import_as) { @@ -519,7 +519,7 @@ Editor::do_embed (vector paths, ImportDisposition import_as, ImportMode /* have to reset this for every file we handle */ if (use_timestamp) { - pos = -1; + pos = timepos_t::max (pos.time_domain()); } to_embed.clear (); @@ -541,7 +541,7 @@ Editor::do_embed (vector paths, ImportDisposition import_as, ImportMode /* have to reset this for every file we handle */ if (use_timestamp) { - pos = -1; + pos = timepos_t::max (pos.time_domain()); } to_embed.clear (); @@ -566,7 +566,7 @@ Editor::do_embed (vector paths, ImportDisposition import_as, ImportMode /* have to reset this for every file we handle */ if (use_timestamp) { - pos = -1; + pos = timepos_t::max (pos.time_domain()); } to_embed.clear (); @@ -806,7 +806,7 @@ Editor::add_sources (vector paths, bool use_timestamp; vector track_names; - use_timestamp = (pos == -1); + use_timestamp = (pos == timepos_t::max (pos.time_domain())); // kludge (for MIDI we're abusing "channel" for "track" here) if (SMFSource::safe_midi_file_extension (paths.front())) { diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 22cf51a12d..9c1415cc90 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -607,7 +607,7 @@ std::pair Editor::session_gui_extents (bool use_extra) const { if (!_session) { - return std::make_pair (timepos_t::max (Temporal::AudioTime), timepos_t (0)); + return std::make_pair (timepos_t::max (Temporal::AudioTime), timepos_t (Temporal::AudioTime)); } timepos_t session_extent_start (_session->current_start_sample()); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index c0ab99d209..128281be8d 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -5419,7 +5419,8 @@ RubberbandSelectDrag::do_select_things (GdkEvent* event, bool drag_in_progress) if (!UIConfiguration::instance().get_rubberbanding_snaps_to_grid ()) { grab = raw_grab_time (); - lpf = _editor->pixel_to_sample_from_event (last_pointer_x()); +#warning NUTEMPO how can this ever use BeatTime + lpf = timepos_t (_editor->pixel_to_sample_from_event (last_pointer_x())); } if (grab < lpf) { @@ -6512,8 +6513,8 @@ AutomationRangeDrag::setup (list > const & lin AudioRegionGainLine *argl = dynamic_cast ((*i).get()); if (!argl) { //in automation lanes, the EFFECTIVE range should be considered 0->max_samplepos (even if there is no line) - r.first = 0; - r.second = max_samplepos; + r.first = Temporal::timepos_t ((*i)->the_list()->time_domain()); + r.second = Temporal::timepos_t::max ((*i)->the_list()->time_domain()); } /* check this range against all the TimelineRanges that we are using */ @@ -6896,7 +6897,7 @@ NoteCreateDrag::NoteCreateDrag (Editor* e, ArdourCanvas::Item* i, MidiRegionView , _region_view (rv) , _drag_rect (0) { - _note[0] = _note[1] = 0; + _note[0] = _note[1] = timepos_t (Temporal::BeatTime); } NoteCreateDrag::~NoteCreateDrag () @@ -6954,9 +6955,9 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) } } - _note[0] = grid_beats; + _note[0] = timepos_t (grid_beats); /* minimum initial length is grid beats */ - _note[1] = grid_beats + grid_beats; + _note[1] = timepos_t (grid_beats + grid_beats); double const x0 = _editor->time_to_pixel (_note[0]); double const x1 = _editor->time_to_pixel (_note[1]); @@ -6993,7 +6994,7 @@ NoteCreateDrag::motion (GdkEvent* event, bool) aligned_beats += grid_beats; } - _note[1] = max (Temporal::Beats(), aligned_beats - _region_view->region()->position ().beats()); + _note[1] = timepos_t (max (Temporal::Beats(), aligned_beats - _region_view->region()->position ().beats())); double const x0 = _editor->time_to_pixel (_note[0]); double const x1 = _editor->time_to_pixel (_note[1]); diff --git a/gtk2_ardour/editor_keys.cc b/gtk2_ardour/editor_keys.cc index 1275b1e5af..c8652663d5 100644 --- a/gtk2_ardour/editor_keys.cc +++ b/gtk2_ardour/editor_keys.cc @@ -53,7 +53,7 @@ Editor::keyboard_selection_finish (bool /*add*/, Editing::EditIgnoreOption ign) timepos_t start = selection->time.start_time(); timepos_t end; if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) { - end = _session->audible_sample(); + end = timepos_t (_session->audible_sample()); } else { end = get_preferred_edit_position(ign); } @@ -82,7 +82,7 @@ Editor::keyboard_selection_begin (Editing::EditIgnoreOption ign) timepos_t start; timepos_t end (selection->time.end_time()); if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) { - start = _session->audible_sample(); + start = timepos_t (_session->audible_sample()); } else { start = get_preferred_edit_position(ign); } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 60038e2294..e8a30494d7 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1219,11 +1219,11 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir) switch (point) { case Start: - pos = r->first_sample (); + pos = timepos_t (r->first_sample ()); break; case End: - pos = r->last_sample (); + pos = timepos_t (r->last_sample ()); break; case SyncPoint: @@ -4471,7 +4471,7 @@ Editor::cut_copy_points (Editing::CutCopyOp op, timepos_t const & earliest_time) if (earliest != timepos_t::max (earliest.time_domain())) { if (earliest.time_domain() == Temporal::BeatTime) { /* always just round down to beat */ - earliest = earliest.beats().round_down_to_beat(); + earliest = timepos_t (earliest.beats().round_down_to_beat()); } else { /* do actual snap */ snap_to (earliest, Temporal::RoundDownMaybe); @@ -6863,7 +6863,7 @@ Editor::set_auto_punch_range () set_punch_range (begin, end, _("Auto Punch In/Out")); } else { // normal case for 2nd press - set the punch out - end = _playhead_cursor->current_sample (); + end = timepos_t (playhead_cursor->current_sample ()); set_punch_range (tpl->start(), now, _("Auto Punch In/Out")); _session->config.set_punch_out(true); } diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 67d9b6c28f..299d271b0d 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -760,8 +760,9 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op) /* 1. find the last selected regionview in the track that was clicked in */ - last_pos = 0; - first_pos = timepos_t::max (selection->regions.empty() ? Temporal::AudioTime : selection->regions.front()->region()->position().time_domain()); + const Temporal::TimeDomain time_domain = (selection->regions.empty() ? Temporal::AudioTime : selection->regions.front()->region()->position().time_domain()); + last_pos = timepos_t (time_domain); + first_pos = timepos_t::max (time_domain); for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) { if (&(*x)->get_time_axis_view() == &clicked_regionview->get_time_axis_view()) { diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 92ced334c3..47a514f54b 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2536,7 +2536,7 @@ MidiRegionView::move_selection(timecnt_t const & dx_qn, double dy, double cumula /* update length */ if (midi_view()->note_mode() == Sustained) { Note* sus = dynamic_cast (*i); - double const len_dx = editor->time_to_pixel_unrounded (timepos_t (note_time_qn) + dx_qn + n->note()->length()); + double const len_dx = editor->time_to_pixel_unrounded (timepos_t (note_time_qn) + dx_qn + timecnt_t (n->note()->length())); sus->set_x1 (n->item()->canvas_to_item (ArdourCanvas::Duple (len_dx, 0)).x); } @@ -2631,7 +2631,7 @@ MidiRegionView::move_copies (timecnt_t const & dx_qn, double dy, double cumulati if (midi_view()->note_mode() == Sustained) { Note* sus = dynamic_cast (*i); - double const len_dx = editor->time_to_pixel_unrounded (timepos_t (note_time_qn) + dx_qn + n->note()->length()); + double const len_dx = editor->time_to_pixel_unrounded (timepos_t (note_time_qn) + dx_qn + timecnt_t (n->note()->length())); sus->set_x1 (n->item()->canvas_to_item (ArdourCanvas::Duple (len_dx, 0)).x); } @@ -2928,7 +2928,7 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_ if (with_snap) { snapped_x = snap_pixel_to_time (current_x, ensure_snap); /* units depend on snap settings */ } else { - snapped_x = trackview.editor ().pixel_to_sample (current_x); /* samples */ + snapped_x = timepos_t (trackview.editor ().pixel_to_sample (current_x)); /* probably samples */ } Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use()); @@ -3023,7 +3023,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_ if (with_snap) { current_time = snap_pixel_to_time (current_x, ensure_snap); } else { - current_time = trackview.editor().pixel_to_sample (current_x); + current_time = timepos_t (trackview.editor().pixel_to_sample (current_x)); } /* and then to beats */ diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index dc241d9e85..234997545a 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -41,7 +41,7 @@ StepEditor::StepEditor (PublicEditor& e, boost::shared_ptr t, MidiTim , _track (t) , _mtv (mtv) { - step_edit_insert_position = 0; + step_edit_insert_position = timepos_t (Temporal::BeatTime); _step_edit_triplet_countdown = 0; _step_edit_within_chord = 0; _step_edit_chord_duration = Temporal::Beats();