Fix DnD import to grouped tracks
Import via Drag/Drop previously worked by selecting a track, and then importing to the selected track. This approach fails when the selected track is in a track-group, and selecting the track also selects other tracks of different type. Now the track to drop onto is passed directly passed through to ::finish_bringing_in_material as existing_track.
This commit is contained in:
parent
20088062bb
commit
07dea50456
@ -471,13 +471,15 @@ public:
|
||||
ARDOUR::MidiTempoMapDisposition mtd,
|
||||
Temporal::timepos_t& pos,
|
||||
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>(),
|
||||
boost::shared_ptr<ARDOUR::Track> track = boost::shared_ptr<ARDOUR::Track>(),
|
||||
bool with_markers = false);
|
||||
|
||||
void do_embed (std::vector<std::string> paths,
|
||||
Editing::ImportDisposition disposition,
|
||||
Editing::ImportMode mode,
|
||||
Temporal::timepos_t& pos,
|
||||
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
|
||||
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>(),
|
||||
boost::shared_ptr<ARDOUR::Track> track = boost::shared_ptr<ARDOUR::Track>());
|
||||
|
||||
void get_regionview_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
|
||||
|
||||
|
@ -361,17 +361,17 @@ Editor::import_smf_markers (Evoral::SMF & smf, timepos_t const & pos)
|
||||
}
|
||||
|
||||
void
|
||||
Editor::do_import (vector<string> paths,
|
||||
ImportDisposition disposition,
|
||||
ImportMode mode,
|
||||
SrcQuality quality,
|
||||
MidiTrackNameSource midi_track_name_source,
|
||||
MidiTempoMapDisposition smf_tempo_disposition,
|
||||
timepos_t& pos,
|
||||
ARDOUR::PluginInfoPtr instrument,
|
||||
bool with_markers)
|
||||
Editor::do_import (vector<string> paths,
|
||||
ImportDisposition disposition,
|
||||
ImportMode mode,
|
||||
SrcQuality quality,
|
||||
MidiTrackNameSource midi_track_name_source,
|
||||
MidiTempoMapDisposition smf_tempo_disposition,
|
||||
timepos_t& pos,
|
||||
ARDOUR::PluginInfoPtr instrument,
|
||||
boost::shared_ptr<Track> track,
|
||||
bool with_markers)
|
||||
{
|
||||
boost::shared_ptr<Track> track;
|
||||
vector<string> to_import;
|
||||
int nth = 0;
|
||||
bool use_timestamp = (pos == timepos_t::max (pos.time_domain()));
|
||||
@ -522,9 +522,13 @@ Editor::do_import (vector<string> paths,
|
||||
}
|
||||
|
||||
void
|
||||
Editor::do_embed (vector<string> paths, ImportDisposition import_as, ImportMode mode, timepos_t& pos, ARDOUR::PluginInfoPtr instrument)
|
||||
Editor::do_embed (vector<string> paths,
|
||||
ImportDisposition import_as,
|
||||
ImportMode mode,
|
||||
timepos_t& pos,
|
||||
ARDOUR::PluginInfoPtr instrument,
|
||||
boost::shared_ptr<Track> track)
|
||||
{
|
||||
boost::shared_ptr<Track> track;
|
||||
bool check_sample_rate = true;
|
||||
vector<string> to_embed;
|
||||
bool multi = paths.size() > 1;
|
||||
@ -1051,7 +1055,7 @@ int
|
||||
Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
|
||||
uint32_t in_chans,
|
||||
uint32_t out_chans,
|
||||
timepos_t& pos,
|
||||
timepos_t& pos,
|
||||
ImportMode mode,
|
||||
boost::shared_ptr<Track>& existing_track,
|
||||
string const& new_track_name,
|
||||
|
@ -440,7 +440,7 @@ Editor::drop_paths_part_two (const vector<string>& paths, timepos_t const & p, d
|
||||
/* drop onto canvas background: create new tracks */
|
||||
|
||||
InstrumentSelector is(InstrumentSelector::ForTrackDefault); // instantiation builds instrument-list and sets default.
|
||||
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument(), false);
|
||||
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument());
|
||||
|
||||
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
|
||||
do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack,
|
||||
@ -454,17 +454,14 @@ Editor::drop_paths_part_two (const vector<string>& paths, timepos_t const & p, d
|
||||
/* check that its a track, not a bus */
|
||||
|
||||
if (tv->track()) {
|
||||
/* select the track, then embed/import */
|
||||
selection->set (tv);
|
||||
|
||||
do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack,
|
||||
SrcBest, SMFTrackNumber, SMFTempoIgnore, pos);
|
||||
SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, boost::shared_ptr<ARDOUR::PluginInfo>(), tv->track ());
|
||||
|
||||
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
|
||||
do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack,
|
||||
SrcBest, SMFTrackName, SMFTempoIgnore, pos, boost::shared_ptr<PluginInfo>(), false);
|
||||
SrcBest, SMFTrackName, SMFTempoIgnore, pos, boost::shared_ptr<PluginInfo>());
|
||||
} else {
|
||||
do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, pos);
|
||||
do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, pos, boost::shared_ptr<ARDOUR::PluginInfo>(), tv->track ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -282,9 +282,11 @@ public:
|
||||
virtual void do_import (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality,
|
||||
ARDOUR::MidiTrackNameSource, ARDOUR::MidiTempoMapDisposition, Temporal::timepos_t&,
|
||||
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>(),
|
||||
boost::shared_ptr<ARDOUR::Track> track = boost::shared_ptr<ARDOUR::Track>(),
|
||||
bool with_markers = false) = 0;
|
||||
virtual void do_embed (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, Temporal::timepos_t&,
|
||||
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>()) = 0;
|
||||
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>(),
|
||||
boost::shared_ptr<ARDOUR::Track> track = boost::shared_ptr<ARDOUR::Track>()) = 0;
|
||||
|
||||
/** Open main export dialog */
|
||||
virtual void export_audio () = 0;
|
||||
|
@ -2208,7 +2208,7 @@ SoundFileOmega::do_something (int action)
|
||||
_import_active = true;
|
||||
|
||||
if (copy_files_btn.get_active()) {
|
||||
PublicEditor::instance().do_import (paths, chns, mode, quality, mts, mtd, where, instrument, with_midi_markers);
|
||||
PublicEditor::instance().do_import (paths, chns, mode, quality, mts, mtd, where, instrument, boost::shared_ptr<Track>(), with_midi_markers);
|
||||
} else {
|
||||
PublicEditor::instance().do_embed (paths, chns, mode, where, instrument);
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ TriggerPage::drop_paths_part_two (std::vector<std::string> paths)
|
||||
}
|
||||
timepos_t pos (0);
|
||||
Editing::ImportDisposition disposition = Editing::ImportSerializeFiles; // or Editing::ImportDistinctFiles // TODO use drop modifier? config?
|
||||
PublicEditor::instance().do_import (midi_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, _trigger_clip_picker.instrument_plugin (), false);
|
||||
PublicEditor::instance().do_import (midi_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, _trigger_clip_picker.instrument_plugin ());
|
||||
PublicEditor::instance().do_import (audio_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos);
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ function factory (params) return function ()
|
||||
|
||||
files:push_back("/tmp/test.wav")
|
||||
|
||||
local pos = -1
|
||||
local pos = Temporal.timepos_t(0)
|
||||
Editor:do_import (files,
|
||||
Editing.ImportDistinctFiles, Editing.ImportAsTrack, ARDOUR.SrcQuality.SrcBest,
|
||||
ARDOUR.MidiTrackNameSource.SMFTrackName, ARDOUR.MidiTempoMapDisposition.SMFTempoIgnore,
|
||||
pos, ARDOUR.PluginInfo(), false)
|
||||
pos, ARDOUR.PluginInfo(), ARDOUR.Track(), false)
|
||||
|
||||
end end
|
||||
|
Loading…
Reference in New Issue
Block a user