summaryrefslogtreecommitdiff
path: root/gtk2_ardour/selection.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-01-18 04:34:00 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-01-18 04:34:00 +0000
commit013ec977324d98d7c4b243ddad86d84b94abdc62 (patch)
tree8ef847eaab6b6df2bf406eba96370c9fd4bd9301 /gtk2_ardour/selection.cc
parent143983948ecbdc9e9e4c4f3fe2541b2bea22be87 (diff)
make ctrl-rubber-band-select do something closer to the right thing
git-svn-id: svn://localhost/ardour2/trunk@1354 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/selection.cc')
-rw-r--r--gtk2_ardour/selection.cc40
1 files changed, 39 insertions, 1 deletions
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc
index 76767f539d..ba0d51e606 100644
--- a/gtk2_ardour/selection.cc
+++ b/gtk2_ardour/selection.cc
@@ -622,6 +622,44 @@ Selection::empty ()
}
void
+Selection::toggle (const vector<AutomationSelectable*>& autos)
+{
+ for (vector<AutomationSelectable*>::const_iterator x = autos.begin(); x != autos.end(); ++x) {
+ (*x)->set_selected (!(*x)->get_selected());
+ }
+}
+
+void
+Selection::toggle (list<Selectable*>& selectables)
+{
+ RegionView* rv;
+ AutomationSelectable* as;
+ vector<RegionView*> rvs;
+ vector<AutomationSelectable*> autos;
+
+ for (std::list<Selectable*>::iterator i = selectables.begin(); i != selectables.end(); ++i) {
+ if ((rv = dynamic_cast<RegionView*> (*i)) != 0) {
+ rvs.push_back (rv);
+ } else if ((as = dynamic_cast<AutomationSelectable*> (*i)) != 0) {
+ autos.push_back (as);
+ } else {
+ fatal << _("programming error: ")
+ << X_("unknown selectable type passed to Selection::toggle()")
+ << endmsg;
+ /*NOTREACHED*/
+ }
+ }
+
+ if (!rvs.empty()) {
+ toggle (rvs);
+ }
+
+ if (!autos.empty()) {
+ toggle (autos);
+ }
+}
+
+void
Selection::set (list<Selectable*>& selectables)
{
clear_regions();
@@ -645,7 +683,7 @@ Selection::add (list<Selectable*>& selectables)
autos.push_back (as);
} else {
fatal << _("programming error: ")
- << X_("unknown selectable type passed to Selection::set()")
+ << X_("unknown selectable type passed to Selection::add()")
<< endmsg;
/*NOTREACHED*/
}