more fun and games with selection logic
git-svn-id: svn://localhost/ardour2/trunk@1353 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
6b0e0e379b
commit
143983948e
@ -2948,12 +2948,16 @@ Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no
|
||||
}
|
||||
|
||||
bool
|
||||
Editor::set_selected_track_from_click (Selection::Operation op, bool no_remove)
|
||||
Editor::set_selected_track_from_click (bool press, Selection::Operation op, bool no_remove)
|
||||
{
|
||||
if (!clicked_trackview) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!press) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return set_selected_track (*clicked_trackview, op, no_remove);
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ class Editor : public PublicEditor
|
||||
bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
|
||||
|
||||
bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
|
||||
bool set_selected_track_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
|
||||
bool set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
|
||||
bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
|
||||
|
||||
void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
|
||||
|
@ -317,7 +317,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
|
||||
switch (item_type) {
|
||||
case RegionItem:
|
||||
/* XXX make tying track/region selection optional */
|
||||
c1 = set_selected_track_from_click (op, true);
|
||||
c1 = set_selected_track_from_click (press, op, true);
|
||||
c2 = set_selected_regionview_from_click (press, op, true);
|
||||
commit = (c1 || c2);
|
||||
break;
|
||||
@ -325,7 +325,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
|
||||
case RegionViewNameHighlight:
|
||||
case RegionViewName:
|
||||
/* XXX make tying track/region selection optional */
|
||||
c1 = set_selected_track_from_click (op, true);
|
||||
c1 = set_selected_track_from_click (press, op, true);
|
||||
c2 = set_selected_regionview_from_click (press, op, true);
|
||||
commit = (c1 || c2);
|
||||
break;
|
||||
@ -335,7 +335,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
|
||||
case FadeOutHandleItem:
|
||||
case FadeOutItem:
|
||||
/* XXX make tying track/region selection optional */
|
||||
c1 = set_selected_track_from_click (op, true);
|
||||
c1 = set_selected_track_from_click (press, op, true);
|
||||
c2 = set_selected_regionview_from_click (press, op, true);
|
||||
commit = (c1 || c2);
|
||||
|
||||
@ -343,17 +343,17 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
|
||||
case PanAutomationControlPointItem:
|
||||
case RedirectAutomationControlPointItem:
|
||||
/* XXX make tying track/region selection optional */
|
||||
c1 = set_selected_track_from_click (op, true);
|
||||
c1 = set_selected_track_from_click (press, op, true);
|
||||
c2 = set_selected_control_point_from_click (op, false);
|
||||
commit = (c1 || c2);
|
||||
break;
|
||||
|
||||
case StreamItem:
|
||||
commit = set_selected_track_from_click (op, true);
|
||||
commit = set_selected_track_from_click (press, op, true);
|
||||
break;
|
||||
|
||||
case AutomationTrackItem:
|
||||
commit = set_selected_track_from_click (op, true);
|
||||
commit = set_selected_track_from_click (press, op, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -372,7 +372,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
|
||||
case StreamItem:
|
||||
case RegionItem:
|
||||
case AutomationTrackItem:
|
||||
commit = set_selected_track_from_click (op, true);
|
||||
commit = set_selected_track_from_click (true, op, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -4777,6 +4777,8 @@ Editor::end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event)
|
||||
}
|
||||
|
||||
} else {
|
||||
cerr << "Boo!\n";
|
||||
selection->clear_tracks();
|
||||
selection->clear_regions();
|
||||
selection->clear_points ();
|
||||
selection->clear_lines ();
|
||||
|
@ -1377,6 +1377,7 @@ Editor::select_all_within (nframes_t start, nframes_t end, double top, double bo
|
||||
{
|
||||
list<Selectable*> touched;
|
||||
list<Selectable*>::size_type n = 0;
|
||||
TrackViewList touched_tracks;
|
||||
|
||||
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
|
||||
if ((*iter)->hidden()) {
|
||||
@ -1388,10 +1389,15 @@ Editor::select_all_within (nframes_t start, nframes_t end, double top, double bo
|
||||
(*iter)->get_selectables (start, end, top, bot, touched);
|
||||
|
||||
if (n != touched.size()) {
|
||||
selection->add (*iter);
|
||||
touched_tracks.push_back (*iter);
|
||||
}
|
||||
}
|
||||
|
||||
if (!touched_tracks.empty()) {
|
||||
selection->clear_tracks();
|
||||
selection->set (touched_tracks);
|
||||
}
|
||||
|
||||
begin_reversible_command (_("select all within"));
|
||||
switch (op) {
|
||||
case Selection::Add:
|
||||
|
@ -73,7 +73,7 @@ RegionSelection::clear_all()
|
||||
_current_end = 0;
|
||||
}
|
||||
|
||||
bool RegionSelection::contains (RegionView* rv)
|
||||
bool RegionSelection::contains (RegionView* rv) const
|
||||
{
|
||||
return find (begin(), end(), rv) != end();
|
||||
}
|
||||
@ -241,3 +241,15 @@ RegionSelection::sort_by_position_and_track ()
|
||||
RegionSortByTrack sorter;
|
||||
sort (sorter);
|
||||
}
|
||||
|
||||
bool
|
||||
RegionSelection::involves (const TimeAxisView& tv) const
|
||||
{
|
||||
for (RegionSelection::const_iterator i = begin(); i != end(); ++i) {
|
||||
if (&(*i)->get_trackview() == &tv) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,11 @@ class RegionSelection : public std::list<RegionView*>, public sigc::trackable
|
||||
|
||||
void add (RegionView*);
|
||||
bool remove (RegionView*);
|
||||
bool contains (RegionView*);
|
||||
void sort_by_position_and_track ();
|
||||
|
||||
bool contains (RegionView*) const;
|
||||
bool involves (const TimeAxisView&) const;
|
||||
|
||||
void clear_all();
|
||||
|
||||
nframes_t start () const {
|
||||
|
@ -461,8 +461,13 @@ Selection::remove (const list<boost::shared_ptr<Playlist> >& pllist)
|
||||
void
|
||||
Selection::remove (RegionView* r)
|
||||
{
|
||||
regions.remove (r);
|
||||
if (regions.remove (r)) {
|
||||
RegionsChanged ();
|
||||
}
|
||||
|
||||
if (!regions.involves (r->get_trackview())) {
|
||||
remove (&r->get_trackview());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user