case GDK_LEAVE_NOTIFY:
track_canvas.w2c(event->crossing.x, event->crossing.y, *pcx, *pcy);
break;
+ case GDK_KEY_PRESS:
+ case GDK_KEY_RELEASE:
+ // track_canvas.w2c(event->key.x, event->key.y, *pcx, *pcy);
+ break;
default:
warning << string_compose (_("Editor::event_frame() used on unhandled event type %1"), event->type) << endmsg;
break;
position is negative (as can be the case with motion events in particular),
the frame location is always positive.
*/
-
+
return pixel_to_frame (*pcx);
}
return;
}
- if (m == mouse_mode && !force) {
+ if (!force && m == mouse_mode) {
return;
}
} else {
- /* in range mode, hide object (region) selection, and show the
- range selection.
+ /*
+ in range mode,show the range selection.
*/
- for (AudioRegionSelection::iterator i = selection->audio_regions.begin(); i != selection->audio_regions.end(); ++i) {
- (*i)->set_should_show_selection (false);
- }
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
if ((*i)->selected()) {
(*i)->show_selection (selection->time);
ignore_mouse_mode_toggle = false;
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor(*current_canvas_cursor);
+ track_canvas.get_window()->set_cursor(*current_canvas_cursor);
}
}
}
}
-bool
-Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
+void
+Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
- jack_nframes_t where = event_frame (event, 0, 0);
-
- if (session && session->actively_recording()) {
- return TRUE;
- }
+ bool commit;
+ bool c1;
+ bool c2;
/* in object/audition/timefx mode, any button press sets
the selection if the object can be selected. this is a
bit of hack, because we want to avoid this if the
mouse operation is a region alignment.
- */
-
- if (((mouse_mode == MouseObject) ||
- (mouse_mode == MouseAudition && item_type == RegionItem) ||
- (mouse_mode == MouseTimeFX && item_type == RegionItem)) &&
- event->type == GDK_BUTTON_PRESS &&
- event->button.button <= 3) {
- AudioRegionView* rv;
- ControlPoint* cp;
-
- /* not dbl-click or triple-click */
-
- switch (item_type) {
- case RegionItem:
- set_selected_regionview_from_click (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift), true);
- break;
-
- case AudioRegionViewNameHighlight:
- case AudioRegionViewName:
- if ((rv = reinterpret_cast<AudioRegionView *> (gtk_object_get_data(GTK_OBJECT(item), "regionview"))) != 0) {
- set_selected_regionview_from_click (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift), true);
- }
- break;
-
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- if ((cp = reinterpret_cast<ControlPoint *> (gtk_object_get_data(GTK_OBJECT(item), "control_point"))) != 0) {
- set_selected_control_point_from_click (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift), true);
- }
- break;
+ note: not dbl-click or triple-click
+ */
- case StreamItem:
- break;
+ if (((mouse_mode != MouseObject) &&
+ (mouse_mode != MouseAudition || item_type != RegionItem) &&
+ (mouse_mode != MouseTimeFX || item_type != RegionItem)) ||
+ (event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE || event->button.button > 3)) {
+
+ return;
+ }
+
+ Selection::Operation op = Keyboard::selection_type (event->button.state);
+ bool press = (event->type == GDK_BUTTON_PRESS);
- case AutomationTrackItem:
- break;
+ begin_reversible_command (_("select on click"));
- default:
- break;
- }
+ 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);
+ break;
+
+ case AudioRegionViewNameHighlight:
+ case AudioRegionViewName:
+ c1 = set_selected_track_from_click (press, op, true, true);
+ c2 = set_selected_regionview_from_click (press, op, true);
+ commit = (c1 || c2);
+ 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);
+ break;
+
+ case StreamItem:
+ commit = set_selected_track_from_click (press, op, true, true);
+ break;
+
+ case AutomationTrackItem:
+ commit = set_selected_track_from_click (press, op, true, 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 */
event->type == GDK_BUTTON_PRESS &&
event->button.button <= 3) {
- AudioRegionView* rv;
-
switch (item_type) {
case StreamItem:
case RegionItem:
case AutomationTrackItem:
- set_selected_track_from_click (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift), true, true);
+ commit = set_selected_track_from_click (press, op, true, true);
break;
- case AudioRegionViewNameHighlight:
- case AudioRegionViewName:
- rv = reinterpret_cast<AudioRegionView *> (gtk_object_get_data(GTK_OBJECT(item), "regionview"));
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()) {
+ return true;
+ }
+ button_selection (item, event, item_type);
+
if (drag_info.item == 0 &&
(Keyboard::is_delete_event (&event->button) ||
Keyboard::is_context_menu_event (&event->button) ||
Keyboard::is_edit_event (&event->button))) {
/* handled by button release */
- return TRUE;
+ return true;
}
switch (event->button.button) {
case EditCursorItem:
case PlayheadCursorItem:
start_cursor_grab (item, event);
- return TRUE;
+ return true;
case MarkerItem:
if (Keyboard::modifier_state_equals (event->button.state,
} else {
start_marker_grab (item, event);
}
- return TRUE;
+ return true;
case TempoMarkerItem:
- start_tempo_marker_grab (item, event);
- return TRUE;
+ if (Keyboard::modifier_state_contains (event->button.state, Keyboard::Control)) {
+ start_tempo_marker_copy_grab (item, event);
+ } else {
+ start_tempo_marker_grab (item, event);
+ }
+ return true;
case MeterMarkerItem:
- start_meter_marker_grab (item, event);
- return TRUE;
+ if (Keyboard::modifier_state_contains (event->button.state, Keyboard::Control)) {
+ start_meter_marker_copy_grab (item, event);
+ } else {
+ start_meter_marker_grab (item, event);
+ }
+ return true;
case TempoBarItem:
- return TRUE;
+ return true;
case MeterBarItem:
- return TRUE;
+ return true;
case RangeMarkerBarItem:
start_range_markerbar_op (item, event, CreateRangeMarker);
- return TRUE;
+ return true;
break;
+
case TransportMarkerBarItem:
start_range_markerbar_op (item, event, CreateTransportMarker);
- return TRUE;
+ return true;
break;
default:
default:
start_selection_op (item, event, CreateSelection);
}
- return TRUE;
+ return true;
break;
case MouseObject:
switch (item_type) {
case FadeInHandleItem:
start_fade_in_grab (item, event);
- return TRUE;
+ return true;
case FadeOutHandleItem:
start_fade_out_grab (item, event);
- return TRUE;
+ return true;
case RegionItem:
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::Control)) {
case AudioRegionViewNameHighlight:
start_trim (item, event);
- return TRUE;
+ return true;
break;
case AudioRegionViewName:
/* rename happens on edit clicks */
start_trim (clicked_regionview->get_name_highlight(), event);
- return TRUE;
+ return true;
break;
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
start_control_point_grab (item, event);
- return TRUE;
+ return true;
break;
case GainAutomationLineItem:
case PanAutomationLineItem:
case RedirectAutomationLineItem:
start_line_grab_from_line (item, event);
- return TRUE;
+ return true;
break;
case StreamItem:
/* <CMT Additions> */
case ImageFrameHandleStartItem:
imageframe_start_handle_op(item, event) ;
- return(TRUE) ;
+ return(true) ;
break ;
case ImageFrameHandleEndItem:
imageframe_end_handle_op(item, event) ;
- return(TRUE) ;
+ return(true) ;
break ;
case MarkerViewHandleStartItem:
markerview_item_start_handle_op(item, event) ;
- return(TRUE) ;
+ return(true) ;
break ;
case MarkerViewHandleEndItem:
markerview_item_end_handle_op(item, event) ;
- return(TRUE) ;
+ return(true) ;
break ;
/* </CMT Additions> */
break ;
/* </CMT Additions> */
+ case MarkerBarItem:
+
+ break;
+
default:
break;
}
}
- return TRUE;
+ return true;
break;
case MouseGain:
case GainControlPointItem:
start_control_point_grab (item, event);
- return TRUE;
+ return true;
case GainLineItem:
start_line_grab_from_line (item, event);
- return TRUE;
+ return true;
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
start_control_point_grab (item, event);
- return TRUE;
+ return true;
break;
default:
break;
}
- return TRUE;
+ return true;
break;
switch (item_type) {
default:
break;
}
- return TRUE;
+ return true;
break;
case MouseZoom:
start_mouse_zoom (item, event);
}
- return TRUE;
+ return true;
break;
case MouseTimeFX:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
start_control_point_grab (item, event);
- return TRUE;
+ return true;
break;
default:
switch (item_type) {
case AudioRegionViewNameHighlight:
start_trim (item, event);
- return TRUE;
+ return true;
break;
case AudioRegionViewName:
start_trim (clicked_regionview->get_name_highlight(), event);
- return TRUE;
+ return true;
break;
default:
if (event->type == GDK_BUTTON_PRESS) {
/* relax till release */
}
- return TRUE;
+ return true;
break;
} else {
temporal_zoom_to_frame (true, event_frame(event));
}
- return TRUE;
+ return 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 ();
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 ();
break;
}
- return FALSE;
+
+ return false;
}
bool
/* no action if we're recording */
if (session && session->actively_recording()) {
- return TRUE;
+ return true;
}
/* first, see if we're finishing a drag ... */
if (drag_info.item) {
if (end_grab (item, event)) {
/* grab dragged, so do nothing else */
- return TRUE;
+ return true;
}
}
+ button_selection (item, event, item_type);
+
/* edit events get handled here */
if (drag_info.item == 0 && Keyboard::is_edit_event (&event->button)) {
default:
break;
}
- return TRUE;
+ return true;
}
/* context menu events get handled here */
break;
}
- return TRUE;
+ return true;
}
}
break;
case MarkerItem:
-
remove_marker (*item, event);
-
break;
case RegionItem:
default:
break;
}
- return TRUE;
+ return true;
}
switch (event->button.button) {
case RedirectAutomationLineItem:
case StartSelectionTrimItem:
case EndSelectionTrimItem:
- return TRUE;
+ return true;
case MarkerBarItem:
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (where, 0, true);
}
mouse_add_new_marker (where);
- return TRUE;
+ return true;
case TempoBarItem:
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (where);
}
mouse_add_new_tempo_event (where);
- return TRUE;
+ return true;
case MeterBarItem:
mouse_add_new_meter_event (pixel_to_frame (event->button.x));
- return TRUE;
+ return true;
break;
default:
event,
where,
event->button.y);
- return TRUE;
+ return true;
break;
default:
switch (item_type) {
case RegionItem:
clicked_regionview->add_gain_point_event (item, event);
- return TRUE;
+ return true;
break;
case AutomationTrackItem:
dynamic_cast<AutomationTimeAxisView*>(clicked_trackview)->
add_automation_event (item, event, where, event->button.y);
- return TRUE;
+ return true;
break;
default:
break;
}
- return TRUE;
+ return true;
break;
} else {
// Button2 click is unused
}
- return TRUE;
+ return true;
break;
case MouseRange:
// x_style_paste (where, 1.0);
- return TRUE;
+ return true;
break;
default:
default:
break;
}
- return FALSE;
-}
-
-void
-Editor::maybe_autoscroll (GdkEvent* event)
-{
- jack_nframes_t one_page = (jack_nframes_t) rint (canvas_width * frames_per_unit);
- jack_nframes_t rightmost_frame = leftmost_frame + one_page;
-
- jack_nframes_t frame = drag_info.current_pointer_frame;
-
- if (autoscroll_timeout_tag < 0) {
- if (frame > rightmost_frame) {
- if (rightmost_frame < max_frames) {
- start_canvas_autoscroll (1);
- }
- } else if (frame < leftmost_frame) {
- if (leftmost_frame > 0) {
- start_canvas_autoscroll (-1);
- }
- }
- } else {
- if (frame >= leftmost_frame && frame < rightmost_frame) {
- stop_canvas_autoscroll ();
- }
- }
+ return false;
}
bool
switch (item_type) {
case GainControlPointItem:
if (mouse_mode == MouseGain) {
- cp = reinterpret_cast<ControlPoint*>(gtk_object_get_data (GTK_OBJECT(item), "control_point"));
+ cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
cp->set_visible (true);
double at_x, at_y;
show_verbose_canvas_cursor ();
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*fader_cursor);
+ track_canvas.get_window()->set_cursor (*fader_cursor);
}
}
break;
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
- cp = reinterpret_cast<ControlPoint*>(gtk_object_get_data (GTK_OBJECT(item), "control_point"));
+ cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
cp->set_visible (true);
double at_x, at_y;
show_verbose_canvas_cursor ();
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*fader_cursor);
+ track_canvas.get_window()->set_cursor (*fader_cursor);
}
break;
if (line)
line->property_fill_color_rgba() = color_map[cEnteredGainLine];
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*fader_cursor);
+ track_canvas.get_window()->set_cursor (*fader_cursor);
}
}
break;
line->property_fill_color_rgba() = color_map[cEnteredAutomationLine];
}
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*fader_cursor);
+ track_canvas.get_window()->set_cursor (*fader_cursor);
}
break;
case AudioRegionViewNameHighlight:
if (is_drawable() && mouse_mode == MouseObject) {
- track_canvas_scroller.get_window()->set_cursor (*trimmer_cursor);
+ track_canvas.get_window()->set_cursor (*trimmer_cursor);
}
break;
/* </CMT Additions> */
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*trimmer_cursor);
+ track_canvas.get_window()->set_cursor (*trimmer_cursor);
}
break;
case EditCursorItem:
case PlayheadCursorItem:
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*grabber_cursor);
+ track_canvas.get_window()->set_cursor (*grabber_cursor);
}
break;
/* when the name is not an active item, the entire name highlight is for trimming */
- if (!reinterpret_cast<AudioRegionView *> (gtk_object_get_data(GTK_OBJECT(item), "regionview"))->name_active()) {
+ if (!reinterpret_cast<AudioRegionView *> (item->get_data ("regionview"))->name_active()) {
if (mouse_mode == MouseObject && is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*trimmer_cursor);
+ track_canvas.get_window()->set_cursor (*trimmer_cursor);
}
}
break;
break;
}
- track_canvas_scroller.get_window()->set_cursor (*cursor);
+ track_canvas.get_window()->set_cursor (*cursor);
AutomationTimeAxisView* atv;
- if ((atv = static_cast<AutomationTimeAxisView*>(gtk_object_get_data(GTK_OBJECT(item), "trackview"))) != 0) {
+ if ((atv = static_cast<AutomationTimeAxisView*>(item->get_data ("trackview"))) != 0) {
clear_entered_track = false;
set_entered_track (atv);
}
case MeterBarItem:
case TempoBarItem:
if (is_drawable()) {
- time_canvas_scroller.get_window()->set_cursor (*timebar_cursor);
+ time_canvas.get_window()->set_cursor (*timebar_cursor);
}
break;
case MarkerItem:
- if ((marker = static_cast<Marker *> (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) {
+ if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
break;
}
marker->set_color_rgba (color_map[cEnteredMarker]);
case MeterMarkerItem:
case TempoMarkerItem:
if (is_drawable()) {
- time_canvas_scroller.get_window()->set_cursor (*timebar_cursor);
+ time_canvas.get_window()->set_cursor (*timebar_cursor);
}
break;
case FadeInHandleItem:
break;
}
- return FALSE;
+ return false;
}
bool
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
- cp = reinterpret_cast<ControlPoint*>(gtk_object_get_data (GTK_OBJECT(item), "control_point"));
+ cp = reinterpret_cast<ControlPoint*>(item->get_data ("control_point"));
if (cp->line.npoints() > 1) {
if (!cp->selected) {
cp->set_visible (false);
}
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*current_canvas_cursor);
+ track_canvas.get_window()->set_cursor (*current_canvas_cursor);
}
hide_verbose_canvas_cursor ();
case MarkerViewHandleEndItem:
/* </CMT Additions> */
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*current_canvas_cursor);
+ track_canvas.get_window()->set_cursor (*current_canvas_cursor);
}
break;
case GainAutomationLineItem:
case RedirectAutomationLineItem:
case PanAutomationLineItem:
- al = reinterpret_cast<AutomationLine*> (gtk_object_get_data (GTK_OBJECT(item),"line"));
+ al = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
line->property_fill_color_rgba() = al->get_line_color();
}
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*current_canvas_cursor);
+ track_canvas.get_window()->set_cursor (*current_canvas_cursor);
}
break;
case AudioRegionViewName:
/* see enter_handler() for notes */
- if (!reinterpret_cast<AudioRegionView *> (gtk_object_get_data(GTK_OBJECT(item), "regionview"))->name_active()) {
+ if (!reinterpret_cast<AudioRegionView *> (item->get_data ("regionview"))->name_active()) {
if (is_drawable() && mouse_mode == MouseObject) {
- track_canvas_scroller.get_window()->set_cursor (*current_canvas_cursor);
+ track_canvas.get_window()->set_cursor (*current_canvas_cursor);
}
}
break;
case TempoBarItem:
case MarkerBarItem:
if (is_drawable()) {
- time_canvas_scroller.get_window()->set_cursor (*timebar_cursor);
+ time_canvas.get_window()->set_cursor (*timebar_cursor);
}
break;
case MarkerItem:
- if ((marker = static_cast<Marker *> (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) {
+ if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
break;
}
loc = find_location_from_marker (marker, is_start);
case TempoMarkerItem:
if (is_drawable()) {
- time_canvas_scroller.get_window()->set_cursor (*timebar_cursor);
+ time_canvas.get_window()->set_cursor (*timebar_cursor);
}
break;
case FadeInHandleItem:
case FadeOutHandleItem:
- rv = static_cast<AudioRegionView*>(gtk_object_get_data (GTK_OBJECT(item), "regionview"));
+ rv = static_cast<AudioRegionView*>(item->get_data ("regionview"));
{
ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
if (rect) {
case AutomationTrackItem:
if (is_drawable()) {
- track_canvas_scroller.get_window()->set_cursor (*current_canvas_cursor);
+ track_canvas.get_window()->set_cursor (*current_canvas_cursor);
clear_entered_track = true;
Glib::signal_idle().connect (mem_fun(*this, &Editor::left_automation_track));
}
break;
}
- return FALSE;
+ return false;
}
gint
set_entered_track (0);
clear_entered_track = false;
}
- return FALSE;
+ return false;
}
bool
-Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
+Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type, bool from_autoscroll)
{
gint x, y;
if (session && session->actively_recording()) {
/* Sorry. no dragging stuff around while we record */
- return TRUE;
+ return true;
}
+ drag_info.item_type = item_type;
drag_info.current_pointer_frame = event_frame (event, &drag_info.current_pointer_x,
&drag_info.current_pointer_y);
- if (drag_info.item) {
- /* item != 0 is the best test i can think of for
- dragging.
+
+ if (!from_autoscroll && drag_info.item) {
+ /* item != 0 is the best test i can think of for dragging.
*/
- if (!drag_info.move_threshold_passsed)
- {
- drag_info.move_threshold_passsed = (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
+ if (!drag_info.move_threshold_passed) {
+ drag_info.move_threshold_passed = (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
+
// and change the initial grab loc/frame if this drag info wants us to
- if (drag_info.want_move_threshold && drag_info.move_threshold_passsed) {
+
+ if (drag_info.want_move_threshold && drag_info.move_threshold_passed) {
drag_info.grab_frame = drag_info.current_pointer_frame;
drag_info.grab_x = drag_info.current_pointer_x;
drag_info.grab_y = drag_info.current_pointer_y;
/* </CMT Additions> */
if (drag_info.item && (event->motion.state & Gdk::BUTTON1_MASK ||
(event->motion.state & Gdk::BUTTON2_MASK))) {
- maybe_autoscroll (event);
- (this->*(drag_info.motion_callback)) (item, event);
- goto handled;
- }
- goto not_handled;
-
+ if (!from_autoscroll) {
+ maybe_autoscroll (event);
+ }
+ (this->*(drag_info.motion_callback)) (item, event);
+ goto handled;
+ }
+ goto not_handled;
+
default:
break;
}
case MouseTimeFX:
if (drag_info.item && (event->motion.state & GDK_BUTTON1_MASK ||
(event->motion.state & GDK_BUTTON2_MASK))) {
- maybe_autoscroll (event);
+ if (!from_autoscroll) {
+ maybe_autoscroll (event);
+ }
(this->*(drag_info.motion_callback)) (item, event);
goto handled;
}
handled:
track_canvas_motion (event);
- return TRUE;
+ // drag_info.last_pointer_frame = drag_info.current_pointer_frame;
+ return true;
not_handled:
- return FALSE;
+ return false;
}
void
// if dragging with button2, the motion is x constrained, with Alt-button2 it is y constrained
if (event->button.button == 2) {
- drag_info.x_constrained = true;
+ if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Alt)) {
+ drag_info.y_constrained = true;
+ drag_info.x_constrained = false;
+ } else {
+ drag_info.y_constrained = false;
+ drag_info.x_constrained = true;
+ }
} else {
drag_info.x_constrained = false;
+ drag_info.y_constrained = false;
}
drag_info.grab_frame = event_frame(event, &drag_info.grab_x, &drag_info.grab_y);
drag_info.cumulative_x_drag = 0;
drag_info.cumulative_y_drag = 0;
drag_info.first_move = true;
- drag_info.move_threshold_passsed = false;
+ drag_info.move_threshold_passed = false;
drag_info.want_move_threshold = false;
drag_info.pointer_frame_offset = 0;
drag_info.brushing = false;
}
}
+void
+Editor::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t time)
+{
+ drag_info.item->ungrab (0);
+ drag_info.item = new_item;
+
+ if (cursor == 0) {
+ cursor = grabber_cursor;
+ }
+
+ drag_info.item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK, *cursor, time);
+}
+
bool
Editor::end_grab (ArdourCanvas::Item* item, GdkEvent* event)
{
start_grab (event);
- if ((drag_info.data = (gtk_object_get_data (GTK_OBJECT(item), "regionview"))) == 0) {
+ if ((drag_info.data = (item->get_data ("regionview"))) == 0) {
fatal << _("programming error: fade in canvas item has no regionview data pointer!") << endmsg;
/*NOTREACHED*/
}
start_grab (event);
- if ((drag_info.data = (gtk_object_get_data (GTK_OBJECT(item), "regionview"))) == 0) {
+ if ((drag_info.data = (item->get_data ("regionview"))) == 0) {
fatal << _("programming error: fade out canvas item has no regionview data pointer!") << endmsg;
/*NOTREACHED*/
}
start_grab (event);
- if ((drag_info.data = (gtk_object_get_data (GTK_OBJECT(item), "cursor"))) == 0) {
+ if ((drag_info.data = (item->get_data ("cursor"))) == 0) {
fatal << _("programming error: cursor canvas item has no cursor data pointer!") << endmsg;
/*NOTREACHED*/
}
{
Marker* marker;
- if ((marker = static_cast<Marker *> (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) {
+ if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
/*NOTREACHED*/
}
bool is_start;
bool move_both = false;
+
jack_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;
else {
newframe = 0;
}
-
+
jack_nframes_t next = newframe;
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
snap_to (newframe, 0, true);
}
- if (drag_info.current_pointer_frame == drag_info.last_pointer_frame) return;
+ if (drag_info.current_pointer_frame == drag_info.last_pointer_frame) {
+ return;
+ }
/* call this to find out if its the start or end */
Marker* marker = (Marker *) drag_info.data;
bool is_start;
+
+
+ begin_reversible_command ( _("move marker") );
+ session->add_undo( session->locations()->get_memento() );
+
Location * location = find_location_from_marker (marker, is_start);
+
if (location) {
location->set (drag_info.copied_location->start(), drag_info.copied_location->end());
}
+
+ session->add_redo_no_execute( session->locations()->get_memento() );
+ commit_reversible_command ();
marker_drag_line->hide();
range_marker_drag_rect->hide();
Marker* marker;
MeterMarker* meter_marker;
- if ((marker = reinterpret_cast<Marker *> (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) {
+ if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
fatal << _("programming error: meter marker canvas item has no marker object pointer!") << endmsg;
/*NOTREACHED*/
}
show_verbose_time_cursor (drag_info.current_pointer_frame, 10);
}
+void
+Editor::start_meter_marker_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
+{
+ Marker* marker;
+ MeterMarker* meter_marker;
+
+ if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
+ fatal << _("programming error: meter marker canvas item has no marker object pointer!") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ meter_marker = dynamic_cast<MeterMarker*> (marker);
+
+ // create a dummy marker for visual representation of moving the copy.
+ // The actual copying is not done before we reach the finish callback.
+ char name[64];
+ snprintf (name, sizeof(name), "%g/%g", meter_marker->meter().beats_per_bar(), meter_marker->meter().note_divisor ());
+ MeterMarker* new_marker = new MeterMarker(*this, *meter_group, color_map[cMeterMarker], name,
+ *new MeterSection(meter_marker->meter()));
+
+ drag_info.item = &new_marker->the_item();
+ drag_info.copy = true;
+ drag_info.data = new_marker;
+ drag_info.motion_callback = &Editor::meter_marker_drag_motion_callback;
+ drag_info.finished_callback = &Editor::meter_marker_drag_finished_callback;
+
+ start_grab (event);
+
+ drag_info.pointer_frame_offset = drag_info.grab_frame - meter_marker->meter().frame();
+
+ show_verbose_time_cursor (drag_info.current_pointer_frame, 10);
+}
+
void
Editor::meter_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
{
if (drag_info.first_move) return;
- meter_marker_drag_motion_callback (item, event);
+ meter_marker_drag_motion_callback (drag_info.item, event);
MeterMarker* marker = (MeterMarker *) drag_info.data;
BBT_Time when;
TempoMap& map (session->tempo_map());
map.bbt_time (drag_info.last_pointer_frame, when);
- begin_reversible_command (_("move meter mark"));
- session->add_undo (map.get_memento());
- map.move_meter (marker->meter(), when);
- session->add_redo_no_execute (map.get_memento());
- commit_reversible_command ();
+ if (drag_info.copy == true) {
+ begin_reversible_command (_("copy meter mark"));
+ session->add_undo (map.get_memento());
+ map.add_meter (marker->meter(), when);
+ session->add_redo_no_execute (map.get_memento());
+ commit_reversible_command ();
+
+ // delete the dummy marker we used for visual representation of copying.
+ // a new visual marker will show up automatically.
+ delete marker;
+ } else {
+ begin_reversible_command (_("move meter mark"));
+ session->add_undo (map.get_memento());
+ map.move_meter (marker->meter(), when);
+ session->add_redo_no_execute (map.get_memento());
+ commit_reversible_command ();
+ }
}
void
Marker* marker;
TempoMarker* tempo_marker;
- if ((marker = reinterpret_cast<Marker *> (gtk_object_get_data (GTK_OBJECT(item), "tempo_marker"))) == 0) {
+ if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
/*NOTREACHED*/
}
show_verbose_time_cursor (drag_info.current_pointer_frame, 10);
}
+void
+Editor::start_tempo_marker_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
+{
+ Marker* marker;
+ TempoMarker* tempo_marker;
+
+ if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
+ fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ if ((tempo_marker = dynamic_cast<TempoMarker *> (marker)) == 0) {
+ fatal << _("programming error: marker for tempo is not a tempo marker!") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ // create a dummy marker for visual representation of moving the copy.
+ // The actual copying is not done before we reach the finish callback.
+ char name[64];
+ snprintf (name, sizeof (name), "%.2f", tempo_marker->tempo().beats_per_minute());
+ TempoMarker* new_marker = new TempoMarker(*this, *tempo_group, color_map[cTempoMarker], name,
+ *new TempoSection(tempo_marker->tempo()));
+
+ drag_info.item = &new_marker->the_item();
+ drag_info.copy = true;
+ drag_info.data = new_marker;
+ drag_info.motion_callback = &Editor::tempo_marker_drag_motion_callback;
+ drag_info.finished_callback = &Editor::tempo_marker_drag_finished_callback;
+
+ start_grab (event);
+
+ drag_info.pointer_frame_offset = drag_info.grab_frame - tempo_marker->tempo().frame();
+
+ show_verbose_time_cursor (drag_info.current_pointer_frame, 10);
+}
+
void
Editor::tempo_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
{
if (drag_info.first_move) return;
- tempo_marker_drag_motion_callback (item, event);
+ tempo_marker_drag_motion_callback (drag_info.item, event);
TempoMarker* marker = (TempoMarker *) drag_info.data;
BBT_Time when;
TempoMap& map (session->tempo_map());
map.bbt_time (drag_info.last_pointer_frame, when);
- begin_reversible_command (_("move tempo mark"));
- session->add_undo (map.get_memento());
- map.move_tempo (marker->tempo(), when);
- session->add_redo_no_execute (map.get_memento());
- commit_reversible_command ();
+ if (drag_info.copy == true) {
+ begin_reversible_command (_("copy tempo mark"));
+ session->add_undo (map.get_memento());
+ map.add_tempo (marker->tempo(), when);
+ session->add_redo_no_execute (map.get_memento());
+ commit_reversible_command ();
+
+ // delete the dummy marker we used for visual representation of copying.
+ // a new visual marker will show up automatically.
+ delete marker;
+ } else {
+ begin_reversible_command (_("move tempo mark"));
+ session->add_undo (map.get_memento());
+ map.move_tempo (marker->tempo(), when);
+ session->add_redo_no_execute (map.get_memento());
+ commit_reversible_command ();
+ }
}
void
{
ControlPoint* control_point;
- if ((control_point = reinterpret_cast<ControlPoint *> (gtk_object_get_data (GTK_OBJECT(item), "control_point"))) == 0) {
+ if ((control_point = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"))) == 0) {
fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg;
/*NOTREACHED*/
}
{
ControlPoint* control_point;
- if ((control_point = reinterpret_cast<ControlPoint *> (gtk_object_get_data (GTK_OBJECT(item), "control_point"))) == 0) {
+ if ((control_point = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"))) == 0) {
fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg;
/*NOTREACHED*/
}
{
ControlPoint* control_point;
- if ((control_point = reinterpret_cast<ControlPoint *> (gtk_object_get_data (GTK_OBJECT(item), "control_point"))) == 0) {
+ if ((control_point = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"))) == 0) {
fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg;
/*NOTREACHED*/
}
drag_info.cumulative_x_drag = cx - drag_info.grab_x ;
drag_info.cumulative_y_drag = cy - drag_info.grab_y ;
- bool x_constrained = false;
-
if (drag_info.x_constrained) {
- if (fabs(drag_info.cumulative_x_drag) < fabs(drag_info.cumulative_y_drag)) {
- cx = drag_info.grab_x;
- x_constrained = true;
-
- } else {
- cy = drag_info.grab_y;
- }
-
- }
+ cx = drag_info.grab_x;
+ }
+ if (drag_info.y_constrained) {
+ cy = drag_info.grab_y;
+ }
cp->line.parent_group().w2i (cx, cy);
cy = min ((double) cp->line.height(), cy);
//translate cx to frames
- jack_nframes_t cx_frames = (jack_nframes_t) floor (cx * frames_per_unit);
+ jack_nframes_t cx_frames = unit_to_frame (cx);
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && !x_constrained) {
+ if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && !drag_info.x_constrained) {
snap_to (cx_frames);
}
cp->line.point_drag (*cp, cx_frames , fraction, push);
set_verbose_canvas_cursor_text (cp->line.get_verbose_cursor_string (fraction));
+
+ drag_info.first_move = false;
}
void
Editor::control_point_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
ControlPoint* cp = reinterpret_cast<ControlPoint *> (drag_info.data);
- control_point_drag_motion_callback (item, event);
+
+ if (drag_info.first_move) {
+
+ /* just a click */
+
+ if ((event->type == GDK_BUTTON_RELEASE) && (event->button.button == 1) && Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift)) {
+ reset_point_selection ();
+ }
+
+ } else {
+ control_point_drag_motion_callback (item, event);
+ }
cp->line.end_drag (cp);
}
{
AutomationLine* al;
- if ((al = reinterpret_cast<AutomationLine*> (gtk_object_get_data (GTK_OBJECT(item), "line"))) == 0) {
+ if ((al = reinterpret_cast<AutomationLine*> (item->get_data ("line"))) == 0) {
fatal << _("programming error: line canvas item has no line pointer!") << endmsg;
/*NOTREACHED*/
}
return;
}
- /* this is committed in the grab finished callback. */
-
- begin_reversible_command (_("Drag region copy"));
-
- /* duplicate the region(s) */
-
- vector<AudioRegionView*> new_regionviews;
-
- for (list<AudioRegionView*>::const_iterator i = selection->audio_regions.by_layer().begin(); i != selection->audio_regions.by_layer().end(); ++i) {
- AudioRegionView* rv;
-
- rv = (*i);
-
- Playlist* to_playlist = rv->region.playlist();
- AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(&rv->get_time_axis_view());
-
- session->add_undo (to_playlist->get_memento ());
- latest_regionview = 0;
-
- sigc::connection c = atv->view->AudioRegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
-
- /* create a new region with the same name.
- */
-
- AudioRegion* newregion = new AudioRegion (rv->region);
-
- /* 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 (new_regionviews.empty()) {
- return;
- }
-
- /* reset selection to new regionviews */
-
- selection->set (new_regionviews);
-
- drag_info.item = new_regionviews.front()->get_canvas_group ();
drag_info.copy = true;
- drag_info.data = new_regionviews.front();
- drag_info.motion_callback = &Editor::region_drag_motion_callback;
- drag_info.finished_callback = &Editor::region_drag_finished_callback;
+ drag_info.item = item;
+ drag_info.data = clicked_regionview;
start_grab(event);
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;
-
- show_verbose_time_cursor (drag_info.last_frame_position, 10);
-
- begin_reversible_command (_("copy region(s)"));
+ drag_info.motion_callback = &Editor::region_drag_motion_callback;
+ drag_info.finished_callback = &Editor::region_drag_finished_callback;
}
void
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<AudioRegionView*> new_regionviews;
+
+ set<Playlist*> affected_playlists;
+ pair<set<Playlist*>::iterator,bool> insert_result;
+
+ for (list<AudioRegionView*>::const_iterator i = selection->audio_regions.by_layer().begin(); i != selection->audio_regions.by_layer().end(); ++i) {
+ AudioRegionView* rv;
+
+ rv = (*i);
+
+ Playlist* to_playlist = rv->region.playlist();
+ AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(&rv->get_time_axis_view());
+
+ insert_result = affected_playlists.insert (to_playlist);
+ if (insert_result.second) {
+ session->add_undo (to_playlist->get_memento ());
+ }
+
+ latest_regionview = 0;
+
+ sigc::connection c = atv->view->AudioRegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
+
+ /* create a new region with the same name.
+ */
+
+ AudioRegion* newregion = new AudioRegion (rv->region);
+
+ /* 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 (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);
+ }
+
/* Which trackview is this ? */
TimeAxisView* tvp = trackview_by_y_position (drag_info.current_pointer_y);
if ((pointer_y_span = (drag_info.last_trackview->order - tv->order)) != 0) {
int32_t children = 0, numtracks = 0;
- bitset <512> tracks (0x00);
+ // XXX hard coding track limit, oh my, so very very bad
+ bitset <1024> tracks (0x00);
/* get a bitmask representing the visible tracks */
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
the region would be if we moved it by that much.
*/
- if (drag_info.move_threshold_passsed) {
+ if (drag_info.move_threshold_passed) {
if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
************************************************************/
pair<set<Playlist*>::iterator,bool> insert_result;
+ const list<AudioRegionView*>& layered_regions = selection->audio_regions.by_layer();
- for (list<AudioRegionView*>::const_iterator i = selection->audio_regions.by_layer().begin(); i != selection->audio_regions.by_layer().end(); ++i) {
+ for (list<AudioRegionView*>::const_iterator i = layered_regions.begin(); i != layered_regions.end(); ++i) {
AudioRegionView* rv;
rv = (*i);
} else {
/* motion within a single track */
-
+
for (list<AudioRegionView*>::const_iterator i = selection->audio_regions.by_layer().begin(); i != selection->audio_regions.by_layer().end(); ++i) {
rv = (*i);
}
rv->get_time_axis_view().reveal_dependent_views (*rv);
+
+ /* no need to add an undo here, we did that when we added this playlist to motion_frozen playlists */
- session->add_undo (rv->region.playlist()->get_memento());
rv->region.set_position (where, (void *) this);
}
}
Editor::show_verbose_time_cursor (jack_nframes_t frame, double offset, double xpos, double ypos)
{
char buf[128];
- SMPTE_Time smpte;
+ SMPTE::Time smpte;
BBT_Time bbt;
float secs;
Editor::show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end, double offset, double xpos, double ypos)
{
char buf[128];
- SMPTE_Time smpte;
+ SMPTE::Time smpte;
BBT_Time sbbt;
BBT_Time ebbt;
float secs;
/* 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), "%02ld:%02ld:%.4f", smpte.hours, smpte.minutes, secs);
+ snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", smpte.hours, smpte.minutes, secs);
break;
default:
void
Editor::cancel_selection ()
{
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->hide_selection ();
}
+ begin_reversible_command (_("cancel selection"));
selection->clear ();
clicked_selection = 0;
+ commit_reversible_command ();
}
void
switch (op) {
case CreateSelection:
-
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift)) {
drag_info.copy = true;
} else {
break;
case SelectionStartTrim:
- clicked_trackview->order_selection_trims (item, true);
+ if (clicked_trackview) {
+ clicked_trackview->order_selection_trims (item, true);
+ }
start_grab (event, trimmer_cursor);
start = selection->time[clicked_selection].start;
drag_info.pointer_frame_offset = drag_info.grab_frame - start;
break;
case SelectionEndTrim:
- clicked_trackview->order_selection_trims (item, false);
+ if (clicked_trackview) {
+ clicked_trackview->order_selection_trims (item, false);
+ }
start_grab (event, trimmer_cursor);
end = selection->time[clicked_selection].end;
drag_info.pointer_frame_offset = drag_info.grab_frame - end;
break;
}
-
- if (event->button.x >= track_canvas_scroller.get_hadjustment()->get_value() + canvas_width) {
+ if (event->button.x >= horizontal_adjustment.get_value() + canvas_width) {
start_canvas_autoscroll (1);
}
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);
+
+ motion_frozen_playlists.clear();
//drag_info.item = clicked_regionview->get_name_highlight();
drag_info.item = item;
show_verbose_time_cursor(drag_info.current_pointer_frame, 10);
break;
}
-
- flush_track_canvas ();
}
void
double speed = 1.0;
TimeAxisView* tvp = clicked_trackview;
AudioTimeAxisView* tv = dynamic_cast<AudioTimeAxisView*>(tvp);
+ pair<set<Playlist*>::iterator,bool> insert_result;
if (tv && tv->is_audio_track()) {
speed = tv->get_diskstream()->speed();
for (list<AudioRegionView*>::const_iterator i = selection->audio_regions.by_layer().begin(); i != selection->audio_regions.by_layer().end(); ++i) {
(*i)->region.freeze ();
(*i)->temporarily_hide_envelope ();
- session->add_undo ((*i)->region.playlist()->get_memento());
+
+ Playlist * pl = (*i)->region.playlist();
+ insert_result = motion_frozen_playlists.insert (pl);
+ if (insert_result.second) {
+ session->add_undo (pl->get_memento());
+ }
}
}
thaw_region_after_trim (**i);
}
}
+
+ for (set<Playlist*>::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) {
+ //(*p)->thaw ();
+ session->add_redo_no_execute ((*p)->get_memento());
+ }
+
+ motion_frozen_playlists.clear ();
+
commit_reversible_command();
} else {
/* no mouse movement */
point_trim (event);
}
-
- flush_track_canvas ();
}
void
Marker* marker;
bool is_start;
- if ((marker = static_cast<Marker *> (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) {
+ if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
/*NOTREACHED*/
}
void
Editor::start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp op)
{
-
if (session == 0) {
return;
}
}
/* first drag: Either add to the selection
- or create a new selection->
+ or create a new selection.
*/
if (drag_info.first_move) {
break;
}
-
- if (event->button.x >= track_canvas_scroller.get_hadjustment()->get_value() + canvas_width) {
+ if (event->button.x >= horizontal_adjustment.get_value() + canvas_width) {
start_canvas_autoscroll (1);
}
if (!drag_info.first_move) {
drag_range_markerbar_op (item, event);
- switch (range_marker_op)
- {
+ switch (range_marker_op) {
case CreateRangeMarker:
begin_reversible_command (_("new range marker"));
session->add_undo (session->locations()->get_memento());
- newloc = new Location(temp_location->start(), temp_location->end(), "unnamed");
+ newloc = new Location(temp_location->start(), temp_location->end(), "unnamed", Location::IsRangeMarker);
session->locations()->add (newloc, true);
session->add_redo_no_execute (session->locations()->get_memento());
commit_reversible_command ();
break;
}
} else {
- /* just a click, no pointer movement.*/
+ /* just a click, no pointer movement. remember that context menu stuff was handled elsewhere */
if (Keyboard::no_modifier_keys_pressed (&event->button)) {
- // nothing yet
+ jack_nframes_t start;
+ jack_nframes_t end;
+
+ start = session->locations()->first_mark_before (drag_info.grab_frame);
+ end = session->locations()->first_mark_after (drag_info.grab_frame);
+
+ if (end == max_frames) {
+ end = session->current_end_frame ();
+ }
+
+ if (start == 0) {
+ start = session->current_start_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;
+
+ case MouseRange:
+ /* find the two markers on either side of the click and make the range out of it */
+ selection->set (0, start, end);
+ break;
+ default:
+ break;
+ }
}
}
double x1 = frame_to_pixel (start);
double x2 = frame_to_pixel (end);
- gtk_object_set (GTK_OBJECT(rubberband_rect),
- "x1", x1,
- "y1", y1,
- "x2", x2,
- "y2", y2,
- NULL);
+ rubberband_rect->property_x1() = x1;
+ rubberband_rect->property_y1() = y1;
+ rubberband_rect->property_x2() = x2;
+ rubberband_rect->property_y2() = y2;
rubberband_rect->show();
rubberband_rect->raise_to_top();
}
- bool add = Keyboard::modifier_state_contains (event->button.state, Keyboard::Shift);
+ Selection::Operation op = Keyboard::selection_type (event->button.state);
bool commit;
begin_reversible_command (_("select regions"));
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, add);
+ commit = select_all_within (drag_info.grab_frame, drag_info.last_pointer_frame, y1, y2, op);
} else {
- commit = select_all_within (drag_info.last_pointer_frame, drag_info.grab_frame, y1, y2, add);
+ commit = select_all_within (drag_info.last_pointer_frame, drag_info.grab_frame, y1, y2, op);
}
if (commit) {
prompter.set_prompt (_("Name for region:"));
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 ();
switch (prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
- string str;
+ case Gtk::RESPONSE_ACCEPT:
+ string str;
prompter.get_result(str);
if (str.length()) {
-
- clicked_regionview->region.set_name (str);
+ clicked_regionview->region.set_name (str);
}
break;
}
- return TRUE;
+ return true;
}
void
if (delta.tv_sec * 1000000 + delta.tv_usec > 250000) { /* milliseconds */
current_stepping_trackview = 0;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}