mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
modify Selection API to provide (default-valued) "with_signal" argument to all ::clear_*() methods
This allows the clear methods to be used before calling ::add(), to avoid the emission of a signal saying "there are no <foo> selected right now". There should be no side-effects from this commit. Note that correct use of this new API is complex, and requires avoiding the use of wrapper methods like clear_objects().
This commit is contained in:
parent
9fe4b7a92a
commit
fbe236999d
2 changed files with 52 additions and 37 deletions
|
|
@ -116,36 +116,37 @@ Selection::clear ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_objects ()
|
Selection::clear_objects (bool with_signal)
|
||||||
{
|
{
|
||||||
clear_regions ();
|
clear_regions (with_signal);
|
||||||
clear_points ();
|
clear_points (with_signal);
|
||||||
clear_lines();
|
clear_lines(with_signal);
|
||||||
clear_playlists ();
|
clear_playlists (with_signal);
|
||||||
clear_midi_notes ();
|
clear_midi_notes (with_signal);
|
||||||
clear_midi_regions ();
|
clear_midi_regions (with_signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_tracks ()
|
Selection::clear_tracks (bool with_signal)
|
||||||
{
|
{
|
||||||
if (!tracks.empty()) {
|
if (!tracks.empty()) {
|
||||||
for (TrackViewList::iterator x = tracks.begin(); x != tracks.end(); ++x) {
|
for (TrackViewList::iterator x = tracks.begin(); x != tracks.end(); ++x) {
|
||||||
(*x)->set_selected (false);
|
(*x)->set_selected (false);
|
||||||
}
|
}
|
||||||
tracks.clear ();
|
tracks.clear ();
|
||||||
if (!_no_tracks_changed) {
|
if (!_no_tracks_changed && with_signal) {
|
||||||
TracksChanged();
|
TracksChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_time ()
|
Selection::clear_time (bool with_signal)
|
||||||
{
|
{
|
||||||
time.clear();
|
time.clear();
|
||||||
|
if (with_signal) {
|
||||||
TimeChanged ();
|
TimeChanged ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -159,24 +160,28 @@ Selection::dump_region_layers()
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_regions ()
|
Selection::clear_regions (bool with_signal)
|
||||||
{
|
{
|
||||||
if (!regions.empty()) {
|
if (!regions.empty()) {
|
||||||
regions.clear_all ();
|
regions.clear_all ();
|
||||||
|
if (with_signal) {
|
||||||
RegionsChanged();
|
RegionsChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_midi_notes ()
|
Selection::clear_midi_notes (bool with_signal)
|
||||||
{
|
{
|
||||||
if (!midi_notes.empty()) {
|
if (!midi_notes.empty()) {
|
||||||
for (MidiNoteSelection::iterator x = midi_notes.begin(); x != midi_notes.end(); ++x) {
|
for (MidiNoteSelection::iterator x = midi_notes.begin(); x != midi_notes.end(); ++x) {
|
||||||
delete *x;
|
delete *x;
|
||||||
}
|
}
|
||||||
midi_notes.clear ();
|
midi_notes.clear ();
|
||||||
|
if (with_signal) {
|
||||||
MidiNotesChanged ();
|
MidiNotesChanged ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// clear note selections for MRV's that have note selections
|
// clear note selections for MRV's that have note selections
|
||||||
// this will cause the MRV to be removed from the list
|
// this will cause the MRV to be removed from the list
|
||||||
|
|
@ -193,16 +198,18 @@ Selection::clear_midi_notes ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_midi_regions ()
|
Selection::clear_midi_regions (bool with_signal)
|
||||||
{
|
{
|
||||||
if (!midi_regions.empty()) {
|
if (!midi_regions.empty()) {
|
||||||
midi_regions.clear ();
|
midi_regions.clear ();
|
||||||
|
if (with_signal) {
|
||||||
MidiRegionsChanged ();
|
MidiRegionsChanged ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_playlists ()
|
Selection::clear_playlists (bool with_signal)
|
||||||
{
|
{
|
||||||
/* Selections own their playlists */
|
/* Selections own their playlists */
|
||||||
|
|
||||||
|
|
@ -214,26 +221,32 @@ Selection::clear_playlists ()
|
||||||
|
|
||||||
if (!playlists.empty()) {
|
if (!playlists.empty()) {
|
||||||
playlists.clear ();
|
playlists.clear ();
|
||||||
|
if (with_signal) {
|
||||||
PlaylistsChanged();
|
PlaylistsChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_lines ()
|
Selection::clear_lines (bool with_signal)
|
||||||
{
|
{
|
||||||
if (!lines.empty()) {
|
if (!lines.empty()) {
|
||||||
lines.clear ();
|
lines.clear ();
|
||||||
|
if (with_signal) {
|
||||||
LinesChanged();
|
LinesChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_markers ()
|
Selection::clear_markers (bool with_signal)
|
||||||
{
|
{
|
||||||
if (!markers.empty()) {
|
if (!markers.empty()) {
|
||||||
markers.clear ();
|
markers.clear ();
|
||||||
|
if (with_signal) {
|
||||||
MarkersChanged();
|
MarkersChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -776,7 +789,7 @@ Selection::remove (boost::shared_ptr<ARDOUR::AutomationList> ac)
|
||||||
void
|
void
|
||||||
Selection::set (TimeAxisView* track)
|
Selection::set (TimeAxisView* track)
|
||||||
{
|
{
|
||||||
clear_objects(); //enforce object/range exclusivity
|
clear_objects (); //enforce object/range exclusivity
|
||||||
clear_tracks ();
|
clear_tracks ();
|
||||||
add (track);
|
add (track);
|
||||||
}
|
}
|
||||||
|
|
@ -1090,12 +1103,14 @@ Selection::add (list<Selectable*> const & selectables)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::clear_points ()
|
Selection::clear_points (bool with_signal)
|
||||||
{
|
{
|
||||||
if (!points.empty()) {
|
if (!points.empty()) {
|
||||||
points.clear ();
|
points.clear ();
|
||||||
|
if (with_signal) {
|
||||||
PointsChanged ();
|
PointsChanged ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -200,18 +200,18 @@ class Selection : public sigc::trackable, public PBD::ScopedConnectionList
|
||||||
|
|
||||||
void clear_all() { clear_time(); clear_tracks(); clear_objects(); }
|
void clear_all() { clear_time(); clear_tracks(); clear_objects(); }
|
||||||
|
|
||||||
void clear_time(); //clears any time selection ( i.e. Range )
|
void clear_time(bool with_signal = true); //clears any time selection ( i.e. Range )
|
||||||
void clear_tracks (); //clears the track header selections
|
void clear_tracks (bool with_signal = true); //clears the track header selections
|
||||||
void clear_objects(); //clears the items listed below
|
void clear_objects(bool with_signal = true); //clears the items listed below
|
||||||
|
|
||||||
// these items get cleared wholesale in clear_objects
|
// these items get cleared wholesale in clear_objects
|
||||||
void clear_regions();
|
void clear_regions(bool with_signal = true);
|
||||||
void clear_lines ();
|
void clear_lines (bool with_signal = true);
|
||||||
void clear_playlists ();
|
void clear_playlists (bool with_signal = true);
|
||||||
void clear_points ();
|
void clear_points (bool with_signal = true);
|
||||||
void clear_markers ();
|
void clear_markers (bool with_signal = true);
|
||||||
void clear_midi_notes ();
|
void clear_midi_notes (bool with_signal = true);
|
||||||
void clear_midi_regions ();
|
void clear_midi_regions (bool with_signal = true);
|
||||||
|
|
||||||
void foreach_region (void (ARDOUR::Region::*method)(void));
|
void foreach_region (void (ARDOUR::Region::*method)(void));
|
||||||
void foreach_regionview (void (RegionView::*method)(void));
|
void foreach_regionview (void (RegionView::*method)(void));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue