mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
move templated foreach methods from TrackSelection into parent (TrackViewList)
This allows the same methods to be used on e.g. Editor::track_views
This commit is contained in:
parent
e954303fec
commit
97d1ee9822
2 changed files with 79 additions and 63 deletions
|
|
@ -22,9 +22,6 @@
|
||||||
#define __ardour_gtk_track_selection_h__
|
#define __ardour_gtk_track_selection_h__
|
||||||
|
|
||||||
#include "track_view_list.h"
|
#include "track_view_list.h"
|
||||||
#include "route_ui.h"
|
|
||||||
#include "audio_time_axis.h"
|
|
||||||
#include "midi_time_axis.h"
|
|
||||||
|
|
||||||
class PublicEditor;
|
class PublicEditor;
|
||||||
|
|
||||||
|
|
@ -36,65 +33,6 @@ public:
|
||||||
|
|
||||||
virtual ~TrackSelection ();
|
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:
|
private:
|
||||||
PublicEditor const * _editor;
|
PublicEditor const * _editor;
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,15 @@
|
||||||
#ifndef __ardour_gtk_track_view_list_h__
|
#ifndef __ardour_gtk_track_view_list_h__
|
||||||
#define __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 <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include "route_ui.h"
|
||||||
|
#include "audio_time_axis.h"
|
||||||
|
#include "midi_time_axis.h"
|
||||||
|
|
||||||
class TimeAxisView;
|
class TimeAxisView;
|
||||||
|
|
||||||
class TrackViewList : public std::list<TimeAxisView*>
|
class TrackViewList : public std::list<TimeAxisView*>
|
||||||
|
|
@ -39,6 +44,79 @@ public:
|
||||||
|
|
||||||
TrackViewList filter_to_unique_playlists ();
|
TrackViewList filter_to_unique_playlists ();
|
||||||
ARDOUR::RouteList routelist () const;
|
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
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue