_item = new_item;
if (cursor == 0) {
- cursor = _editor->which_grabber_cursor ();
+ _item->grab (Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK, time);
+ } else {
+ _item->grab (Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK, *cursor, time);
}
-
- _item->grab (Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK, *cursor, time);
}
void
Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
{
- if (cursor == 0) {
- cursor = _editor->which_grabber_cursor ();
- }
-
// if dragging with button2, the motion is x constrained, with Alt-button2 it is y constrained
if (Keyboard::is_button2_event (&event->button)) {
_last_pointer_x = _grab_x;
_last_pointer_y = _grab_y;
- _item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK,
- *cursor,
- event->button.time);
+ if (cursor == 0) {
+ _item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK,
+ event->button.time);
+ } else {
+ _item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK,
+ *cursor,
+ event->button.time);
+ }
if (_editor->session() && _editor->session()->transport_rolling()) {
_was_rolling = true;
// not, because we'll remove it from the map).
MeterSection section (_marker->meter());
-
+
if (!section.movable()) {
return;
}
if (!_copy) {
TempoMap& map (_editor->session()->tempo_map());
+ /* get current state */
+ before_state = &map.get_state();
/* remove the section while we drag it */
map.remove_meter (section, true);
}
} else {
_editor->begin_reversible_command (_("move meter mark"));
- XMLNode &before = map.get_state();
/* we removed it before, so add it back now */
map.add_meter (_marker->meter(), when);
XMLNode &after = map.get_state();
- _editor->session()->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));
_editor->commit_reversible_command ();
}
if (!_copy) {
TempoMap& map (_editor->session()->tempo_map());
+ /* get current state */
+ before_state = &map.get_state();
/* remove the section while we drag it */
map.remove_tempo (section, true);
}
motion (event, false);
+ TempoMap& map (_editor->session()->tempo_map());
+ framepos_t beat_time = map.round_to_beat (last_pointer_frame(), 0);
Timecode::BBT_Time when;
- TempoMap& map (_editor->session()->tempo_map());
- map.bbt_time (last_pointer_frame(), when);
+ map.bbt_time (beat_time, when);
if (_copy == true) {
_editor->begin_reversible_command (_("copy tempo mark"));
} else {
_editor->begin_reversible_command (_("move tempo mark"));
- XMLNode &before = map.get_state();
/* we removed it before, so add it back now */
map.add_tempo (_marker->tempo(), when);
XMLNode &after = map.get_state();
- _editor->session()->add_command (new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command (new MementoCommand<TempoMap>(map, before_state, &after));
_editor->commit_reversible_command ();
}
RubberbandSelectDrag::RubberbandSelectDrag (Editor* e, ArdourCanvas::Item* i)
: Drag (e, i)
+ , _vertical_only (false)
{
DEBUG_TRACE (DEBUG::Drags, "New RubberbandSelectDrag\n");
}
double x2 = _editor->frame_to_pixel (end);
_editor->rubberband_rect->property_x1() = x1;
+ if (_vertical_only) {
+ /* fixed 10 pixel width */
+ _editor->rubberband_rect->property_x2() = x1 + 10;
+ } else {
+ _editor->rubberband_rect->property_x2() = x2;
+ }
+
_editor->rubberband_rect->property_y1() = y1;
- _editor->rubberband_rect->property_x2() = x2;
_editor->rubberband_rect->property_y2() = y2;
_editor->rubberband_rect->show();
/* XXX */
}
+MidiVerticalSelectDrag::MidiVerticalSelectDrag (Editor* e, MidiRegionView* rv)
+ : RubberbandSelectDrag (e, rv->get_canvas_frame ())
+ , _region_view (rv)
+{
+ _vertical_only = true;
+}
+
+void
+MidiVerticalSelectDrag::select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress)
+{
+ double const y = _region_view->midi_view()->y_position ();
+
+ y1 = max (0.0, y1 - y);
+ y2 = max (0.0, y2 - y);
+
+ _region_view->update_vertical_drag_selection (
+ y1,
+ y2,
+ Keyboard::modifier_state_contains (button_state, Keyboard::TertiaryModifier)
+ );
+}
+
+void
+MidiVerticalSelectDrag::deselect_things ()
+{
+ /* XXX */
+}
+
EditorRubberbandSelectDrag::EditorRubberbandSelectDrag (Editor* e, ArdourCanvas::Item* i)
: RubberbandSelectDrag (e, i)
{
framecnt_t length = abs (_note[0] - _note[1]);
framecnt_t const g = grid_frames (start);
- double const one_tick = 1 / Timecode::BBT_Time::ticks_per_bar_division;
+ double const one_tick = 1 / Timecode::BBT_Time::ticks_per_beat;
if (_editor->snap_mode() == SnapNormal && length < g) {
length = g - one_tick;