mapping bar: some mouse handling

This commit is contained in:
Paul Davis 2023-02-26 12:43:27 -07:00
parent e9b83e0f1d
commit d61a741e4b
4 changed files with 19 additions and 15 deletions

View file

@ -2530,7 +2530,7 @@ private:
friend class RegionDrag; friend class RegionDrag;
friend class RegionMoveDrag; friend class RegionMoveDrag;
friend class TrimDrag; friend class TrimDrag;
friend class BBTRulerDrag; friend class MappingDrag;
friend class MeterMarkerDrag; friend class MeterMarkerDrag;
friend class BBTMarkerDrag; friend class BBTMarkerDrag;
friend class TempoMarkerDrag; friend class TempoMarkerDrag;

View file

@ -3476,18 +3476,18 @@ BBTMarkerDrag::aborted (bool moved)
} }
} }
BBTRulerDrag::BBTRulerDrag (Editor* e, ArdourCanvas::Item* i) MappingDrag::MappingDrag (Editor* e, ArdourCanvas::Item* i)
: Drag (e, i, Temporal::BeatTime) : Drag (e, i, Temporal::BeatTime)
, _tempo (0) , _tempo (0)
, _before_state (0) , _before_state (0)
, _drag_valid (true) , _drag_valid (true)
{ {
DEBUG_TRACE (DEBUG::Drags, "New BBTRulerDrag\n"); DEBUG_TRACE (DEBUG::Drags, "New MappingDrag\n");
} }
void void
BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) MappingDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{ {
map = _editor->begin_tempo_mapping (); map = _editor->begin_tempo_mapping ();
@ -3515,7 +3515,7 @@ BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
} }
void void
BBTRulerDrag::setup_pointer_offset () MappingDrag::setup_pointer_offset ()
{ {
/* get current state */ /* get current state */
_before_state = &map->get_state(); _before_state = &map->get_state();
@ -3533,7 +3533,7 @@ BBTRulerDrag::setup_pointer_offset ()
} }
void void
BBTRulerDrag::motion (GdkEvent* event, bool first_move) MappingDrag::motion (GdkEvent* event, bool first_move)
{ {
if (!_drag_valid) { if (!_drag_valid) {
return; return;
@ -3570,7 +3570,7 @@ BBTRulerDrag::motion (GdkEvent* event, bool first_move)
} }
void void
BBTRulerDrag::finished (GdkEvent* event, bool movement_occurred) MappingDrag::finished (GdkEvent* event, bool movement_occurred)
{ {
if (!_drag_valid) { if (!_drag_valid) {
_editor->abort_tempo_map_edit (); _editor->abort_tempo_map_edit ();
@ -3613,7 +3613,7 @@ BBTRulerDrag::finished (GdkEvent* event, bool movement_occurred)
} }
void void
BBTRulerDrag::aborted (bool moved) MappingDrag::aborted (bool moved)
{ {
_editor->abort_tempo_mapping (); _editor->abort_tempo_mapping ();
} }

View file

@ -915,10 +915,10 @@ private:
/** BBT Ruler drag */ /** BBT Ruler drag */
class BBTRulerDrag : public Drag class MappingDrag : public Drag
{ {
public: public:
BBTRulerDrag (Editor *, ArdourCanvas::Item *); MappingDrag (Editor *, ArdourCanvas::Item *);
void start_grab (GdkEvent *, Gdk::Cursor* c = 0); void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool); void motion (GdkEvent *, bool);

View file

@ -817,7 +817,15 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
break; break;
case MappingBarItem: case MappingBarItem:
break; if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)
&& !ArdourKeyboard::indicates_constraint (event->button.state)) {
_drags->set (new CursorDrag (this, *_playhead_cursor, false), event);
} else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier|Keyboard::TertiaryModifier)) {
_drags->set (new TempoTwistDrag (this, item), event);
} else if (Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier)) {
_drags->set (new MappingDrag (this, item), event);
}
return true;
case TempoBarItem: case TempoBarItem:
case TempoCurveItem: case TempoCurveItem:
@ -841,10 +849,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier) if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)
&& !ArdourKeyboard::indicates_constraint (event->button.state)) { && !ArdourKeyboard::indicates_constraint (event->button.state)) {
_drags->set (new CursorDrag (this, *_playhead_cursor, false), event); _drags->set (new CursorDrag (this, *_playhead_cursor, false), event);
} else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier|Keyboard::TertiaryModifier)) {
_drags->set (new TempoTwistDrag (this, item), event);
} else if (Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier)) {
_drags->set (new BBTRulerDrag (this, item), event);
} }
return true; return true;