change return API for Location::clear_*() methods to indicate if anything was removed
This commit is contained in:
parent
bcb3e75cec
commit
950f0d4c9b
@ -200,10 +200,10 @@ public:
|
||||
Location* add_range (samplepos_t start, samplepos_t end);
|
||||
|
||||
void remove (Location *);
|
||||
void clear ();
|
||||
void clear_markers ();
|
||||
void clear_xrun_markers ();
|
||||
void clear_ranges ();
|
||||
bool clear ();
|
||||
bool clear_markers ();
|
||||
bool clear_xrun_markers ();
|
||||
bool clear_ranges ();
|
||||
|
||||
XMLNode& get_state (void);
|
||||
int set_state (const XMLNode&, int version);
|
||||
|
@ -903,9 +903,11 @@ Locations::set_current_unlocked (Location *loc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Locations::clear ()
|
||||
{
|
||||
bool deleted = false;
|
||||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (lock);
|
||||
|
||||
@ -917,6 +919,7 @@ Locations::clear ()
|
||||
if (!(*i)->is_session_range()) {
|
||||
delete *i;
|
||||
locations.erase (i);
|
||||
deleted = true;
|
||||
}
|
||||
|
||||
i = tmp;
|
||||
@ -924,14 +927,19 @@ Locations::clear ()
|
||||
|
||||
current_location = 0;
|
||||
}
|
||||
if (deleted) {
|
||||
changed (); /* EMIT SIGNAL */
|
||||
current_changed (0); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
changed (); /* EMIT SIGNAL */
|
||||
current_changed (0); /* EMIT SIGNAL */
|
||||
return deleted;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Locations::clear_markers ()
|
||||
{
|
||||
bool deleted = false;
|
||||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (lock);
|
||||
LocationList::iterator tmp;
|
||||
@ -943,18 +951,25 @@ Locations::clear_markers ()
|
||||
if ((*i)->is_mark() && !(*i)->is_session_range()) {
|
||||
delete *i;
|
||||
locations.erase (i);
|
||||
deleted = true;
|
||||
}
|
||||
|
||||
i = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
changed (); /* EMIT SIGNAL */
|
||||
if (deleted) {
|
||||
changed (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Locations::clear_xrun_markers ()
|
||||
{
|
||||
bool deleted = false;
|
||||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (lock);
|
||||
LocationList::iterator tmp;
|
||||
@ -966,18 +981,25 @@ Locations::clear_xrun_markers ()
|
||||
if ((*i)->is_xrun()) {
|
||||
delete *i;
|
||||
locations.erase (i);
|
||||
deleted = true;
|
||||
}
|
||||
|
||||
i = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
changed (); /* EMIT SIGNAL */
|
||||
if (deleted) {
|
||||
changed (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Locations::clear_ranges ()
|
||||
{
|
||||
bool deleted = false;
|
||||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (lock);
|
||||
LocationList::iterator tmp;
|
||||
@ -1001,7 +1023,7 @@ Locations::clear_ranges ()
|
||||
if (!(*i)->is_mark()) {
|
||||
delete *i;
|
||||
locations.erase (i);
|
||||
|
||||
deleted = true;
|
||||
}
|
||||
|
||||
i = tmp;
|
||||
@ -1010,8 +1032,12 @@ Locations::clear_ranges ()
|
||||
current_location = 0;
|
||||
}
|
||||
|
||||
changed ();
|
||||
current_changed (0); /* EMIT SIGNAL */
|
||||
if (deleted) {
|
||||
changed (); /* EMIT SIGNAL */
|
||||
current_changed (0); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user