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