}
if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) {
- if (!selection->tracks.empty()) {
- for (TrackViewList::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
- (*i)->reshow_selection (selection->time);
- }
- } else {
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->reshow_selection (selection->time);
- }
+ for (TrackViewList::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+ (*i)->reshow_selection (selection->time);
}
}
nframes64_t end = 0;
nframes64_t length;
-
nframes64_t const pending_position = adjusted_current_frame (event);
/* only alter selection if the current frame is
}
/* first drag: Either add to the selection
- or create a new selection->
+ or create a new selection
*/
if (first_move) {
if (_copy) {
/* adding to the selection */
+ _editor->selection->add (_editor->clicked_axisview);
_editor->clicked_selection = _editor->selection->add (start, end);
_copy = false;
} else {
- /* new selection-> */
- _editor->clicked_selection = _editor->selection->set (_editor->clicked_axisview, start, end);
+ /* new selection */
+
+ if (!_editor->selection->selected (_editor->clicked_axisview)) {
+ _editor->selection->set (_editor->clicked_axisview);
+ }
+
+ _editor->clicked_selection = _editor->selection->set (start, end);
}
}
break;
/* just a click, no pointer movement.*/
if (Keyboard::no_modifier_keys_pressed (&event->button)) {
-
_editor->selection->clear_time();
+ }
+ if (!_editor->selection->selected (_editor->clicked_axisview)) {
+ _editor->selection->set (_editor->clicked_axisview);
}
if (s && s->get_play_range () && s->transport_rolling()) {
case MouseRange:
/* find the two markers on either side of the click and make the range out of it */
- _editor->selection->set (0, start, end);
+ _editor->selection->set (start, end);
break;
default:
if (add) {
selection->add (pending_keyboard_selection_start, end);
} else {
- selection->set (0, pending_keyboard_selection_start, end);
+ selection->set (pending_keyboard_selection_start, end);
}
have_pending_keyboard_selection = false;
} else {
/*
- in range mode,show the range selection.
+ in range mode, show the range selection.
*/
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
- if ((*i)->get_selected()) {
- (*i)->show_selection (selection->time);
- }
+ (*i)->show_selection (selection->time);
}
}
break;
case StreamItem:
- /* for context click or range selection, select track */
+ /* for context click, select track */
if (event->button.button == 3) {
set_selected_track_as_side_effect ();
- } else if (event->type == GDK_BUTTON_PRESS && mouse_mode == MouseRange) {
- set_selected_track_as_side_effect ();
}
break;
start = selection->time.start ();
}
- /* Try to leave the selection with the same route if possible */
-
- if ((tv = selection->time.track) == 0) {
- return;
- }
-
begin_reversible_command (_("extend selection"));
- selection->set (tv, start, region->position() + region->length());
+ selection->set (start, region->position() + region->length());
commit_reversible_command ();
}
/* Try to leave the selection with the same route if possible */
- if ((tv = selection->time.track) == 0) {
- return;
- }
-
begin_reversible_command (_("extend selection"));
- selection->set (tv, region->position(), end);
+ selection->set (region->position(), end);
commit_reversible_command ();
}
if (!get_edit_op_range (start, end)) {
return;
}
- selection->set ((TimeAxisView*) 0, start, end);
+ selection->set (start, end);
}
begin_reversible_command (opname + _(" range"));
(*i)->hide_selection ();
}
- if (selection->tracks.empty()) {
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->show_selection (selection->time);
- }
- } else {
- for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
- (*i)->show_selection (selection->time);
- }
+ for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+ (*i)->show_selection (selection->time);
}
if (selection->time.empty()) {
} else {
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true);
}
-
}
void
return;
}
- selection->set (0, selection->regions.start(), selection->regions.end_frame());
+ selection->set (selection->regions.start(), selection->regions.end_frame());
if (!Profile->get_sae()) {
set_mouse_mode (Editing::MouseRange, false);
}
Editor::set_selection_from_range (Location& loc)
{
begin_reversible_command (_("set selection from range"));
- selection->set (0, loc.start(), loc.end());
+ selection->set (loc.start(), loc.end());
commit_reversible_command ();
if (!Profile->get_sae()) {
}
set_mouse_mode (MouseRange);
- selection->set ((TimeAxisView*) 0, start, end);
+ selection->set (start, end);
}
bool
{
return a.regions == b.regions &&
a.tracks == b.tracks &&
- a.time.track == b.time.track &&
- a.time.group == b.time.group &&
a.time == b.time &&
a.lines == b.lines &&
a.playlists == b.playlists &&
void
Selection::clear_time ()
{
- time.track = 0;
- time.group = 0;
time.clear();
TimeChanged ();
add (v);
}
+/** Set the start and end time of the time selection, without changing
+ * the list of tracks it applies to.
+ */
long
-Selection::set (TimeAxisView* track, nframes_t start, nframes_t end)
+Selection::set (nframes_t start, nframes_t end)
{
if ((start == 0 && end == 0) || end < start) {
return 0;
time.front().end = end;
}
- if (track) {
- time.track = track;
- time.group = track->route_group();
- } else {
- time.track = 0;
- time.group = 0;
- }
-
time.consolidate ();
TimeChanged ();
void set (RegionView*, bool also_clear_tracks = true);
void set (MidiRegionView*);
void set (std::vector<RegionView*>&);
- long set (TimeAxisView*, nframes_t, nframes_t);
+ long set (nframes_t, nframes_t);
void set (boost::shared_ptr<Evoral::ControlList>);
void set (boost::shared_ptr<ARDOUR::Playlist>);
void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
controls_ebox.set_name (controls_base_selected_name);
controls_hbox.set_name (controls_base_selected_name);
controls_vbox.set_name (controls_base_selected_name);
- /* propagate any existing selection, if the mode is right */
-
- if (_editor.current_mouse_mode() == Editing::MouseRange && !_editor.get_selection().time.empty()) {
- show_selection (_editor.get_selection().time);
- }
-
} else {
controls_ebox.set_name (controls_base_unselected_name);
controls_hbox.set_name (controls_base_unselected_name);
{
return end_frame() - start() + 1;
}
-
class RouteGroup;
}
-class TimeAxisView;
-
-struct TimeSelection : public std::list<ARDOUR::AudioRange> {
-
- /* if (track == 0 && group == 0) then it applies to all
- tracks.
-
- if (track != 0 && group == 0) then it applies just to
- that track.
-
- if (group != 0) then it applies to all tracks in
- the group.
- */
-
- TimeAxisView* track;
- ARDOUR::RouteGroup* group;
-
- ARDOUR::AudioRange& operator[](uint32_t);
-
- nframes_t start();
- nframes_t end_frame();
- nframes_t length();
-
- bool consolidate ();
+class TimeSelection : public std::list<ARDOUR::AudioRange>
+{
+public:
+ ARDOUR::AudioRange& operator[](uint32_t);
+
+ nframes_t start();
+ nframes_t end_frame();
+ nframes_t length();
+
+ bool consolidate ();
};