rbutil: add fuzev2
[kugel-rb.git] / apps / keymaps / keymap-cowond2.c
blob09d17120ef1639ccb2c809733161807dea49e807
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 Rob Purchase
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 /* Button Code Definitions for the Cowon D2 target */
23 /* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */
25 #include <stdio.h>
26 #include <string.h>
27 #include <stdlib.h>
29 #include "config.h"
30 #include "action.h"
31 #include "button.h"
32 #include "settings.h"
35 * The format of the list is as follows
36 * { Action Code, Button code, Prereq button code }
37 * if there's no need to check the previous button's value, use BUTTON_NONE
38 * Insert LAST_ITEM_IN_LIST at the end of each mapping
41 static const struct button_mapping button_context_standard[] = {
42 { ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE },
43 { ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
44 { ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE },
45 { ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
47 { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
48 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
50 { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
52 LAST_ITEM_IN_LIST
53 }; /* button_context_standard */
56 static const struct button_mapping button_context_wps[] = {
58 { ACTION_WPS_VOLDOWN, BUTTON_MINUS, BUTTON_NONE },
59 { ACTION_WPS_VOLDOWN, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
60 { ACTION_WPS_VOLUP, BUTTON_PLUS, BUTTON_NONE },
61 { ACTION_WPS_VOLUP, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
62 { ACTION_WPS_BROWSE, BUTTON_MINUS|BUTTON_POWER, BUTTON_MINUS },
63 { ACTION_WPS_BROWSE, BUTTON_MINUS|BUTTON_POWER, BUTTON_MINUS|BUTTON_REPEAT },
64 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
65 { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
67 LAST_ITEM_IN_LIST
68 }; /* button_context_wps */
70 static const struct button_mapping button_context_list[] = {
71 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
72 }; /* button_context_list */
74 static const struct button_mapping button_context_tree[] = {
75 { ACTION_TREE_WPS, BUTTON_PLUS|BUTTON_MENU, BUTTON_PLUS },
76 { ACTION_TREE_WPS, BUTTON_PLUS|BUTTON_MENU, BUTTON_PLUS|BUTTON_REPEAT },
77 { ACTION_TREE_STOP, BUTTON_MINUS|BUTTON_POWER, BUTTON_MINUS },
78 { ACTION_TREE_STOP, BUTTON_MINUS|BUTTON_POWER, BUTTON_MINUS|BUTTON_REPEAT },
80 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
81 }; /* button_context_tree */
83 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
84 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
87 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
88 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
91 static const struct button_mapping button_context_settings[] = {
92 { ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE },
93 { ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
94 { ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE },
95 { ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
96 { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE },
97 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
99 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
100 }; /* button_context_settings */
102 static const struct button_mapping button_context_settings_right_is_inc[] = {
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
105 }; /* button_context_settingsgraphical */
107 static const struct button_mapping button_context_yesno[] = {
108 { ACTION_YESNO_ACCEPT, BUTTON_MENU, BUTTON_NONE },
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
111 }; /* button_context_settings_yesno */
113 static const struct button_mapping button_context_colorchooser[] = {
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
115 }; /* button_context_colorchooser */
117 static const struct button_mapping button_context_eq[] = {
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
119 }; /* button_context_eq */
121 /** Bookmark Screen **/
122 static const struct button_mapping button_context_bmark[] = {
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
124 }; /* button_context_bmark */
126 static const struct button_mapping button_context_time[] = {
127 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
128 }; /* button_context_time */
130 static const struct button_mapping button_context_quickscreen[] = {
131 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
132 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
134 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
135 }; /* button_context_quickscreen */
137 static const struct button_mapping button_context_pitchscreen[] = {
139 { ACTION_PS_INC_SMALL, BUTTON_PLUS, BUTTON_NONE },
140 { ACTION_PS_INC_BIG, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
141 { ACTION_PS_DEC_SMALL, BUTTON_MINUS, BUTTON_NONE },
142 { ACTION_PS_DEC_BIG, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
143 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
144 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
145 }; /* button_context_pitchcreen */
147 static const struct button_mapping button_context_keyboard[] = {
148 { ACTION_KBD_PAGE_FLIP, BUTTON_MENU, BUTTON_NONE },
149 { ACTION_KBD_CURSOR_LEFT, BUTTON_MINUS, BUTTON_NONE },
150 { ACTION_KBD_CURSOR_LEFT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
151 { ACTION_KBD_CURSOR_RIGHT, BUTTON_PLUS, BUTTON_NONE },
152 { ACTION_KBD_CURSOR_RIGHT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
154 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
155 }; /* button_context_keyboard */
157 static const struct button_mapping button_context_radio[] = {
158 { ACTION_FM_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
159 { ACTION_FM_PRESET, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
160 { ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE },
162 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
163 }; /* button_context_radio */
165 const struct button_mapping* target_get_context_mapping(int context)
167 switch (context)
169 case CONTEXT_STD:
170 return button_context_standard;
171 case CONTEXT_WPS:
172 return button_context_wps;
174 case CONTEXT_LIST:
175 return button_context_list;
176 case CONTEXT_MAINMENU:
177 case CONTEXT_TREE:
178 if (global_settings.hold_lr_for_scroll_in_list)
179 return button_context_listtree_scroll_without_combo;
180 else
181 return button_context_listtree_scroll_with_combo;
182 case CONTEXT_CUSTOM|CONTEXT_TREE:
183 return button_context_tree;
185 case CONTEXT_SETTINGS:
186 return button_context_settings;
187 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
188 case CONTEXT_SETTINGS_RECTRIGGER:
189 return button_context_settings_right_is_inc;
191 case CONTEXT_SETTINGS_COLOURCHOOSER:
192 return button_context_colorchooser;
193 case CONTEXT_SETTINGS_EQ:
194 return button_context_eq;
196 case CONTEXT_SETTINGS_TIME:
197 return button_context_time;
199 case CONTEXT_YESNOSCREEN:
200 return button_context_yesno;
201 case CONTEXT_FM:
202 return button_context_radio;
203 case CONTEXT_BOOKMARKSCREEN:
204 return button_context_bmark;
205 case CONTEXT_QUICKSCREEN:
206 return button_context_quickscreen;
207 case CONTEXT_PITCHSCREEN:
208 return button_context_pitchscreen;
209 case CONTEXT_KEYBOARD:
210 return button_context_keyboard;
212 return button_context_standard;