From 649c8060861255a608cfa7f13acb6e67eb45bc59 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sat, 2 Nov 2024 18:04:45 +0100 Subject: [PATCH] further keyboard redefining + making sense of text functions --- src/x49gpng/ui.c | 250 +++++++++++++++++++++++++---------------------- 1 file changed, 131 insertions(+), 119 deletions(-) diff --git a/src/x49gpng/ui.c b/src/x49gpng/ui.c index 8f2dd05..7e63fa2 100644 --- a/src/x49gpng/ui.c +++ b/src/x49gpng/ui.c @@ -33,9 +33,17 @@ #define NB_KEYS 51 +#define KB_WIDTH_6_KEYS 36 +#define KB_WIDTH_5_KEYS 46 + +#define KB_HEIGHT_MENU_KEYS 22 +#define KB_HEIGHT_SMALL_KEYS 28 +#define KB_HEIGHT_BIG_KEYS 32 + #define KB_LINE_HEIGHT 48 -#define KB_COLUMN_WIDTH_6_KEYS 50 -#define KB_COLUMN_WIDTH_5_KEYS 60 +#define KB_SPACING_KEYS 14 +#define KB_COLUMN_WIDTH_6_KEYS ( KB_WIDTH_6_KEYS + KB_SPACING_KEYS ) +#define KB_COLUMN_WIDTH_5_KEYS ( KB_WIDTH_5_KEYS + KB_SPACING_KEYS ) static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { {.label = "F1", @@ -50,8 +58,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 0, .y = 0, - .width = 36, - .height = 22, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_MENU_KEYS, .column = 5, .row = 1, .columnbit = ( 1 << 5 ), @@ -70,8 +78,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = KB_COLUMN_WIDTH_6_KEYS, .y = 0, - .width = 36, - .height = 22, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_MENU_KEYS, .column = 5, .row = 2, .columnbit = ( 1 << 5 ), @@ -90,8 +98,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 2 * KB_COLUMN_WIDTH_6_KEYS, .y = 0, - .width = 36, - .height = 22, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_MENU_KEYS, .column = 5, .row = 3, .columnbit = ( 1 << 5 ), @@ -110,8 +118,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 3 * KB_COLUMN_WIDTH_6_KEYS, .y = 0, - .width = 36, - .height = 22, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_MENU_KEYS, .column = 5, .row = 4, .columnbit = ( 1 << 5 ), @@ -130,8 +138,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 4 * KB_COLUMN_WIDTH_6_KEYS, .y = 0, - .width = 36, - .height = 22, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_MENU_KEYS, .column = 5, .row = 5, .columnbit = ( 1 << 5 ), @@ -150,8 +158,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 5 * KB_COLUMN_WIDTH_6_KEYS, .y = 0, - .width = 36, - .height = 22, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_MENU_KEYS, .column = 5, .row = 6, .columnbit = ( 1 << 5 ), @@ -171,8 +179,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_BELOW, .x = 0, .y = KB_LINE_HEIGHT, - .width = 36, - .height = 28, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 5, .row = 7, .columnbit = ( 1 << 5 ), @@ -191,8 +199,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_BELOW, .x = KB_COLUMN_WIDTH_6_KEYS, .y = KB_LINE_HEIGHT, - .width = 36, - .height = 28, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 6, .row = 5, .columnbit = ( 1 << 6 ), @@ -211,8 +219,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_BELOW, .x = 2 * KB_COLUMN_WIDTH_6_KEYS, .y = KB_LINE_HEIGHT, - .width = 36, - .height = 28, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 6, .row = 6, .columnbit = ( 1 << 6 ), @@ -231,8 +239,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_BELOW, .x = 0, .y = 2 * KB_LINE_HEIGHT, - .width = 36, - .height = 28, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 6, .row = 7, .columnbit = ( 1 << 6 ), @@ -251,8 +259,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_BELOW, .x = KB_COLUMN_WIDTH_6_KEYS, .y = 2 * KB_LINE_HEIGHT, - .width = 36, - .height = 28, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 7, .row = 1, .columnbit = ( 1 << 7 ), @@ -271,8 +279,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_BELOW, .x = 2 * KB_COLUMN_WIDTH_6_KEYS, .y = 2 * KB_LINE_HEIGHT, - .width = 36, - .height = 28, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 7, .row = 2, .columnbit = ( 1 << 7 ), @@ -290,10 +298,10 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .font_weight = CAIRO_FONT_WEIGHT_BOLD, .letter_size = 0.0, .layout = 0, - .x = 200, - .y = 38, - .width = 33, - .height = 33, + .x = 4 * KB_COLUMN_WIDTH_6_KEYS, + .y = 0.75 * KB_LINE_HEIGHT, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 6, .row = 1, .columnbit = ( 1 << 6 ), @@ -310,10 +318,10 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .font_weight = CAIRO_FONT_WEIGHT_BOLD, .letter_size = 0.0, .layout = 0, - .x = 164, - .y = 66, - .width = 33, - .height = 33, + .x = 3.25 * KB_COLUMN_WIDTH_6_KEYS, + .y = 1.25 * KB_LINE_HEIGHT, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 6, .row = 2, .columnbit = ( 1 << 6 ), @@ -330,10 +338,10 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .font_weight = CAIRO_FONT_WEIGHT_BOLD, .letter_size = 0.0, .layout = 0, - .x = 200, - .y = 94, - .width = 33, - .height = 33, + .x = 4 * KB_COLUMN_WIDTH_6_KEYS, + .y = 1.75 * KB_LINE_HEIGHT, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 6, .row = 3, .columnbit = ( 1 << 6 ), @@ -350,10 +358,10 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .font_weight = CAIRO_FONT_WEIGHT_BOLD, .letter_size = 0.0, .layout = 0, - .x = 236, - .y = 66, - .width = 33, - .height = 33, + .x = 4.78 * KB_COLUMN_WIDTH_6_KEYS, + .y = 1.25 * KB_LINE_HEIGHT, + .width = KB_WIDTH_6_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 6, .row = 4, .columnbit = ( 1 << 6 ), @@ -373,8 +381,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 0, .y = 3 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 4, .row = 1, .columnbit = ( 1 << 4 ), @@ -393,8 +401,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = KB_COLUMN_WIDTH_5_KEYS, .y = 3 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 3, .row = 1, .columnbit = ( 1 << 3 ), @@ -413,8 +421,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 2 * KB_COLUMN_WIDTH_5_KEYS, .y = 3 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 2, .row = 1, .columnbit = ( 1 << 2 ), @@ -433,8 +441,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 3 * KB_COLUMN_WIDTH_5_KEYS, .y = 3 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 1, .row = 1, .columnbit = ( 1 << 1 ), @@ -453,8 +461,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 4 * KB_COLUMN_WIDTH_5_KEYS, .y = 3 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 0, .row = 1, .columnbit = ( 1 << 0 ), @@ -474,8 +482,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 0, .y = 4 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 4, .row = 2, .columnbit = ( 1 << 4 ), @@ -494,8 +502,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = KB_COLUMN_WIDTH_5_KEYS, .y = 4 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 3, .row = 2, .columnbit = ( 1 << 3 ), @@ -514,8 +522,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 2 * KB_COLUMN_WIDTH_5_KEYS, .y = 4 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 2, .row = 2, .columnbit = ( 1 << 2 ), @@ -534,8 +542,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 3 * KB_COLUMN_WIDTH_5_KEYS, .y = 4 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 1, .row = 2, .columnbit = ( 1 << 1 ), @@ -554,8 +562,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 4 * KB_COLUMN_WIDTH_5_KEYS, .y = 4 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 0, .row = 2, .columnbit = ( 1 << 0 ), @@ -575,8 +583,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 0, .y = 5 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 4, .row = 3, .columnbit = ( 1 << 4 ), @@ -595,8 +603,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = KB_COLUMN_WIDTH_5_KEYS, .y = 5 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 3, .row = 3, .columnbit = ( 1 << 3 ), @@ -615,8 +623,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 2 * KB_COLUMN_WIDTH_5_KEYS, .y = 5 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 2, .row = 3, .columnbit = ( 1 << 2 ), @@ -635,8 +643,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT, .x = 3 * KB_COLUMN_WIDTH_5_KEYS, .y = 5 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 1, .row = 3, .columnbit = ( 1 << 1 ), @@ -655,8 +663,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = UI_LAYOUT_LEFT_NO_SPACE, .x = 4 * KB_COLUMN_WIDTH_5_KEYS, .y = 5 * KB_LINE_HEIGHT, - .width = 46, - .height = 28, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_SMALL_KEYS, .column = 0, .row = 3, .columnbit = ( 1 << 0 ), @@ -676,8 +684,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 0, .y = 6 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 0, .columnbit = 0, @@ -696,8 +704,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = KB_COLUMN_WIDTH_5_KEYS, .y = 6 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 3, .row = 4, .columnbit = ( 1 << 3 ), @@ -716,8 +724,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 2 * KB_COLUMN_WIDTH_5_KEYS, .y = 6 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 2, .row = 4, .columnbit = ( 1 << 2 ), @@ -736,8 +744,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 3 * KB_COLUMN_WIDTH_5_KEYS, .y = 6 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 1, .row = 4, .columnbit = ( 1 << 1 ), @@ -756,8 +764,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 4 * KB_COLUMN_WIDTH_5_KEYS, .y = 6 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 4, .columnbit = ( 1 << 0 ), @@ -777,8 +785,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 0, .y = 7 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 0, .columnbit = 0, @@ -797,8 +805,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = KB_COLUMN_WIDTH_5_KEYS, .y = 7 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 3, .row = 5, .columnbit = ( 1 << 3 ), @@ -817,8 +825,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 2 * KB_COLUMN_WIDTH_5_KEYS, .y = 7 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 2, .row = 5, .columnbit = ( 1 << 2 ), @@ -837,8 +845,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 3 * KB_COLUMN_WIDTH_5_KEYS, .y = 7 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 1, .row = 5, .columnbit = ( 1 << 1 ), @@ -857,8 +865,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 4 * KB_COLUMN_WIDTH_5_KEYS, .y = 7 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 5, .columnbit = ( 1 << 0 ), @@ -878,8 +886,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 0, .y = 8 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 0, .columnbit = 0, @@ -898,8 +906,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = KB_COLUMN_WIDTH_5_KEYS, .y = 8 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 3, .row = 6, .columnbit = ( 1 << 3 ), @@ -918,8 +926,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 2 * KB_COLUMN_WIDTH_5_KEYS, .y = 8 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 2, .row = 6, .columnbit = ( 1 << 2 ), @@ -938,8 +946,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 3 * KB_COLUMN_WIDTH_5_KEYS, .y = 8 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 1, .row = 6, .columnbit = ( 1 << 1 ), @@ -958,8 +966,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 4 * KB_COLUMN_WIDTH_5_KEYS, .y = 8 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 6, .columnbit = ( 1 << 0 ), @@ -979,8 +987,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 0, .y = 9 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 0, .columnbit = 0, @@ -999,8 +1007,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = KB_COLUMN_WIDTH_5_KEYS, .y = 9 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 3, .row = 7, .columnbit = ( 1 << 3 ), @@ -1019,8 +1027,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 2 * KB_COLUMN_WIDTH_5_KEYS, .y = 9 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 2, .row = 7, .columnbit = ( 1 << 2 ), @@ -1039,8 +1047,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 3 * KB_COLUMN_WIDTH_5_KEYS, .y = 9 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 1, .row = 7, .columnbit = ( 1 << 1 ), @@ -1059,8 +1067,8 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = { .layout = 0, .x = 4 * KB_COLUMN_WIDTH_5_KEYS, .y = 9 * KB_LINE_HEIGHT, - .width = 46, - .height = 32, + .width = KB_WIDTH_5_KEYS, + .height = KB_HEIGHT_BIG_KEYS, .column = 0, .row = 7, .columnbit = ( 1 << 0 ), @@ -1203,7 +1211,7 @@ static bool x49gp_ui_lookup_glyph( const char* name, int namelen, gunichar* glyp return false; } -static int x49gp_text_strlen( const char* text ) +static int __text_strlen( const char* text ) { const char *p, *q; char c; @@ -1254,7 +1262,8 @@ static int x49gp_text_strlen( const char* text ) return n; } -static int x49gp_text_to_ucs4( const char* text, gunichar** ucs4p ) +/* used in x49gp_ui_vtext_path() */ +static int _text_to_ucs4( const char* text, gunichar** ucs4p ) { const char *p, *q; gunichar glyph; @@ -1262,15 +1271,13 @@ static int x49gp_text_to_ucs4( const char* text, gunichar** ucs4p ) char c; int namelen; int i = 0; - int n = x49gp_text_strlen( text ); + int n = __text_strlen( text ); if ( n <= 0 ) return n; ucs4 = malloc( n * sizeof( gunichar ) ); - i = 0; - p = text; while ( ( c = *p++ ) ) { if ( i == n ) { @@ -1342,7 +1349,7 @@ static void x49gp_ui_vtext_path( cairo_t* cr, const char* family, double size, d cairo_set_font_size( cr, size ); ucs4 = NULL; - len = x49gp_text_to_ucs4( text, &ucs4 ); + len = _text_to_ucs4( text, &ucs4 ); if ( len <= 0 ) continue; @@ -2789,10 +2796,15 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile ) ui->lcd_y_offset = ui->lcd_x_offset; ui->kb_x_offset = 10; - ui->kb_y_offset = ui->lcd_y_offset + ui->lcd_height + 16; // 280; // 301; + ui->kb_y_offset = ui->lcd_height + ( 2 * ui->lcd_y_offset); ui->width = ui->lcd_width + ( 2 * ui->lcd_x_offset ); ui->height = ui->kb_y_offset + ui_keys[ NB_KEYS - 1 ].y + KB_LINE_HEIGHT; + int kb_width = ( ui->kb_x_offset ) + ( 5 * KB_COLUMN_WIDTH_5_KEYS ); + if ( ui->width < kb_width ) { + ui->width = kb_width; + ui->lcd_x_offset = ( ui->width - ui->lcd_width ) / 2; + } ui->bg_pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, FALSE, 8, ui->width, ui->height );