use stringcr_t and gain 1/1000 binary size reduction. not thaat much...
[ardour.git] / gtk2_ardour / editing.cc
1 #include <string>
2
3 #include "editing.h"
4
5 using namespace std;
6
7 // This involves some cpp magic. --taybin
8
9 #define SNAPTYPE(a) /*empty*/
10 #define SNAPMODE(a) /*empty*/
11 #define REGIONLISTSORTTYPE(a) /*empty*/
12 #define MOUSEMODE(a) /*empty*/
13 #define ZOOMFOCUS(a) /*empty*/
14 #define DISPLAYCONTROL(a) /*empty*/
15
16 namespace Editing {
17
18 // SNAPTYPE
19 #undef SNAPTYPE
20 #define SNAPTYPE(s) if (!strcmp(type, #s)) {return s;}
21 SnapType
22 str2snaptype (ARDOUR::stringcr_t str) {
23         const char* type = str.c_str();
24         #include "editing_syms.h"
25         return SnapToBar;
26 }
27 #undef SNAPTYPE
28 #define SNAPTYPE(a) /*empty*/
29
30 // SNAPMODE
31 #undef SNAPMODE
32 #define SNAPMODE(s) if (!strcmp(type, #s)) {return s;}
33 SnapMode
34 str2snapmode (ARDOUR::stringcr_t str) {
35         const char* type = str.c_str();
36         #include "editing_syms.h"
37         return SnapNormal;
38 }
39 #undef SNAPMODE
40 #define SNAPMODE(a) /*empty*/
41
42 // REGIONLISTSORTTYPE
43 #undef REGIONLISTSORTTYPE
44 #define REGIONLISTSORTTYPE(s) if (!strcmp(type, #s)) {return s;}
45 RegionListSortType
46 str2regionlistsorttype (ARDOUR::stringcr_t str) {
47         const char* type = str.c_str();
48         #include "editing_syms.h"
49         return ByName;
50 }
51 #undef REGIONLISTSORTTYPE
52 #define REGIONLISTSORTTYPE(a) /*empty*/
53
54 // MOUSEMODE
55 #undef MOUSEMODE
56 #define MOUSEMODE(s) if (!strcmp(type, #s)) {return s;}
57 MouseMode
58 str2mousemode (ARDOUR::stringcr_t str) {
59         const char* type = str.c_str();
60         #include "editing_syms.h"
61         return MouseObject;
62 }
63 #undef MOUSEMODE
64 #define MOUSEMODE(a) /*empty*/
65
66 // ZOOMFOCUS
67 #undef ZOOMFOCUS
68 #define ZOOMFOCUS(s) if (!strcmp(type, #s)) {return s;}
69 ZoomFocus
70 str2zoomfocus (ARDOUR::stringcr_t str) {
71         const char* type = str.c_str();
72         #include "editing_syms.h"
73         return ZoomFocusPlayhead;
74 }
75 #undef ZOOMFOCUS
76 #define ZOOMFOCUS(a) /*empty*/
77
78 // DISPLAYCONTROL
79 #undef DISPLAYCONTROL
80 #define DISPLAYCONTROL(s) if (!strcmp(type, #s)) {return s;}
81 DisplayControl
82 str2displaycontrol (ARDOUR::stringcr_t str) {
83         const char* type = str.c_str();
84         #include "editing_syms.h"
85         return FollowPlayhead;
86 }
87 #undef DISPLAYCONTROL
88 #define DISPLAYCONTROL(a) /*empty*/
89
90 // COLORID
91 #undef COLORID
92 #define COLORID(s) if (!strcmp(type, #s)) {return s;}
93 ColorID
94 str2color_id (ARDOUR::stringcr_t str) {
95         const char* type = str.c_str();
96         #include "editing_syms.h"
97         return cFrameHandleEndOutline;
98 }
99 #undef COLORID
100 #define COLORID(a) /*empty*/
101
102 ColorMap color_map;
103
104 } // namespace Editing