projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix rect select to work in all directions.
[ardour.git]
/
gtk2_ardour
/
region_selection.cc
diff --git
a/gtk2_ardour/region_selection.cc
b/gtk2_ardour/region_selection.cc
index 34810691f5c33e3f1cc678b9dc056daa0f6f55bc..8074383141fff7d7ca4e17042c80a84c314d37b2 100644
(file)
--- a/
gtk2_ardour/region_selection.cc
+++ b/
gtk2_ardour/region_selection.cc
@@
-31,12
+31,16
@@
using namespace sigc;
RegionSelection::RegionSelection ()
{
RegionSelection::RegionSelection ()
{
+ RegionView::RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
+
_current_start = 0;
_current_end = 0;
}
RegionSelection::RegionSelection (const RegionSelection& other)
{
_current_start = 0;
_current_end = 0;
}
RegionSelection::RegionSelection (const RegionSelection& other)
{
+ RegionView::RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
+
for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
add (*i);
}
for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
add (*i);
}
@@
-44,8
+48,6
@@
RegionSelection::RegionSelection (const RegionSelection& other)
_current_end = other._current_end;
}
_current_end = other._current_end;
}
-
-
RegionSelection&
RegionSelection::operator= (const RegionSelection& other)
{
RegionSelection&
RegionSelection::operator= (const RegionSelection& other)
{
@@
-86,8
+88,6
@@
RegionSelection::add (RegionView* rv)
return false;
}
return false;
}
- rv->RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
-
if (rv->region()->first_frame() < _current_start || empty()) {
_current_start = rv->region()->first_frame();
}
if (rv->region()->first_frame() < _current_start || empty()) {
_current_start = rv->region()->first_frame();
}
@@
-114,31
+114,33
@@
RegionSelection::remove_it (RegionView *rv)
bool
RegionSelection::remove (RegionView* rv)
{
bool
RegionSelection::remove (RegionView* rv)
{
- RegionSelection::iterator
i
;
+ RegionSelection::iterator
r
;
- if ((i = find (begin(), end(), rv)) != end()) {
-
- erase (i);
+ if ((r = find (begin(), end(), rv)) != end()) {
// remove from layer sorted list
_bylayer.remove (rv);
// remove from layer sorted list
_bylayer.remove (rv);
- if (empty()) {
+ if (size() == 1) {
+
+ /* this is the last one, so when we delete it
+ we will be empty.
+ */
_current_start = 0;
_current_end = 0;
} else {
_current_start = 0;
_current_end = 0;
} else {
- boost::shared_ptr<Region> region ((*
i
)->region());
-
+ boost::shared_ptr<Region> region ((*
r
)->region());
+
if (region->first_frame() == _current_start) {
/* reset current start */
nframes_t ref = max_frames;
if (region->first_frame() == _current_start) {
/* reset current start */
nframes_t ref = max_frames;
- for (i = begin (); i != end(); ++i) {
+ for (
RegionSelection::iterator
i = begin (); i != end(); ++i) {
if (region->first_frame() < ref) {
ref = region->first_frame();
}
if (region->first_frame() < ref) {
ref = region->first_frame();
}
@@
-154,7
+156,7
@@
RegionSelection::remove (RegionView* rv)
nframes_t ref = 0;
nframes_t ref = 0;
- for (i = begin (); i != end(); ++i) {
+ for (
RegionSelection::iterator
i = begin (); i != end(); ++i) {
if (region->first_frame() > ref) {
ref = region->first_frame();
}
if (region->first_frame() > ref) {
ref = region->first_frame();
}
@@
-164,6
+166,8
@@
RegionSelection::remove (RegionView* rv)
}
}
}
}
+ erase (r);
+
return true;
}
return true;
}