Merged up to trunk R732
[ardour.git] / gtk2_ardour / selection_templates.h
1 /*
2     Copyright (C) 2000-2003 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #ifndef __ardour_gtk_selection_templates_h__
22 #define __ardour_gtk_selection_templates_h__
23
24 /* these inlines require knowledge of Region and Route classes,
25    and so they are in a separate header file from selection.h to 
26    avoid multiplying dependencies.
27 */
28
29 #include <ardour/region.h>
30
31 #include "selection.h"
32 #include "region_view.h"
33
34 inline void
35 Selection::foreach_region (void (ARDOUR::Region::*method)(void)) {
36         for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
37                 ((*i)->region().*(method))();
38         }
39 }
40
41 template<class A> inline void 
42 Selection::foreach_region (void (ARDOUR::Region::*method)(A), A arg) {
43         for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
44                 ((*i)->region().*(method))(arg);
45         }
46 }
47
48 #if 0
49
50 template<class A> inline void 
51 Selection::foreach_route (void (ARDOUR::Route::*method)(A), A arg) {
52         for (list<ARDOUR::Route*>::iterator i = routes.begin(); i != routes.end(); ++i) {
53                 ((*i)->region().*(method))(arg);
54         }
55 }
56
57 template<class A1, class A2> inline void 
58 Selection::foreach_route (void (ARDOUR::Route::*method)(A1,A2), A1 arg1, A2 arg2) {
59         for (list<ARDOUR::Route*>::iterator i = routes.begin(); i != routes.end(); ++i) {
60                 ((*i)->region().*(method))(arg1, arg2);
61         }
62 }
63
64 #endif
65
66 #endif /* __ardour_gtk_selection_templates_h__ */