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