#include "ardour/dB.h"
#include "ardour/location.h"
#include "ardour/midi_region.h"
+#include "ardour/midi_track.h"
#include "ardour/operations.h"
#include "ardour/playlist_factory.h"
#include "ardour/quantize.h"
return;
}
- Location *location = _session->locations()->first_location_after (playhead_cursor->current_frame);
+ framepos_t pos = _session->locations()->first_mark_after (playhead_cursor->current_frame);
- if (location) {
- _session->request_locate (location->start(), _session->transport_rolling());
- } else {
- _session->request_locate (_session->current_end_frame());
+ if (pos < 0) {
+ return;
}
+
+ _session->request_locate (pos, _session->transport_rolling());
}
void
return;
}
- Location *location = _session->locations()->first_location_before (playhead_cursor->current_frame);
+ framepos_t pos = _session->locations()->first_mark_before (playhead_cursor->current_frame);
- if (location) {
- _session->request_locate (location->start(), _session->transport_rolling());
- } else {
- _session->goto_start ();
+ if (pos < 0) {
+ return;
}
+
+ _session->request_locate (pos, _session->transport_rolling());
}
void
returns a single range.
*/
- if (mouse_mode == MouseRange && !selection->time.empty()) {
+ if (!selection->time.empty()) {
separate_regions_between (selection->time);
if (rtv && rtv->track() && replace && enable_processing && !rtv->track()->bounceable (rtv->track()->main_outs(), false)) {
MessageDialog d (
_("You can't perform this operation because the processing of the signal "
- "will cause one or more of the tracks will end up with a region with more channels than this track has inputs.\n\n"
+ "will cause one or more of the tracks to end up with a region with more channels than this track has inputs.\n\n"
"You can do this without processing, which is a different operation.")
);
d.set_title (_("Cannot bounce"));
bool
Editor::can_cut_copy () const
{
- switch (current_mouse_mode()) {
+ switch (effective_mouse_mode()) {
case MouseObject:
if (!selection->regions.empty() || !selection->points.empty()) {
}
}
- cut_buffer->clear ();
+ if ( op != Clear ) //"Delete" doesn't change copy/paste buf
+ cut_buffer->clear ();
if (entered_marker) {
if (internal_editing()) {
- switch (current_mouse_mode()) {
+ switch (effective_mouse_mode()) {
case MouseObject:
case MouseRange:
cut_copy_midi (op);
} else {
- RegionSelection rs;
+ RegionSelection rs;
- /* we only want to cut regions if some are selected */
+ /* we only want to cut regions if some are selected */
- if (doing_object_stuff()) {
- rs = get_regions_from_selection ();
- if (!rs.empty() || !selection->points.empty()) {
+ if (!selection->regions.empty()) {
+ rs = selection->regions;
+ }
+ switch (effective_mouse_mode()) {
+/*
+ * case MouseGain: {
+ //find regions's gain line
+ AudioRegionView *rview = dynamic_cast<AudioRegionView*>(clicked_regionview);
+ AutomationTimeAxisView *tview = dynamic_cast<AutomationTimeAxisView*>(clicked_trackview);
+ if (rview) {
+ AudioRegionGainLine *line = rview->get_gain_line();
+ if (!line) break;
+
+ //cut region gain points in the selection
+ AutomationList& alist (line->the_list());
+ XMLNode &before = alist.get_state();
+ AutomationList* what_we_got = 0;
+ if ((what_we_got = alist.cut (selection->time.front().start - rview->audio_region()->position(), selection->time.front().end - rview->audio_region()->position())) != 0) {
+ session->add_command(new MementoCommand<AutomationList>(alist, &before, &alist.get_state()));
+ delete what_we_got;
+ what_we_got = 0;
+ }
+
+ rview->set_envelope_visible(true);
+ rview->audio_region()->set_envelope_active(true);
+
+ } else if (tview) {
+ AutomationLine *line = *(tview->lines.begin());
+ if (!line) break;
+
+ //cut auto points in the selection
+ AutomationList& alist (line->the_list());
+ XMLNode &before = alist.get_state();
+ AutomationList* what_we_got = 0;
+ if ((what_we_got = alist.cut (selection->time.front().start, selection->time.front().end)) != 0) {
+ session->add_command(new MementoCommand<AutomationList>(alist, &before, &alist.get_state()));
+ delete what_we_got;
+ what_we_got = 0;
+ }
+ } else
+ break;
+ } break;
+*/
+ case MouseObject:
+ case MouseRange:
+ if (!rs.empty() || !selection->points.empty()) {
begin_reversible_command (opname + _(" objects"));
if (!rs.empty()) {
cut_copy_regions (op, rs);
-
+
if (op == Cut || op == Delete) {
selection->clear_regions ();
}
selection->clear_points ();
}
}
- commit_reversible_command ();
- goto out;
- }
- if (!selection->time.empty() && (_join_object_range_state == JOIN_OBJECT_RANGE_NONE)) {
- /* don't cause suprises */
- goto out;
- }
- }
- if (doing_range_stuff()) {
+ commit_reversible_command ();
+ break;
+ }
+
if (selection->time.empty()) {
framepos_t start, end;
if (!get_edit_op_range (start, end)) {
}
selection->set (start, end);
}
-
+
begin_reversible_command (opname + _(" range"));
cut_copy_ranges (op);
commit_reversible_command ();
-
+
if (op == Cut || op == Delete) {
selection->clear_time ();
}
+
+ break;
+
+ default:
+ break;
}
}
- out:
if (op == Delete || op == Cut || op == Clear) {
_drags->abort ();
}
_session->commit_reversible_command ();
}
+#ifdef WITH_VIDEOTIMELINE
+void
+Editor::toggle_region_video_lock ()
+{
+ if (_ignore_region_action) {
+ return;
+ }
+
+ RegionSelection rs = get_regions_from_selection_and_entered ();
+
+ if (!_session || rs.empty()) {
+ return;
+ }
+
+ _session->begin_reversible_command (_("Toggle Video Lock"));
+
+ for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
+ (*i)->region()->clear_changes ();
+ (*i)->region()->set_video_locked (!(*i)->region()->video_locked());
+ _session->add_command (new StatefulDiffCommand ((*i)->region()));
+ }
+
+ _session->commit_reversible_command ();
+}
+#endif
+
+
void
Editor::toggle_region_lock_style ()
{
void
Editor::split_region ()
{
- if (((mouse_mode == MouseRange) ||
- (mouse_mode != MouseObject && _join_object_range_state == JOIN_OBJECT_RANGE_RANGE)) &&
- !selection->time.empty()) {
+ if ( !selection->time.empty()) {
separate_regions_between (selection->time);
return;
}
} else if (t.frame() == start) {
_session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
} else {
- _session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), start);
+ Timecode::BBT_Time bbt;
+ _session->tempo_map().bbt_time (start, bbt);
+ _session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), bbt);
}
XMLNode& after (_session->tempo_map().get_state());