improve range drag semantics
If a track is selected during the drag (by moving the mouse pointer into a new track), but it was not selected at the start, and is then de-selected (by moving the mouse back out of it), then remove it from the selection.
This commit is contained in:
parent
484c3316d6
commit
6de15a79cf
@ -5038,6 +5038,7 @@ SelectionDrag::SelectionDrag (Editor* e, ArdourCanvas::Item* i, Operation o)
|
|||||||
: Drag (e, i)
|
: Drag (e, i)
|
||||||
, _operation (o)
|
, _operation (o)
|
||||||
, _add (false)
|
, _add (false)
|
||||||
|
, _track_selection_at_start (e)
|
||||||
, _time_selection_at_start (!_editor->get_selection().time.empty())
|
, _time_selection_at_start (!_editor->get_selection().time.empty())
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::Drags, "New SelectionDrag\n");
|
DEBUG_TRACE (DEBUG::Drags, "New SelectionDrag\n");
|
||||||
@ -5134,6 +5135,10 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (first_move) {
|
||||||
|
_track_selection_at_start = _editor->selection->tracks;
|
||||||
|
}
|
||||||
|
|
||||||
switch (_operation) {
|
switch (_operation) {
|
||||||
case CreateSelection:
|
case CreateSelection:
|
||||||
{
|
{
|
||||||
@ -5209,10 +5214,26 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
|
|||||||
//( NOTE: most mouse moves don't change the selection so we can't just SET it for every mouse move; it gets clunky )
|
//( NOTE: most mouse moves don't change the selection so we can't just SET it for every mouse move; it gets clunky )
|
||||||
TrackViewList tracks_to_add;
|
TrackViewList tracks_to_add;
|
||||||
TrackViewList tracks_to_remove;
|
TrackViewList tracks_to_remove;
|
||||||
for (TrackViewList::const_iterator i = new_selection.begin(); i != new_selection.end(); ++i)
|
|
||||||
if ( !_editor->selection->tracks.contains ( *i ) )
|
if (!first_move) {
|
||||||
tracks_to_add.push_back ( *i );
|
for (TrackViewList::const_iterator i = _editor->selection->tracks.begin(); i != _editor->selection->tracks.end(); ++i) {
|
||||||
_editor->selection->add(tracks_to_add);
|
if (!new_selection.contains (*i) && !_track_selection_at_start.contains (*i)) {
|
||||||
|
tracks_to_remove.push_back (*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TrackViewList::const_iterator i = new_selection.begin(); i != new_selection.end(); ++i) {
|
||||||
|
if (!_editor->selection->tracks.contains (*i)) {
|
||||||
|
tracks_to_add.push_back (*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_editor->selection->add (tracks_to_add);
|
||||||
|
|
||||||
|
if (!tracks_to_remove.empty()) {
|
||||||
|
_editor->selection->remove (tracks_to_remove);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "editor_items.h"
|
#include "editor_items.h"
|
||||||
#include "mouse_cursors.h"
|
#include "mouse_cursors.h"
|
||||||
#include "editing.h"
|
#include "editing.h"
|
||||||
|
#include "track_selection.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Location;
|
class Location;
|
||||||
@ -1106,7 +1107,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Operation _operation;
|
Operation _operation;
|
||||||
bool _add;
|
bool _add;
|
||||||
std::list<TimeAxisView*> _added_time_axes;
|
TrackSelection _track_selection_at_start;
|
||||||
bool _time_selection_at_start;
|
bool _time_selection_at_start;
|
||||||
framepos_t start_at_start;
|
framepos_t start_at_start;
|
||||||
framepos_t end_at_start;
|
framepos_t end_at_start;
|
||||||
|
Loading…
Reference in New Issue
Block a user