summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2018-11-15 09:33:44 -0600
committerBen Loftis <ben@harrisonconsoles.com>2019-08-01 12:11:31 -0500
commite0bdcd7137c4b0f792c7824ad146ebdc5687a5cf (patch)
treeadc0fe4bc904c24626376da3d620e54101f1ee8b /gtk2_ardour
parentedde5d64a2630c6d79239b92f2fe428022626dde (diff)
(Source List) Clean up the natural_position implementation (gtk2 part).
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_sources.cc16
-rw-r--r--gtk2_ardour/export_report.cc2
-rw-r--r--gtk2_ardour/midi_region_view.cc2
-rw-r--r--gtk2_ardour/sfdb_ui.cc6
4 files changed, 17 insertions, 9 deletions
diff --git a/gtk2_ardour/editor_sources.cc b/gtk2_ardour/editor_sources.cc
index 2586151786..2a3e0edcc0 100644
--- a/gtk2_ardour/editor_sources.cc
+++ b/gtk2_ardour/editor_sources.cc
@@ -350,12 +350,13 @@ EditorSources::populate_row (TreeModel::Row row, boost::shared_ptr<ARDOUR::Sourc
row[_columns.natural_s] = source->natural_position();
//Natural Position (text representation)
- char buf[64];
- snprintf(buf, 16, "--" );
- if (source->natural_position() > 0) {
+ if (source->have_natural_position()) {
+ char buf[64];
format_position (source->natural_position(), buf, sizeof (buf));
+ row[_columns.natural_pos] = buf;
+ } else {
+ row[_columns.natural_pos] = X_("--");
}
- row[_columns.natural_pos] = buf;
}
void
@@ -380,13 +381,20 @@ EditorSources::source_changed (boost::shared_ptr<ARDOUR::Source> source)
{
TreeModel::iterator i;
TreeModel::Children rows = _model->children();
+ bool found = false;
+
for (i = rows.begin(); i != rows.end(); ++i) {
boost::shared_ptr<ARDOUR::Source> ss = (*i)[_columns.source];
if (source == ss) {
populate_row(*i, source);
+ found = true;
break;
}
}
+
+ if (!found) {
+ add_source (source);
+ }
}
void
diff --git a/gtk2_ardour/export_report.cc b/gtk2_ardour/export_report.cc
index 52a5dae0cc..b42196c87c 100644
--- a/gtk2_ardour/export_report.cc
+++ b/gtk2_ardour/export_report.cc
@@ -990,7 +990,7 @@ ExportReport::audition (std::string path, unsigned n_chn, int page)
PBD::PropertyList plist;
plist.add (ARDOUR::Properties::start, 0);
- plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->timeline_position()));
+ plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->natural_position()));
plist.add (ARDOUR::Properties::name, rname);
plist.add (ARDOUR::Properties::layer, 0);
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 11c027fabf..46877d43e0 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -4204,7 +4204,7 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
/* convert from session samples to source beats */
Temporal::Beats const time_beats = _source_relative_time_converter.from(
- ev.time() - src->timeline_position() + _region->start());
+ ev.time() - src->natural_position() + _region->start());
if (ev.type() == MIDI_CMD_NOTE_ON) {
boost::shared_ptr<NoteType> note (
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 63b09ba3b8..7937cd958c 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -342,7 +342,7 @@ SoundFileBox::setup_labels (const string& filename)
channels_value.set_text (to_string(ms->num_tracks()));
}
}
- length_clock.set (ms->length(ms->timeline_position()));
+ length_clock.set (ms->length(ms->natural_position()));
switch (ms->num_tempos()) {
case 0:
tempomap_value.set_text (_("No tempo data"));
@@ -497,7 +497,7 @@ SoundFileBox::audition ()
PropertyList plist;
plist.add (ARDOUR::Properties::start, 0);
- plist.add (ARDOUR::Properties::length, ms->length(ms->timeline_position()));
+ plist.add (ARDOUR::Properties::length, ms->length(ms->natural_position()));
plist.add (ARDOUR::Properties::name, rname);
plist.add (ARDOUR::Properties::layer, 0);
@@ -546,7 +546,7 @@ SoundFileBox::audition ()
PropertyList plist;
plist.add (ARDOUR::Properties::start, 0);
- plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->timeline_position()));
+ plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->natural_position()));
plist.add (ARDOUR::Properties::name, rname);
plist.add (ARDOUR::Properties::layer, 0);