along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <cassert>
using namespace Gtk;
using namespace Editing;
-jack_nframes_t
+nframes_t
Editor::event_frame (GdkEvent* event, double* pcx, double* pcy)
{
double cx, cy;
Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
bool commit = false;
- bool c1;
- bool c2;
/* in object/audition/timefx mode, any button press sets
the selection if the object can be selected. this is a
if (((mouse_mode != MouseObject) &&
(mouse_mode != MouseAudition || item_type != RegionItem) &&
- (mouse_mode != MouseTimeFX || item_type != RegionItem)) ||
+ (mouse_mode != MouseTimeFX || item_type != RegionItem) &&
+ (mouse_mode != MouseRange)) ||
+
(event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE || event->button.button > 3)) {
return;
}
+
+ if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) {
+
+ if ((event->button.state & Keyboard::RelevantModifierKeyMask) && event->button.button != 1) {
+
+ /* almost no selection action on modified button-2 or button-3 events */
+
+ if (item_type != RegionItem && event->button.button != 2) {
+ return;
+ }
+ }
+ }
Selection::Operation op = Keyboard::selection_type (event->button.state);
bool press = (event->type == GDK_BUTTON_PRESS);
switch (item_type) {
case RegionItem:
- c1 = set_selected_track_from_click (press, op, true, true);
- c2 = set_selected_regionview_from_click (press, op, true);
- commit = (c1 || c2);
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_regionview_from_click (press, op, true);
+ } else if (event->type == GDK_BUTTON_PRESS) {
+ commit = set_selected_track_from_click (press, op, false);
+ }
break;
case RegionViewNameHighlight:
case RegionViewName:
- c1 = set_selected_track_from_click (press, op, true, true);
- c2 = set_selected_regionview_from_click (press, op, true);
- commit = (c1 || c2);
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_regionview_from_click (press, op, true);
+ } else if (event->type == GDK_BUTTON_PRESS) {
+ commit = set_selected_track_from_click (press, op, false);
+ }
+ break;
+
+ case FadeInHandleItem:
+ case FadeInItem:
+ case FadeOutHandleItem:
+ case FadeOutItem:
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_regionview_from_click (press, op, true);
+ } else if (event->type == GDK_BUTTON_PRESS) {
+ commit = set_selected_track_from_click (press, op, false);
+ }
break;
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
- c1 = set_selected_track_from_click (press, op, true, true);
- c2 = set_selected_control_point_from_click (press, op, false);
- commit = (c1 || c2);
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_control_point_from_click (op, false);
+ }
break;
case StreamItem:
- commit = set_selected_track_from_click (press, op, true, true);
+ /* for context click or range selection, select track */
+ if (event->button.button == 3) {
+ commit = set_selected_track_from_click (press, op, true);
+ } else if (event->type == GDK_BUTTON_PRESS && mouse_mode == MouseRange) {
+ commit = set_selected_track_from_click (press, op, false);
+ }
break;
case AutomationTrackItem:
- commit = set_selected_track_from_click (press, op, true, true);
+ commit = set_selected_track_from_click (press, op, true);
break;
default:
break;
}
-#define SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
-#ifdef SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
- /* in range mode, button 1/2/3 press potentially selects a track */
-
- if (mouse_mode == MouseRange &&
- event->type == GDK_BUTTON_PRESS &&
- event->button.button <= 3) {
-
- switch (item_type) {
- case StreamItem:
- case RegionItem:
- case AutomationTrackItem:
- commit = set_selected_track_from_click (press, op, true, true);
- break;
-
- default:
- break;
- }
- }
-#endif
if (commit) {
commit_reversible_command ();
}
bool
Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
- jack_nframes_t where = event_frame (event, 0, 0);
-
track_canvas.grab_focus();
if (session && session->actively_recording()) {
break;
case MouseObject:
- if (Keyboard::modifier_state_contains (event->button.state,
- Keyboard::ModifierMask(Keyboard::Control|Keyboard::Alt))
- && event->type == GDK_BUTTON_PRESS) {
-
+ if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::Control|Keyboard::Alt)) &&
+ event->type == GDK_BUTTON_PRESS) {
+
start_rubberband_select (item, event);
} else if (event->type == GDK_BUTTON_PRESS) {
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;
bool
Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
- jack_nframes_t where = event_frame (event, 0, 0);
+ nframes_t where = event_frame (event, 0, 0);
/* no action if we're recording */
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
- cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
- cp->set_visible (true);
-
- double at_x, at_y;
- at_x = cp->get_x();
- at_y = cp->get_y ();
- cp->item->i2w (at_x, at_y);
- at_x += 20.0;
- at_y += 20.0;
-
- fraction = 1.0 - (cp->get_y() / cp->line.height());
-
- set_verbose_canvas_cursor (cp->line.get_verbose_cursor_string (fraction), at_x, at_y);
- show_verbose_canvas_cursor ();
-
- if (is_drawable()) {
- track_canvas.get_window()->set_cursor (*fader_cursor);
+ if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
+ cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
+ cp->set_visible (true);
+
+ double at_x, at_y;
+ at_x = cp->get_x();
+ at_y = cp->get_y ();
+ cp->item->i2w (at_x, at_y);
+ at_x += 20.0;
+ at_y += 20.0;
+
+ fraction = 1.0 - (cp->get_y() / cp->line.height());
+
+ set_verbose_canvas_cursor (cp->line.get_verbose_cursor_string (fraction), at_x, at_y);
+ show_verbose_canvas_cursor ();
+
+ if (is_drawable()) {
+ track_canvas.get_window()->set_cursor (*fader_cursor);
+ }
}
break;
case GainAutomationLineItem:
case RedirectAutomationLineItem:
case PanAutomationLineItem:
- {
- ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
- if (line)
- line->property_fill_color_rgba() = color_map[cEnteredAutomationLine];
- }
- if (is_drawable()) {
- track_canvas.get_window()->set_cursor (*fader_cursor);
+ if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
+ {
+ ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
+ if (line)
+ line->property_fill_color_rgba() = color_map[cEnteredAutomationLine];
+ }
+ if (is_drawable()) {
+ track_canvas.get_window()->set_cursor (*fader_cursor);
+ }
}
break;
*/
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 ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
+ bool y_threshold_passed = (abs ((int) (drag_info.current_pointer_y - drag_info.grab_y)) > 4);
+
+ drag_info.move_threshold_passed = (x_threshold_passed || y_threshold_passed);
// and change the initial grab loc/frame if this drag info wants us to
void
Editor::set_edit_cursor (GdkEvent* event)
{
- jack_nframes_t pointer_frame = event_frame (event);
+ nframes_t pointer_frame = event_frame (event);
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
if (snap_type != SnapToEditCursor) {
void
Editor::set_playhead_cursor (GdkEvent* event)
{
- jack_nframes_t pointer_frame = event_frame (event);
+ nframes_t pointer_frame = event_frame (event);
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (pointer_frame);
AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data);
- drag_info.pointer_frame_offset = drag_info.grab_frame - ((jack_nframes_t) arv->audio_region().fade_in().back()->when + arv->region().position());
+ drag_info.pointer_frame_offset = drag_info.grab_frame - ((nframes_t) arv->audio_region()->fade_in().back()->when + arv->region()->position());
}
void
Editor::fade_in_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data);
- jack_nframes_t pos;
- jack_nframes_t fade_length;
+ nframes_t pos;
+ nframes_t fade_length;
- if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
else {
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (pos);
}
-
- if (pos < (arv->region().position() + 64)) {
+
+ if (pos < (arv->region()->position() + 64)) {
fade_length = 64; // this should be a minimum defined somewhere
- } else if (pos > arv->region().last_frame()) {
- fade_length = arv->region().length();
+ } else if (pos > arv->region()->last_frame()) {
+ fade_length = arv->region()->length();
} else {
- fade_length = pos - arv->region().position();
- }
+ fade_length = pos - arv->region()->position();
+ }
+ /* mapover the region selection */
+
+ for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+
+ AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
+
+ if (!tmp) {
+ continue;
+ }
- arv->reset_fade_in_shape_width (fade_length);
+ tmp->reset_fade_in_shape_width (fade_length);
+ }
- show_verbose_duration_cursor (arv->region().position(), arv->region().position() + fade_length, 10);
+ show_verbose_duration_cursor (arv->region()->position(), arv->region()->position() + fade_length, 10);
drag_info.first_move = false;
}
void
Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
- if (drag_info.first_move) return;
-
AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data);
- jack_nframes_t pos;
- jack_nframes_t fade_length;
+ nframes_t pos;
+ nframes_t fade_length;
- if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
+ if (drag_info.first_move) return;
+
+ if ((int32_t)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;
}
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
- snap_to (pos);
- }
-
- if (pos < (arv->region().position() + 64)) {
+ if (pos < (arv->region()->position() + 64)) {
fade_length = 64; // this should be a minimum defined somewhere
+ } else if (pos > arv->region()->last_frame()) {
+ fade_length = arv->region()->length();
+ } else {
+ fade_length = pos - arv->region()->position();
}
- else if (pos > arv->region().last_frame()) {
- fade_length = arv->region().length();
- }
- else {
- fade_length = pos - arv->region().position();
- }
-
+
begin_reversible_command (_("change fade in length"));
- XMLNode &before = arv->audio_region().get_state();
- arv->audio_region().set_fade_in_length (fade_length);
+ for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+
+ AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
+
+ if (!tmp) {
+ continue;
+ }
+
+ AutomationList& alist = tmp->audio_region()->fade_in();
+ XMLNode &before = alist.get_state();
+
+ tmp->audio_region()->set_fade_in_length (fade_length);
+
+ XMLNode &after = alist.get_state();
+ session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
+ }
- XMLNode &after = arv->audio_region().get_state();
- session->add_command(new MementoCommand<ARDOUR::AudioRegion>(arv->audio_regio(),
- before,
- after));
commit_reversible_command ();
- fade_in_drag_motion_callback (item, event);
}
void
AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data);
- drag_info.pointer_frame_offset = drag_info.grab_frame - (arv->region().length() - (jack_nframes_t) arv->audio_region().fade_out().back()->when + arv->region().position());
+ drag_info.pointer_frame_offset = drag_info.grab_frame - (arv->region()->length() - (nframes_t) arv->audio_region()->fade_out().back()->when + arv->region()->position());
}
void
Editor::fade_out_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data);
- jack_nframes_t pos;
- jack_nframes_t fade_length;
+ nframes_t pos;
+ nframes_t fade_length;
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (pos);
}
-
- if (pos > (arv->region().last_frame() - 64)) {
+
+ if (pos > (arv->region()->last_frame() - 64)) {
fade_length = 64; // this should really be a minimum fade defined somewhere
}
- else if (pos < arv->region().position()) {
- fade_length = arv->region().length();
+ else if (pos < arv->region()->position()) {
+ fade_length = arv->region()->length();
}
else {
- fade_length = arv->region().last_frame() - pos;
+ fade_length = arv->region()->last_frame() - pos;
}
+
+ /* mapover the region selection */
+
+ for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+
+ AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
+
+ if (!tmp) {
+ continue;
+ }
- arv->reset_fade_out_shape_width (fade_length);
+ tmp->reset_fade_out_shape_width (fade_length);
+ }
- show_verbose_duration_cursor (arv->region().last_frame() - fade_length, arv->region().last_frame(), 10);
+ show_verbose_duration_cursor (arv->region()->last_frame() - fade_length, arv->region()->last_frame(), 10);
drag_info.first_move = false;
}
if (drag_info.first_move) return;
AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data);
- jack_nframes_t pos;
- jack_nframes_t fade_length;
+ nframes_t pos;
+ nframes_t fade_length;
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
snap_to (pos);
}
- if (pos > (arv->region().last_frame() - 64)) {
+ if (pos > (arv->region()->last_frame() - 64)) {
fade_length = 64; // this should really be a minimum fade defined somewhere
}
- else if (pos < arv->region().position()) {
- fade_length = arv->region().length();
+ else if (pos < arv->region()->position()) {
+ fade_length = arv->region()->length();
}
else {
- fade_length = arv->region().last_frame() - pos;
+ fade_length = arv->region()->last_frame() - pos;
}
begin_reversible_command (_("change fade out length"));
- XMLNode &before = arv->region().get_state();
- arv->audio_region().set_fade_out_length (fade_length);
+ for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
- XMLNode &after = arv->region().get_state();
- session->add_command(new MementoCommand<ARDOUR::AudioRegion>(arv->region(), before, after));
- commit_reversible_command ();
+ AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
+
+ if (!tmp) {
+ continue;
+ }
+
+ AutomationList& alist = tmp->audio_region()->fade_out();
+ XMLNode &before = alist.get_state();
+
+ tmp->audio_region()->set_fade_out_length (fade_length);
+
+ XMLNode &after = alist.get_state();
+ session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
+ }
- fade_out_drag_motion_callback (item, event);
+ commit_reversible_command ();
}
void
Cursor* cursor = (Cursor *) drag_info.data;
- if (session && cursor == playhead_cursor) {
- if (drag_info.was_rolling) {
+ if (cursor == playhead_cursor) {
+ _dragging_playhead = true;
+
+ if (session && drag_info.was_rolling) {
session->request_stop ();
}
}
Editor::cursor_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
Cursor* cursor = (Cursor *) drag_info.data;
- jack_nframes_t adjusted_frame;
+ nframes_t adjusted_frame;
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
if (cursor == edit_cursor) {
edit_cursor_clock.set (cursor->current_frame);
+ } else {
+ UpdateAllTransportClocks (cursor->current_frame);
}
show_verbose_time_cursor (cursor->current_frame, 10);
if (drag_info.first_move) return;
cursor_drag_motion_callback (item, event);
+
+ _dragging_playhead = false;
if (item == &playhead_cursor->canvas_item) {
if (session) {
void
Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
- jack_nframes_t f_delta;
+ nframes_t f_delta;
Marker* marker = (Marker *) drag_info.data;
Location *real_location;
Location *copy_location;
bool move_both = false;
- jack_nframes_t newframe;
+ nframes_t newframe;
if (drag_info.pointer_frame_offset <= (long) drag_info.current_pointer_frame) {
newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
newframe = 0;
}
- jack_nframes_t next = newframe;
+ nframes_t next = newframe;
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (newframe, 0, true);
}
XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after));
+ session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
commit_reversible_command ();
marker_drag_line->hide();
Editor::meter_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
MeterMarker* marker = (MeterMarker *) drag_info.data;
- jack_nframes_t adjusted_frame;
+ nframes_t adjusted_frame;
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
XMLNode &before = map.get_state();
map.add_meter (marker->meter(), when);
XMLNode &after = map.get_state();
- session->add_command(new MementoCommand<TempoMap>(map, before, after));
+ session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
commit_reversible_command ();
// delete the dummy marker we used for visual representation of copying.
XMLNode &before = map.get_state();
map.move_meter (marker->meter(), when);
XMLNode &after = map.get_state();
- session->add_command(new MementoCommand<TempoMap>(map, before, after));
+ session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
commit_reversible_command ();
}
}
Editor::tempo_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
TempoMarker* marker = (TempoMarker *) drag_info.data;
- jack_nframes_t adjusted_frame;
+ nframes_t adjusted_frame;
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
XMLNode &before = map.get_state();
map.add_tempo (marker->tempo(), when);
XMLNode &after = map.get_state();
- session->add_command (new MementoCommand<TempoMap>(map, before, after));
+ session->add_command (new MementoCommand<TempoMap>(map, &before, &after));
commit_reversible_command ();
// delete the dummy marker we used for visual representation of copying.
XMLNode &before = map.get_state();
map.move_tempo (marker->tempo(), when);
XMLNode &after = map.get_state();
- session->add_command (new MementoCommand<TempoMap>(map, before, after));
+ session->add_command (new MementoCommand<TempoMap>(map, &before, &after));
commit_reversible_command ();
}
}
start_grab (event, fader_cursor);
- control_point->line.start_drag (control_point, 0);
+ control_point->line.start_drag (control_point, drag_info.grab_frame, 0);
float fraction = 1.0 - (control_point->get_y() / control_point->line.height());
set_verbose_canvas_cursor (control_point->line.get_verbose_cursor_string (fraction),
cy = min ((double) cp->line.height(), cy);
//translate cx to frames
- jack_nframes_t cx_frames = unit_to_frame (cx);
+ nframes_t cx_frames = unit_to_frame (cx);
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && !drag_info.x_constrained) {
snap_to (cx_frames);
{
double cx;
double cy;
- jack_nframes_t frame_within_region;
+ nframes_t frame_within_region;
/* need to get x coordinate in terms of parent (TimeAxisItemView)
origin.
cx = event->button.x;
cy = event->button.y;
line->parent_group().w2i (cx, cy);
- frame_within_region = (jack_nframes_t) floor (cx * frames_per_unit);
+ frame_within_region = (nframes_t) floor (cx * frames_per_unit);
if (!line->control_points_adjacent (frame_within_region, current_line_drag_info.before,
current_line_drag_info.after)) {
double fraction = 1.0 - (cy / line->height());
- line->start_drag (0, fraction);
+ line->start_drag (0, drag_info.grab_frame, fraction);
set_verbose_canvas_cursor (line->get_verbose_cursor_string (fraction),
drag_info.current_pointer_x + 20, drag_info.current_pointer_y + 20);
speed = tv->get_diskstream()->speed();
}
- drag_info.last_frame_position = (jack_nframes_t) (clicked_regionview->region().position() / speed);
+ drag_info.last_frame_position = (nframes_t) (clicked_regionview->region()->position() / speed);
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
drag_info.last_trackview = &clicked_regionview->get_time_axis_view();
// we want a move threshold
}
drag_info.last_trackview = &clicked_regionview->get_time_axis_view();
- drag_info.last_frame_position = (jack_nframes_t) (clicked_regionview->region().position() / speed);
+ drag_info.last_frame_position = (nframes_t) (clicked_regionview->region()->position() / speed);
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
// we want a move threshold
drag_info.want_move_threshold = true;
drag_info.motion_callback = &Editor::region_drag_motion_callback;
drag_info.finished_callback = &Editor::region_drag_finished_callback;
+ show_verbose_time_cursor (drag_info.last_frame_position, 10);
}
void
speed = tv->get_diskstream()->speed();
}
- drag_info.last_frame_position = (jack_nframes_t) (clicked_regionview->region().position() / speed);
+ drag_info.last_frame_position = (nframes_t) (clicked_regionview->region()->position() / speed);
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
drag_info.last_trackview = &clicked_regionview->get_time_axis_view();
// we want a move threshold
double x_delta;
double y_delta = 0;
RegionView* rv = reinterpret_cast<RegionView*> (drag_info.data);
- jack_nframes_t pending_region_position = 0;
+ nframes_t pending_region_position = 0;
int32_t pointer_y_span = 0, canvas_pointer_y_span = 0, original_pointer_order;
int32_t visible_y_high = 0, visible_y_low = 512; //high meaning higher numbered.. not the height on the screen
bool clamp_y_axis = false;
vector<int32_t> height_list(512) ;
vector<int32_t>::iterator j;
- show_verbose_time_cursor (drag_info.last_frame_position, 10);
-
if (drag_info.copy && drag_info.move_threshold_passed && drag_info.want_move_threshold) {
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<Playlist*> affected_playlists;
- pair<set<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);
-
- 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 MementoUndoCommand<Playlist>(*to_playlist, to_playlist->get_state()));
- }
-
- latest_regionview = 0;
-
- sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
-
- /* create a new region with the same name. */
-
- // FIXME: ew. need a (virtual) Region::duplicate() or something?
- Region* newregion = NULL;
- if (dynamic_cast<AudioRegion*>(&rv->region()))
- newregion = new AudioRegion (dynamic_cast<AudioRegion&>(rv->region()));
- assert(newregion);
- /* if the original region was locked, we don't care */
-
- newregion->set_locked (false);
-
- to_playlist->add_region (*newregion, (jack_nframes_t) (rv->region().position() * atv->get_diskstream()->speed()));
- c.disconnect ();
-
- if (latest_regionview) {
- new_regionviews.push_back (latest_regionview);
+ if ((arv = dynamic_cast<AudioRegionView*>(rv)) == 0) {
+ /* XXX handle MIDI here */
+ continue;
}
+
+ nrv = new AudioRegionView (*arv);
+ nrv->get_canvas_group()->show ();
+
+ new_regionviews.push_back (nrv);
}
-
+
if (new_regionviews.empty()) {
return;
}
-
+
/* reset selection to new regionviews */
selection->set (new_regionviews);
/* 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 ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
- jack_nframes_t sync_frame;
- jack_nframes_t sync_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);
+ sync_offset = rv->region()->sync_offset (sync_dir);
+ sync_frame = rv->region()->adjust_to_sync (pending_region_position);
/* we snap if the snap modifier is not enabled.
*/
pending_region_position = 0;
}
- if (pending_region_position > max_frames - rv->region().length()) {
+ if (pending_region_position > max_frames - rv->region()->length()) {
pending_region_position = drag_info.last_frame_position;
}
MOTION
************************************************************/
- pair<set<Playlist*>::iterator,bool> insert_result;
- const list<RegionView*>& layered_regions = selection->regions.by_layer();
+ bool do_move;
+
+ if (drag_info.first_move) {
+ if (drag_info.move_threshold_passed) {
+ do_move = true;
+ } else {
+ do_move = false;
+ }
+ } else {
+ do_move = true;
+ }
+
+ if (do_move) {
- for (list<RegionView*>::const_iterator i = layered_regions.begin(); i != layered_regions.end(); ++i) {
+ pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
+ const list<RegionView*>& layered_regions = selection->regions.by_layer();
+
+ for (list<RegionView*>::const_iterator i = layered_regions.begin(); i != layered_regions.end(); ++i) {
- RegionView* rv = (*i);
- double ix1, ix2, iy1, iy2;
- int32_t temp_pointer_y_span = pointer_y_span;
+ RegionView* rv = (*i);
+ double ix1, ix2, iy1, iy2;
+ int32_t temp_pointer_y_span = pointer_y_span;
- /* get item BBox, which will be relative to parent. so we have
- to query on a child, then convert to world coordinates using
- the parent.
- */
+ /* get item BBox, which will be relative to parent. so we have
+ to query on a child, then convert to world coordinates using
+ the parent.
+ */
- 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* canvas_atv = dynamic_cast<AudioTimeAxisView*>(tvp2);
- AudioTimeAxisView* temp_atv;
-
- if ((pointer_y_span != 0) && !clamp_y_axis) {
- y_delta = 0;
- int32_t x = 0;
- for (j = height_list.begin(); j!= height_list.end(); j++) {
- if (x == canvas_atv->order) {
- /* we found the track the region is on */
- if (x != original_pointer_order) {
- /*this isn't from the same track we're dragging from */
- temp_pointer_y_span = canvas_pointer_y_span;
- }
- while (temp_pointer_y_span > 0) {
- /* we're moving up canvas-wise,
- so we need to find the next track height
- */
- if (j != height_list.begin()) {
- j--;
- }
- if (x != original_pointer_order) {
- /* we're not from the dragged track, so ignore hidden tracks. */
- if ((*j) == 0) {
- temp_pointer_y_span++;
- }
- }
- y_delta -= (*j);
- temp_pointer_y_span--;
- }
- while (temp_pointer_y_span < 0) {
- y_delta += (*j);
- if (x != original_pointer_order) {
- if ((*j) == 0) {
- temp_pointer_y_span--;
+ 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* canvas_atv = dynamic_cast<AudioTimeAxisView*>(tvp2);
+ AudioTimeAxisView* temp_atv;
+
+ if ((pointer_y_span != 0) && !clamp_y_axis) {
+ y_delta = 0;
+ int32_t x = 0;
+ for (j = height_list.begin(); j!= height_list.end(); j++) {
+ if (x == canvas_atv->order) {
+ /* we found the track the region is on */
+ if (x != original_pointer_order) {
+ /*this isn't from the same track we're dragging from */
+ temp_pointer_y_span = canvas_pointer_y_span;
+ }
+ while (temp_pointer_y_span > 0) {
+ /* we're moving up canvas-wise,
+ so we need to find the next track height
+ */
+ if (j != height_list.begin()) {
+ j--;
}
- }
+ if (x != original_pointer_order) {
+ /* we're not from the dragged track, so ignore hidden tracks. */
+ if ((*j) == 0) {
+ temp_pointer_y_span++;
+ }
+ }
+ y_delta -= (*j);
+ temp_pointer_y_span--;
+ }
+ while (temp_pointer_y_span < 0) {
+ y_delta += (*j);
+ if (x != original_pointer_order) {
+ if ((*j) == 0) {
+ temp_pointer_y_span--;
+ }
+ }
- if (j != height_list.end()) {
- j++;
+ if (j != height_list.end()) {
+ j++;
+ }
+ temp_pointer_y_span++;
}
- temp_pointer_y_span++;
- }
- /* find out where we'll be when we move and set height accordingly */
+ /* find out where we'll be when we move and set height accordingly */
- tvp2 = trackview_by_y_position (iy1 + y_delta);
- temp_atv = dynamic_cast<AudioTimeAxisView*>(tvp2);
- rv->set_height (temp_atv->height);
+ tvp2 = trackview_by_y_position (iy1 + y_delta);
+ temp_atv = dynamic_cast<AudioTimeAxisView*>(tvp2);
+ rv->set_height (temp_atv->height);
- /* if you un-comment the following, the region colours will follow the track colours whilst dragging,
- personally, i think this can confuse things, but never mind.
- */
+ /* if you un-comment the following, the region colours will follow the track colours whilst dragging,
+ personally, i think this can confuse things, but never mind.
+ */
- //const GdkColor& col (temp_atv->view->get_region_color());
- //rv->set_color (const_cast<GdkColor&>(col));
- break;
+ //const GdkColor& col (temp_atv->view->get_region_color());
+ //rv->set_color (const_cast<GdkColor&>(col));
+ break;
+ }
+ x++;
}
- x++;
}
- }
- /* prevent the regionview from being moved to before
- the zero position on the canvas.
- */
- /* clamp */
+ /* prevent the regionview from being moved to before
+ the zero position on the canvas.
+ */
+ /* clamp */
- if (x_delta < 0) {
- if (-x_delta > ix1) {
- x_delta = -ix1;
+ if (x_delta < 0) {
+ if (-x_delta > ix1) {
+ x_delta = -ix1;
+ }
+ } else if ((x_delta > 0) &&(rv->region()->last_frame() > max_frames - x_delta)) {
+ x_delta = max_frames - rv->region()->last_frame();
}
- } 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 */
+ if (drag_info.first_move) {
-// rv->get_time_axis_view().hide_dependent_views (*rv);
-
- /* this is subtle. raising the regionview itself won't help,
- because raise_to_top() just puts the item on the top of
- its parent's stack. so, we need to put the trackview canvas_display group
- on the top, since its parent is the whole canvas.
- */
-
- rv->get_canvas_group()->raise_to_top();
- rv->get_time_axis_view().canvas_display->raise_to_top();
- cursor_group->raise_to_top();
+ /* hide any dependent views */
+
+ rv->get_time_axis_view().hide_dependent_views (*rv);
+
+ /* this is subtle. raising the regionview itself won't help,
+ because raise_to_top() just puts the item on the top of
+ its parent's stack. so, we need to put the trackview canvas_display group
+ on the top, since its parent is the whole canvas.
+ */
+
+ 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.
- */
+ rv->fake_set_opaque (true);
+ }
+
+ if (drag_info.brushing) {
+ mouse_brush_insert_region (rv, pending_region_position);
+ } else {
+ rv->move (x_delta, y_delta);
+ }
- AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (&rv->get_time_axis_view());
- if (atv && atv->is_audio_track()) {
- AudioPlaylist* pl = dynamic_cast<AudioPlaylist*>(atv->get_diskstream()->playlist());
- if (pl) {
- /* only freeze and capture state once */
+ } /* foreach region */
- insert_result = motion_frozen_playlists.insert (pl);
- if (insert_result.second) {
- pl->freeze();
- session->add_command(new MementoUndoCommand<Playlist>(*pl, pl->get_state()));
- }
- }
- }
- }
+ } /* if do_move */
- if (drag_info.brushing) {
- mouse_brush_insert_region (rv, pending_region_position);
- } else {
- rv->move (x_delta, y_delta);
- }
- }
-
- if (drag_info.first_move) {
+ if (drag_info.first_move && drag_info.move_threshold_passed) {
cursor_group->raise_to_top();
+ drag_info.first_move = false;
}
-
- drag_info.first_move = false;
-
+
if (x_delta != 0 && !drag_info.brushing) {
show_verbose_time_cursor (drag_info.last_frame_position, 10);
}
-
}
void
Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
- jack_nframes_t where;
+ nframes_t where;
RegionView* rv = reinterpret_cast<RegionView *> (drag_info.data);
- pair<set<Playlist*>::iterator,bool> insert_result;
+ pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
bool nocommit = true;
double speed;
RouteTimeAxisView* atv;
speed = atv->get_diskstream()->speed();
}
- regionview_x_movement = (drag_info.last_frame_position != (jack_nframes_t) (rv->region().position()/speed));
+ regionview_x_movement = (drag_info.last_frame_position != (nframes_t) (rv->region()->position()/speed));
regionview_y_movement = (drag_info.last_trackview != &rv->get_time_axis_view());
//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());
+ char* op_string;
+
+ 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");
+ }
+ }
+
+ begin_reversible_command (op_string);
+
if (regionview_y_movement) {
- /* motion between tracks */
+ /* moved to a different audio track. */
list<RegionView*> new_selection;
-
- /* moved to a different audio track. */
+ new_selection = selection->regions.by_layer();
+ selection->clear_regions ();
- for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ) {
+ for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end(); ++i) {
- 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++;
- }
-
- /* first, freeze the target tracks */
-
- for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end();i++ ) {
+ RegionView* rv = (*i);
- Playlist* from_playlist;
- 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);
-
- from_playlist = (*i)->region().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);
-
- /* only freeze the to_playlist once */
-
- insert_result = motion_frozen_playlists.insert(to_playlist);
- if (insert_result.second) {
- to_playlist->freeze();
- session->add_command(new MementoUndoCommand<Playlist>(*to_playlist, to_playlist->get_state()));
- }
-
- }
-
- /* now do it again with the actual operations */
-
- for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end();i++ ) {
+ boost::shared_ptr<Playlist> from_playlist = rv->region()->playlist();
+ boost::shared_ptr<Playlist> to_playlist = atv2->playlist();
+
+ where = (nframes_t) (unit_to_frame (ix1) * speed);
+ boost::shared_ptr<Region> new_region (RegionFactory::create (rv->region()));
- Playlist* from_playlist;
- Playlist* to_playlist;
+ if (!drag_info.copy) {
- 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);
+ /* 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.
+ */
- from_playlist = (*i)->region().playlist();
- to_playlist = atv2->playlist();
+ rv->hide_region_editor();
+ rv->fake_set_opaque (false);
- latest_regionview = 0;
-
- where = (jack_nframes_t) (unit_to_frame (ix1) * speed);
- Region* new_region = createRegion ((*i)->region());
+ 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()));
+ }
- from_playlist->remove_region (&((*i)->region()));
-
+ latest_regionview = 0;
+
sigc::connection c = atv2->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
- to_playlist->add_region (*new_region, where);
+ 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);
}
+
+ if (drag_info.copy) {
+ // get rid of the copy
+ delete rv;
+ }
}
} 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);
- if (rv->region().locked()) {
+ if (rv->region()->locked()) {
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();
rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
rv->get_canvas_group()->i2w (ix1, iy1);
- where = (jack_nframes_t) (unit_to_frame (ix1) * ownspeed);
+ where = (nframes_t) (unit_to_frame (ix1) * ownspeed);
} else {
- where = rv->region().position();
+ 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);
+ /* 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()));
+
+ /* get rid of the copy */
+
+ if (drag_info.copy) {
+ delete rv;
+ }
}
}
out:
- for (set<Playlist*>::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) {
- (*p)->thaw ();
- session->add_command (new MementoRedoCommand<Playlist>(*(*p), (*p)->get_state()));
- }
-
- motion_frozen_playlists.clear ();
-
+
if (!nocommit) {
commit_reversible_command ();
}
if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Alt))) {
- align_region (rv.region(), SyncPoint, (jack_nframes_t) (edit_cursor->current_frame * speed));
+ align_region (rv.region(), SyncPoint, (nframes_t) (edit_cursor->current_frame * speed));
} else if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Shift))) {
- align_region (rv.region(), End, (jack_nframes_t) (edit_cursor->current_frame * speed));
+ align_region (rv.region(), End, (nframes_t) (edit_cursor->current_frame * speed));
} else {
- align_region (rv.region(), Start, (jack_nframes_t) (edit_cursor->current_frame * speed));
+ align_region (rv.region(), Start, (nframes_t) (edit_cursor->current_frame * speed));
}
}
}
void
-Editor::show_verbose_time_cursor (jack_nframes_t frame, double offset, double xpos, double ypos)
+Editor::show_verbose_time_cursor (nframes_t frame, double offset, double xpos, double ypos)
{
char buf[128];
SMPTE::Time smpte;
BBT_Time bbt;
+ int hours, mins;
+ nframes_t frame_rate;
float secs;
if (session == 0) {
break;
case AudioClock::MinSec:
- /* XXX fix this to compute min/sec properly */
- session->smpte_time (frame, smpte);
- secs = smpte.seconds + ((float) smpte.frames / session->smpte_frames_per_second);
- snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", smpte.hours, smpte.minutes, secs);
+ /* XXX this is copied from show_verbose_duration_cursor() */
+ frame_rate = session->frame_rate();
+ hours = frame / (frame_rate * 3600);
+ frame = frame % (frame_rate * 3600);
+ mins = frame / (frame_rate * 60);
+ frame = frame % (frame_rate * 60);
+ secs = (float) frame / (float) frame_rate;
+ snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", hours, mins, secs);
break;
default:
}
void
-Editor::show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end, double offset, double xpos, double ypos)
+Editor::show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset, double xpos, double ypos)
{
char buf[128];
SMPTE::Time smpte;
BBT_Time sbbt;
BBT_Time ebbt;
+ int hours, mins;
+ nframes_t distance, frame_rate;
float secs;
Meter meter_at_start(session->tempo_map().meter_at(start));
break;
case AudioClock::MinSec:
- /* XXX fix this to compute min/sec properly */
- session->smpte_duration (end - start, smpte);
- secs = smpte.seconds + ((float) smpte.frames / session->smpte_frames_per_second);
- snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", smpte.hours, smpte.minutes, secs);
+ /* XXX this stuff should be elsewhere.. */
+ distance = end - start;
+ frame_rate = session->frame_rate();
+ hours = distance / (frame_rate * 3600);
+ distance = distance % (frame_rate * 3600);
+ mins = distance / (frame_rate * 60);
+ distance = distance % (frame_rate * 60);
+ secs = (float) distance / (float) frame_rate;
+ snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", hours, mins, secs);
break;
default:
/* lets try to create new Region for the selection */
- vector<AudioRegion*> new_regions;
+ vector<boost::shared_ptr<AudioRegion> > new_regions;
create_region_from_selection (new_regions);
if (new_regions.empty()) {
/* XXX fix me one day to use all new regions */
- Region* region = new_regions.front();
+ boost::shared_ptr<Region> region (new_regions.front());
/* add it to the current stream/playlist.
begin_reversible_command (_("selection grab"));
- Playlist* playlist = clicked_trackview->playlist();
+ boost::shared_ptr<Playlist> playlist = clicked_trackview->playlist();
- before = &(playlist->get_state());
- clicked_trackview->playlist()->add_region (*region, selection->time[clicked_selection].start);
- XMLNode &after = playlist->get_state();
- session->add_command(new MementoCommand<Playlist>(*playlist, *before, after));
+ XMLNode *before = &(playlist->get_state());
+ clicked_trackview->playlist()->add_region (region, selection->time[clicked_selection].start);
+ XMLNode *after = &(playlist->get_state());
+ session->add_command(new MementoCommand<Playlist>(*playlist, before, after));
commit_reversible_command ();
start_grab (event);
drag_info.last_trackview = clicked_trackview;
- drag_info.last_frame_position = latest_regionview->region().position();
+ drag_info.last_frame_position = latest_regionview->region()->position();
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
show_verbose_time_cursor (drag_info.last_frame_position, 10);
void
Editor::start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp op)
{
- jack_nframes_t start = 0;
- jack_nframes_t end = 0;
+ nframes_t start = 0;
+ nframes_t end = 0;
if (session == 0) {
return;
void
Editor::drag_selection (ArdourCanvas::Item* item, GdkEvent* event)
{
- jack_nframes_t start = 0;
- jack_nframes_t end = 0;
- jack_nframes_t length;
- jack_nframes_t pending_position;
+ nframes_t start = 0;
+ nframes_t end = 0;
+ nframes_t length;
+ nframes_t pending_position;
if ((int32_t) drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
pending_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
speed = tv->get_diskstream()->speed();
}
- jack_nframes_t region_start = (jack_nframes_t) (clicked_regionview->region().position() / speed);
- jack_nframes_t region_end = (jack_nframes_t) (clicked_regionview->region().last_frame() / speed);
- jack_nframes_t region_length = (jack_nframes_t) (clicked_regionview->region().length() / speed);
+ nframes_t region_start = (nframes_t) (clicked_regionview->region()->position() / speed);
+ 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;
Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
RegionView* rv = clicked_regionview;
- jack_nframes_t frame_delta = 0;
+ nframes_t frame_delta = 0;
bool left_direction;
bool obey_snap = !Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier());
double speed = 1.0;
TimeAxisView* tvp = clicked_trackview;
RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
- pair<set<Playlist*>::iterator,bool> insert_result;
+ pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
if (tv && tv->is_audio_track()) {
speed = tv->get_diskstream()->speed();
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().freeze ();
+ (*i)->fake_set_opaque(false);
+ (*i)->region()->freeze ();
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
if (arv)
arv->temporarily_hide_envelope ();
- Playlist * pl = (*i)->region().playlist();
+ boost::shared_ptr<Playlist> pl = (*i)->region()->playlist();
insert_result = motion_frozen_playlists.insert (pl);
if (insert_result.second) {
- session->add_command(new MementoUndoCommand<Playlist>(*pl, pl->get_state()));
+ session->add_command(new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
}
}
}
switch (trim_op) {
case StartTrim:
- if ((left_direction == false) && (drag_info.current_pointer_frame <= rv->region().first_frame()/speed)) {
+ if ((left_direction == false) && (drag_info.current_pointer_frame <= rv->region()->first_frame()/speed)) {
break;
} else {
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
}
case EndTrim:
- if ((left_direction == true) && (drag_info.current_pointer_frame > (jack_nframes_t) (rv->region().last_frame()/speed))) {
+ if ((left_direction == true) && (drag_info.current_pointer_frame > (nframes_t) (rv->region()->last_frame()/speed))) {
break;
} else {
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
switch (trim_op) {
case StartTrim:
- show_verbose_time_cursor((jack_nframes_t) (rv->region().position()/speed), 10);
+ show_verbose_time_cursor((nframes_t) (rv->region()->position()/speed), 10);
break;
case EndTrim:
- show_verbose_time_cursor((jack_nframes_t) (rv->region().last_frame()/speed), 10);
+ show_verbose_time_cursor((nframes_t) (rv->region()->last_frame()/speed), 10);
break;
case ContentsTrim:
show_verbose_time_cursor(drag_info.current_pointer_frame, 10);
}
void
-Editor::single_contents_trim (RegionView& rv, jack_nframes_t frame_delta, bool left_direction, bool swap_direction, bool obey_snap)
+Editor::single_contents_trim (RegionView& rv, nframes_t frame_delta, bool left_direction, bool swap_direction, bool obey_snap)
{
- Region& region (rv.region());
+ boost::shared_ptr<Region> region (rv.region());
- if (region.locked()) {
+ if (region->locked()) {
return;
}
- jack_nframes_t new_bound;
+ nframes_t new_bound;
double speed = 1.0;
TimeAxisView* tvp = clicked_trackview;
if (left_direction) {
if (swap_direction) {
- new_bound = (jack_nframes_t) (region.position()/speed) + frame_delta;
+ new_bound = (nframes_t) (region->position()/speed) + frame_delta;
} else {
- new_bound = (jack_nframes_t) (region.position()/speed) - frame_delta;
+ new_bound = (nframes_t) (region->position()/speed) - frame_delta;
}
} else {
if (swap_direction) {
- new_bound = (jack_nframes_t) (region.position()/speed) - frame_delta;
+ new_bound = (nframes_t) (region->position()/speed) - frame_delta;
} else {
- new_bound = (jack_nframes_t) (region.position()/speed) + frame_delta;
+ new_bound = (nframes_t) (region->position()/speed) + frame_delta;
}
}
if (obey_snap) {
snap_to (new_bound);
}
- region.trim_start ((jack_nframes_t) (new_bound * speed), this);
+ region->trim_start ((nframes_t) (new_bound * speed), this);
rv.region_changed (StartChanged);
}
void
-Editor::single_start_trim (RegionView& rv, jack_nframes_t frame_delta, bool left_direction, bool obey_snap)
+Editor::single_start_trim (RegionView& rv, nframes_t frame_delta, bool left_direction, bool obey_snap)
{
- Region& region (rv.region());
+ boost::shared_ptr<Region> region (rv.region());
- if (region.locked()) {
+ if (region->locked()) {
return;
}
- jack_nframes_t new_bound;
+ nframes_t new_bound;
double speed = 1.0;
TimeAxisView* tvp = clicked_trackview;
}
if (left_direction) {
- new_bound = (jack_nframes_t) (region.position()/speed) - frame_delta;
+ new_bound = (nframes_t) (region->position()/speed) - frame_delta;
} else {
- new_bound = (jack_nframes_t) (region.position()/speed) + frame_delta;
+ new_bound = (nframes_t) (region->position()/speed) + frame_delta;
}
if (obey_snap) {
snap_to (new_bound, (left_direction ? 0 : 1));
}
- region.trim_front ((jack_nframes_t) (new_bound * speed), this);
+ region->trim_front ((nframes_t) (new_bound * speed), this);
rv.region_changed (Change (LengthChanged|PositionChanged|StartChanged));
}
void
-Editor::single_end_trim (RegionView& rv, jack_nframes_t frame_delta, bool left_direction, bool obey_snap)
+Editor::single_end_trim (RegionView& rv, nframes_t frame_delta, bool left_direction, bool obey_snap)
{
- Region& region (rv.region());
+ boost::shared_ptr<Region> region (rv.region());
- if (region.locked()) {
+ if (region->locked()) {
return;
}
- jack_nframes_t new_bound;
+ nframes_t new_bound;
double speed = 1.0;
TimeAxisView* tvp = clicked_trackview;
}
if (left_direction) {
- new_bound = (jack_nframes_t) ((region.last_frame() + 1)/speed) - frame_delta;
+ new_bound = (nframes_t) ((region->last_frame() + 1)/speed) - frame_delta;
} else {
- new_bound = (jack_nframes_t) ((region.last_frame() + 1)/speed) + frame_delta;
+ new_bound = (nframes_t) ((region->last_frame() + 1)/speed) + frame_delta;
}
if (obey_snap) {
snap_to (new_bound);
}
- region.trim_end ((jack_nframes_t) (new_bound * speed), this);
+ region->trim_end ((nframes_t) (new_bound * speed), this);
rv.region_changed (LengthChanged);
}
i != selection->regions.by_layer().end(); ++i)
{
thaw_region_after_trim (**i);
+ (*i)->fake_set_opaque (true);
}
}
- for (set<Playlist*>::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) {
+ for (set<boost::shared_ptr<Playlist> >::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) {
//(*p)->thaw ();
- session->add_command (new MementoRedoCommand<Playlist>(*(*p), (*p)->get_state()));
+ session->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state()));
}
motion_frozen_playlists.clear ();
Editor::point_trim (GdkEvent* event)
{
RegionView* rv = clicked_regionview;
- jack_nframes_t new_bound = drag_info.current_pointer_frame;
+ nframes_t new_bound = drag_info.current_pointer_frame;
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (new_bound);
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin();
i != selection->regions.by_layer().end(); ++i)
{
- if (!(*i)->region().locked()) {
- Playlist *pl = (*i)->region.playlist();
+ if (!(*i)->region()->locked()) {
+ boost::shared_ptr<Playlist> pl = (*i)->region()->playlist();
XMLNode &before = pl->get_state();
- (*i)->region().trim_front (new_bound, this);
+ (*i)->region()->trim_front (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl, before, after));
+ session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
} else {
- if (!rv->region().locked()) {
- Playlist *pl = rv->region().playlist();
+ if (!rv->region()->locked()) {
+ boost::shared_ptr<Playlist> pl = rv->region()->playlist();
XMLNode &before = pl->get_state();
- rv->region().trim_front (new_bound, this);
+ rv->region()->trim_front (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl, before, after));
+ session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i)
{
- if (!(*i)->region().locked()) {
- Playlist *pl = (*i)->region().playlist();
+ if (!(*i)->region()->locked()) {
+ boost::shared_ptr<Playlist> pl = (*i)->region()->playlist();
XMLNode &before = pl->get_state();
- (*i)->region().trim_end (new_bound, this);
+ (*i)->region()->trim_end (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command(new MementoCommand<Playlist>(*pl, before, after));
+ session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
} else {
- if (!rv->region().locked()) {
- Playlist *pl = rv->region().playlist();
+ if (!rv->region()->locked()) {
+ boost::shared_ptr<Playlist> pl = rv->region()->playlist();
XMLNode &before = pl->get_state();
- rv->region().trim_end (new_bound, this);
+ rv->region()->trim_end (new_bound, this);
XMLNode &after = pl->get_state();
- session->add_command (new MementoCommand<Playlist>(*pl, before, after));
+ session->add_command (new MementoCommand<Playlist>(*pl.get(), &before, &after));
}
}
void
Editor::thaw_region_after_trim (RegionView& rv)
{
- Region& region (rv.region());
+ boost::shared_ptr<Region> region (rv.region());
- if (region.locked()) {
+ if (region->locked()) {
return;
}
- region.thaw (_("trimmed region"));
- XMLNode &after = region.playlist()->get_state();
- session->add_command (new MementoRedoCommand<Playlist>(*(region.playlist()), after));
+ region->thaw (_("trimmed region"));
+ XMLNode &after = region->playlist()->get_state();
+ session->add_command (new MementoCommand<Playlist>(*(region->playlist()), 0, &after));
AudioRegionView* arv = dynamic_cast<AudioRegionView*>(&rv);
if (arv)
void
Editor::drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
{
- jack_nframes_t start = 0;
- jack_nframes_t end = 0;
+ nframes_t start = 0;
+ nframes_t end = 0;
ArdourCanvas::SimpleRect *crect = (range_marker_op == CreateRangeMarker) ? range_bar_drag_rect: transport_bar_drag_rect;
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
Editor::end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
{
Location * newloc = 0;
+ string rangename;
if (!drag_info.first_move) {
drag_range_markerbar_op (item, event);
{
begin_reversible_command (_("new range marker"));
XMLNode &before = session->locations()->get_state();
- newloc = new Location(temp_location->start(), temp_location->end(), "unnamed", Location::IsRangeMarker);
+ session->locations()->next_available_name(rangename,"unnamed");
+ newloc = new Location(temp_location->start(), temp_location->end(), rangename, Location::IsRangeMarker);
session->locations()->add (newloc, true);
XMLNode &after = session->locations()->get_state();
- session->add_command(new MementoCommand<Locations>(*(session->locations()), before, after));
+ session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
commit_reversible_command ();
range_bar_drag_rect->hide();
if (Keyboard::no_modifier_keys_pressed (&event->button)) {
- jack_nframes_t start;
- jack_nframes_t end;
+ nframes_t start;
+ nframes_t end;
start = session->locations()->first_mark_before (drag_info.grab_frame);
end = session->locations()->first_mark_after (drag_info.grab_frame);
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);
break;
void
Editor::drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event)
{
- jack_nframes_t start;
- jack_nframes_t end;
+ nframes_t start;
+ nframes_t end;
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (drag_info.current_pointer_frame);
}
void
-Editor::reposition_zoom_rect (jack_nframes_t start, jack_nframes_t end)
+Editor::reposition_zoom_rect (nframes_t start, nframes_t end)
{
double x1 = frame_to_pixel (start);
double x2 = frame_to_pixel (end);
- double y2 = canvas_height - 2;
+ double y2 = full_canvas_height - 1.0;
zoom_rect->property_x1() = x1;
zoom_rect->property_y1() = 1.0;
void
Editor::drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event)
{
- jack_nframes_t start;
- jack_nframes_t end;
+ nframes_t start;
+ nframes_t end;
double y1;
double y2;
return;
}
-// if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
-// snap_to (drag_info.current_pointer_frame);
-
-// if (drag_info.first_move) {
-// snap_to (drag_info.grab_frame);
-// }
-// }
-
+ if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
+ if (drag_info.first_move) {
+ snap_to (drag_info.grab_frame);
+ }
+ snap_to (drag_info.current_pointer_frame);
+ }
/* base start and end on initial click position */
+
if (drag_info.current_pointer_frame < drag_info.grab_frame) {
start = drag_info.current_pointer_frame;
end = drag_info.grab_frame;
if (drag_info.current_pointer_y < drag_info.grab_y) {
y1 = drag_info.current_pointer_y;
y2 = drag_info.grab_y;
- }
- else {
+ } else {
y2 = drag_info.current_pointer_y;
y1 = drag_info.grab_y;
}
Selection::Operation op = Keyboard::selection_type (event->button.state);
bool commit;
- begin_reversible_command (_("select regions"));
+ 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);
}
} else {
+ selection->clear_tracks();
selection->clear_regions();
selection->clear_points ();
selection->clear_lines ();
ArdourPrompter prompter (false);
prompter.set_prompt (_("Name for region:"));
- prompter.set_initial_text (clicked_regionview->region().name());
+ prompter.set_initial_text (clicked_regionview->region()->name());
prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
prompter.show_all ();
string str;
prompter.get_result(str);
if (str.length()) {
- clicked_regionview->region().set_name (str);
+ clicked_regionview->region()->set_name (str);
}
break;
}
return;
}
- if (drag_info.current_pointer_frame > rv->region().position()) {
- rv->get_time_axis_view().show_timestretch (rv->region().position(), drag_info.current_pointer_frame);
+ if (drag_info.current_pointer_frame > rv->region()->position()) {
+ rv->get_time_axis_view().show_timestretch (rv->region()->position(), drag_info.current_pointer_frame);
}
drag_info.last_pointer_frame = drag_info.current_pointer_frame;
return;
}
- jack_nframes_t newlen = drag_info.last_pointer_frame - clicked_regionview->region().position();
- float percentage = (float) ((double) newlen - (double) clicked_regionview->region().length()) / ((double) newlen) * 100.0f;
+ nframes_t newlen = drag_info.last_pointer_frame - clicked_regionview->region()->position();
+ float percentage = (float) ((double) newlen - (double) clicked_regionview->region()->length()) / ((double) newlen) * 100.0f;
begin_reversible_command (_("timestretch"));
}
void
-Editor::mouse_brush_insert_region (RegionView* rv, jack_nframes_t pos)
+Editor::mouse_brush_insert_region (RegionView* rv, nframes_t pos)
{
/* no brushing without a useful snap setting */
/* don't brush a copy over the original */
- if (pos == rv->region().position()) {
+ if (pos == rv->region()->position()) {
return;
}
return;
}
- Playlist* playlist = atv->playlist();
+ boost::shared_ptr<Playlist> playlist = atv->playlist();
double speed = atv->get_diskstream()->speed();
XMLNode &before = playlist->get_state();
- playlist->add_region (*(new AudioRegion (arv->audio_region)), (jack_nframes_t) (pos * speed));
+ playlist->add_region (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (arv->audio_region())), (nframes_t) (pos * speed));
XMLNode &after = playlist->get_state();
- session->add_command(new MementoCommand<Playlist>(*playlist, before, after));
+ session->add_command(new MementoCommand<Playlist>(*playlist.get(), &before, &after));
// playlist is frozen, so we have to update manually
- playlist->StateChanged (Change (~0)); /* EMIT SIGNAL */
+ playlist->Modified(); /* EMIT SIGNAL */
}
gint