summaryrefslogtreecommitdiff
path: root/apps/recorder/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/keyboard.c')
-rw-r--r--apps/recorder/keyboard.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index ceb8de00fb..6e91d69b6d 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -82,6 +82,7 @@
82struct keyboard_parameters 82struct keyboard_parameters
83{ 83{
84 unsigned short kbd_buf[KBD_BUF_SIZE]; 84 unsigned short kbd_buf[KBD_BUF_SIZE];
85 unsigned short *kbd_buf_ptr;
85 unsigned short max_line_len; 86 unsigned short max_line_len;
86 int default_lines; 87 int default_lines;
87 int last_k; 88 int last_k;
@@ -295,7 +296,7 @@ static unsigned short get_kbd_ch(struct keyboard_parameters *pm, int x, int y)
295 i = pm->last_i; 296 i = pm->last_i;
296 k -= pm->last_k; 297 k -= pm->last_k;
297 } 298 }
298 for (pbuf = &pm->kbd_buf[i]; (i = *pbuf) != 0xFEFF; pbuf += i + 1) 299 for (pbuf = &pm->kbd_buf_ptr[i]; (i = *pbuf) != 0xFEFF; pbuf += i + 1)
299 { 300 {
300 n = i ? (i + pm->max_chars - 1) / pm->max_chars : 1; 301 n = i ? (i + pm->max_chars - 1) / pm->max_chars : 1;
301 if (k < n) break; 302 if (k < n) break;
@@ -304,7 +305,7 @@ static unsigned short get_kbd_ch(struct keyboard_parameters *pm, int x, int y)
304 if (y == 0 && i != 0xFEFF) 305 if (y == 0 && i != 0xFEFF)
305 { 306 {
306 pm->last_k = pm->page*pm->lines - k; 307 pm->last_k = pm->page*pm->lines - k;
307 pm->last_i = pbuf - pm->kbd_buf; 308 pm->last_i = pbuf - pm->kbd_buf_ptr;
308 } 309 }
309 k = k * pm->max_chars + x; 310 k = k * pm->max_chars + x;
310 return (*pbuf != 0xFEFF && k < *pbuf)? pbuf[k+1]: ' '; 311 return (*pbuf != 0xFEFF && k < *pbuf)? pbuf[k+1]: ' ';
@@ -330,7 +331,7 @@ static void kbd_move_picker_horizontal(struct keyboard_parameters *pm,
330static void kbd_move_picker_vertical(struct keyboard_parameters *pm, 331static void kbd_move_picker_vertical(struct keyboard_parameters *pm,
331 struct edit_state *state, int dir); 332 struct edit_state *state, int dir);
332 333
333int kbd_input(char* text, int buflen) 334int kbd_input(char* text, int buflen, unsigned short *kbd)
334{ 335{
335 bool done = false; 336 bool done = false;
336 struct keyboard_parameters * const param = kbd_param; 337 struct keyboard_parameters * const param = kbd_param;
@@ -438,6 +439,12 @@ int kbd_input(char* text, int buflen)
438 FOR_NB_SCREENS(l) 439 FOR_NB_SCREENS(l)
439 { 440 {
440 struct keyboard_parameters *pm = &param[l]; 441 struct keyboard_parameters *pm = &param[l];
442
443 if(kbd) /* user supplied custom layout */
444 pm->kbd_buf_ptr = kbd;
445 else
446 pm->kbd_buf_ptr = pm->kbd_buf; /* internal layout buffer */
447
441 struct screen *sc = &screens[l]; 448 struct screen *sc = &screens[l];
442 kbd_calc_params(pm, sc, &state); 449 kbd_calc_params(pm, sc, &state);
443 } 450 }
@@ -743,7 +750,7 @@ static void kbd_calc_params(struct keyboard_parameters *pm,
743 * since we're going to be adding spaces, 750 * since we're going to be adding spaces,
744 * max width is at least their width */ 751 * max width is at least their width */
745 pm->font_w = font_get_width(font, ' '); 752 pm->font_w = font_get_width(font, ' ');
746 for (pbuf = pm->kbd_buf; *pbuf != 0xFEFF; pbuf += i) 753 for (pbuf = pm->kbd_buf_ptr; *pbuf != 0xFEFF; pbuf += i)
747 { 754 {
748 for (i = 0; ++i <= *pbuf; ) 755 for (i = 0; ++i <= *pbuf; )
749 { 756 {
@@ -807,7 +814,7 @@ recalc_param:
807 pm->keyboard_margin = DEFAULT_MARGIN; 814 pm->keyboard_margin = DEFAULT_MARGIN;
808 815
809 total_lines = 0; 816 total_lines = 0;
810 for (pbuf = pm->kbd_buf; (i = *pbuf) != 0xFEFF; pbuf += i + 1) 817 for (pbuf = pm->kbd_buf_ptr; (i = *pbuf) != 0xFEFF; pbuf += i + 1)
811 total_lines += (i ? (i + pm->max_chars - 1) / pm->max_chars : 1); 818 total_lines += (i ? (i + pm->max_chars - 1) / pm->max_chars : 1);
812 819
813 pm->pages = (total_lines + pm->lines - 1) / pm->lines; 820 pm->pages = (total_lines + pm->lines - 1) / pm->lines;