diff options
author | Björn Stenberg <bjorn@haxx.se> | 2003-01-15 13:48:54 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2003-01-15 13:48:54 +0000 |
commit | 58dff17b8ef920e0d57673523849132398170c35 (patch) | |
tree | 44206d72f3c1d8c023833a4fdb90c0eec3f0950d /apps/recorder/keyboard.c | |
parent | 2c301079cce2a8f403d31a28acf6304ab75c7ffb (diff) | |
download | rockbox-58dff17b8ef920e0d57673523849132398170c35.tar.gz rockbox-58dff17b8ef920e0d57673523849132398170c35.zip |
Keyboard fixes. ON now means Done on both recorder and player. Navigation keys repeat. Recorder keyboard uses system font.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3092 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/keyboard.c')
-rw-r--r-- | apps/recorder/keyboard.c | 130 |
1 files changed, 69 insertions, 61 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 431bfb6b19..8f22d19d97 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -84,6 +84,7 @@ int kbd_input(char* text, int buflen) | |||
84 | char c = 0; | 84 | char c = 0; |
85 | struct font* font = font_get(FONT_SYSFIXED); | 85 | struct font* font = font_get(FONT_SYSFIXED); |
86 | 86 | ||
87 | lcd_setfont(FONT_SYSFIXED); | ||
87 | font_w = font->maxwidth; | 88 | font_w = font->maxwidth; |
88 | font_h = font->height; | 89 | font_h = font->height; |
89 | 90 | ||
@@ -131,7 +132,7 @@ int kbd_input(char* text, int buflen) | |||
131 | 132 | ||
132 | /* draw the status bar */ | 133 | /* draw the status bar */ |
133 | kbd_draw_statusbar_button(0, "Shift", status_y1, font_w); | 134 | kbd_draw_statusbar_button(0, "Shift", status_y1, font_w); |
134 | kbd_draw_statusbar_button(1, "Done", status_y1, font_w); | 135 | kbd_draw_statusbar_button(1, "Cancl", status_y1, font_w); |
135 | kbd_draw_statusbar_button(2, "Del", status_y1, font_w); | 136 | kbd_draw_statusbar_button(2, "Del", status_y1, font_w); |
136 | 137 | ||
137 | /* highlight the key that has focus */ | 138 | /* highlight the key that has focus */ |
@@ -140,67 +141,74 @@ int kbd_input(char* text, int buflen) | |||
140 | 141 | ||
141 | switch ( button_get(true) ) { | 142 | switch ( button_get(true) ) { |
142 | 143 | ||
143 | case BUTTON_OFF: | 144 | case BUTTON_OFF: |
144 | /* abort */ | 145 | case BUTTON_F2: |
145 | return -1; | 146 | /* abort */ |
146 | break; | 147 | lcd_setfont(FONT_UI); |
147 | 148 | return -1; | |
148 | case BUTTON_F1: | 149 | break; |
149 | /* Page */ | 150 | |
150 | if (++page == KEYBOARD_PAGES) | 151 | case BUTTON_F1: |
151 | page = 0; | 152 | /* Page */ |
152 | kbd_setupkeys(line, page); | 153 | if (++page == KEYBOARD_PAGES) |
153 | break; | 154 | page = 0; |
154 | 155 | kbd_setupkeys(line, page); | |
155 | case BUTTON_RIGHT: | 156 | break; |
156 | if (x < (int)strlen(line[y]) - 1) | 157 | |
157 | x++; | 158 | case BUTTON_RIGHT: |
158 | else | 159 | case BUTTON_RIGHT | BUTTON_REPEAT: |
159 | x = 0; | 160 | if (x < (int)strlen(line[y]) - 1) |
160 | break; | 161 | x++; |
161 | 162 | else | |
162 | case BUTTON_LEFT: | 163 | x = 0; |
163 | if (x) | 164 | break; |
164 | x--; | 165 | |
165 | else | 166 | case BUTTON_LEFT: |
166 | x = strlen(line[y]) - 1; | 167 | case BUTTON_LEFT | BUTTON_REPEAT: |
167 | break; | 168 | if (x) |
168 | 169 | x--; | |
169 | case BUTTON_DOWN: | 170 | else |
170 | if (y < KEYBOARD_LINES - 1) | 171 | x = strlen(line[y]) - 1; |
171 | y++; | 172 | break; |
172 | else | 173 | |
173 | y=0; | 174 | case BUTTON_DOWN: |
174 | break; | 175 | case BUTTON_DOWN | BUTTON_REPEAT: |
175 | 176 | if (y < KEYBOARD_LINES - 1) | |
176 | case BUTTON_UP: | 177 | y++; |
177 | if (y) | 178 | else |
178 | y--; | 179 | y=0; |
179 | else | 180 | break; |
180 | y = KEYBOARD_LINES - 1; | 181 | |
181 | break; | 182 | case BUTTON_UP: |
182 | 183 | case BUTTON_UP | BUTTON_REPEAT: | |
183 | case BUTTON_F3: | 184 | if (y) |
184 | /* backspace */ | 185 | y--; |
185 | if (len) | 186 | else |
186 | text[len-1] = 0; | 187 | y = KEYBOARD_LINES - 1; |
187 | break; | 188 | break; |
188 | 189 | ||
189 | case BUTTON_F2: | 190 | case BUTTON_F3: |
190 | /* F2 accepts what was entered and continues */ | 191 | /* backspace */ |
191 | done = true; | 192 | if (len) |
192 | break; | 193 | text[len-1] = 0; |
193 | 194 | break; | |
194 | case BUTTON_PLAY: | 195 | |
195 | /* PLAY inserts the selected char */ | 196 | case BUTTON_ON: |
196 | if (len<buflen) | 197 | /* ON accepts what was entered and continues */ |
197 | { | 198 | done = true; |
198 | c = line[y][x]; | 199 | break; |
199 | text[len] = c; | 200 | |
200 | text[len+1] = 0; | 201 | case BUTTON_PLAY: |
201 | } | 202 | /* PLAY inserts the selected char */ |
202 | break; | 203 | if (len<buflen) |
204 | { | ||
205 | c = line[y][x]; | ||
206 | text[len] = c; | ||
207 | text[len+1] = 0; | ||
208 | } | ||
209 | break; | ||
203 | } | 210 | } |
204 | } | 211 | } |
212 | lcd_setfont(FONT_UI); | ||
205 | return 0; | 213 | return 0; |
206 | } | 214 | } |