GUI: moving along with timeline type conversion

This commit is contained in:
Paul Davis 2020-10-15 19:07:15 -06:00
parent ff93c97296
commit aa56f4a16e
9 changed files with 103 additions and 104 deletions

View file

@ -364,8 +364,8 @@ ARDOUR_UI::add_video (Gtk::Window* float_window)
} }
_session->maybe_update_session_range ( _session->maybe_update_session_range (
std::max(video_timeline->get_offset(), (ARDOUR::sampleoffset_t) 0), timepos_t (std::max(video_timeline->get_offset(), (sampleoffset_t) 0)),
std::max(video_timeline->get_offset() + video_timeline->get_duration(), (ARDOUR::sampleoffset_t) 0)); timepos_t (std::max(video_timeline->get_offset() + video_timeline->get_duration(), (sampleoffset_t) 0)));
if (add_video_dialog->launch_xjadeo() && local_file) { if (add_video_dialog->launch_xjadeo() && local_file) {

View file

@ -170,7 +170,7 @@ Editor::time_fx (RegionList& regions, float val, bool pitching)
const timecnt_t oldlen = regions.front()->nt_length(); const timecnt_t oldlen = regions.front()->nt_length();
const timecnt_t newlen = regions.front()->nt_length() * val; const timecnt_t newlen = regions.front()->nt_length() * val;
const timecnt_t pos = regions.front()->nt_position (); const timepos_t pos = regions.front()->nt_position ();
current_timefx = new TimeFXDialog (*this, pitching, oldlen, newlen, pos); current_timefx = new TimeFXDialog (*this, pitching, oldlen, newlen, pos);
current_timefx->regions = regions; current_timefx->regions = regions;
@ -427,7 +427,7 @@ Editor::do_timefx ()
boost::shared_ptr<Region> region = i->first; boost::shared_ptr<Region> region = i->first;
boost::shared_ptr<Region> new_region = i->second; boost::shared_ptr<Region> new_region = i->second;
boost::shared_ptr<Playlist> playlist = region->playlist(); boost::shared_ptr<Playlist> playlist = region->playlist();
playlist->replace_region (region, new_region, region->position()); playlist->replace_region (region, new_region, region->nt_position());
PBD::StatefulDiffCommand* cmd = new StatefulDiffCommand (playlist); PBD::StatefulDiffCommand* cmd = new StatefulDiffCommand (playlist);
_session->add_command (cmd); _session->add_command (cmd);

View file

@ -352,7 +352,7 @@ PannerUI::start_touch (boost::weak_ptr<AutomationControl> wac)
if (!ac) { if (!ac) {
return; return;
} }
ac->start_touch (ac->session().transport_sample()); ac->start_touch (timepos_t (ac->session().transport_sample()));
} }
void void
@ -362,7 +362,7 @@ PannerUI::stop_touch (boost::weak_ptr<AutomationControl> wac)
if (!ac) { if (!ac) {
return; return;
} }
ac->stop_touch (ac->session().transport_sample()); ac->stop_touch (timepos_t (ac->session().transport_sample()));
} }
bool bool

View file

@ -110,7 +110,7 @@ AudioRegionGainLine::region_changed (const PropertyChange& what_changed)
interesting_stuff.add (ARDOUR::Properties::start); interesting_stuff.add (ARDOUR::Properties::start);
interesting_stuff.add (ARDOUR::Properties::position); interesting_stuff.add (ARDOUR::Properties::position);
if (what_changed.containts (ARDOUR::Properties::position)) { if (what_changed.contains (ARDOUR::Properties::position)) {
set_distance_measure_origin (rv.region()->nt_position()); set_distance_measure_origin (rv.region()->nt_position());
} }

View file

