(Source List) Clean up the natural_position implementation (gtk2 part).
authorBen Loftis <ben@harrisonconsoles.com>
Thu, 15 Nov 2018 15:33:44 +0000 (09:33 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Thu, 1 Aug 2019 17:11:31 +0000 (12:11 -0500)
gtk2_ardour/editor_sources.cc
gtk2_ardour/export_report.cc
gtk2_ardour/midi_region_view.cc
gtk2_ardour/sfdb_ui.cc

index 258615178616fedaaa18b86300afd993fc4db1b5..2a3e0edcc0dc5c95aad4b8c0ab9b23ca648852d0 100644 (file)
@@ -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
index 52a5dae0cc83385abe78bba7c210a5061c4d5abc..b42196c87c934e6299de6ec7e10e970e88e48b61 100644 (file)
@@ -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);
 
index 11c027fabf2a69301c0a08a3ec910b4a562c7f2c..46877d43e08c7512df00a1451a1e3cdf1714eb90 100644 (file)
@@ -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 (
index 63b09ba3b8b2b75d9c52e297a7d0623c4e4eb2b6..7937cd958c71d2241231d822650cd0d1895788ce 100644 (file)
@@ -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);