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,14 +4230,8 @@ Editor::post_zoom ()
}
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);
}
}

View File

@ -2933,7 +2933,6 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
nframes64_t end = 0;
nframes64_t length;
nframes64_t const pending_position = adjusted_current_frame (event);
/* 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
or create a new selection->
or create a new selection
*/
if (first_move) {
@ -2970,11 +2969,17 @@ SelectionDrag::motion (GdkEvent* event, bool 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;
@ -3077,9 +3082,11 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
/* 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()) {
@ -3288,7 +3295,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
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:

View File

@ -57,7 +57,7 @@ Editor::keyboard_selection_finish (bool add)
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;

View File

@ -331,13 +331,11 @@ Editor::mouse_mode_toggled (MouseMode m)
} 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);
}
}
@ -483,11 +481,9 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp
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;

View File

@ -247,14 +247,8 @@ Editor::extend_selection_to_end_of_region (bool next)
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 ();
}
@ -277,12 +271,8 @@ Editor::extend_selection_to_start_of_region (bool previous)
/* 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 ();
}
@ -3921,7 +3911,7 @@ Editor::cut_copy (CutCopyOp op)
if (!get_edit_op_range (start, end)) {
return;
}
selection->set ((TimeAxisView*) 0, start, end);
selection->set (start, end);
}
begin_reversible_command (opname + _(" range"));

View File

@ -808,14 +808,8 @@ Editor::time_selection_changed ()
(*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()) {
@ -823,7 +817,6 @@ Editor::time_selection_changed ()
} else {
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true);
}
}
void
@ -1033,7 +1026,7 @@ Editor::set_selection_from_region ()
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);
}
@ -1066,7 +1059,7 @@ void
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()) {
@ -1293,7 +1286,7 @@ Editor::select_range_between ()
}
set_mouse_mode (MouseRange);
selection->set ((TimeAxisView*) 0, start, end);
selection->set (start, end);
}
bool

View File

@ -64,8 +64,6 @@ operator== (const Selection& a, const Selection& b)
{
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 &&
@ -139,8 +137,6 @@ Selection::clear_midi_regions ()
void
Selection::clear_time ()
{
time.track = 0;
time.group = 0;
time.clear();
TimeChanged ();
@ -729,8 +725,11 @@ Selection::set (vector<RegionView*>& v)
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;
@ -748,14 +747,6 @@ Selection::set (TimeAxisView* track, nframes_t start, nframes_t end)
time.front().end = end;
}
if (track) {
time.track = track;
time.group = track->route_group();
} else {
time.track = 0;
time.group = 0;
}
time.consolidate ();
TimeChanged ();

View File

@ -117,7 +117,7 @@ class Selection : public sigc::trackable
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> >&);

View File

@ -619,12 +619,6 @@ TimeAxisView::set_selected (bool yn)
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);

View File

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

View File

@ -27,30 +27,16 @@ namespace ARDOUR {
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 ();
};