Merged with trunk R1719.
[ardour.git] / gtk2_ardour / editing.cc
1 /*
2     Copyright (C) 2000-2007 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 */
19
20 #include <string>
21
22 #include "editing.h"
23
24 #include "i18n.h"
25
26 using namespace std;
27
28 // This involves some cpp magic. --taybin
29
30 #define SNAPTYPE(a) /*empty*/
31 #define SNAPMODE(a) /*empty*/
32 #define REGIONLISTSORTTYPE(a) /*empty*/
33 #define MOUSEMODE(a) /*empty*/
34 #define ZOOMFOCUS(a) /*empty*/
35 #define DISPLAYCONTROL(a) /*empty*/
36
37 namespace Editing {
38
39 // SNAPTYPE
40 #undef SNAPTYPE
41 #define SNAPTYPE(s) if (!strcmp(type, #s)) {return s;}
42 SnapType
43 str2snaptype (const string & str) {
44         const char* type = str.c_str();
45         #include "editing_syms.h"
46         return SnapToBar;
47 }
48
49 #undef SNAPTYPE
50 #define SNAPTYPE(s) N_(#s),
51 const char *snaptypestrs[] = {
52         #include "editing_syms.h"
53         0
54 };
55 #undef SNAPTYPE
56 #define SNAPTYPE(a) /*empty*/
57
58 // SNAPMODE
59 #undef SNAPMODE
60 #define SNAPMODE(s) if (!strcmp(type, #s)) {return s;}
61 SnapMode
62 str2snapmode (const string & str) {
63         const char* type = str.c_str();
64         #include "editing_syms.h"
65         return SnapNormal;
66 }
67
68 #undef SNAPMODE
69 #define SNAPMODE(s) N_(#s),
70 const char *snapmodestrs[] = {
71         #include "editing_syms.h"
72         0
73 };
74 #undef SNAPMODE
75 #define SNAPMODE(a) /*empty*/
76
77
78 // REGIONLISTSORTTYPE
79 #undef REGIONLISTSORTTYPE
80 #define REGIONLISTSORTTYPE(s) if (!strcmp(type, #s)) {return s;}
81 RegionListSortType
82 str2regionlistsorttype (const string & str) {
83         const char* type = str.c_str();
84         #include "editing_syms.h"
85         return ByName;
86 }
87
88 #undef REGIONLISTSORTTYPE
89 #define REGIONLISTSORTTYPE(s) N_(#s),
90 const char *regionlistsorttypestrs[] = {
91         #include "editing_syms.h"
92         0
93 };
94 #undef REGIONLISTSORTTYPE
95 #define REGIONLISTSORTTYPE(a) /*empty*/
96
97 // MOUSEMODE
98 #undef MOUSEMODE
99 #define MOUSEMODE(s) if (!strcmp(type, #s)) {return s;}
100 MouseMode
101 str2mousemode (const string & str) {
102         const char* type = str.c_str();
103         #include "editing_syms.h"
104         return MouseObject;
105 }
106
107 #undef MOUSEMODE
108 #define MOUSEMODE(s) N_(#s),
109 const char *mousemodestrs[] = {
110         #include "editing_syms.h"
111         0
112 };
113 #undef MOUSEMODE
114 #define MOUSEMODE(a) /*empty*/
115
116 // ZOOMFOCUS
117 #undef ZOOMFOCUS
118 #define ZOOMFOCUS(s) if (!strcmp(type, #s)) {return s;}
119 ZoomFocus
120 str2zoomfocus (const string & str) {
121         const char* type = str.c_str();
122         #include "editing_syms.h"
123         return ZoomFocusPlayhead;
124 }
125
126 #undef ZOOMFOCUS
127 #define ZOOMFOCUS(s) N_(#s),
128 const char *zoomfocusstrs[] = {
129         #include "editing_syms.h"
130         0
131 };
132 #undef ZOOMFOCUS
133 #define ZOOMFOCUS(a) /*empty*/
134
135 // DISPLAYCONTROL
136 #undef DISPLAYCONTROL
137 #define DISPLAYCONTROL(s) if (!strcmp(type, #s)) {return s;}
138 DisplayControl
139 str2displaycontrol (const string & str) {
140         const char* type = str.c_str();
141         #include "editing_syms.h"
142         return FollowPlayhead;
143 }
144
145 #undef DISPLAYCONTROL
146 #define DISPLAYCONTROL(s) N_(#s),
147 const char *displaycontrolstrs[] = {
148         #include "editing_syms.h"
149         0
150 };
151 #undef DISPLAYCONTROL
152 #define DISPLAYCONTROL(a) /*empty*/
153
154 //IMPORTMODE
155 #undef IMPORTMODE
156 #define IMPORTMODE(s) N_(#s),
157 const char *importmodestrs[] = {
158         #include "editing_syms.h"
159         0
160 };
161 #undef IMPORTMODE
162 #define IMPORTMODE(a) /*empty*/
163
164 } // namespace Editing
165