diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-04-03 13:23:41 -0600 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-04-03 13:28:58 -0600 |
commit | 97d1ee9822289e383a784371abbc6d5786c39534 (patch) | |
tree | 00a768c284c5b1059456bcaca4c16faab0fd6ba0 /gtk2_ardour | |
parent | e954303fec5187ad5ed848782ff5105b692afbfd (diff) |
move templated foreach methods from TrackSelection into parent (TrackViewList)
This allows the same methods to be used on e.g. Editor::track_views
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/track_selection.h | 62 | ||||
-rw-r--r-- | gtk2_ardour/track_view_list.h | 80 |
2 files changed, 79 insertions, 63 deletions
diff --git a/gtk2_ardour/track_selection.h b/gtk2_ardour/track_selection.h index c5e0425704..7fdfaadd10 100644 --- a/gtk2_ardour/track_selection.h +++ b/gtk2_ardour/track_selection.h @@ -22,9 +22,6 @@ #define __ardour_gtk_track_selection_h__ #include "track_view_list.h" -#include "route_ui.h" -#include "audio_time_axis.h" -#include "midi_time_axis.h" class PublicEditor; @@ -36,65 +33,6 @@ public: virtual ~TrackSelection (); - template <typename Function> - void foreach_time_axis (Function f) { - for (iterator i = begin(); i != end(); ++i) { - f (*i); - } - } - - template <typename Function> - void foreach_route_ui (Function f) { - for (iterator i = begin(); i != end(); ) { - iterator tmp = i; - ++tmp; - - RouteUI* t = dynamic_cast<RouteUI*> (*i); - if (t) { - f (t); - } - i = tmp; - } - } - - template <typename Function> - void foreach_route_time_axis (Function f) { - for (iterator i = begin(); i != end(); ) { - iterator tmp = i; - ++tmp; - RouteTimeAxisView* t = dynamic_cast<RouteTimeAxisView*> (*i); - if (t) { - f (t); - } - i = tmp; - } - } - - template <typename Function> - void foreach_audio_time_axis (Function f) { - for (iterator i = begin(); i != end(); ) { - iterator tmp = i; - ++tmp; - AudioTimeAxisView* t = dynamic_cast<AudioTimeAxisView*> (*i); - if (t) { - f (t); - } - i = tmp; - } - } - - template <typename Function> - void foreach_midi_time_axis (Function f) { - for (iterator i = begin(); i != end(); ) { - iterator tmp = i; - ++tmp; - MidiTimeAxisView* t = dynamic_cast<MidiTimeAxisView*> (*i); - if (t) { - f (t); - } - i = tmp; - } - } private: PublicEditor const * _editor; diff --git a/gtk2_ardour/track_view_list.h b/gtk2_ardour/track_view_list.h index 4ed4461d9d..8874795703 100644 --- a/gtk2_ardour/track_view_list.h +++ b/gtk2_ardour/track_view_list.h @@ -20,10 +20,15 @@ #ifndef __ardour_gtk_track_view_list_h__ #define __ardour_gtk_track_view_list_h__ -#include "ardour/types.h" +#include "ardour/types.h" /* XXX is this here because of some Cocoa nonsense ? */ + #include <list> #include <set> +#include "route_ui.h" +#include "audio_time_axis.h" +#include "midi_time_axis.h" + class TimeAxisView; class TrackViewList : public std::list<TimeAxisView*> @@ -39,6 +44,79 @@ public: TrackViewList filter_to_unique_playlists (); ARDOUR::RouteList routelist () const; + + template <typename Function> + void foreach_time_axis (Function f) { + for (iterator i = begin(); i != end(); ++i) { + f (*i); + } + } + + template <typename Function> + void foreach_route_ui (Function f) { + for (iterator i = begin(); i != end(); ) { + iterator tmp = i; + ++tmp; + + RouteUI* t = dynamic_cast<RouteUI*> (*i); + if (t) { + f (t); + } + i = tmp; + } + } + + template <typename Function> + void foreach_stripable_time_axis (Function f) { + for (iterator i = begin(); i != end(); ) { + iterator tmp = i; + ++tmp; + StripableTimeAxisView* t = dynamic_cast<StripableTimeAxisView*> (*i); + if (t) { + f (t); + } + i = tmp; + } + } + + template <typename Function> + void foreach_route_time_axis (Function f) { + for (iterator i = begin(); i != end(); ) { + iterator tmp = i; + ++tmp; + RouteTimeAxisView* t = dynamic_cast<RouteTimeAxisView*> (*i); + if (t) { + f (t); + } + i = tmp; + } + } + + template <typename Function> + void foreach_audio_time_axis (Function f) { + for (iterator i = begin(); i != end(); ) { + iterator tmp = i; + ++tmp; + AudioTimeAxisView* t = dynamic_cast<AudioTimeAxisView*> (*i); + if (t) { + f (t); + } + i = tmp; + } + } + + template <typename Function> + void foreach_midi_time_axis (Function f) { + for (iterator i = begin(); i != end(); ) { + iterator tmp = i; + ++tmp; + MidiTimeAxisView* t = dynamic_cast<MidiTimeAxisView*> (*i); + if (t) { + f (t); + } + i = tmp; + } + } }; #endif |