1 /*
2  * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
3  * Copyright (C) 2006-2016 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2007-2009 David Robillard <d@drobilla.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #include <cstring>
22 
23 #include "editing.h"
24 
25 #include "pbd/i18n.h"
26 
27 using namespace std;
28 
29 // This involves some cpp magic. --taybin
30 
31 #define GRIDTYPE(a) /*empty*/
32 #define SNAPMODE(a) /*empty*/
33 #define REGIONLISTSORTTYPE(a) /*empty*/
34 #define MOUSEMODE(a) /*empty*/
35 #define MIDIEDITMODE(a) /*empty*/
36 #define ZOOMFOCUS(a) /*empty*/
37 #define DISPLAYCONTROL(a) /*empty*/
38 
39 namespace Editing {
40 
41 // GRIDTYPE
42 #undef GRIDTYPE
43 #define GRIDTYPE(s) if (!strcmp(type, #s)) {return s;}
44 GridType
str2gridtype(const string & str)45 str2gridtype (const string & str) {
46 	const char* type = str.c_str();
47 	#include "editing_syms.h"
48 	return GridTypeBar;
49 }
50 
51 #undef GRIDTYPE
52 #define GRIDTYPE(s) N_(#s),
53 const char *gridtypestrs[] = {
54 	#include "editing_syms.h"
55 	0
56 };
57 #undef GRIDTYPE
58 #define GRIDTYPE(a) /*empty*/
59 
60 // SNAPMODE
61 #undef SNAPMODE
62 #define SNAPMODE(s) if (!strcmp(type, #s)) {return s;}
63 SnapMode
str2snapmode(const string & str)64 str2snapmode (const string & str) {
65 	const char* type = str.c_str();
66 	#include "editing_syms.h"
67 	return SnapMagnetic;
68 }
69 
70 #undef SNAPMODE
71 #define SNAPMODE(s) N_(#s),
72 const char *snapmodestrs[] = {
73 	#include "editing_syms.h"
74 	0
75 };
76 #undef SNAPMODE
77 #define SNAPMODE(a) /*empty*/
78 
79 
80 // REGIONLISTSORTTYPE
81 #undef REGIONLISTSORTTYPE
82 #define REGIONLISTSORTTYPE(s) if (!strcmp(type, #s)) {return s;}
83 RegionListSortType
str2regionlistsorttype(const string & str)84 str2regionlistsorttype (const string & str) {
85 	const char* type = str.c_str();
86 	#include "editing_syms.h"
87 	return ByName;
88 }
89 
90 #undef REGIONLISTSORTTYPE
91 #define REGIONLISTSORTTYPE(s) N_(#s),
92 const char *regionlistsorttypestrs[] = {
93 	#include "editing_syms.h"
94 	0
95 };
96 #undef REGIONLISTSORTTYPE
97 #define REGIONLISTSORTTYPE(a) /*empty*/
98 
99 // MOUSEMODE
100 #undef MOUSEMODE
101 #define MOUSEMODE(s) if (!strcmp(type, #s)) {return s;}
102 MouseMode
str2mousemode(const string & str)103 str2mousemode (const string & str) {
104 	const char* type = str.c_str();
105 	#include "editing_syms.h"
106 	return MouseObject;
107 }
108 
109 #undef MOUSEMODE
110 #define MOUSEMODE(s) N_(#s),
111 const char *mousemodestrs[] = {
112 	#include "editing_syms.h"
113 	0
114 };
115 #undef MOUSEMODE
116 #define MOUSEMODE(a) /*empty*/
117 
118 // ZOOMFOCUS
119 #undef ZOOMFOCUS
120 #define ZOOMFOCUS(s) if (!strcmp(type, #s)) {return s;}
121 ZoomFocus
str2zoomfocus(const string & str)122 str2zoomfocus (const string & str) {
123 	const char* type = str.c_str();
124 	#include "editing_syms.h"
125 	return ZoomFocusPlayhead;
126 }
127 
128 #undef ZOOMFOCUS
129 #define ZOOMFOCUS(s) N_(#s),
130 const char *zoomfocusstrs[] = {
131 	#include "editing_syms.h"
132 	0
133 };
134 #undef ZOOMFOCUS
135 #define ZOOMFOCUS(a) /*empty*/
136 
137 // DISPLAYCONTROL
138 #undef DISPLAYCONTROL
139 #define DISPLAYCONTROL(s) if (!strcmp(type, #s)) {return s;}
140 DisplayControl
str2displaycontrol(const string & str)141 str2displaycontrol (const string & str) {
142 	const char* type = str.c_str();
143 	#include "editing_syms.h"
144 	return FollowPlayhead;
145 }
146 
147 #undef DISPLAYCONTROL
148 #define DISPLAYCONTROL(s) N_(#s),
149 const char *displaycontrolstrs[] = {
150 	#include "editing_syms.h"
151 	0
152 };
153 #undef DISPLAYCONTROL
154 #define DISPLAYCONTROL(a) /*empty*/
155 
156 //IMPORTMODE
157 #undef IMPORTMODE
158 #define IMPORTMODE(s) N_(#s),
159 const char *importmodestrs[] = {
160 	#include "editing_syms.h"
161 	0
162 };
163 #undef IMPORTMODE
164 #define IMPORTMODE(a) /*empty*/
165 
166 } // namespace Editing
167 
168