#include "utils.h"
#include "editor_drag.h"
#include "strip_silence_dialog.h"
-#include "editor_route_list.h"
+#include "editor_routes.h"
+#include "editor_regions.h"
#include "i18n.h"
}
boost::shared_ptr<Region>
-Editor::select_region_for_operation (int dir, TimeAxisView **tv)
+Editor::select_region_for_operation (int /*dir*/, TimeAxisView **tv)
{
RegionView* rv;
boost::shared_ptr<Region> region;
/* hide irrelevant tracks */
- _route_list->suspend_redisplay ();
+ _routes->suspend_redisplay ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if (find (tracks.begin(), tracks.end(), (*i)) == tracks.end()) {
}
}
- _route_list->resume_redisplay ();
+ _routes->resume_redisplay ();
vertical_adjustment.set_value (0.0);
no_save_visual = false;
}
void
-Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op)
+Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & /*op*/)
{
if (!session) return;
if ((playlist = tv->playlist()) == 0) {
return;
}
-
- Glib::RefPtr<TreeSelection> selected = region_list_display.get_selection();
-
- if (selected->count_selected_rows() != 1) {
+
+ boost::shared_ptr<Region> region = _regions->get_single_selection ();
+ if (region == 0) {
return;
}
-
- TreeView::Selection::ListHandle_Path rows = selected->get_selected_rows ();
-
- /* only one row selected, so rows.begin() is it */
-
- TreeIter iter;
-
- if ((iter = region_list_model->get_iter (*rows.begin()))) {
-
- boost::shared_ptr<Region> region = (*iter)[region_list_columns.region];
- begin_reversible_command (_("insert region"));
- XMLNode &before = playlist->get_state();
- playlist->add_region ((RegionFactory::create (region)), get_preferred_edit_position(), times);
- session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
- commit_reversible_command ();
- }
+ begin_reversible_command (_("insert region"));
+ XMLNode &before = playlist->get_state();
+ playlist->add_region ((RegionFactory::create (region)), get_preferred_edit_position(), times);
+ session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ commit_reversible_command ();
}
/* BUILT-IN EFFECTS */
strip_whitespace_edges (str);
if (!str.empty()) {
rs.front()->region()->set_name (str);
- redisplay_regions ();
+ _regions->redisplay ();
}
}
}
nframes64_t start = selection->time[clicked_selection].start;
nframes64_t end = selection->time[clicked_selection].end;
+ TrackSelection tracks = get_tracks_for_range_action ();
+
nframes64_t selection_cnt = end - start + 1;
- for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+ for (TrackSelection::iterator i = tracks.begin(); i != tracks.end(); ++i) {
boost::shared_ptr<Region> current;
boost::shared_ptr<Playlist> pl;
nframes64_t internal_start;
}
}
-void
-Editor::separate_regions_between (const TimeSelection& ts)
+/** Return either:
+ * - selected tracks, or if there are none...
+ * - tracks containing selected regions, or if there are none...
+ * - all tracks
+ * @return tracks.
+ */
+TrackSelection
+Editor::get_tracks_for_range_action () const
{
- bool in_command = false;
- boost::shared_ptr<Playlist> playlist;
- RegionSelection new_selection;
- TrackSelection tmptracks;
-
+ TrackSelection t;
+
if (selection->tracks.empty()) {
/* use tracks with selected regions */
- RegionSelection rs;
-
- get_regions_for_action (rs);
+ RegionSelection rs = selection->regions;
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
TimeAxisView* tv = &(*i)->get_time_axis_view();
- if (find (tmptracks.begin(), tmptracks.end(), tv) == tmptracks.end()) {
- tmptracks.push_back (tv);
+ if (!t.contains (tv)) {
+ t.push_back (tv);
}
}
- if (tmptracks.empty()) {
- /* no regions selected: do nothing */
- return;
+ if (t.empty()) {
+ /* no regions and no tracks: use all tracks */
+ t = track_views;
}
} else {
- tmptracks = selection->tracks;
-
+ t = selection->tracks;
}
+ return t;
+}
+
+void
+Editor::separate_regions_between (const TimeSelection& ts)
+{
+ bool in_command = false;
+ boost::shared_ptr<Playlist> playlist;
+ RegionSelection new_selection;
+
+ TrackSelection tmptracks = get_tracks_for_range_action ();
sort_track_selection (&tmptracks);
for (TrackSelection::iterator i = tmptracks.begin(); i != tmptracks.end(); ++i) {
}
}
+/** Take tracks from get_tracks_for_range_action and cut any regions
+ * on those tracks so that the tracks are empty over the time
+ * selection.
+ */
void
Editor::separate_region_from_selection ()
{
return;
}
-
- Glib::RefPtr<TreeSelection> selected = region_list_display.get_selection();
-
- if (selected->count_selected_rows() != 1) {
+ boost::shared_ptr<Region> region = _regions->get_single_selection ();
+ if (region == 0) {
return;
}
- TreeModel::iterator i = region_list_display.get_selection()->get_selected();
- boost::shared_ptr<Region> region = (*i)[region_list_columns.region];
-
nframes64_t start = selection->time[clicked_selection].start;
nframes64_t end = selection->time[clicked_selection].end;
}
gint
-Editor::freeze_progress_timeout (void *arg)
+Editor::freeze_progress_timeout (void */*arg*/)
{
interthread_progress_bar.set_fraction (current_interthread_info->progress);
return !(current_interthread_info->done || current_interthread_info->cancel);
return;
}
- RegionSelection rs;
-
- /* we only want to cut regions if some are selected */
-
- if (!selection->regions.empty()) {
- get_regions_for_action (rs);
- }
+ if (internal_editing()) {
- switch (current_mouse_mode()) {
- case MouseObject:
- if (!rs.empty() || !selection->points.empty()) {
+ switch (current_mouse_mode()) {
+ case MouseObject:
+ case MouseRange:
+ cut_copy_midi (op);
+ break;
+ default:
+ break;
+ }
+
+ } else {
+
+ RegionSelection rs;
+
+ /* we only want to cut regions if some are selected */
+
+ if (!selection->regions.empty()) {
+ get_regions_for_action (rs);
+ }
+
+ switch (current_mouse_mode()) {
+ case MouseObject:
+ if (!rs.empty() || !selection->points.empty()) {
- begin_reversible_command (opname + _(" objects"));
+ begin_reversible_command (opname + _(" objects"));
- if (!rs.empty()) {
- cut_copy_regions (op, rs);
+ if (!rs.empty()) {
+ cut_copy_regions (op, rs);
- if (op == Cut) {
- selection->clear_regions ();
+ if (op == Cut) {
+ selection->clear_regions ();
+ }
}
- }
- if (!selection->points.empty()) {
- cut_copy_points (op);
+ if (!selection->points.empty()) {
+ cut_copy_points (op);
- if (op == Cut) {
- selection->clear_points ();
+ if (op == Cut) {
+ selection->clear_points ();
+ }
}
- }
- commit_reversible_command ();
- break; // terminate case statement here
- }
- if (!selection->time.empty()) {
- /* don't cause suprises */
- break;
- }
- // fall thru if there was nothing selected
+ commit_reversible_command ();
+ break; // terminate case statement here
+ }
+ if (!selection->time.empty()) {
+ /* don't cause suprises */
+ break;
+ }
+ // fall thru if there was nothing selected
- case MouseRange:
- if (selection->time.empty()) {
- nframes64_t start, end;
- if (!get_edit_op_range (start, end)) {
- return;
+ case MouseRange:
+ if (selection->time.empty()) {
+ nframes64_t start, end;
+ if (!get_edit_op_range (start, end)) {
+ return;
+ }
+ selection->set ((TimeAxisView*) 0, start, end);
}
- selection->set ((TimeAxisView*) 0, start, end);
- }
- begin_reversible_command (opname + _(" range"));
- cut_copy_ranges (op);
- commit_reversible_command ();
+ begin_reversible_command (opname + _(" range"));
+ cut_copy_ranges (op);
+ commit_reversible_command ();
- if (op == Cut) {
- selection->clear_time ();
- }
+ if (op == Cut) {
+ selection->clear_time ();
+ }
- break;
+ break;
- default:
- break;
+ default:
+ break;
+ }
}
-
-
+
if (op == Cut || op == Clear) {
break_drag ();
delete _drag;
}
}
+/** Cut, copy or clear selected automation points.
+ * @param op Operation (Cut, Copy or Clear)
+ */
+void
+Editor::cut_copy_midi (CutCopyOp op)
+{
+ cerr << "CCM: there are " << selection->midi.size() << " MRV's to work on\n";
+
+ for (MidiSelection::iterator i = selection->midi.begin(); i != selection->midi.end(); ++i) {
+ MidiRegionView* mrv = *i;
+ mrv->cut_copy_clear (op);
+ }
+}
+
struct PlaylistState {
boost::shared_ptr<Playlist> playlist;
XMLNode* before;
/* get everything in the correct order */
-
if (!selection->tracks.empty()) {
sort_track_selection ();
ts = selection->tracks;
fit_tracks (selection->tracks);
}
-void
-Editor::fit_route_group (RouteGroup *g)
-{
- TrackSelection ts = axis_views_from_routes (g->route_list ());
- fit_tracks (ts);
-}
-
void
Editor::fit_tracks (TrackSelection & tracks)
{