1 /**
2  * projectM -- Milkdrop-esque visualisation SDK
3  * Copyright (C)2003-2007 projectM Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  * See 'LICENSE.txt' included within this release
19  *
20  */
21 /**
22  * $Id: carbontoprojectM.hpp,v 1.2 2004/11/12 15:12:58 cvs Exp $
23  *
24  * Translates CARBON -> projectM variables
25  *
26  * $Log$
27  */
28 
29 #ifndef _CARBONTOPROJECTM_H
30 #define _CARBONTOPROJECTM_H
31 
32 #include "event.h"
33 #ifdef WIN32
34 #else
35 #endif
36 
carbon2pmEvent(EventRecord * event)37 projectMEvent carbon2pmEvent( EventRecord *event ) {
38 
39 switch ( event->what ) {
40 	/*
41         case updateEvt:
42             return PROJECTM_VIDEORESIZE;
43         case keyUp:
44             return PROJECTM_KEYUP;
45         case keyDown:
46             return PROJECTM_KEYDOWN;
47 */
48         default:
49             return PROJECTM_KEYDOWN;
50 
51       }
52   }
53 
carbon2pmKeycode(EventRecord * event)54 projectMKeycode carbon2pmKeycode( EventRecord *event ) {
55 
56     projectMKeycode char_code = (projectMKeycode)(event->message & charCodeMask);
57     switch ( char_code ) {
58         case kFunctionKeyCharCode: {
59 
60             switch ( ( event->message << 16 ) >> 24 ) { \
61                 case 111: { \
62                     return PROJECTM_K_F12; \
63                   } \
64                 case 103: { \
65                     return PROJECTM_K_F11; \
66                   } \
67                 case 109: { \
68                     return PROJECTM_K_F10; \
69                   } \
70                 case 101: { \
71                     return PROJECTM_K_F9; \
72                   } \
73                 case 100: { \
74                     return PROJECTM_K_F8; \
75                   } \
76                 case 98: { \
77                     return PROJECTM_K_F7; \
78                   } \
79                 case 97: { \
80                     return PROJECTM_K_F6; \
81                   } \
82                 case 96: { \
83                     return PROJECTM_K_F5; \
84                   } \
85                 case 118: { \
86                     return PROJECTM_K_F4; \
87                   } \
88                 case 99: { \
89                     return PROJECTM_K_F3; \
90                   } \
91                 case 120: { \
92                     return PROJECTM_K_F2; \
93                   } \
94                 case 122: { \
95                     return PROJECTM_K_F1; \
96                   }
97 				default:
98 					{
99 						return PROJECTM_K_NONE;
100 					}
101 			}
102 
103           }
104         default: {
105             return char_code;
106           }
107       }
108 
109 }
110 
carbon2pmModifier(EventRecord * event)111 projectMModifier carbon2pmModifier( EventRecord *event ) { \
112     return (projectMModifier)PROJECTM_K_LSHIFT; \
113   } \
114 
115 #endif /** _CARBONTOPROJECTM_H */
116