mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
Implement new trigger-track from region drop
This commit is contained in:
parent
aa3806d875
commit
02b94123ef
1 changed files with 42 additions and 8 deletions
|
|
@ -20,6 +20,8 @@
|
||||||
#include "gtk2ardour-config.h"
|
#include "gtk2ardour-config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include <gtkmm/label.h>
|
#include <gtkmm/label.h>
|
||||||
|
|
||||||
#include "pbd/properties.h"
|
#include "pbd/properties.h"
|
||||||
|
|
@ -30,6 +32,12 @@
|
||||||
|
|
||||||
#include "widgets/ardour_spacer.h"
|
#include "widgets/ardour_spacer.h"
|
||||||
|
|
||||||
|
#include "ardour/audio_track.h"
|
||||||
|
#include "ardour/audioregion.h"
|
||||||
|
#include "ardour/midi_region.h"
|
||||||
|
#include "ardour/midi_track.h"
|
||||||
|
#include "ardour/region_factory.h"
|
||||||
|
#include "ardour/profile.h"
|
||||||
#include "ardour/smf_source.h"
|
#include "ardour/smf_source.h"
|
||||||
|
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
|
|
@ -513,15 +521,41 @@ TriggerPage::no_strip_drag_data_received (Glib::RefPtr<Gdk::DragContext> const&
|
||||||
{
|
{
|
||||||
if (data.get_target () == X_("regions")) {
|
if (data.get_target () == X_("regions")) {
|
||||||
boost::shared_ptr<Region> region = PublicEditor::instance ().get_dragged_region_from_sidebar ();
|
boost::shared_ptr<Region> region = PublicEditor::instance ().get_dragged_region_from_sidebar ();
|
||||||
#if 0 // TODO ..
|
boost::shared_ptr<TriggerBox> triggerbox;
|
||||||
if (region) {
|
|
||||||
context->drag_finish (true, false, time);
|
if (boost::dynamic_pointer_cast<AudioRegion> (region)) {
|
||||||
} else {
|
uint32_t output_chan = region->sources().size();
|
||||||
context->drag_finish (false, false, time);
|
if ((Config->get_output_auto_connect() & AutoConnectMaster) && session()->master_out()) {
|
||||||
|
output_chan = session()->master_out()->n_inputs().n_audio();
|
||||||
|
}
|
||||||
|
std::list<boost::shared_ptr<AudioTrack> > audio_tracks;
|
||||||
|
audio_tracks = session()->new_audio_track (region->sources().size(), output_chan, 0, 1, region->name(), PresentationInfo::max_order);
|
||||||
|
if (!audio_tracks.empty()) {
|
||||||
|
triggerbox = audio_tracks.front()->triggerbox ();
|
||||||
|
}
|
||||||
|
} else if (boost::dynamic_pointer_cast<MidiRegion> (region)) {
|
||||||
|
ChanCount one_midi_port (DataType::MIDI, 1);
|
||||||
|
list<boost::shared_ptr<MidiTrack> > midi_tracks;
|
||||||
|
midi_tracks = session()->new_midi_track (one_midi_port, one_midi_port,
|
||||||
|
Config->get_strict_io () || Profile->get_mixbus (),
|
||||||
|
boost::shared_ptr<ARDOUR::PluginInfo>(),
|
||||||
|
(ARDOUR::Plugin::PresetRecord*) 0,
|
||||||
|
(ARDOUR::RouteGroup*) 0, 1, region->name(), PresentationInfo::max_order, Normal, true);
|
||||||
|
if (!midi_tracks.empty()) {
|
||||||
|
triggerbox = midi_tracks.front()->triggerbox ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
context->drag_finish (false, false, time);
|
if (!triggerbox) {
|
||||||
#endif
|
context->drag_finish (false, false, time);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX: check does the region need to be copied?
|
||||||
|
boost::shared_ptr<Region> region_copy = RegionFactory::create (region, true);
|
||||||
|
triggerbox->set_from_selection (0, region_copy);
|
||||||
|
|
||||||
|
context->drag_finish (true, false, time);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue