Remove confusing track / group members in TimeSelection struct; time selection

applies to the selected tracks.  Some tinkering with how tracks are selected
during time selections.


git-svn-id: svn://localhost/ardour2/branches/3.0@6360 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-12-13 21:27:19 +00:00
parent 3db46ba30f
commit 04c7158a41
11 changed files with 42 additions and 92 deletions

View file

@ -4230,15 +4230,9 @@ Editor::post_zoom ()
} }
if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) { 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) { for (TrackViewList::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
(*i)->reshow_selection (selection->time); (*i)->reshow_selection (selection->time);
} }
} else {
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->reshow_selection (selection->time);
}
}
} }
leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);

View file

@ -2933,7 +2933,6 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
nframes64_t end = 0; nframes64_t end = 0;
nframes64_t length; nframes64_t length;
nframes64_t const pending_position = adjusted_current_frame (event); nframes64_t const pending_position = adjusted_current_frame (event);
/* only alter selection if the current frame is /* only alter selection if the current frame is
@ -2960,7 +2959,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
} }
/* first drag: Either add to the selection /* first drag: Either add to the selection
or create a new selection-> or create a new selection
*/ */
if (first_move) { if (first_move) {
@ -2970,11 +2969,17 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
if (_copy) { if (_copy) {
/* adding to the selection */ /* adding to the selection */
_editor->selection->add (_editor->clicked_axisview);
_editor->clicked_selection = _editor->selection->add (start, end); _editor->clicked_selection = _editor->selection->add (start, end);
_copy = false; _copy = false;
} else { } else {
/* new selection-> */ /* new selection */
_editor->clicked_selection = _editor->selection->set (_editor->clicked_axisview, start, end);
if (!_editor->selection->selected (_editor->clicked_axisview)) {
_editor->selection->set (_editor->clicked_axisview);
}
_editor->clicked_selection = _editor->selection->set (start, end);
} }
} }
break; break;
@ -3077,9 +3082,11 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
/* just a click, no pointer movement.*/ /* just a click, no pointer movement.*/
if (Keyboard::no_modifier_keys_pressed (&event->button)) { if (Keyboard::no_modifier_keys_pressed (&event->button)) {
_editor->selection->clear_time(); _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()) { if (s && s->get_play_range () && s->transport_rolling()) {
@ -3288,7 +3295,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
case MouseRange: case MouseRange:
/* find the two markers on either side of the click and make the range out of it */ /* 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; break;
default: default:

View file

@ -57,7 +57,7 @@ Editor::keyboard_selection_finish (bool add)
if (add) { if (add) {
selection->add (pending_keyboard_selection_start, end); selection->add (pending_keyboard_selection_start, end);
} else { } else {
selection->set (0, pending_keyboard_selection_start, end); selection->set (pending_keyboard_selection_start, end);
} }
have_pending_keyboard_selection = false; have_pending_keyboard_selection = false;

View file

@ -335,11 +335,9 @@ Editor::mouse_mode_toggled (MouseMode m)
*/ */
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { 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);
} }
} }
}
set_canvas_cursor (); set_canvas_cursor ();
} }
@ -483,11 +481,9 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp
break; break;
case StreamItem: case StreamItem:
/* for context click or range selection, select track */ /* for context click, select track */
if (event->button.button == 3) { if (event->button.button == 3) {
set_selected_track_as_side_effect (); set_selected_track_as_side_effect ();
} else if (event->type == GDK_BUTTON_PRESS && mouse_mode == MouseRange) {
set_selected_track_as_side_effect ();
} }
break; break;

View file

@ -247,14 +247,8 @@ Editor::extend_selection_to_end_of_region (bool next)
start = selection->time.start (); 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")); begin_reversible_command (_("extend selection"));
selection->set (tv, start, region->position() + region->length()); selection->set (start, region->position() + region->length());
commit_reversible_command (); commit_reversible_command ();
} }
@ -277,12 +271,8 @@ Editor::extend_selection_to_start_of_region (bool previous)
/* Try to leave the selection with the same route if possible */ /* Try to leave the selection with the same route if possible */
if ((tv = selection->time.track) == 0) {
return;
}
begin_reversible_command (_("extend selection")); begin_reversible_command (_("extend selection"));
selection->set (tv, region->position(), end); selection->set (region->position(), end);
commit_reversible_command (); commit_reversible_command ();
} }
@ -3921,7 +3911,7 @@ Editor::cut_copy (CutCopyOp op)
if (!get_edit_op_range (start, end)) { if (!get_edit_op_range (start, end)) {
return; return;
} }
selection->set ((TimeAxisView*) 0, start, end); selection->set (start, end);
} }
begin_reversible_command (opname + _(" range")); begin_reversible_command (opname + _(" range"));

View file

@ -808,22 +808,15 @@ Editor::time_selection_changed ()
(*i)->hide_selection (); (*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) { for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
(*i)->show_selection (selection->time); (*i)->show_selection (selection->time);
} }
}
if (selection->time.empty()) { if (selection->time.empty()) {
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, false); ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, false);
} else { } else {
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true); ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true);
} }
} }
void void
@ -1033,7 +1026,7 @@ Editor::set_selection_from_region ()
return; return;
} }
selection->set (0, selection->regions.start(), selection->regions.end_frame()); selection->set (selection->regions.start(), selection->regions.end_frame());
if (!Profile->get_sae()) { if (!Profile->get_sae()) {
set_mouse_mode (Editing::MouseRange, false); set_mouse_mode (Editing::MouseRange, false);
} }
@ -1066,7 +1059,7 @@ void
Editor::set_selection_from_range (Location& loc) Editor::set_selection_from_range (Location& loc)
{ {
begin_reversible_command (_("set selection from range")); begin_reversible_command (_("set selection from range"));
selection->set (0, loc.start(), loc.end()); selection->set (loc.start(), loc.end());
commit_reversible_command (); commit_reversible_command ();
if (!Profile->get_sae()) { if (!Profile->get_sae()) {
@ -1293,7 +1286,7 @@ Editor::select_range_between ()
} }
set_mouse_mode (MouseRange); set_mouse_mode (MouseRange);
selection->set ((TimeAxisView*) 0, start, end); selection->set (start, end);
} }
bool bool

View file

@ -64,8 +64,6 @@ operator== (const Selection& a, const Selection& b)
{ {
return a.regions == b.regions && return a.regions == b.regions &&
a.tracks == b.tracks && a.tracks == b.tracks &&
a.time.track == b.time.track &&
a.time.group == b.time.group &&
a.time == b.time && a.time == b.time &&
a.lines == b.lines && a.lines == b.lines &&
a.playlists == b.playlists && a.playlists == b.playlists &&
@ -139,8 +137,6 @@ Selection::clear_midi_regions ()
void void
Selection::clear_time () Selection::clear_time ()
{ {
time.track = 0;
time.group = 0;
time.clear(); time.clear();
TimeChanged (); TimeChanged ();
@ -729,8 +725,11 @@ Selection::set (vector<RegionView*>& v)
add (v); add (v);
} }
/** Set the start and end time of the time selection, without changing
* the list of tracks it applies to.
*/
long 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) { if ((start == 0 && end == 0) || end < start) {
return 0; return 0;
@ -748,14 +747,6 @@ Selection::set (TimeAxisView* track, nframes_t start, nframes_t end)
time.front().end = end; time.front().end = end;
} }
if (track) {
time.track = track;
time.group = track->route_group();
} else {
time.track = 0;
time.group = 0;
}
time.consolidate (); time.consolidate ();
TimeChanged (); TimeChanged ();

View file

@ -117,7 +117,7 @@ class Selection : public sigc::trackable
void set (RegionView*, bool also_clear_tracks = true); void set (RegionView*, bool also_clear_tracks = true);
void set (MidiRegionView*); void set (MidiRegionView*);
void set (std::vector<RegionView*>&); 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<Evoral::ControlList>);
void set (boost::shared_ptr<ARDOUR::Playlist>); void set (boost::shared_ptr<ARDOUR::Playlist>);
void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&); void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);

View file

@ -619,12 +619,6 @@ TimeAxisView::set_selected (bool yn)
controls_ebox.set_name (controls_base_selected_name); controls_ebox.set_name (controls_base_selected_name);
controls_hbox.set_name (controls_base_selected_name); controls_hbox.set_name (controls_base_selected_name);
controls_vbox.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 { } else {
controls_ebox.set_name (controls_base_unselected_name); controls_ebox.set_name (controls_base_unselected_name);
controls_hbox.set_name (controls_base_unselected_name); controls_hbox.set_name (controls_base_unselected_name);

View file

@ -105,4 +105,3 @@ TimeSelection::length()
{ {
return end_frame() - start() + 1; return end_frame() - start() + 1;
} }

View file

@ -27,23 +27,9 @@ namespace ARDOUR {
class RouteGroup; class RouteGroup;
} }
class TimeAxisView; class TimeSelection : public std::list<ARDOUR::AudioRange>
{
struct TimeSelection : public std::list<ARDOUR::AudioRange> { public:
/* 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); ARDOUR::AudioRange& operator[](uint32_t);
nframes_t start(); nframes_t start();