}
bool
-AutomationTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx)
+AutomationTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num)
{
if (_line) {
return paste_one (pos, ctx.count, ctx.times, selection, ctx.counts, ctx.greedy);
/* editing operations */
void cut_copy_clear (Selection&, Editing::CutCopyOp);
- bool paste (ARDOUR::framepos_t, const Selection&, PasteContext&);
+ bool paste (ARDOUR::framepos_t, const Selection&, PasteContext&, const int32_t& sub_num);
int set_state (const XMLNode&, int version);
void cut_copy_midi (Editing::CutCopyOp);
void mouse_paste ();
- void paste_internal (framepos_t position, float times);
+ void paste_internal (framepos_t position, float times, const int32_t& sub_num);
/* EDITING OPERATIONS */
void delete_ ();
void cut ();
void copy ();
- void paste (float times, bool from_context_menu = false);
+ void paste (float times, bool from_context_menu);
void place_transient ();
void remove_transient (ArdourCanvas::Item* item);
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(rv);
const boost::shared_ptr<const Region> original = rv->region();
- boost::shared_ptr<Region> region_copy = RegionFactory::create (original, true);
- region_copy->set_position (original->position(), _editor->get_grid_music_divisions (event->button.state));
+ boost::shared_ptr<Region> region_copy = RegionFactory::create (original, true
+ , _editor->get_grid_music_divisions (event->button.state));
/* need to set this so that the drop zone code can work. This doesn't
actually put the region into the playlist, but just sets a weak pointer
to it.
}
if (dest_rtv != 0) {
- RegionView* new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where, modified_playlists);
+ RegionView* new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where,
+ modified_playlists, _editor->get_grid_music_divisions (ev_state));
+
if (new_view != 0) {
new_views.push_back (new_view);
}
/* insert into new playlist */
RegionView* new_view = insert_region_into_playlist (
- RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where, modified_playlists
+ RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where,
+ modified_playlists, _editor->get_grid_music_divisions (ev_state)
);
if (new_view == 0) {
RouteTimeAxisView* dest_rtv,
layer_t dest_layer,
framecnt_t where,
- PlaylistSet& modified_playlists
+ PlaylistSet& modified_playlists,
+ const int32_t& sub_num
)
{
boost::shared_ptr<Playlist> dest_playlist = dest_rtv->playlist ();
if (r.second) {
dest_playlist->clear_changes ();
}
-
- dest_playlist->add_region (region, where);
+ dest_playlist->add_region (region, where, 1.0, false, sub_num);
if (dest_rtv->view()->layer_display() == Stacked || dest_rtv->view()->layer_display() == Expanded) {
dest_playlist->set_layer (region, dest_layer);
RouteTimeAxisView*,
ARDOUR::layer_t,
ARDOUR::framecnt_t,
- PlaylistSet&
+ PlaylistSet&,
+ const int32_t& sub_num
);
void remove_region_from_playlist (
void
Editor::keyboard_paste ()
{
- paste (1);
+ paste (1, false);
}
{
DEBUG_TRACE (DEBUG::CutNPaste, "paste to preferred edit pos\n");
- paste_internal (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), times);
+ paste_internal (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), times, get_grid_music_divisions (0));
}
void
}
snap_to (where);
- paste_internal (where, 1);
+ paste_internal (where, 1, get_grid_music_divisions (0));
}
void
-Editor::paste_internal (framepos_t position, float times)
+Editor::paste_internal (framepos_t position, float times, const int32_t& sub_num)
{
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("apparent paste position is %1\n", position));
"greedy" paste from one automation type to another. */
PasteContext ctx(paste_count, times, ItemCounts(), true);
- ts.front()->paste (position, *cut_buffer, ctx);
+ ts.front()->paste (position, *cut_buffer, ctx, sub_num);
} else {
PasteContext ctx(paste_count, times, ItemCounts(), false);
for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
- (*i)->paste (position, *cut_buffer, ctx);
+ (*i)->paste (position, *cut_buffer, ctx, sub_num);
}
}
/** This method handles undo */
bool
-MidiRegionView::paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx)
+MidiRegionView::paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t& sub_num)
{
bool commit = false;
// Paste notes, if available
typedef RouteTimeAxisView::AutomationTracks ATracks;
const ATracks& atracks = midi_view()->automation_tracks();
for (ATracks::const_iterator a = atracks.begin(); a != atracks.end(); ++a) {
- if (a->second->paste(pos, selection, ctx)) {
+ if (a->second->paste(pos, selection, ctx, sub_num)) {
commit = true;
}
}
void resolve_note(uint8_t note_num, Evoral::Beats end_time);
void cut_copy_clear (Editing::CutCopyOp);
- bool paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx);
+ bool paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t& sub_num);
void paste_internal (framepos_t pos, unsigned paste_count, float times, const MidiCutBuffer&);
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext, bool);
};
bool
-MidiStreamView::paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx)
+MidiStreamView::paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num)
{
/* Paste into the first region which starts on or before pos. Only called when
using an internal editing tool. */
}
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*prev);
- return mrv ? mrv->paste(pos, selection, ctx) : false;
+ return mrv ? mrv->paste(pos, selection, ctx, sub_num) : false;
}
RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool);
- bool paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx);
+ bool paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num);
void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views);
}
bool
-MidiTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx)
+MidiTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num)
{
if (!_editor.internal_editing()) {
// Non-internal paste, paste regions like any other route
- return RouteTimeAxisView::paste(pos, selection, ctx);
+ return RouteTimeAxisView::paste(pos, selection, ctx, sub_num);
}
- return midi_view()->paste(pos, selection, ctx);
+ return midi_view()->paste(pos, selection, ctx, sub_num);
}
void show_existing_automation (bool apply_to_selection = false);
void create_automation_child (const Evoral::Parameter& param, bool show);
- bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx);
+ bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx, const int32_t& sub_num);
ARDOUR::NoteMode note_mode() const { return _note_mode; }
ARDOUR::ColorMode color_mode() const { return _color_mode; }
}
bool
-RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx)
+RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num)
{
if (!is_track()) {
return false;
framecnt_t amount = extent.second - extent.first;
pl->ripple(pos, amount * ctx.times, boost::shared_ptr<Region>());
}
- pl->paste (*p, pos, ctx.times);
+ pl->paste (*p, pos, ctx.times, sub_num);
vector<Command*> cmds;
pl->rdiff (cmds);
/* Editing operations */
void cut_copy_clear (Selection&, Editing::CutCopyOp);
- bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx);
+ bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx, const int32_t& sub_num);
RegionView* combine_regions ();
void uncombine_regions ();
void uncombine_region (RegionView*);
*/
virtual bool paste (ARDOUR::framepos_t pos,
const Selection& selection,
- PasteContext& ctx) { return false; }
+ PasteContext& ctx,
+ const int32_t& sub_num) { return false; }
virtual void set_selected_regionviews (RegionSelection&) {}
virtual void set_selected_points (PointSelection&) {}
/* Editing operations */
- void add_region (boost::shared_ptr<Region>, framepos_t position, float times = 1, bool auto_partition = false);
+ void add_region (boost::shared_ptr<Region>, framepos_t position, float times = 1, bool auto_partition = false, const int32_t& sub_num = 0);
void remove_region (boost::shared_ptr<Region>);
void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
boost::shared_ptr<Playlist> cut (std::list<AudioRange>&, bool result_is_hidden = true);
boost::shared_ptr<Playlist> copy (std::list<AudioRange>&, bool result_is_hidden = true);
- int paste (boost::shared_ptr<Playlist>, framepos_t position, float times);
+ int paste (boost::shared_ptr<Playlist>, framepos_t position, float times, const int32_t& sub_num);
const RegionListProperty& region_list_property () const { return regions; }
boost::shared_ptr<RegionList> region_list();
virtual XMLNode& state (bool);
- bool add_region_internal (boost::shared_ptr<Region>, framepos_t position);
+ bool add_region_internal (boost::shared_ptr<Region>, framepos_t position, const int32_t& sub_num = 0);
int remove_region_internal (boost::shared_ptr<Region>);
void copy_regions (RegionList&) const;
Trimmable::CanTrim can_trim () const;
PositionLockStyle position_lock_style () const { return _position_lock_style; }
- double beat () const { return _beat; }
void set_position_lock_style (PositionLockStyle ps);
void recompute_position_from_lock_style (const int32_t& sub_num);
+ double beat () const { return _beat; }
+ void set_beat (double beat) { _beat = beat; }
+
void suspend_property_changes ();
bool covers (framepos_t frame) const {
, _start_beats (Properties::start_beats, Evoral::Beats())
, _length_beats (Properties::length_beats, other->_length_beats)
{
- const double offset_beat = _session.tempo_map().exact_beat_at_frame (other->_position + offset, sub_num) - other->beat();
- _start_beats = Evoral::Beats (other->_start_beats.val().to_double() + offset_beat);
+ _start_beats = Evoral::Beats (_session.tempo_map().exact_beat_at_frame (other->_position + offset - other->_start, sub_num) - other->beat());
update_length_beats (sub_num);
register_properties ();
plist.add (Properties::length_beats, _length_beats);
plist.add (Properties::layer, 0);
- return boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true));
+ boost::shared_ptr<MidiRegion> ret (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true)));
+ ret->set_beat (beat());
+
+ return ret;
}
void
/** Note: this calls set_layer (..., DBL_MAX) so it will reset the layering index of region */
void
- Playlist::add_region (boost::shared_ptr<Region> region, framepos_t position, float times, bool auto_partition)
+ Playlist::add_region (boost::shared_ptr<Region> region, framepos_t position, float times, bool auto_partition, const int32_t& sub_num)
{
RegionWriteLock rlock (this);
times = fabs (times);
}
if (itimes >= 1) {
- add_region_internal (region, pos);
+ add_region_internal (region, pos, sub_num);
set_layer (region, DBL_MAX);
pos += region->length();
--itimes;
for (int i = 0; i < itimes; ++i) {
boost::shared_ptr<Region> copy = RegionFactory::create (region, true);
- add_region_internal (copy, pos);
+ add_region_internal (copy, pos, sub_num);
set_layer (copy, DBL_MAX);
pos += region->length();
}
plist.add (Properties::layer, region->layer());
boost::shared_ptr<Region> sub = RegionFactory::create (region, plist);
- add_region_internal (sub, pos);
+ add_region_internal (sub, pos, sub_num);
set_layer (sub, DBL_MAX);
}
}
}
bool
- Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t position)
+ Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t position, const int32_t& sub_num)
{
if (region->data_type() != _type) {
return false;
region->set_playlist (boost::weak_ptr<Playlist>(foo));
}
- region->set_position (position);
+ region->set_position (position, sub_num);
regions.insert (upper_bound (regions.begin(), regions.end(), region, cmp), region);
all_regions.insert (region);
chopped.
*/
- ret->paste (pl, (*i).start - start, 1.0f);
+ ret->paste (pl, (*i).start - start, 1.0f, 0);
}
}
}
int
- Playlist::paste (boost::shared_ptr<Playlist> other, framepos_t position, float times)
+ Playlist::paste (boost::shared_ptr<Playlist> other, framepos_t position, float times, const int32_t& sub_num)
{
times = fabs (times);
the ordering they had in the original playlist.
*/
- add_region_internal (copy_of_region, (*i)->position() + pos);
+ add_region_internal (copy_of_region, (*i)->position() + pos, sub_num);
set_layer (copy_of_region, copy_of_region->layer() + top);
}
pos += shift;
{
boost::shared_ptr<Playlist> pl = copy (range.start, range.length(), true);
framecnt_t offset = range.end - range.start;
- paste (pl, range.start + offset, times);
+ paste (pl, range.start + offset, times, 0);
}
void
for (list<AudioRange>::iterator i = ranges.begin(); i != ranges.end(); ++i) {
boost::shared_ptr<Playlist> pl = copy ((*i).start, (*i).length(), true);
- paste (pl, (*i).start + offset, 1.0f); // times ??
+ paste (pl, (*i).start + offset, 1.0f, 0); // times ??
}
}