mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
implement axis-limited dragging
This commit is contained in:
parent
994dff91a2
commit
456374c995
2 changed files with 27 additions and 3 deletions
|
|
@ -394,8 +394,6 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
|
||||||
} else {
|
} else {
|
||||||
_initially_vertical = false;
|
_initially_vertical = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << "IV = " << _initially_vertical << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!from_autoscroll) {
|
if (!from_autoscroll) {
|
||||||
|
|
@ -556,6 +554,7 @@ RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView
|
||||||
, _total_x_delta (0)
|
, _total_x_delta (0)
|
||||||
, _last_pointer_time_axis_view (0)
|
, _last_pointer_time_axis_view (0)
|
||||||
, _last_pointer_layer (0)
|
, _last_pointer_layer (0)
|
||||||
|
, _single_axis (false)
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::Drags, "New RegionMotionDrag\n");
|
DEBUG_TRACE (DEBUG::Drags, "New RegionMotionDrag\n");
|
||||||
}
|
}
|
||||||
|
|
@ -565,6 +564,10 @@ RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
||||||
{
|
{
|
||||||
Drag::start_grab (event, cursor);
|
Drag::start_grab (event, cursor);
|
||||||
|
|
||||||
|
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::TertiaryModifier)) {
|
||||||
|
_single_axis = true;
|
||||||
|
}
|
||||||
|
|
||||||
show_verbose_cursor_time (_last_frame_position);
|
show_verbose_cursor_time (_last_frame_position);
|
||||||
|
|
||||||
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (current_pointer_y ());
|
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (current_pointer_y ());
|
||||||
|
|
@ -639,6 +642,10 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_r
|
||||||
bool
|
bool
|
||||||
RegionMotionDrag::y_movement_allowed (int delta_track, double delta_layer) const
|
RegionMotionDrag::y_movement_allowed (int delta_track, double delta_layer) const
|
||||||
{
|
{
|
||||||
|
if (_y_constrained) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||||
int const n = i->time_axis_view + delta_track;
|
int const n = i->time_axis_view + delta_track;
|
||||||
if (n < 0 || n >= int (_time_axis_views.size())) {
|
if (n < 0 || n >= int (_time_axis_views.size())) {
|
||||||
|
|
@ -683,6 +690,18 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
|
||||||
pair<TimeAxisView*, double> const r = _editor->trackview_by_y_position (current_pointer_y ());
|
pair<TimeAxisView*, double> const r = _editor->trackview_by_y_position (current_pointer_y ());
|
||||||
TimeAxisView* tv = r.first;
|
TimeAxisView* tv = r.first;
|
||||||
|
|
||||||
|
if (first_move) {
|
||||||
|
if (_single_axis) {
|
||||||
|
if (initially_vertical()) {
|
||||||
|
_y_constrained = false;
|
||||||
|
_x_constrained = true;
|
||||||
|
} else {
|
||||||
|
_y_constrained = true;
|
||||||
|
_x_constrained = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tv && tv->view()) {
|
if (tv && tv->view()) {
|
||||||
double layer = r.second;
|
double layer = r.second;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,10 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool initially_vertical() const {
|
||||||
|
return _initially_vertical;
|
||||||
|
}
|
||||||
|
|
||||||
/** Set up the _pointer_frame_offset */
|
/** Set up the _pointer_frame_offset */
|
||||||
virtual void setup_pointer_frame_offset () {
|
virtual void setup_pointer_frame_offset () {
|
||||||
_pointer_frame_offset = 0;
|
_pointer_frame_offset = 0;
|
||||||
|
|
@ -330,6 +334,7 @@ protected:
|
||||||
double _total_x_delta;
|
double _total_x_delta;
|
||||||
int _last_pointer_time_axis_view;
|
int _last_pointer_time_axis_view;
|
||||||
double _last_pointer_layer;
|
double _last_pointer_layer;
|
||||||
|
bool _single_axis;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue