#include "rgb_macros.h"
#include <ardour/types.h>
+#include <ardour/profile.h>
#include <ardour/route.h>
#include <ardour/audio_track.h>
#include <ardour/audio_diskstream.h>
Selection::Operation op = Keyboard::selection_type (event->button.state);
bool press = (event->type == GDK_BUTTON_PRESS);
- begin_reversible_command (_("select on click"));
-
+ // begin_reversible_command (_("select on click"));
+
switch (item_type) {
case RegionItem:
if (mouse_mode != MouseRange) {
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
+ commit = set_selected_track_from_click (press, op, true);
if (mouse_mode != MouseRange) {
- commit = set_selected_control_point_from_click (op, false);
+ commit |= set_selected_control_point_from_click (op, false);
}
break;
break;
}
- if (commit) {
- commit_reversible_command ();
- }
+// if (commit) {
+// commit_reversible_command ();
+// }
}
bool
Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
- nframes_t where = event_frame (event, 0, 0);
-
track_canvas.grab_focus();
if (session && session->actively_recording()) {
case 3:
break;
- case 4:
- switch (mouse_mode) {
- case MouseZoom:
- //temporal_zoom_to_frame (true, where);
- if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Control)) {
- temporal_zoom_to_frame (true, where);
- }
- else {
- temporal_zoom_step (true);
- }
- break;
- default:
-
- if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::Alt))) {
- scroll_backward (0.6f);
- return true;
- }
- else if (Keyboard::no_modifier_keys_pressed (&event->button)) {
- scroll_tracks_up_line ();
- } else {
- if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift)) {
- if (clicked_trackview) {
- if (!current_stepping_trackview) {
- step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500);
- current_stepping_trackview = clicked_trackview;
- }
- gettimeofday (&last_track_height_step_timestamp, 0);
- current_stepping_trackview->step_height (true);
- }
- }
- else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Control)) {
- temporal_zoom_to_frame (true, where);
- }
- }
- }
- break;
-
- case 5:
- switch (mouse_mode) {
- case MouseZoom:
- // temporal_zoom_to_frame (false, where);
- if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Control)) {
- temporal_zoom_to_frame (false, where);
- }
- else {
- temporal_zoom_step (false);
- }
- break;
- default:
-
- if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::Alt))) {
- scroll_forward (0.6f);
- return true;
- }
- else if (Keyboard::no_modifier_keys_pressed (&event->button)) {
- scroll_tracks_down_line ();
- } else {
- if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift)) {
- if (clicked_trackview) {
- if (!current_stepping_trackview) {
- step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500);
- current_stepping_trackview = clicked_trackview;
- }
- gettimeofday (&last_track_height_step_timestamp, 0);
- current_stepping_trackview->step_height (false);
- }
- } else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Control)) {
- temporal_zoom_to_frame (false, where);
- }
- }
- }
- break;
-
default:
break;
case MouseGain:
// Gain only makes sense for audio regions
- if ( ! dynamic_cast<AudioRegionView*>(clicked_regionview))
+
+ if (!dynamic_cast<AudioRegionView*>(clicked_regionview)) {
break;
+ }
switch (item_type) {
case RegionItem:
if (mouse_mode == MouseGain) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
- line->property_fill_color_rgba() = color_map[cEnteredGainLine];
+ line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredGainLine.get();
if (is_drawable()) {
track_canvas.get_window()->set_cursor (*fader_cursor);
}
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
- line->property_fill_color_rgba() = color_map[cEnteredAutomationLine];
+ line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get();
}
if (is_drawable()) {
track_canvas.get_window()->set_cursor (*fader_cursor);
if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
break;
}
- marker->set_color_rgba (color_map[cEnteredMarker]);
+ marker->set_color_rgba (ARDOUR_UI::config()->canvasvar_EnteredMarker.get());
// fall through
case MeterMarkerItem:
case TempoMarkerItem:
*/
if (!drag_info.move_threshold_passed) {
- drag_info.move_threshold_passed = (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
+ bool x_threshold_passed = (abs ((nframes64_t) (drag_info.current_pointer_x - drag_info.grab_x)) > 4LL);
+ bool y_threshold_passed = (abs ((nframes64_t) (drag_info.current_pointer_y - drag_info.grab_y)) > 4LL);
+
+ drag_info.move_threshold_passed = (x_threshold_passed || y_threshold_passed);
- /* if we are dragging Regions we must also consider a change in track
- ** as passing the move threshold, otherwise e.g. copying regions to
- ** the same temporal position on a different track doesn't work.
- */
- if (drag_info.item_type == RegionItem) {
- RegionView* rv = reinterpret_cast<RegionView *> (drag_info.data);
- if (drag_info.last_trackview != &rv->get_time_axis_view()) {
- drag_info.move_threshold_passed = true;
- }
- }
-
// and change the initial grab loc/frame if this drag info wants us to
if (drag_info.want_move_threshold && drag_info.move_threshold_passed) {
drag_info.y_constrained = false;
}
- drag_info.grab_frame = event_frame(event, &drag_info.grab_x, &drag_info.grab_y);
+ drag_info.grab_frame = event_frame (event, &drag_info.grab_x, &drag_info.grab_y);
drag_info.last_pointer_frame = drag_info.grab_frame;
drag_info.current_pointer_frame = drag_info.grab_frame;
drag_info.current_pointer_x = drag_info.grab_x;
nframes_t pos;
nframes_t fade_length;
- if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
else {
if (drag_info.first_move) return;
- if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
} else {
pos = 0;
nframes_t pos;
nframes_t fade_length;
- if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
- }
- else {
+ } else {
pos = 0;
}
nframes_t pos;
nframes_t fade_length;
- if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
else {
if (session && drag_info.was_rolling) {
session->request_stop ();
- }
+ }
+
+ if (session && session->is_auditioning()) {
+ session->cancel_audition ();
+ }
}
drag_info.pointer_frame_offset = drag_info.grab_frame - cursor->current_frame;
Cursor* cursor = (Cursor *) drag_info.data;
nframes_t adjusted_frame;
- if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
else {
nframes_t newframe;
- if (drag_info.pointer_frame_offset <= (long) drag_info.current_pointer_frame) {
+ if (drag_info.pointer_frame_offset <= drag_info.current_pointer_frame) {
newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
- }
- else {
+ } else {
newframe = 0;
}
// The actual copying is not done before we reach the finish callback.
char name[64];
snprintf (name, sizeof(name), "%g/%g", meter_marker->meter().beats_per_bar(), meter_marker->meter().note_divisor ());
- MeterMarker* new_marker = new MeterMarker(*this, *meter_group, color_map[cMeterMarker], name,
+ MeterMarker* new_marker = new MeterMarker(*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), name,
*new MeterSection(meter_marker->meter()));
drag_info.item = &new_marker->the_item();
MeterMarker* marker = (MeterMarker *) drag_info.data;
nframes_t adjusted_frame;
- if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
else {
// The actual copying is not done before we reach the finish callback.
char name[64];
snprintf (name, sizeof (name), "%.2f", tempo_marker->tempo().beats_per_minute());
- TempoMarker* new_marker = new TempoMarker(*this, *tempo_group, color_map[cTempoMarker], name,
+ TempoMarker* new_marker = new TempoMarker(*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), name,
*new TempoSection(tempo_marker->tempo()));
drag_info.item = &new_marker->the_item();
TempoMarker* marker = (TempoMarker *) drag_info.data;
nframes_t adjusted_frame;
- if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
else {
drag_info.want_move_threshold = false; // don't copy again
- /* this is committed in the grab finished callback. */
-
- begin_reversible_command (_("Drag region copy"));
-
/* duplicate the region(s) */
-
+
vector<RegionView*> new_regionviews;
- set<boost::shared_ptr<Playlist> > affected_playlists;
- pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
-
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
RegionView* rv;
-
+ RegionView* nrv;
+ AudioRegionView* arv;
+
rv = (*i);
-
- boost::shared_ptr<Playlist> to_playlist = rv->region()->playlist();
- RouteTimeAxisView* atv = dynamic_cast<RouteTimeAxisView*>(&rv->get_time_axis_view());
- insert_result = affected_playlists.insert (to_playlist);
- if (insert_result.second) {
- session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
- }
-
- latest_regionview = 0;
-
- /* create a new region with the same name. */
-
- // FIXME: ew. need a (virtual) Region::duplicate() or something?
-
- boost::shared_ptr<Region> newregion;
- boost::shared_ptr<Region> ar;
-
- if ((ar = boost::dynamic_pointer_cast<AudioRegion>(rv->region())) != 0) {
- newregion = RegionFactory::create (ar);
+ if ((arv = dynamic_cast<AudioRegionView*>(rv)) == 0) {
+ /* XXX handle MIDI here */
+ continue;
}
- assert(newregion != 0);
- /* if the original region was locked, we don't care */
-
- newregion->set_locked (false);
-
- sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
- to_playlist->add_region (newregion, (nframes_t) (rv->region()->position() * atv->get_diskstream()->speed()));
+ nrv = new AudioRegionView (*arv);
+ nrv->get_canvas_group()->show ();
- c.disconnect ();
-
- if (latest_regionview) {
- new_regionviews.push_back (latest_regionview);
- }
+ new_regionviews.push_back (nrv);
}
if (new_regionviews.empty()) {
/* reset drag_info data to reflect the fact that we are dragging the copies */
drag_info.data = new_regionviews.front();
+
swap_grab (new_regionviews.front()->get_canvas_group (), 0, event->motion.time);
}
if (drag_info.move_threshold_passed) {
- if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
nframes_t sync_frame;
nframes_t sync_offset;
int32_t sync_dir;
pending_region_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
-
+
sync_offset = rv->region()->sync_offset (sync_dir);
sync_frame = rv->region()->adjust_to_sync (pending_region_position);
/* now compute the canvas unit distance we need to move the regiondrag_info.last_trackview->order
to make it appear at the new location.
*/
-
+
if (pending_region_position > drag_info.last_frame_position) {
x_delta = ((double) (pending_region_position - drag_info.last_frame_position) / frames_per_unit);
} else {
x_delta = -((double) (drag_info.last_frame_position - pending_region_position) / frames_per_unit);
}
-
+
drag_info.last_frame_position = pending_region_position;
} else {
return;
}
+
if (x_delta < 0) {
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
if (-x_delta > ix1) {
x_delta = -ix1;
}
- } else if ((x_delta > 0) &&(rv->region()->last_frame() > max_frames - x_delta)) {
+ } else if ((x_delta > 0) && (rv->region()->last_frame() > max_frames - x_delta)) {
x_delta = max_frames - rv->region()->last_frame();
}
+
if (drag_info.first_move) {
/* hide any dependent views */
rv->get_canvas_group()->raise_to_top();
rv->get_time_axis_view().canvas_display->raise_to_top();
cursor_group->raise_to_top();
-
- /* freeze the playlists from notifying till
- the motion is done.
- */
-
- AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (&rv->get_time_axis_view());
- if (atv && atv->is_audio_track()) {
- boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist>(atv->get_diskstream()->playlist());
- if (pl) {
- /* only freeze and capture state once */
-
- insert_result = motion_frozen_playlists.insert (pl);
- if (insert_result.second) {
- pl->freeze();
- session->add_command(new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
- }
- }
- }
-
- rv->region()->set_opaque(false);
+ rv->fake_set_opaque (true);
}
if (drag_info.brushing) {
RouteTimeAxisView* atv;
bool regionview_y_movement;
bool regionview_x_movement;
+ vector<RegionView*> copies;
/* first_move is set to false if the regionview has been moved in the
motion handler.
if (drag_info.brushing) {
/* all changes were made during motion event handlers */
+
+ if (drag_info.copy) {
+ for (list<RegionView*>::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+ copies.push_back (*i);
+ }
+ }
+
goto out;
}
//printf ("last_frame: %s position is %lu %g\n", rv->get_time_axis_view().name().c_str(), drag_info.last_frame_position, speed);
//printf ("last_rackview: %s \n", drag_info.last_trackview->name().c_str());
- if (regionview_y_movement) {
+ char* op_string;
- /* motion between tracks */
+ if (drag_info.copy) {
+ if (drag_info.x_constrained) {
+ op_string = _("fixed time region copy");
+ } else {
+ op_string = _("region copy");
+ }
+ } else {
+ if (drag_info.x_constrained) {
+ op_string = _("fixed time region drag");
+ } else {
+ op_string = _("region drag");
+ }
+ }
- list<RegionView*> new_selection;
-
- /* moved to a different audio track. */
+ begin_reversible_command (op_string);
- for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ) {
-
- RegionView* rv2 = (*i);
-
- /* the region that used to be in the old playlist is not
- moved to the new one - we make a copy of it. as a result,
- any existing editor for the region should no longer be
- visible.
- */
-
- if (!drag_info.copy) {
- rv2->hide_region_editor();
- }
- new_selection.push_back (rv2);
- i++;
- }
+ if (regionview_y_movement) {
- /* first, freeze the target tracks */
+ /* moved to a different audio track. */
+
+ vector<RegionView*> new_selection;
- for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end();i++ ) {
+ for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ) {
+
+ RegionView* rv = (*i);
- boost::shared_ptr<Playlist> from_playlist;
- boost::shared_ptr<Playlist> to_playlist;
-
double ix1, ix2, iy1, iy2;
-
- (*i)->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
- (*i)->get_canvas_group()->i2w (ix1, iy1);
+
+ rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
+ rv->get_canvas_group()->i2w (ix1, iy1);
TimeAxisView* tvp2 = trackview_by_y_position (iy1);
AudioTimeAxisView* atv2 = dynamic_cast<AudioTimeAxisView*>(tvp2);
- (*i)->region()->set_opaque (true);
-
- from_playlist = (*i)->region()->playlist();
- to_playlist = atv2->playlist();
+ boost::shared_ptr<Playlist> from_playlist = rv->region()->playlist();
+ boost::shared_ptr<Playlist> to_playlist = atv2->playlist();
- /* the from_playlist was frozen in the "first_move" case
- of the motion handler. the insert can fail,
- but that doesn't matter. it just means
- we already have the playlist in the list.
- */
-
- motion_frozen_playlists.insert (from_playlist);
+ where = (nframes_t) (unit_to_frame (ix1) * speed);
+ boost::shared_ptr<Region> new_region (RegionFactory::create (rv->region()));
- /* only freeze the to_playlist once */
+ /* undo the previous hide_dependent_views so that xfades don't
+ disappear on copying regions
+ */
- insert_result = motion_frozen_playlists.insert(to_playlist);
- if (insert_result.second) {
- to_playlist->freeze();
- session->add_command(new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
- }
+ rv->get_time_axis_view().reveal_dependent_views (*rv);
- }
+ if (!drag_info.copy) {
+
+ /* the region that used to be in the old playlist is not
+ moved to the new one - we make a copy of it. as a result,
+ any existing editor for the region should no longer be
+ visible.
+ */
+
+ rv->hide_region_editor();
+ rv->fake_set_opaque (false);
- /* now do it again with the actual operations */
+ session->add_command (new MementoCommand<Playlist>(*from_playlist, &from_playlist->get_state(), 0));
+ from_playlist->remove_region ((rv->region()));
+ session->add_command (new MementoCommand<Playlist>(*from_playlist, 0, &from_playlist->get_state()));
- for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end();i++ ) {
+ } else {
- boost::shared_ptr<Playlist> from_playlist;
- boost::shared_ptr<Playlist> to_playlist;
+ /* the regionview we dragged around is a temporary copy, queue it for deletion */
- double ix1, ix2, iy1, iy2;
-
- (*i)->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
- (*i)->get_canvas_group()->i2w (ix1, iy1);
- TimeAxisView* tvp2 = trackview_by_y_position (iy1);
- AudioTimeAxisView* atv2 = dynamic_cast<AudioTimeAxisView*>(tvp2);
-
- from_playlist = (*i)->region()->playlist();
- to_playlist = atv2->playlist();
+ copies.push_back (rv);
+ }
latest_regionview = 0;
-
- where = (nframes_t) (unit_to_frame (ix1) * speed);
- boost::shared_ptr<Region> new_region (RegionFactory::create ((*i)->region()));
-
- from_playlist->remove_region (((*i)->region()));
sigc::connection c = atv2->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
+ session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
to_playlist->add_region (new_region, where);
+ session->add_command (new MementoCommand<Playlist>(*to_playlist, 0, &to_playlist->get_state()));
c.disconnect ();
if (latest_regionview) {
- selection->add (latest_regionview);
+ new_selection.push_back (latest_regionview);
+ }
+
+ /* OK, this is where it gets tricky. If the playlist was being used by >1 tracks, and the region
+ was selected in all of them, then removing it from the playlist will have removed all
+ trace of it from the selection (i.e. there were N regions selected, we removed 1,
+ but since its the same playlist for N tracks, all N tracks updated themselves, removed the
+ corresponding regionview, and the selection is now empty).
+
+ this could have invalidated any and all iterators into the region selection.
+
+ the heuristic we use here is: if the region selection is empty, break out of the loop
+ here. if the region selection is not empty, then restart the loop because we know that
+ we must have removed at least the region(view) we've just been working on as well as any
+ that we processed on previous iterations.
+
+ EXCEPT .... if we are doing a copy drag, then the selection hasn't been modified and
+ we can just iterate.
+ */
+
+ if (drag_info.copy) {
+ ++i;
+ } else {
+ if (selection->regions.empty()) {
+ break;
+ } else {
+ i = selection->regions.by_layer().begin();
+ }
}
}
+ selection->set (new_selection);
+
} else {
/* motion within a single track */
+
+ list<RegionView*> regions = selection->regions.by_layer();
+
+ if (drag_info.copy) {
+ selection->clear_regions();
+ }
- for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
+ for (list<RegionView*>::iterator i = regions.begin(); i != regions.end(); ++i) {
rv = (*i);
continue;
}
+
if (regionview_x_movement) {
double ownspeed = 1.0;
- AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (&(rv->get_time_axis_view()));
+ atv = dynamic_cast<AudioTimeAxisView*> (&(rv->get_time_axis_view()));
if (atv && atv->get_diskstream()) {
ownspeed = atv->get_diskstream()->speed();
where = rv->region()->position();
}
- rv->get_time_axis_view().reveal_dependent_views (*rv);
+ boost::shared_ptr<Playlist> to_playlist = rv->region()->playlist();
- /* no need to add an undo here, we did that when we added this playlist to motion_frozen playlists */
-
- rv->region()->set_position (where, (void *) this);
- rv->region()->set_opaque (true);
+ assert (to_playlist);
+
+ /* add the undo */
+
+ session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
+
+ if (drag_info.copy) {
+
+ boost::shared_ptr<Region> newregion;
+ boost::shared_ptr<Region> ar;
+
+ if ((ar = boost::dynamic_pointer_cast<AudioRegion>(rv->region())) != 0) {
+ newregion = RegionFactory::create (ar);
+ } else {
+ /* XXX MIDI HERE drobilla */
+ continue;
+ }
+
+ /* add it */
+
+ latest_regionview = 0;
+ sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
+ to_playlist->add_region (newregion, (nframes_t) (where * atv->get_diskstream()->speed()));
+ c.disconnect ();
+
+ if (latest_regionview) {
+ atv->reveal_dependent_views (*latest_regionview);
+ selection->add (latest_regionview);
+ }
+
+ /* if the original region was locked, we don't care for the new one */
+
+ newregion->set_locked (false);
+
+ } else {
+
+ /* just change the model */
+
+ rv->region()->set_position (where, (void*) this);
+
+ }
+
+ /* add the redo */
+
+ session->add_command (new MementoCommand<Playlist>(*to_playlist, 0, &to_playlist->get_state()));
+
+ if (drag_info.copy) {
+ copies.push_back (rv);
+ }
}
}
out:
- for (set<boost::shared_ptr<Playlist> >::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) {
- (*p)->thaw ();
- session->add_command (new MementoCommand<Playlist>(*((*p).get()), 0, & (*p)->get_state()));
- }
-
- motion_frozen_playlists.clear ();
-
+
if (!nocommit) {
commit_reversible_command ();
}
+
+ for (vector<RegionView*>::iterator x = copies.begin(); x != copies.end(); ++x) {
+ delete *x;
+ }
}
void
return;
}
- switch (ARDOUR_UI::instance()->secondary_clock.mode ()) {
+ switch (Profile->get_small_screen() ? ARDOUR_UI::instance()->primary_clock.mode () : ARDOUR_UI::instance()->secondary_clock.mode ()) {
case AudioClock::BBT:
session->bbt_time (frame, bbt);
snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
nframes_t length;
nframes_t pending_position;
- if ((int32_t) drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pending_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
- }
- else {
+ } else {
pending_position = 0;
}
nframes_t region_end = (nframes_t) (clicked_regionview->region()->last_frame() / speed);
nframes_t region_length = (nframes_t) (clicked_regionview->region()->length() / speed);
- motion_frozen_playlists.clear();
-
//drag_info.item = clicked_regionview->get_name_highlight();
drag_info.item = item;
drag_info.motion_callback = &Editor::trim_motion_callback;
begin_reversible_command (trim_type);
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
- (*i)->region()->set_opaque(false);
+ (*i)->fake_set_opaque(false);
(*i)->region()->freeze ();
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
i != selection->regions.by_layer().end(); ++i)
{
thaw_region_after_trim (**i);
- (*i)->region()->set_opaque(true);
+ (*i)->fake_set_opaque (true);
}
}
switch (mouse_mode) {
case MouseObject:
/* find the two markers on either side and then make the selection from it */
- cerr << "select between " << start << " .. " << end << endl;
- select_all_within (start, end, 0.0f, FLT_MAX, Selection::Set);
+ select_all_within (start, end, 0.0f, FLT_MAX, track_views, Selection::Set);
break;
case MouseRange:
begin_reversible_command (_("rubberband selection"));
if (drag_info.grab_frame < drag_info.last_pointer_frame) {
- commit = select_all_within (drag_info.grab_frame, drag_info.last_pointer_frame, y1, y2, op);
+ commit = select_all_within (drag_info.grab_frame, drag_info.last_pointer_frame, y1, y2, track_views, op);
} else {
- commit = select_all_within (drag_info.last_pointer_frame, drag_info.grab_frame, y1, y2, op);
+ commit = select_all_within (drag_info.last_pointer_frame, drag_info.grab_frame, y1, y2, track_views, op);
}
if (commit) {
string str;
prompter.get_result(str);
if (str.length()) {
- clicked_regionview->region()->set_name (str);
+ clicked_regionview->region()->set_name (str);
}
break;
}