Ardour  9.0-pre0-582-g084a23a80d
selection_templates.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2009 David Robillard <d@drobilla.net>
3  * Copyright (C) 2006-2009 Paul Davis <paul@linuxaudiosystems.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #pragma once
21 
22 /* these inlines require knowledge of Region and Route classes,
23  and so they are in a separate header file from selection.h to
24  avoid multiplying dependencies.
25 */
26 
27 #include "ardour/region.h"
28 
29 #include "selection.h"
30 #include "region_view.h"
31 #include "midi_region_view.h"
32 
33 inline void
34 Selection::foreach_region (void (ARDOUR::Region::*method)(void)) {
35  for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
36  ARDOUR::Region* region = (*i)->region().get();
37  (region->*(method))();
38  }
39 }
40 
41 inline void
42 Selection::foreach_regionview (void (RegionView::*method)(void)) {
43  for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
44  ((*i)->*(method))();
45  }
46 }
47 
48 inline void
50  for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
51  MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
52  if (mrv) {
53  (mrv->*(method))();
54  }
55  }
56 }
57 
58 template<class A> inline void
59 Selection::foreach_region (void (ARDOUR::Region::*method)(A), A arg) {
60  for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
61  ARDOUR::Region* region = (*i)->region().get();
62  (region->*(method))(arg);
63  }
64 }
65 
void foreach_midi_regionview(void(MidiRegionView::*method)(void))
void foreach_regionview(void(RegionView::*method)(void))
void foreach_region(void(ARDOUR::Region::*method)(void))
RegionSelection regions
PBD::PropertyDescriptor< bool > region