13
0

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
This commit is contained in:
Paul Davis 2007-01-18 04:34:00 +00:00
parent 143983948e
commit 013ec97732
4 changed files with 69 additions and 15 deletions

View File

@ -4777,7 +4777,6 @@ Editor::end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event)
}
} else {
cerr << "Boo!\n";
selection->clear_tracks();
selection->clear_regions();
selection->clear_points ();

View File

@ -1394,16 +1394,30 @@ Editor::select_all_within (nframes_t start, nframes_t end, double top, double bo
}
if (!touched_tracks.empty()) {
selection->clear_tracks();
selection->set (touched_tracks);
switch (op) {
case Selection::Add:
selection->add (touched_tracks);
break;
case Selection::Toggle:
selection->toggle (touched_tracks);
break;
case Selection::Set:
selection->set (touched_tracks);
break;
case Selection::Extend:
/* not defined yet */
break;
}
}
begin_reversible_command (_("select all within"));
switch (op) {
case Selection::Add:
case Selection::Toggle:
selection->add (touched);
break;
case Selection::Toggle:
selection->toggle (touched);
break;
case Selection::Set:
selection->set (touched);
break;

View File

@ -621,6 +621,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)
{
@ -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*/
}

View File

@ -92,49 +92,52 @@ class Selection : public sigc::trackable
bool selected (TimeAxisView*);
bool selected (RegionView*);
void set (list<Selectable*>&);
void add (list<Selectable*>&);
void set (std::list<Selectable*>&);
void add (std::list<Selectable*>&);
void toggle (std::list<Selectable*>&);
void set (TimeAxisView*);
void set (const list<TimeAxisView*>&);
void set (const std::list<TimeAxisView*>&);
void set (RegionView*);
void set (std::vector<RegionView*>&);
long set (TimeAxisView*, nframes_t, nframes_t);
void set (ARDOUR::AutomationList*);
void set (boost::shared_ptr<ARDOUR::Playlist>);
void set (const list<boost::shared_ptr<ARDOUR::Playlist> >&);
void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
void set (boost::shared_ptr<ARDOUR::Redirect>);
void set (AutomationSelectable*);
void toggle (TimeAxisView*);
void toggle (const list<TimeAxisView*>&);
void toggle (const std::list<TimeAxisView*>&);
void toggle (RegionView*);
void toggle (std::vector<RegionView*>&);
long toggle (nframes_t, nframes_t);
void toggle (ARDOUR::AutomationList*);
void toggle (boost::shared_ptr<ARDOUR::Playlist>);
void toggle (const list<boost::shared_ptr<ARDOUR::Playlist> >&);
void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
void toggle (boost::shared_ptr<ARDOUR::Redirect>);
void toggle (const std::vector<AutomationSelectable*>&);
void add (TimeAxisView*);
void add (const list<TimeAxisView*>&);
void add (const std::list<TimeAxisView*>&);
void add (RegionView*);
void add (std::vector<RegionView*>&);
long add (nframes_t, nframes_t);
void add (ARDOUR::AutomationList*);
void add (boost::shared_ptr<ARDOUR::Playlist>);
void add (const list<boost::shared_ptr<ARDOUR::Playlist> >&);
void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
void add (boost::shared_ptr<ARDOUR::Redirect>);
void remove (TimeAxisView*);
void remove (const list<TimeAxisView*>&);
void remove (const std::list<TimeAxisView*>&);
void remove (RegionView*);
void remove (uint32_t selection_id);
void remove (nframes_t, nframes_t);
void remove (ARDOUR::AutomationList*);
void remove (boost::shared_ptr<ARDOUR::Playlist>);
void remove (const list<boost::shared_ptr<ARDOUR::Playlist> >&);
void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
void remove (boost::shared_ptr<ARDOUR::Redirect>);
void remove (const list<Selectable*>&);
void replace (uint32_t time_index, nframes_t start, nframes_t end);