@ -77,7 +77,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
double spu, double spu,
uint32_t basic_color, uint32_t basic_color,
bool automation) bool automation)
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), false, automation, : TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->nt_position(), r->nt_length(), false, automation,
(automation ? TimeAxisViewItem::ShowFrame : (automation ? TimeAxisViewItem::ShowFrame :
TimeAxisViewItem::Visibility ((UIConfiguration::instance().get_show_region_name() ? TimeAxisViewItem::ShowNameText : 0) | TimeAxisViewItem::Visibility ((UIConfiguration::instance().get_show_region_name() ? TimeAxisViewItem::ShowNameText : 0) |
TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame))) TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame)))
@ -157,7 +157,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
uint32_t basic_color, uint32_t basic_color,
bool recording, bool recording,
TimeAxisViewItem::Visibility visibility) TimeAxisViewItem::Visibility visibility)
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), recording, false, visibility) : TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->nt_position(), r->nt_length(), recording, false, visibility)
, _region (r) , _region (r)
, sync_mark(0) , sync_mark(0)
, sync_line(0) , sync_line(0)
@ -308,8 +308,8 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
/* coordinates for the rect are relative to the regionview origin */ /* coordinates for the rect are relative to the regionview origin */
cr->set_x0 (trackview.editor().sample_to_pixel (i->first - _region->start())); cr->set_x0 (trackview.editor().sample_to_pixel (i->first - _region->start_sample()));
cr->set_x1 (trackview.editor().sample_to_pixel (i->second - _region->start())); cr->set_x1 (trackview.editor().sample_to_pixel (i->second - _region->start_sample()));
cr->set_y0 (1); cr->set_y0 (1);
cr->set_y1 (_height - 2); cr->set_y1 (_height - 2);
cr->set_outline (false); cr->set_outline (false);
@ -321,7 +321,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
/* Find shortest audible segment */ /* Find shortest audible segment */
samplecnt_t shortest_audible = max_samplecnt; samplecnt_t shortest_audible = max_samplecnt;
samplecnt_t s = _region->start(); samplecnt_t s = _region->start_sample();
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) { for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
samplecnt_t const dur = i->first - s; samplecnt_t const dur = i->first - s;
if (dur > 0) { if (dur > 0) {
@ -331,7 +331,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
s = i->second; s = i->second;
} }
samplecnt_t const dur = _region->start() + _region->length() - 1 - s; samplecnt_t const dur = _region->start_sample() + _region->length_samples() - 1 - s;
if (dur > 0) { if (dur > 0) {
shortest_audible = min (shortest_audible, dur); shortest_audible = min (shortest_audible, dur);
} }
@ -343,7 +343,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
/* both positions are relative to the region start offset in source */ /* both positions are relative to the region start offset in source */
_silence_text->set_x_position (trackview.editor().sample_to_pixel (silences.front().first - _region->start()) + 10.0); _silence_text->set_x_position (trackview.editor().sample_to_pixel (silences.front().first - _region->start_sample()) + 10.0);
_silence_text->set_y_position (20.0); _silence_text->set_y_position (20.0);
double ms = (float) shortest/_region->session().sample_rate(); double ms = (float) shortest/_region->session().sample_rate();
@ -447,7 +447,7 @@ RegionView::region_changed (const PropertyChange& what_changed)
if (what_changed.contains (ARDOUR::Properties::name)) { if (what_changed.contains (ARDOUR::Properties::name)) {
region_renamed (); region_renamed ();
} }
if (what_changed.contains (ARDOUR::Properties::position_lock_style)) { if (what_changed.contains (ARDOUR::Properties::time_domain)) {
region_renamed (); region_renamed ();
} }
if (what_changed.contains (ARDOUR::Properties::sync_position)) { if (what_changed.contains (ARDOUR::Properties::sync_position)) {
@ -471,7 +471,7 @@ RegionView::region_resized (const PropertyChange& what_changed)
double unit_length; double unit_length;
if (what_changed.contains (ARDOUR::Properties::position)) { if (what_changed.contains (ARDOUR::Properties::position)) {
set_position (_region->position(), 0); set_position (_region->nt_position(), 0);
} }
PropertyChange s_and_l; PropertyChange s_and_l;
@ -480,9 +480,9 @@ RegionView::region_resized (const PropertyChange& what_changed)
if (what_changed.contains (s_and_l)) { if (what_changed.contains (s_and_l)) {
set_duration (_region->length(), 0); set_duration (_region->nt_length(), 0);
unit_length = _region->length() / samples_per_pixel; unit_length = _region->length_samples() / samples_per_pixel;
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
(*i)->set_duration (unit_length); (*i)->set_duration (unit_length);
@ -662,7 +662,7 @@ RegionView::lower_to_bottom ()
} }
bool bool
RegionView::set_position (samplepos_t pos, void* /*src*/, double* ignored) RegionView::set_position (timepos_t const & pos, void* /*src*/, double* ignored)
{ {
double delta; double delta;
bool ret; bool ret;
@ -691,21 +691,22 @@ RegionView::set_samples_per_pixel (double fpp)
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
(*i)->set_samples_per_pixel (fpp); (*i)->set_samples_per_pixel (fpp);
(*i)->set_duration (_region->length() / fpp); #warning NUTEMPO should GhostRegion really be using samples for length/duration?
(*i)->set_duration (_region->length_samples() / fpp);
} }
region_sync_changed (); region_sync_changed ();
} }
bool bool
RegionView::set_duration (samplecnt_t samples, void *src) RegionView::set_duration (timecnt_t const & dur, void *src)
{ {
if (!TimeAxisViewItem::set_duration (samples, src)) { if (!TimeAxisViewItem::set_duration (dur, src)) {
return false; return false;
} }
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
(*i)->set_duration (_region->length() / samples_per_pixel); (*i)->set_duration (_region->length_samples() / samples_per_pixel);
} }
return true; return true;
@ -786,7 +787,7 @@ RegionView::make_name () const
std::string str; std::string str;
// XXX nice to have some good icons for this // XXX nice to have some good icons for this
if (_region->position_lock_style() == MusicTime) { if (_region->position_time_domain() == Temporal::BeatTime) {
str += "\u266B"; // BEAMED EIGHTH NOTES str += "\u266B"; // BEAMED EIGHTH NOTES
} }
@ -824,11 +825,11 @@ void
RegionView::region_sync_changed () RegionView::region_sync_changed ()
{ {
int sync_dir; int sync_dir;
samplecnt_t sync_offset; timecnt_t sync_offset;
sync_offset = _region->sync_offset (sync_dir); sync_offset = _region->sync_offset (sync_dir);
if (sync_offset == 0) { if (sync_offset.zero()) {
/* no need for a sync mark */ /* no need for a sync mark */
if (sync_mark) { if (sync_mark) {
sync_mark->hide(); sync_mark->hide();
@ -862,7 +863,7 @@ RegionView::region_sync_changed ()
} else { } else {
if ((sync_dir < 0) || ((sync_dir > 0) && (sync_offset > _region->length()))) { if ((sync_dir < 0) || ((sync_dir > 0) && (sync_offset > _region->nt_length()))) {
/* no sync mark - its out of the bounds of the region */ /* no sync mark - its out of the bounds of the region */
@ -877,7 +878,7 @@ RegionView::region_sync_changed ()
//points = sync_mark->property_points().get_value(); //points = sync_mark->property_points().get_value();
double offset = sync_offset / samples_per_pixel; double offset = trackview.editor().duration_to_pixels (sync_offset);
points.push_back (ArdourCanvas::Duple (offset - ((sync_mark_width-1)/2), 1)); points.push_back (ArdourCanvas::Duple (offset - ((sync_mark_width-1)/2), 1));
points.push_back (ArdourCanvas::Duple (offset + ((sync_mark_width-1)/2), 1)); points.push_back (ArdourCanvas::Duple (offset + ((sync_mark_width-1)/2), 1));
points.push_back (ArdourCanvas::Duple (offset, sync_mark_width - 1)); points.push_back (ArdourCanvas::Duple (offset, sync_mark_width - 1));
@ -952,9 +953,9 @@ RegionView::set_height (double h)
if (sync_line) { if (sync_line) {
Points points; Points points;
int sync_dir; int sync_dir;
samplecnt_t sync_offset; timecnt_t sync_offset;
sync_offset = _region->sync_offset (sync_dir); sync_offset = _region->sync_offset (sync_dir);
double offset = sync_offset / samples_per_pixel; double offset = trackview.editor().duration_to_pixels (sync_offset);
sync_line->set ( sync_line->set (
ArdourCanvas::Duple (offset, 0), ArdourCanvas::Duple (offset, 0),
@ -997,9 +998,9 @@ RegionView::update_coverage_frame (LayerDisplay d)
return; return;
} }
samplepos_t const position = _region->first_sample (); timepos_t const position = _region->nt_position ();
samplepos_t t = position; timepos_t t (position);
samplepos_t const end = _region->last_sample (); timepos_t const end = _region->nt_last ();
ArdourCanvas::Rectangle* cr = 0; ArdourCanvas::Rectangle* cr = 0;
bool me = false; bool me = false;
@ -1010,20 +1011,20 @@ RegionView::update_coverage_frame (LayerDisplay d)
while (t < end) { while (t < end) {
t++; t.increment();
/* is this region is on top at time t? */ /* is this region is on top at time t? */
bool const new_me = (pl->top_unmuted_region_at (t) == _region); bool const new_me = (pl->top_unmuted_region_at (t) == _region);
/* finish off any old rect, if required */ /* finish off any old rect, if required */
if (cr && me != new_me) { if (cr && me != new_me) {
cr->set_x1 (trackview.editor().sample_to_pixel (t - position)); cr->set_x1 (trackview.editor().duration_to_pixels (position.distance (t)));
} }
/* start off any new rect, if required */ /* start off any new rect, if required */
if (cr == 0 || me != new_me) { if (cr == 0 || me != new_me) {
cr = new ArdourCanvas::Rectangle (group); cr = new ArdourCanvas::Rectangle (group);
_coverage_frame.push_back (cr); _coverage_frame.push_back (cr);
cr->set_x0 (trackview.editor().sample_to_pixel (t - position)); cr->set_x0 (trackview.editor().duration_to_pixels (position.distance (t)));
cr->set_y0 (1); cr->set_y0 (1);
cr->set_y1 (_height + 1); cr->set_y1 (_height + 1);
cr->set_outline (false); cr->set_outline (false);
@ -1035,7 +1036,7 @@ RegionView::update_coverage_frame (LayerDisplay d)
} }
} }
t = pl->find_next_region_boundary (t, 1); t = pl->find_next_region_boundary (t, 1);
if (t < 0) { if (t.negative()) {
break; break;
} }
me = new_me; me = new_me;
@ -1045,7 +1046,7 @@ RegionView::update_coverage_frame (LayerDisplay d)
if (cr) { if (cr) {
/* finish off the last rectangle */ /* finish off the last rectangle */
cr->set_x1 (trackview.editor().sample_to_pixel (end - position)); cr->set_x1 (trackview.editor().duration_to_pixels (position.distance (end)));
} }
if (frame_handle_start) { if (frame_handle_start) {
@ -1066,67 +1067,67 @@ RegionView::update_coverage_frame (LayerDisplay d)
} }
bool bool
RegionView::trim_front (timepos_t const & new_bound, bool no_overlap, const int32_t sub_num) RegionView::trim_front (timepos_t const & new_bound, bool no_overlap)
{ {
if (_region->locked()) { if (_region->locked()) {
return false; return false;
} }
samplepos_t const pre_trim_first_sample = _region->first_sample(); if (_region->nt_position() == new_bound) {
if (_region->position() == new_bound) {
return false; return false;
} }
_region->trim_front (new_bound, sub_num); timepos_t const pos = _region->nt_position();
_region->trim_front (new_bound);
if (no_overlap) { if (no_overlap) {
/* Get the next region on the left of this region and shrink/expand it. */ /* Get the next region on the left of this region and shrink/expand it. */
boost::shared_ptr<Playlist> playlist (_region->playlist()); boost::shared_ptr<Playlist> playlist (_region->playlist());
boost::shared_ptr<Region> region_left = playlist->find_next_region (pre_trim_first_sample, End, 0); boost::shared_ptr<Region> region_left = playlist->find_next_region (pos, End, 0);
bool regions_touching = false; bool regions_touching = false;
if (region_left != 0 && (pre_trim_first_sample == region_left->last_sample() + 1)) { if (region_left != 0 && (pos == region_left->nt_end())) {
regions_touching = true; regions_touching = true;
} }
/* Only trim region on the left if the first sample has gone beyond the left region's last sample. */ /* Only trim region on the left if the first sample has gone beyond the left region's last sample. */
if (region_left != 0 && (region_left->last_sample() > _region->first_sample() || regions_touching)) { if (region_left != 0 && (region_left->nt_last() > _region->nt_position() || regions_touching)) {
region_left->trim_end (_region->first_sample() - 1); region_left->trim_end (_region->nt_position().decrement());
} }
} }
region_changed (ARDOUR::bounds_change); region_changed (ARDOUR::bounds_change);
return (pre_trim_first_sample != _region->first_sample()); // return true if we actually changed something return (pos != _region->nt_position()); // return true if we actually changed something
} }
bool bool
RegionView::trim_end (timepos_t const & new_bound, bool no_overlap, const int32_t sub_num) RegionView::trim_end (timepos_t const & new_bound, bool no_overlap)
{ {
if (_region->locked()) { if (_region->locked()) {
return false; return false;
} }
samplepos_t const pre_trim_last_sample = _region->last_sample(); timepos_t const last = _region->nt_last();
_region->trim_end (new_bound, sub_num); _region->trim_end (new_bound);
if (no_overlap) { if (no_overlap) {
/* Get the next region on the right of this region and shrink/expand it. */ /* Get the next region on the right of this region and shrink/expand it. */
boost::shared_ptr<Playlist> playlist (_region->playlist()); boost::shared_ptr<Playlist> playlist (_region->playlist());
boost::shared_ptr<Region> region_right = playlist->find_next_region (pre_trim_last_sample, Start, 1); boost::shared_ptr<Region> region_right = playlist->find_next_region (last, Start, 1);
bool regions_touching = false; bool regions_touching = false;
if (region_right != 0 && (pre_trim_last_sample == region_right->first_sample() - 1)) { if (region_right != 0 && (last == region_right->nt_position().decrement())) {
regions_touching = true; regions_touching = true;
} }
/* Only trim region on the right if the last sample has gone beyond the right region's first sample. */ /* Only trim region on the right if the last sample has gone beyond the right region's first sample. */
if (region_right != 0 && (region_right->first_sample() < _region->last_sample() || regions_touching)) { if (region_right != 0 && (region_right->nt_position() < _region->nt_last() || regions_touching)) {
region_right->trim_front (_region->last_sample() + 1, sub_num); region_right->trim_front (_region->nt_end());
} }
region_changed (ARDOUR::bounds_change); region_changed (ARDOUR::bounds_change);
@ -1135,7 +1136,7 @@ RegionView::trim_end (timepos_t const & new_bound, bool no_overlap, const int32_
region_changed (PropertyChange (ARDOUR::Properties::length)); region_changed (PropertyChange (ARDOUR::Properties::length));
} }
return (pre_trim_last_sample != _region->last_sample()); // return true if we actually changed something return (last != _region->nt_last()); // return true if we actually changed something
} }
@ -1172,16 +1173,16 @@ RegionView::snap_region_time_to_region_time (timepos_t const & x, bool ensure_sn
{ {
PublicEditor& editor = trackview.editor(); PublicEditor& editor = trackview.editor();
/* x is region relative, convert it to global absolute time */ /* x is region relative, convert it to global absolute time */
timepos_t const session_sample = _region->position() + x; timepos_t const session_pos = _region->nt_position() + x;
/* try a snap in either direction */ /* try a snap in either direction */
timepos_t snapped = session_sample; timepos_t snapped = session_pos;
editor.snap_to (snapped, RoundNearest, false, ensure_snap); editor.snap_to (snapped, Temporal::RoundNearest, SnapToAny_Visual, ensure_snap);
/* if we went off the beginning of the region, snap forwards */ /* if we went off the beginning of the region, snap forwards */
if (snapped < _region->position ()) { if (snapped < _region->nt_position ()) {
snapped = session_sample; snapped = session_pos;
editor.snap_to (snapped, RoundUpAlways, false, ensure_snap); editor.snap_to (snapped, Temporal::RoundUpAlways, SnapToAny_Visual, ensure_snap);
} }
/* back to region relative */ /* back to region relative */

View file

@ -881,17 +881,17 @@ TimeAxisView::show_selection (TimeSelection& ts)
} }
for (list<TimelineRange>::iterator i = ts.begin(); i != ts.end(); ++i) { for (list<TimelineRange>::iterator i = ts.begin(); i != ts.end(); ++i) {
samplepos_t start, end; timepos_t start, end;
samplecnt_t cnt; timecnt_t cnt;
start = (*i).start; start = (*i).start();
end = (*i).end; end = (*i).end();
cnt = end - start + 1; cnt = start.distance (end); /* XXX NUTEMPO used to add 1 here */
rect = get_selection_rect ((*i).id); rect = get_selection_rect ((*i).id);
x1 = _editor.sample_to_pixel (start); x1 = _editor.time_to_pixel (start);
x2 = _editor.sample_to_pixel (start + cnt - 1); x2 = _editor.time_to_pixel (end.decrement());
y2 = current_height() - 1; y2 = current_height() - 1;
if (dynamic_cast<AudioTimeAxisView*>(this)) { if (dynamic_cast<AudioTimeAxisView*>(this)) {
@ -1072,7 +1072,7 @@ TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
* @param result Filled in with selectable things. * @param result Filled in with selectable things.
*/ */
void void
TimeAxisView::get_selectables (samplepos_t start, samplepos_t end, double top, double bot, list<Selectable*>& results, bool within) TimeAxisView::get_selectables (timepos_t const & start, timepos_t const & end, double top, double bot, list<Selectable*>& results, bool within)
{ {
for (Children::iterator i = children.begin(); i != children.end(); ++i) { for (Children::iterator i = children.begin(); i != children.end(); ++i) {
if (!(*i)->hidden()) { if (!(*i)->hidden()) {

View file

@ -121,10 +121,9 @@ TimeAxisViewItem::set_constant_heights ()
*/ */
TimeAxisViewItem::TimeAxisViewItem( TimeAxisViewItem::TimeAxisViewItem(
const string & it_name, ArdourCanvas::Item& parent, TimeAxisView& tv, double spu, uint32_t base_color, const string & it_name, ArdourCanvas::Item& parent, TimeAxisView& tv, double spu, uint32_t base_color,
samplepos_t start, samplecnt_t duration, bool recording, bool automation, Visibility vis timepos_t const & start, timecnt_t const & duration, bool recording, bool automation, Visibility vis
) )
: trackview (tv) : trackview (tv)
, sample_position (-1)
, item_name (it_name) , item_name (it_name)
, selection_frame (0) , selection_frame (0)
, _height (1.0) , _height (1.0)
@ -141,7 +140,6 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
, Selectable (other) , Selectable (other)
, PBD::ScopedConnectionList() , PBD::ScopedConnectionList()
, trackview (other.trackview) , trackview (other.trackview)
, sample_position (-1)
, item_name (other.item_name) , item_name (other.item_name)
, selection_frame (0) , selection_frame (0)
, _height (1.0) , _height (1.0)
@ -156,13 +154,13 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
_selected = other._selected; _selected = other._selected;
init (parent, other.samples_per_pixel, other.fill_color, other.sample_position, init (parent, other.samples_per_pixel, other.fill_color, other.time_position,
other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name); other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
} }
void void
TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_color, TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_color,
samplepos_t start, samplepos_t duration, Visibility vis, timepos_t const & start, timecnt_t const & duration, Visibility vis,
bool wide, bool high) bool wide, bool high)
{ {
group = new ArdourCanvas::Container (parent); group = new ArdourCanvas::Container (parent);
@ -171,12 +169,12 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
fill_color = base_color; fill_color = base_color;
fill_color_name = "time axis view item base"; fill_color_name = "time axis view item base";
samples_per_pixel = fpp; samples_per_pixel = fpp;
sample_position = start; time_position = start;
item_duration = duration; item_duration = duration;
name_connected = false; name_connected = false;
position_locked = false; position_locked = false;
max_item_duration = Temporal::max_samplepos; max_item_duration = timecnt_t::max (item_duration.time_domain());
min_item_duration = 0; min_item_duration = timecnt_t::zero (item_duration.time_domain());
visibility = vis; visibility = vis;
_sensitive = true; _sensitive = true;
name_text_width = 0; name_text_width = 0;
@ -289,9 +287,9 @@ TimeAxisViewItem::set_position(timepos_t const & pos, void* src, double* delta)
return false; return false;
} }
sample_position = pos.samples(); position = pos;
double new_unit_pos = trackview.editor().sample_to_pixel (sample_position); double new_unit_pos = trackview.editor().time_to_pixel (time_position);
if (delta) { if (delta) {
(*delta) = new_unit_pos - group->position().x; (*delta) = new_unit_pos - group->position().x;
@ -305,16 +303,16 @@ TimeAxisViewItem::set_position(timepos_t const & pos, void* src, double* delta)
} }
group->set_x_position (new_unit_pos); group->set_x_position (new_unit_pos);
PositionChanged (sample_position, src); /* EMIT_SIGNAL */ PositionChanged (time_position, src); /* EMIT_SIGNAL */
return true; return true;
} }
/** @return position of this item on the timeline */ /** @return position of this item on the timeline */
samplepos_t timepos_t
TimeAxisViewItem::get_position() const TimeAxisViewItem::get_position() const
{ {
return sample_position; return time_position;
} }
/** /**
@ -326,7 +324,7 @@ TimeAxisViewItem::get_position() const
*/ */
bool bool
TimeAxisViewItem::set_duration (samplecnt_t dur, void* src) TimeAxisViewItem::set_duration (timecnt_t const & dur, void* src)
{ {
if ((dur > max_item_duration) || (dur < min_item_duration)) { if ((dur > max_item_duration) || (dur < min_item_duration)) {
warning << string_compose ( warning << string_compose (
@ -342,8 +340,8 @@ TimeAxisViewItem::set_duration (samplecnt_t dur, void* src)
item_duration = dur; item_duration = dur;
double end_pixel = trackview.editor().sample_to_pixel (sample_position + dur); double end_pixel = trackview.editor().time_to_pixel (time_position + dur);
double first_pixel = trackview.editor().sample_to_pixel (sample_position); double first_pixel = trackview.editor().time_to_pixel (time_position);
reset_width_dependent_items (end_pixel - first_pixel); reset_width_dependent_items (end_pixel - first_pixel);
@ -352,7 +350,7 @@ TimeAxisViewItem::set_duration (samplecnt_t dur, void* src)
} }
/** @return duration of this item */ /** @return duration of this item */
samplepos_t timecnt_t
TimeAxisViewItem::get_duration() const TimeAxisViewItem::get_duration() const
{ {
return item_duration; return item_duration;
@ -372,7 +370,7 @@ TimeAxisViewItem::set_max_duration(samplecnt_t dur, void* src)
} }
/** @return the maximum duration that this item may have */ /** @return the maximum duration that this item may have */
samplecnt_t timecnt_t
TimeAxisViewItem::get_max_duration() const TimeAxisViewItem::get_max_duration() const
{ {
return max_item_duration; return max_item_duration;
@ -392,7 +390,7 @@ TimeAxisViewItem::set_min_duration(samplecnt_t dur, void* src)
} }
/** @return the minimum duration that this item mey have */ /** @return the minimum duration that this item mey have */
samplecnt_t timecnt_t
TimeAxisViewItem::get_min_duration() const TimeAxisViewItem::get_min_duration() const
{ {
return min_item_duration; return min_item_duration;
@ -806,8 +804,8 @@ TimeAxisViewItem::set_samples_per_pixel (double fpp)
samples_per_pixel = fpp; samples_per_pixel = fpp;
set_position (this->get_position(), this); set_position (this->get_position(), this);
double end_pixel = trackview.editor().sample_to_pixel (sample_position + get_duration()); double end_pixel = trackview.editor().time_to_pixel (timeposition + get_duration());
double first_pixel = trackview.editor().sample_to_pixel (sample_position); double first_pixel = trackview.editor().time_to_pixel (time_position);
reset_width_dependent_items (end_pixel - first_pixel); reset_width_dependent_items (end_pixel - first_pixel);
} }

View file

@ -132,19 +132,19 @@ public:
sigc::signal<void,std::string,std::string,void*> NameChanged; sigc::signal<void,std::string,std::string,void*> NameChanged;
/** Emiited when the position of this item changes */ /** Emiited when the position of this item changes */
sigc::signal<void,samplepos_t,void*> PositionChanged; sigc::signal<void,Temporal::timepos_t,void*> PositionChanged;
/** Emitted when the position lock of this item is changed */ /** Emitted when the position lock of this item is changed */
sigc::signal<void,bool,void*> PositionLockChanged; sigc::signal<void,bool,void*> PositionLockChanged;
/** Emitted when the duration of this item changes */ /** Emitted when the duration of this item changes */
sigc::signal<void,samplecnt_t,void*> DurationChanged; sigc::signal<void,Temporal::timecnt_t,void*> DurationChanged;
/** Emitted when the maximum item duration is changed */ /** Emitted when the maximum item duration is changed */
sigc::signal<void,samplecnt_t,void*> MaxDurationChanged; sigc::signal<void,Temporal::timecnt_t,void*> MaxDurationChanged;
/** Emitted when the mionimum item duration is changed */ /** Emitted when the mionimum item duration is changed */
sigc::signal<void,samplecnt_t,void*> MinDurationChanged; sigc::signal<void,Temporal::timecnt_t,void*> MinDurationChanged;
enum Visibility { enum Visibility {
ShowFrame = 0x1, ShowFrame = 0x1,
@ -161,11 +161,11 @@ public:
protected: protected:
TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color, TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color,
samplepos_t, samplecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0)); Temporal::timepos_t const &, Temporal::timecnt_t const &, bool recording = false, bool automation = false, Visibility v = Visibility (0));
TimeAxisViewItem (const TimeAxisViewItem&); TimeAxisViewItem (const TimeAxisViewItem&);
void init (ArdourCanvas::Item*, double, uint32_t, samplepos_t, samplepos_t, Visibility, bool, bool); void init (ArdourCanvas::Item*, double, uint32_t, Temporal::timepos_t const &, Temporal::timecnt_t const &, Visibility, bool, bool);
virtual bool canvas_group_event (GdkEvent*); virtual bool canvas_group_event (GdkEvent*);
@ -186,16 +186,16 @@ protected:
bool position_locked; bool position_locked;
/** position of this item on the timeline */ /** position of this item on the timeline */
samplepos_t sample_position; Temporal::timepos_t time_position;
/** duration of this item upon the timeline */ /** duration of this item upon the timeline */
samplecnt_t item_duration; Temporal::timecnt_t item_duration;
/** maximum duration that this item can have */ /** maximum duration that this item can have */
samplecnt_t max_item_duration; Temporal::timecnt_t max_item_duration;
/** minimum duration that this item can have */ /** minimum duration that this item can have */
samplecnt_t min_item_duration; Temporal::timecnt_t min_item_duration;
/** indicates whether the max duration constraint is active */ /** indicates whether the max duration constraint is active */
bool max_duration_active; bool max_duration_active;

View file

@ -96,11 +96,11 @@ gtk2_ardour_sources = [
'editor_markers.cc', 'editor_markers.cc',
'editor_mixer.cc', 'editor_mixer.cc',
'editor_mouse.cc', 'editor_mouse.cc',
'editor_ops.cc', # 'editor_ops.cc',
'editor_regions.cc', 'editor_regions.cc',
'editor_routes.cc', 'editor_routes.cc',
'editor_rulers.cc', 'editor_rulers.cc',
'editor_selection.cc', # 'editor_selection.cc',
'editor_snapshots.cc', 'editor_snapshots.cc',
'editor_sources.cc', 'editor_sources.cc',
'editor_summary.cc', 'editor_summary.cc',