#include "editor_routes.h"
#include "editor_regions.h"
#include "quantize_dialog.h"
+#include "interthread_progress_window.h"
#include "i18n.h"
boost::shared_ptr<Playlist> pl = (*a)->region()->playlist();
- if (! pl->frozen()) {
+ if (!pl) {
+ a = tmp;
+ continue;
+ }
+
+ if (!pl->frozen()) {
/* we haven't seen this playlist before */
/* remember used playlists so we can thaw them later */
pl->freeze();
}
- AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*a);
- if (arv) {
- _new_regionviews_show_envelope = arv->envelope_visible();
- }
-
if (pl) {
pl->clear_history ();
pl->split_region ((*a)->region(), where);
}
commit_reversible_command ();
- _new_regionviews_show_envelope = false;
}
boost::shared_ptr<Region>
distance = next_distance;
}
- XMLNode &before = r->playlist()->get_state();
+ r->clear_history ();
r->set_position (r->position() + distance, this);
- XMLNode &after = r->playlist()->get_state();
- _session->add_command (new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command (new StatefulDiffCommand (r));
}
commit_reversible_command ();
if (next) {
distance = next_distance;
}
-
- XMLNode &before = r->playlist()->get_state();
+
+ r->clear_history ();
if (r->position() > distance) {
r->set_position (r->position() - distance, this);
} else {
r->set_position (0, this);
}
- XMLNode &after = r->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command (new StatefulDiffCommand (r));
}
commit_reversible_command ();
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
boost::shared_ptr<Region> r ((*i)->region());
- XMLNode &before = r->playlist()->get_state();
+ r->clear_history ();
r->set_position (r->position() + distance, this);
- XMLNode &after = r->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (r));
}
commit_reversible_command ();
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
boost::shared_ptr<Region> r ((*i)->region());
- XMLNode &before = r->playlist()->get_state();
+ r->clear_history ();
if (r->position() > distance) {
r->set_position (r->position() - distance, this);
} else {
r->set_position (0, this);
}
- XMLNode &after = r->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (r));
}
commit_reversible_command ();
void
Editor::build_region_boundary_cache ()
{
- nframes64_t pos = 0;
+ framepos_t pos = 0;
vector<RegionPoint> interesting_points;
boost::shared_ptr<Region> r;
TrackViewList tracks;
while (pos < _session->current_end_frame() && !at_end) {
- nframes64_t rpos;
- nframes64_t lpos = max_frames;
+ framepos_t rpos;
+ framepos_t lpos = max_frames;
for (vector<RegionPoint>::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) {
RouteTimeAxisView *rtav;
if (ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0 ) {
- if (rtav->get_diskstream() != 0) {
- speed = rtav->get_diskstream()->speed();
+ if (rtav->track() != 0) {
+ speed = rtav->track()->speed();
}
}
to sort later.
*/
- vector<nframes64_t>::iterator ri;
+ vector<framepos_t>::iterator ri;
for (ri = region_boundary_cache.begin(); ri != region_boundary_cache.end(); ++ri) {
if (*ri == rpos) {
/* finally sort to be sure that the order is correct */
sort (region_boundary_cache.begin(), region_boundary_cache.end());
+
+ cerr << "RBC contains " << region_boundary_cache.size() << endl;
+
+ for (vector<framepos_t>::iterator x = region_boundary_cache.begin(); x != region_boundary_cache.end(); ++x) {
+ cerr << "Region boundary @ " << *x << endl;
+ }
}
boost::shared_ptr<Region>
-Editor::find_next_region (nframes64_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack)
+Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack)
{
TrackViewList::iterator i;
nframes64_t closest = max_frames;
boost::shared_ptr<Region> ret;
- nframes64_t rpos = 0;
+ framepos_t rpos = 0;
float track_speed;
- nframes64_t track_frame;
+ framepos_t track_frame;
RouteTimeAxisView *rtav;
for (i = tracks.begin(); i != tracks.end(); ++i) {
- nframes64_t distance;
+ framecnt_t distance;
boost::shared_ptr<Region> r;
track_speed = 1.0f;
if ( (rtav = dynamic_cast<RouteTimeAxisView*>(*i)) != 0 ) {
- if (rtav->get_diskstream()!=0)
- track_speed = rtav->get_diskstream()->speed();
+ if (rtav->track()!=0)
+ track_speed = rtav->track()->speed();
}
track_frame = session_frame_to_track_frame(frame, track_speed);
return ret;
}
-nframes64_t
-Editor::find_next_region_boundary (nframes64_t pos, int32_t dir, const TrackViewList& tracks)
+framepos_t
+Editor::find_next_region_boundary (framepos_t pos, int32_t dir, const TrackViewList& tracks)
{
- nframes64_t distance = max_frames;
- nframes64_t current_nearest = -1;
-
+ framecnt_t distance = max_frames;
+ framepos_t current_nearest = -1;
for (TrackViewList::const_iterator i = tracks.begin(); i != tracks.end(); ++i) {
- nframes64_t contender;
- nframes64_t d;
-
+ framepos_t contender;
+ framecnt_t d;
+
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i);
if (!rtv) {
return current_nearest;
}
-nframes64_t
-Editor::get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen)
+framepos_t
+Editor::get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen)
{
- nframes64_t target;
+ framepos_t target;
TrackViewList tvl;
if (with_selection && Config->get_region_boundaries_from_selected_tracks()) {
RouteTimeAxisView *rtav;
if ( ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0 ) {
- if (rtav->get_diskstream() != 0) {
- speed = rtav->get_diskstream()->speed();
+ if (rtav->track() != 0) {
+ speed = rtav->track()->speed();
}
}
RouteTimeAxisView *rtav;
if (ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0) {
- if (rtav->get_diskstream() != 0) {
- speed = rtav->get_diskstream()->speed();
+ if (rtav->track() != 0) {
+ speed = rtav->track()->speed();
}
}
/* XXX this limit is also in ::set_frames_per_unit() */
- if (frames_per_unit <= 2.0 && fpu <= frames_per_unit) {
+ if (frames_per_unit <= 1.0 && fpu <= frames_per_unit) {
return;
}
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if (find (tracks.begin(), tracks.end(), (*i)) == tracks.end()) {
- hide_track_in_display (**i, true);
+ hide_track_in_display (*i, true);
}
}
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_session)
if (_session) {
- temporal_zoom_by_frame (_session->current_start_frame(), _session->current_end_frame(), "zoom to _session");
+ nframes_t const l = _session->current_end_frame() - _session->current_start_frame();
+ double s = _session->current_start_frame() - l * 0.01;
+ if (s < 0) {
+ s = 0;
+ }
+ nframes_t const e = _session->current_end_frame() + l * 0.01;
+ temporal_zoom_by_frame (nframes_t (s), e, "zoom to _session");
}
}
_session->begin_reversible_command (rs.size () > 1 ? _("add markers") : _("add marker"));
XMLNode &before = _session->locations()->get_state();
- cerr << "Add locations\n";
-
for (RegionSelection::iterator i = rs.begin (); i != rs.end (); ++i) {
boost::shared_ptr<Region> region = (*i)->region ();
return;
}
- cerr << "Add location\n";
-
// single range spanning all selected
Location *location = new Location (rs.start(), rs.end_frame(), markername, Location::IsRangeMarker);
_session->locations()->add (location, true);
boost::shared_ptr<Playlist> playlist;
track_canvas->window_to_world (x, y, wx, wy);
- //wx += horizontal_adjustment.get_value();
- //wy += vertical_adjustment.get_value();
GdkEvent event;
event.type = GDK_BUTTON_RELEASE;
snap_to (where);
begin_reversible_command (_("insert dragged region"));
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
playlist->add_region (RegionFactory::create (region), where, 1.0);
- _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command(new StatefulDiffCommand (playlist));
commit_reversible_command ();
}
void
-Editor::insert_route_list_drag (boost::shared_ptr<Route> route, int x, int y) {
+Editor::insert_route_list_drag (boost::shared_ptr<Route> route, int x, int y)
+{
double wx, wy;
double cx, cy;
nframes_t where;
RouteTimeAxisView *source_rtv = 0;
track_canvas->window_to_world (x, y, wx, wy);
- wx += horizontal_adjustment.get_value();
+ wx += horizontal_position ();
wy += vertical_adjustment.get_value();
GdkEvent event;
}
begin_reversible_command (_("insert region"));
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
playlist->add_region ((RegionFactory::create (region)), get_preferred_edit_position(), times);
- _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command(new StatefulDiffCommand (playlist));
commit_reversible_command ();
}
d.get_vbox()->set_border_width (12);
d.get_vbox()->pack_start (hbox, false, false);
- d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
d.set_size_request (300, -1);
d.set_position (Gtk::WIN_POS_MOUSE);
_session->audition_region (region);
}
-void
-Editor::build_interthread_progress_window ()
-{
- interthread_progress_window = new ArdourDialog (X_("interthread progress"), true);
-
- interthread_progress_bar.set_orientation (Gtk::PROGRESS_LEFT_TO_RIGHT);
-
- interthread_progress_window->set_border_width (12);
- interthread_progress_window->get_vbox()->set_spacing (6);
-
- interthread_progress_label.set_alignment (0.5, 0.5);
-
- interthread_progress_window->get_vbox()->pack_start (interthread_progress_label, false, false);
- interthread_progress_window->get_vbox()->pack_start (interthread_progress_bar,false, false);
-
- // GTK2FIX: this button needs a modifiable label
-
- Button* b = interthread_progress_window->add_button (Stock::CANCEL, RESPONSE_CANCEL);
- b->signal_clicked().connect (sigc::mem_fun(*this, &Editor::interthread_cancel_clicked));
-
- interthread_cancel_button.add (interthread_cancel_label);
-
- interthread_progress_window->set_default_size (200, 100);
-}
-
-void
-Editor::interthread_cancel_clicked ()
-{
- if (current_interthread_info) {
- current_interthread_info->cancel = true;
- }
-}
-
void
Editor::region_from_selection ()
{
}
internal_start = start - current->position();
- _session->region_name (new_name, current->name(), true);
+ RegionFactory::region_name (new_name, current->name(), true);
PropertyList plist;
- plist.add (ARDOUR::Properties::start, internal_start);
+ plist.add (ARDOUR::Properties::start, current->start() + internal_start);
plist.add (ARDOUR::Properties::length, selection_cnt);
plist.add (ARDOUR::Properties::name, new_name);
plist.add (ARDOUR::Properties::layer, 0);
}
internal_start = start - current->position();
- _session->region_name (new_name, current->name(), true);
+ RegionFactory::region_name (new_name, current->name(), true);
PropertyList plist;
- plist.add (ARDOUR::Properties::start, internal_start);
+ plist.add (ARDOUR::Properties::start, current->start() + internal_start);
plist.add (ARDOUR::Properties::length, end - start + 1);
plist.add (ARDOUR::Properties::name, new_name);
/* no edits to destructive tracks */
- if (rtv->track()->diskstream()->destructive()) {
+ if (rtv->track()->destructive()) {
continue;
}
if ((playlist = rtv->playlist()) != 0) {
- XMLNode *before;
- bool got_some;
-
- before = &(playlist->get_state());
- got_some = false;
+ playlist->clear_history ();
/* XXX need to consider musical time selections here at some point */
- double speed = rtv->get_diskstream()->speed();
+ double speed = rtv->track()->speed();
for (list<AudioRange>::const_iterator t = ts.begin(); t != ts.end(); ++t) {
sigc::connection c = rtv->view()->RegionViewAdded.connect (
sigc::mem_fun(*this, &Editor::collect_new_region_view));
+
latest_regionviews.clear ();
playlist->partition ((nframes64_t)((*t).start * speed),
- (nframes64_t)((*t).end * speed), true);
+ (nframes64_t)((*t).end * speed), false);
c.disconnect ();
if (!latest_regionviews.empty()) {
- got_some = true;
-
rtv->view()->foreach_regionview (sigc::bind (
sigc::ptr_fun (add_if_covered),
&(*t), &new_selection));
-
+
if (!in_command) {
begin_reversible_command (_("separate"));
in_command = true;
}
+
+ /* pick up changes to existing regions */
- _session->add_command(new MementoCommand<Playlist>(
- *playlist, before, &playlist->get_state()));
- }
- }
+ vector<StatefulDiffCommand*> cmds;
+ playlist->rdiff (cmds);
+ for (vector<StatefulDiffCommand*>::iterator j = cmds.begin(); j != cmds.end(); ++j) {
+ _session->add_command (*j);
+ }
+
+ /* pick up changes to the playlist itself (adds/removes)
+ */
- if (!got_some) {
- delete before;
+ _session->add_command(new StatefulDiffCommand (playlist));
+ }
}
}
}
}
}
+struct PlaylistState {
+ boost::shared_ptr<Playlist> playlist;
+ XMLNode* before;
+};
+
/** 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.
separate_regions_between (ts);
}
+/** Separate regions under the selected region */
+void
+Editor::separate_under_selected_regions ()
+{
+ RegionSelection rs;
+ get_regions_for_action (rs);
+
+ vector<PlaylistState> playlists;
+
+ if (!_session) {
+ return;
+ }
+
+ if (rs.empty()) {
+ return;
+ }
+
+ begin_reversible_command (_("separate region under"));
+
+ list<boost::shared_ptr<Region> > regions_to_remove;
+
+ for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
+ // we can't just remove the region(s) in this loop because
+ // this removes them from the RegionSelection, and they thus
+ // disappear from underneath the iterator, and the ++i above
+ // SEGVs in a puzzling fashion.
+
+ // so, first iterate over the regions to be removed from rs and
+ // add them to the regions_to_remove list, and then
+ // iterate over the list to actually remove them.
+
+ regions_to_remove.push_back ((*i)->region());
+ }
+
+ for (list<boost::shared_ptr<Region> >::iterator rl = regions_to_remove.begin(); rl != regions_to_remove.end(); ++rl) {
+
+ boost::shared_ptr<Playlist> playlist = (*rl)->playlist();
+
+ if (!playlist) {
+ // is this check necessary?
+ continue;
+ }
+
+ vector<PlaylistState>::iterator i;
+
+ //only take state if this is a new playlist.
+ for (i = playlists.begin(); i != playlists.end(); ++i) {
+ if ((*i).playlist == playlist) {
+ break;
+ }
+ }
+
+ if (i == playlists.end()) {
+
+ PlaylistState before;
+ before.playlist = playlist;
+ before.before = &playlist->get_state();
+
+ playlist->freeze ();
+ playlists.push_back(before);
+ }
+
+ //Partition on the region bounds
+ playlist->partition ((*rl)->first_frame() - 1, (*rl)->last_frame() + 1, true);
+
+ //Re-add region that was just removed due to the partition operation
+ playlist->add_region( (*rl), (*rl)->first_frame() );
+ }
+
+ vector<PlaylistState>::iterator pl;
+
+ for (pl = playlists.begin(); pl != playlists.end(); ++pl) {
+ (*pl).playlist->thaw ();
+ _session->add_command(new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
+ }
+
+ commit_reversible_command ();
+}
+
void
Editor::crop_region_to_selection ()
{
boost::shared_ptr<Track> t = rtv->track();
- if (t != 0 && ! t->diskstream()->destructive()) {
+ if (t != 0 && ! t->destructive()) {
if ((playlist = rtv->playlist()) != 0) {
playlists.push_back (playlist);
the_end = min (end, the_end);
cnt = the_end - the_start + 1;
- XMLNode &before = (*i)->get_state();
+ region->clear_history ();
region->trim_to (the_start, cnt, this);
- XMLNode &after = (*i)->get_state();
- _session->add_command (new MementoCommand<Playlist>(*(*i), &before, &after));
+ _session->add_command (new StatefulDiffCommand (region));
}
commit_reversible_command ();
return;
}
- XMLNode &before = pl->get_state();
+ pl->clear_history ();
pl->add_region (RegionFactory::create (region), region->last_frame(), times);
- _session->add_command (new MementoCommand<Playlist>(*pl, &before, &pl->get_state()));
+ _session->add_command (new StatefulDiffCommand (pl));
}
commit_reversible_command ();
continue;
}
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
playlist->add_region (RegionFactory::create (region), start, times);
- _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ _session->add_command (new StatefulDiffCommand (playlist));
}
commit_reversible_command ();
in_command = true;
}
- XMLNode &before = region->playlist()->get_state();
+ region->clear_history ();
region->set_sync_position (where);
- XMLNode &after = region->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (region));
}
if (in_command) {
begin_reversible_command (_("remove sync"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
- XMLNode &before = (*i)->region()->playlist()->get_state();
+ (*i)->region()->clear_history ();
(*i)->region()->clear_sync_position ();
- XMLNode &after = (*i)->region()->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*((*i)->region()->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand ((*i)->region()));
}
commit_reversible_command ();
}
/* move first one specially */
- XMLNode &before = r->playlist()->get_state();
+ r->clear_history ();
r->set_position (pos, this);
- XMLNode &after = r->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (r));
/* move rest by the same amount */
boost::shared_ptr<Region> region ((*i)->region());
- XMLNode &before = region->playlist()->get_state();
+ region->clear_history ();
if (dir > 0) {
region->set_position (region->position() + distance, this);
} else {
region->set_position (region->position() - distance, this);
}
-
- XMLNode &after = region->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+
+ _session->add_command(new StatefulDiffCommand (region));
}
void
Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint point, nframes64_t position)
{
- XMLNode &before = region->playlist()->get_state();
+ region->clear_history ();
switch (point) {
case SyncPoint:
break;
}
- XMLNode &after = region->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (region));
}
void
for (list<RegionView*>::const_iterator i = rs.by_layer().begin(); i != rs.by_layer().end(); ++i) {
if (!(*i)->region()->locked()) {
- boost::shared_ptr<Playlist> pl = (*i)->region()->playlist();
- XMLNode &before = pl->get_state();
+
+ (*i)->region()->clear_history ();
+
if (front) {
(*i)->region()->trim_front (where, this);
} else {
(*i)->region()->trim_end (where, this);
}
- XMLNode &after = pl->get_state();
- _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+
+ _session->add_command (new StatefulDiffCommand ((*i)->region()));
}
}
nframes64_t start;
nframes64_t end;
- if (tav->get_diskstream() != 0) {
- speed = tav->get_diskstream()->speed();
+ if (tav->track() != 0) {
+ speed = tav->track()->speed();
}
start = session_frame_to_track_frame (loc.start(), speed);
end = session_frame_to_track_frame (loc.end(), speed);
-
- XMLNode &before = rv->region()->playlist()->get_state();
+
+ rv->region()->clear_history ();
rv->region()->trim_to (start, (end - start), this);
- XMLNode &after = rv->region()->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(
- *(rv->region()->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (rv->region()));
}
commit_reversible_command ();
float speed = 1.0;
- if (tav->get_diskstream() != 0) {
- speed = tav->get_diskstream()->speed();
+ if (tav->track() != 0) {
+ speed = tav->track()->speed();
}
- XMLNode &before = rv->region()->playlist()->get_state();
+ rv->region()->clear_history ();
rv->region()->trim_end (session_frame_to_track_frame(where, speed), this);
- XMLNode &after = rv->region()->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(
- *(rv->region()->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (rv->region()));
}
commit_reversible_command ();
float speed = 1.0;
- if (tav->get_diskstream() != 0) {
- speed = tav->get_diskstream()->speed();
+ if (tav->track() != 0) {
+ speed = tav->track()->speed();
}
- XMLNode &before = rv->region()->playlist()->get_state();
+ rv->region()->clear_history ();
rv->region()->trim_front (session_frame_to_track_frame(where, speed), this);
- XMLNode &after = rv->region()->playlist()->get_state();
- _session->add_command(new MementoCommand<Playlist>(
- *(rv->region()->playlist()), &before, &after));
+ _session->add_command(new StatefulDiffCommand (rv->region()));
}
commit_reversible_command ();
float speed = 1.0;
- if (atav->get_diskstream() != 0) {
- speed = atav->get_diskstream()->speed();
+ if (atav->track() != 0) {
+ speed = atav->track()->speed();
}
boost::shared_ptr<Region> region = arv->region();
boost::shared_ptr<Playlist> playlist (region->playlist());
- XMLNode &before = playlist->get_state();
+ region->clear_history ();
if(forward){
continue;
}
- region->trim_end((nframes64_t) (next_region->first_frame() * speed), this);
+ region->trim_end((nframes64_t) ( (next_region->first_frame() - 1) * speed), this);
arv->region_changed (PropertyChange (ARDOUR::Properties::length));
}
else {
arv->region_changed (ARDOUR::bounds_change);
}
- XMLNode &after = playlist->get_state();
- _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command(new StatefulDiffCommand (region));
}
commit_reversible_command ();
void*
Editor::freeze_thread ()
{
- clicked_routeview->audio_track()->freeze (*current_interthread_info);
+ clicked_routeview->audio_track()->freeze_me (*current_interthread_info);
current_interthread_info->done = true;
return 0;
}
-gint
-Editor::freeze_progress_timeout (void */*arg*/)
-{
- interthread_progress_bar.set_fraction (current_interthread_info->progress);
- return !(current_interthread_info->done || current_interthread_info->cancel);
-}
-
void
Editor::freeze_route ()
{
}
InterThreadInfo itt;
-
- if (interthread_progress_window == 0) {
- build_interthread_progress_window ();
- }
-
- interthread_progress_window->set_title (_("Freeze"));
- interthread_progress_window->set_position (Gtk::WIN_POS_MOUSE);
- interthread_progress_window->show_all ();
- interthread_progress_bar.set_fraction (0.0f);
- interthread_progress_label.set_text ("");
- interthread_cancel_label.set_text (_("Cancel Freeze"));
current_interthread_info = &itt;
- interthread_progress_connection =
- Glib::signal_timeout().connect (sigc::bind (sigc::mem_fun(*this, &Editor::freeze_progress_timeout), (gpointer) 0), 100);
-
- itt.done = false;
- itt.cancel = false;
- itt.progress = 0.0f;
+ InterthreadProgressWindow ipw (current_interthread_info, _("Freeze"), _("Cancel Freeze"));
pthread_create_and_store (X_("freezer"), &itt.thread, _freeze_thread, this);
gtk_main_iteration ();
}
- interthread_progress_connection.disconnect ();
- interthread_progress_window->hide_all ();
current_interthread_info = 0;
track_canvas->get_window()->set_cursor (*current_canvas_cursor);
}
InterThreadInfo itt;
- itt.done = false;
- itt.cancel = false;
- itt.progress = false;
-
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
+ playlist->clear_owned_history ();
+
boost::shared_ptr<Region> r = rtv->track()->bounce_range (start, start+cnt, itt, enable_processing);
if (replace) {
playlist->add_region (r, start);
}
- XMLNode &after = playlist->get_state();
- _session->add_command (new MementoCommand<Playlist> (*playlist, &before, &after));
+ vector<StatefulDiffCommand*> cmds;
+ playlist->rdiff (cmds);
+ for (vector<StatefulDiffCommand*>::iterator j = cmds.begin(); j != cmds.end(); ++j) {
+ _session->add_command (*j);
+ }
+
+ _session->add_command (new StatefulDiffCommand (playlist));
}
commit_reversible_command ();
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_marker), loc));
}
- _drags->break_drag ();
+ _drags->abort ();
return;
}
}
if (op == Cut || op == Clear) {
- _drags->break_drag ();
+ _drags->abort ();
}
}
}
}
-struct PlaylistState {
- boost::shared_ptr<Playlist> playlist;
- XMLNode* before;
-};
+
struct lt_playlist {
bool operator () (const PlaylistState& a, const PlaylistState& b) {
boost::shared_ptr<Playlist> playlist = clicked_routeview->playlist();
begin_reversible_command (_("remove region"));
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
playlist->remove_region (clicked_regionview->region());
- XMLNode &after = playlist->get_state();
- _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command(new StatefulDiffCommand (playlist));
commit_reversible_command ();
}
regions_to_remove.push_back ((*i)->region());
}
- vector<PlaylistState> playlists;
+ vector<boost::shared_ptr<Playlist> > playlists;
for (list<boost::shared_ptr<Region> >::iterator rl = regions_to_remove.begin(); rl != regions_to_remove.end(); ++rl) {
continue;
}
- vector<PlaylistState>::iterator i;
+ vector<boost::shared_ptr<Playlist> >::iterator i;
- //only take state if this is a new playlist.
+ //only prep history if this is a new playlist.
for (i = playlists.begin(); i != playlists.end(); ++i) {
- if ((*i).playlist == playlist) {
+ if ((*i) == playlist) {
break;
}
}
if (i == playlists.end()) {
- PlaylistState before;
- before.playlist = playlist;
- before.before = &playlist->get_state();
-
+ playlist->clear_history ();
playlist->freeze ();
- playlists.push_back(before);
+
+ playlists.push_back (playlist);
}
playlist->remove_region (*rl);
}
- vector<PlaylistState>::iterator pl;
+ vector<boost::shared_ptr<Playlist> >::iterator pl;
for (pl = playlists.begin(); pl != playlists.end(); ++pl) {
- (*pl).playlist->thaw ();
- _session->add_command(new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
+ (*pl)->thaw ();
+ _session->add_command(new StatefulDiffCommand (*pl));
}
commit_reversible_command ();
nframes64_t first_position = max_frames;
- set<PlaylistState, lt_playlist> freezelist;
- pair<set<PlaylistState, lt_playlist>::iterator,bool> insert_result;
+ typedef set<boost::shared_ptr<Playlist> > FreezeList;
+ FreezeList freezelist;
/* get ordering correct before we cut/copy */
boost::shared_ptr<Playlist> pl = (*x)->region()->playlist();
if (pl) {
- set<PlaylistState, lt_playlist>::iterator fl;
+ FreezeList::iterator fl;
//only take state if this is a new playlist.
for (fl = freezelist.begin(); fl != freezelist.end(); ++fl) {
- if ((*fl).playlist == pl) {
+ if ((*fl) == pl) {
break;
}
}
if (fl == freezelist.end()) {
- PlaylistState before;
- before.playlist = pl;
- before.before = &pl->get_state();
+ pl->clear_history();
pl->freeze ();
- insert_result = freezelist.insert (before);
+ freezelist.insert (pl);
}
}
}
if (!foo.empty()) {
cut_buffer->set (foo);
}
-
- for (set<PlaylistState, lt_playlist>::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
- (*pl).playlist->thaw ();
- _session->add_command (new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
+
+ for (FreezeList::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
+ (*pl)->thaw ();
+ _session->add_command (new StatefulDiffCommand (*pl));
}
}
sigc::connection c = rtv->view()->RegionViewAdded.connect (sigc::mem_fun(*this, &Editor::collect_new_region_view));
playlist = (*i)->region()->playlist();
- XMLNode &before = playlist->get_state();
- playlist->duplicate (r, end_frame + (r->first_frame() - start_frame) + 1, times);
- _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+ playlist->clear_history ();
+ playlist->duplicate (r, end_frame + (r->first_frame() - start_frame), times);
+ _session->add_command(new StatefulDiffCommand (playlist));
c.disconnect ();
if ((playlist = (*i)->playlist()) == 0) {
continue;
}
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
playlist->duplicate (*ri, selection->time[clicked_selection].end, times);
- XMLNode &after = playlist->get_state();
- _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command (new StatefulDiffCommand (playlist));
++ri;
if (ri == new_regions.end()) {
Editor::clear_playlist (boost::shared_ptr<Playlist> playlist)
{
begin_reversible_command (_("clear playlist"));
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
playlist->clear ();
- XMLNode &after = playlist->get_state();
- _session->add_command (new MementoCommand<Playlist>(*playlist.get(), &before, &after));
+ _session->add_command (new StatefulDiffCommand (playlist));
commit_reversible_command ();
}
continue;
}
- XMLNode &before = playlist->get_state();
+ playlist->clear_history ();
+ playlist->clear_owned_history ();
+
playlist->nudge_after (start, distance, forwards);
- XMLNode &after = playlist->get_state();
- _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+
+ vector<StatefulDiffCommand*> cmds;
+
+ playlist->rdiff (cmds);
+
+ for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) {
+ _session->add_command (*c);
+ }
+
+ _session->add_command (new StatefulDiffCommand (playlist));
}
commit_reversible_command ();
if (prompter.run () == 1) {
_session->remove_last_capture ();
+ _regions->redisplay ();
}
} else {
_session->remove_last_capture();
+ _regions->redisplay ();
}
}
Dialog dialog (rs.size() > 1 ? _("Normalize regions") : _("Normalize region"));
HBox hbox;
+ hbox.set_spacing (6);
+ hbox.set_border_width (6);
hbox.pack_start (*manage (new Label (_("Normalize to:"))));
SpinButton spin (0.2, 2);
spin.set_range (-112, 0);
spin.set_value (_last_normalization_value);
hbox.pack_start (*manage (new Label (_("dbFS"))));
hbox.show_all ();
+ dialog.get_vbox()->set_spacing (12);
dialog.get_vbox()->pack_start (hbox);
dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL);
dialog.add_button (_("Normalize"), RESPONSE_ACCEPT);
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r);
if (!arv)
continue;
- XMLNode &before = arv->region()->get_state();
+ arv->region()->clear_history ();
arv->audio_region()->normalize_to (spin.get_value());
- _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+ _session->add_command (new StatefulDiffCommand (arv->region()));
+
}
commit_reversible_command ();
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r);
if (!arv)
continue;
- XMLNode &before = arv->region()->get_state();
+ arv->region()->clear_history ();
arv->audio_region()->set_scale_amplitude (1.0f);
- _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+ _session->add_command (new StatefulDiffCommand (arv->region()));
}
commit_reversible_command ();
for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r);
- if (!arv)
+ if (!arv) {
continue;
- XMLNode &before = arv->region()->get_state();
+ }
+ arv->region()->clear_history ();
+
double fraction = gain_to_slider_position (arv->audio_region()->scale_amplitude ());
if (up) {
}
arv->audio_region()->set_scale_amplitude (fraction);
- _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+ _session->add_command (new StatefulDiffCommand (arv->region()));
}
commit_reversible_command ();
}
}
- StripSilenceDialog d (ar);
+ StripSilenceDialog d (_session, ar);
int const r = d.run ();
if (r == Gtk::RESPONSE_OK) {
Editor::apply_midi_note_edit_op_to_region (MidiOperator& op, MidiRegionView& mrv)
{
Evoral::Sequence<Evoral::MusicalTime>::Notes selected;
- mrv.selection_as_notelist (selected);
+ mrv.selection_as_notelist (selected, true);
vector<Evoral::Sequence<Evoral::MusicalTime>::Notes> v;
v.push_back (selected);
rs.clear ();
}
+void
+Editor::fork_region ()
+{
+ RegionSelection rs;
+
+ get_regions_for_action (rs);
+
+ if (rs.empty()) {
+ return;
+ }
+
+ begin_reversible_command (_("Fork Region(s)"));
+
+ track_canvas->get_window()->set_cursor (*wait_cursor);
+ gdk_flush ();
+
+ for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ) {
+ RegionSelection::iterator tmp = r;
+ ++tmp;
+
+ MidiRegionView* const mrv = dynamic_cast<MidiRegionView*>(*r);
+
+ if (mrv) {
+ boost::shared_ptr<Playlist> playlist = mrv->region()->playlist();
+ boost::shared_ptr<MidiRegion> newregion = mrv->midi_region()->clone ();
+
+ playlist->clear_history ();
+ playlist->replace_region (mrv->region(), newregion, mrv->region()->position());
+ _session->add_command(new StatefulDiffCommand (playlist));
+ }
+
+ r = tmp;
+ }
+
+ commit_reversible_command ();
+ rs.clear ();
+
+ track_canvas->get_window()->set_cursor (*current_canvas_cursor);
+}
+
void
Editor::quantize_region ()
{
if (arv->audio_region()->apply (filter) == 0) {
- XMLNode &before = playlist->get_state();
-
+ playlist->clear_history ();
+
if (filter.results.empty ()) {
/* no regions returned; remove the old one */
}
- XMLNode &after = playlist->get_state();
- _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+ _session->add_command(new StatefulDiffCommand (playlist));
} else {
goto out;
}
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
if (arv) {
- XMLNode &before = arv->region()->get_state ();
+ arv->region()->clear_history ();
arv->set_envelope_visible (!arv->envelope_visible());
- XMLNode &after = arv->region()->get_state ();
- _session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
+ _session->add_command (new StatefulDiffCommand (arv->region()));
}
}
}
void
-Editor::set_region_lock_style (Region::PositionLockStyle ps)
+Editor::toggle_region_lock_style ()
{
RegionSelection rs = get_equivalent_regions (selection->regions, ARDOUR::Properties::edit.property_id);
_session->begin_reversible_command (_("region lock style"));
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
- XMLNode &before = (*i)->region()->get_state ();
- (*i)->region()->set_position_lock_style (ps);
- XMLNode &after = (*i)->region()->get_state ();
- _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+ (*i)->region()->clear_history ();
+ PositionLockStyle const ns = (*i)->region()->position_lock_style() == AudioTime ? MusicTime : AudioTime;
+ (*i)->region()->set_position_lock_style (ns);
+ _session->add_command (new StatefulDiffCommand ((*i)->region()));
}
_session->commit_reversible_command ();
first = false;
}
- rtav->track()->set_record_enable(new_state, this);
+ rtav->track()->set_record_enabled (new_state, this);
}
}
nframes64_t pos = get_preferred_edit_position();
nframes64_t len;
- char* cmd;
+ char const * cmd;
if (pos > rv->region()->last_frame() || pos < rv->region()->first_frame()) {
/* edit point is outside the relevant region */
have_switch = true;
}
- XMLNode &before = region->get_state();
+ region->clear_history ();
+
if (in) {
region->set_fade_in_active (!yn);
} else {
region->set_fade_out_active (!yn);
}
- XMLNode &after = region->get_state();
- _session->add_command(new MementoCommand<AudioRegion>(*region.get(), &before, &after));
+
+ _session->add_command(new StatefulDiffCommand (region));
}
commit_reversible_command ();
boost::shared_ptr<AudioRegion> ar (tmp->audio_region());
-
- XMLNode &before = ar->get_state();
-
+
+ ar->clear_history ();
ar->set_fade_in_active (yn);
-
- XMLNode &after = ar->get_state();
- _session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
+ _session->add_command (new StatefulDiffCommand (ar));
}
commit_reversible_command ();
boost::shared_ptr<AudioRegion> ar (tmp->audio_region());
- XMLNode &before = ar->get_state();
-
+ ar->clear_history ();
ar->set_fade_out_active (yn);
-
- XMLNode &after = ar->get_state();
- _session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
+ _session->add_command(new StatefulDiffCommand (ar));
}
commit_reversible_command ();
void
Editor::split ()
{
+ if (((mouse_mode == MouseRange) ||
+ (mouse_mode != MouseObject && _join_object_range_state == JOIN_OBJECT_RANGE_RANGE)) &&
+ !selection->time.empty()) {
+ separate_regions_between (selection->time);
+ return;
+ }
+
RegionSelection rs;
get_regions_for_action (rs, true);
int response = msg.run();
msg.hide ();
+
switch (response) {
case RESPONSE_OK:
break;
AnalysisFeatureList::const_iterator x;
- nframes64_t pos = r->position();
-
- XMLNode& before (pl->get_state());
+ pl->clear_history ();
x = positions.begin();
- while (x != positions.end()) {
- if ((*x) > pos) {
- break;
- }
- ++x;
- }
-
if (x == positions.end()) {
return;
}
pl->freeze ();
pl->remove_region (r);
+ nframes64_t pos = 0;
+
while (x != positions.end()) {
+
+ /* deal with positons that are out of scope of present region bounds */
+ if (*x <= 0 || *x > r->length()){
+ ++x;
+ continue;
+ }
/* file start = original start + how far we from the initial position ?
*/
- nframes64_t file_start = r->start() + (pos - r->position());
+ nframes64_t file_start = r->start() + pos;
/* length = next position - current position
*/
nframes64_t len = (*x) - pos;
-
+
/* XXX we do we really want to allow even single-sample regions?
shouldn't we have some kind of lower limit on region size?
*/
string new_name;
- if (_session->region_name (new_name, r->name())) {
+ if (RegionFactory::region_name (new_name, r->name())) {
break;
}
plist.add (ARDOUR::Properties::layer, 0);
boost::shared_ptr<Region> nr = RegionFactory::create (r->sources(), plist, false);
- pl->add_region (nr, pos);
+ pl->add_region (nr, r->position() + pos);
pos += len;
++x;
+ }
- if (*x > r->last_frame()) {
+ string new_name;
- /* add final fragment */
+ RegionFactory::region_name (new_name, r->name());
+
+ /* Add the final region */
+ PropertyList plist;
+
+ plist.add (ARDOUR::Properties::start, r->start() + pos);
+ plist.add (ARDOUR::Properties::length, r->last_frame() - (r->position() + pos) + 1);
+ plist.add (ARDOUR::Properties::name, new_name);
+ plist.add (ARDOUR::Properties::layer, 0);
- file_start = r->start() + (pos - r->position());
- len = r->last_frame() - pos;
+ boost::shared_ptr<Region> nr = RegionFactory::create (r->sources(), plist, false);
+ pl->add_region (nr, r->position() + pos);
- PropertyList plist2;
-
- plist2.add (ARDOUR::Properties::start, file_start);
- plist2.add (ARDOUR::Properties::length, len);
- plist2.add (ARDOUR::Properties::name, new_name);
- plist2.add (ARDOUR::Properties::layer, 0);
+
+ pl->thaw ();
- nr = RegionFactory::create (r->sources(), plist2);
- pl->add_region (nr, pos);
+ _session->add_command (new StatefulDiffCommand (pl));
+}
- break;
- }
+void
+Editor::place_transient()
+{
+ if (!_session) {
+ return;
}
- pl->thaw ();
+ RegionSelection rs;
+
+ get_regions_for_action (rs);
+
+ if (rs.empty()) {
+ return;
+ }
+
+ nframes64_t where = get_preferred_edit_position();
+
+ _session->begin_reversible_command (_("place transient"));
+
+ for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) {
+ framepos_t position = (*r)->region()->position();
+ (*r)->region()->add_transient(where - position);
+ }
+
+ _session->commit_reversible_command ();
+}
+
+void
+Editor::remove_transient(ArdourCanvas::Item* item)
+{
+ if (!_session) {
+ return;
+ }
- XMLNode& after (pl->get_state());
+ ArdourCanvas::SimpleLine* _line = reinterpret_cast<ArdourCanvas::SimpleLine*> (item);
+ assert (_line);
- _session->add_command (new MementoCommand<Playlist>(*pl, &before, &after));
+ AudioRegionView* _arv = reinterpret_cast<AudioRegionView*> (item->get_data ("regionview"));
+ _arv->remove_transient(_line->property_x1());
+}
+
+void
+Editor::snap_regions_to_grid()
+{
+ if (!_session) {
+ return;
+ }
+
+ RegionSelection rs;
+
+ get_regions_for_action (rs);
+
+ if (rs.empty()) {
+ return;
+ }
+
+ _session->begin_reversible_command (_("snap regions to grid"));
+
+ for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) {
+ framepos_t start_frame = (*r)->region()->first_frame ();
+ snap_to (start_frame);
+ (*r)->region()->set_position (start_frame, this);
+ }
+
+ _session->commit_reversible_command ();
+}
+
+void
+Editor::close_region_gaps()
+{
+ if (!_session) {
+ return;
+ }
+
+ RegionSelection rs;
+
+ get_regions_for_action (rs);
+
+ if (rs.empty()) {
+ return;
+ }
+
+ Dialog dialog (rs.size() > 1 ? _("Conform regions") : _("Conform region"));
+
+ HBox hbox_crossfade;
+ hbox_crossfade.set_spacing (10);
+ //hbox_crossfade.set_border_width (3);
+ hbox_crossfade.pack_start (*manage (new Label (_("Crossfade length:"))));
+
+ SpinButton spin_crossfade (1, 0);
+ spin_crossfade.set_range (0, 15);
+ spin_crossfade.set_increments (1, 1);
+ spin_crossfade.set_value (3);
+
+ hbox_crossfade.pack_start (spin_crossfade);
+ hbox_crossfade.pack_start (*manage (new Label (_("ms"))));
+ hbox_crossfade.show_all ();
+
+ HBox hbox_pullback;
+
+ hbox_pullback.set_spacing (10);
+ //hbox_pullback.set_border_width (3);
+ hbox_pullback.pack_start (*manage (new Label (_("Pull-back length:"))));
+
+ SpinButton spin_pullback (1, 0);
+ spin_pullback.set_range (0, 15);
+ spin_pullback.set_increments (1, 1);
+ spin_pullback.set_value (5);
+
+ hbox_pullback.pack_start (spin_pullback);
+ hbox_pullback.pack_start (*manage (new Label (_("ms"))));
+ hbox_pullback.show_all ();
+
+ dialog.get_vbox()->set_spacing (6);
+ dialog.get_vbox()->pack_start (hbox_crossfade);
+ dialog.get_vbox()->pack_start (hbox_pullback);
+ dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL);
+ dialog.add_button (_("Ok"), RESPONSE_ACCEPT);
+
+ if (dialog.run () == RESPONSE_CANCEL) {
+ return;
+ }
+
+ nframes64_t crossfade_len = spin_crossfade.get_value();
+ nframes64_t pull_back_frames = spin_pullback.get_value();
+
+ crossfade_len = lrintf (crossfade_len * _session->frame_rate()/1000);
+ pull_back_frames = lrintf (pull_back_frames * _session->frame_rate()/1000);
+
+ /* Iterate over the region list and make adjacent regions overlap by crossfade_len_ms */
+
+ _session->begin_reversible_command (_("close region gaps"));
+
+ int idx = 0;
+ boost::shared_ptr<Region> last_region;
+
+ rs.sort_by_position_and_track();
+
+ for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) {
+
+ nframes64_t position = (*r)->region()->position();
+
+ if (idx == 0 || position < last_region->position()){
+ last_region = (*r)->region();
+ idx++;
+ continue;
+ }
+
+ (*r)->region()->trim_front( (position - pull_back_frames), this );
+ last_region->trim_end( (position - pull_back_frames + crossfade_len), this );
+
+ last_region = (*r)->region();
+
+ idx++;
+ }
+
+ _session->commit_reversible_command ();
}
void
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*t);
if (rtv) {
- boost::shared_ptr<Diskstream> ds = rtv->get_diskstream();
- if (ds) {
- boost::shared_ptr<Playlist> pl = rtv->get_diskstream()->playlist ();
+ boost::shared_ptr<Track> tr = rtv->track();
+ if (tr) {
+ boost::shared_ptr<Playlist> pl = tr->playlist ();
if (pl) {
nframes64_t result = pl->find_next_transient (pos, forward ? 1 : -1);
}
}
}
+
void
Editor::playhead_forward_to_grid ()
{
}
void
-Editor::set_track_height (uint32_t h)
+Editor::set_track_height (Height h)
{
TrackSelection& ts (selection->tracks);
const char* trackstr;
const char* busstr;
vector<boost::shared_ptr<Route> > routes;
+ bool special_bus = false;
for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) {
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*x);
}
}
routes.push_back (rtv->_route);
- }
+ if (rtv->route()->is_master() || rtv->route()->is_monitor()) {
+ special_bus = true;
+ }
+ }
+
+ if (special_bus && !Config->get_allow_special_bus_removal()) {
+ MessageDialog msg (_("That would be bad news ...."),
+ false,
+ Gtk::MESSAGE_INFO,
+ Gtk::BUTTONS_OK);
+ msg.set_secondary_text (string_compose (_(
+"Removing the master or monitor bus is such a bad idea\n\
+that %1 is not going to allow it.\n\
+\n\
+If you really want to do this sort of thing\n\
+edit your ardour.rc file to set the\n\
+\"allow-special-bus-removal\" option to be \"yes\""), PROGRAM_NAME));
+
+ msg.present ();
+ msg.run ();
+ return;
+ }
+
if (ntracks + nbusses == 0) {
return;
}
return;
}
- InsertTimeOption opt;
+ /* only setting this to keep GCC quiet */
+ InsertTimeOption opt = LeaveIntersected;
switch (intersected_combo.get_active_row_number ()) {
case 0:
if (pl) {
- XMLNode &before = pl->get_state();
+ pl->clear_history ();
+ pl->clear_owned_history ();
if (opt == SplitIntersected) {
pl->split (pos);
pl->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue);
- XMLNode &after = pl->get_state();
-
- _session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));
+ vector<StatefulDiffCommand*> cmds;
+
+ pl->rdiff (cmds);
+
+ for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) {
+ _session->add_command (*c);
+ }
+
+ _session->add_command (new StatefulDiffCommand (pl));
commit = true;
}
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize) / tracks.size());
double first_y_pos = DBL_MAX;
- if (h < TimeAxisView::hSmall) {
+ if (h < TimeAxisView::preset_height (HeightSmall)) {
MessageDialog msg (*this, _("There are too many tracks to fit in the current window"));
/* too small to be displayed */
return;
first_y_pos = std::min ((*t)->y_position (), first_y_pos);
} else {
if (prev_was_selected && next_is_selected) {
- hide_track_in_display (**t);
+ hide_track_in_display (*t);
}
}