1
0
Fork 0
forked from Miroirs/x49gp

Compare commits

..

No commits in common. "c7d1a1700ee1f3d49c56d0764a52024808b5d523" and "c8f9ce5c2ca9e0cbd792d01ff5d12f7b3c9205a8" have entirely different histories.

3 changed files with 148 additions and 215 deletions

View file

@ -29,7 +29,7 @@ void config_init( char* progname, int argc, char* argv[] )
opt.model = MODEL_50G;
opt.name = NULL;
opt.text_scale = 1;
opt.display_scale = 2;
opt.display_scale = 1;
#if defined( __linux__ )
opt.font = "urw gothic l";
@ -39,27 +39,27 @@ void config_init( char* progname, int argc, char* argv[] )
const char* optstring = "hrc:D:df:Fn:t:";
struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"help", no_argument, NULL, 'h'},
{"config", required_argument, NULL, 'c'},
{"config", required_argument, NULL, 'c'},
{"enable-debug", required_argument, NULL, 'D'},
{"debug", no_argument, NULL, 'd'},
{"reflash", required_argument, NULL, 'f'},
{"reflash-full", no_argument, NULL, 'F'},
{"reboot", no_argument, NULL, 'r'},
{"enable-debug", required_argument, NULL, 'D'},
{"debug", no_argument, NULL, 'd'},
{"reflash", required_argument, NULL, 'f'},
{"reflash-full", no_argument, NULL, 'F'},
{"reboot", no_argument, NULL, 'r'},
{"50g", no_argument, NULL, 506},
{"50g-newrpl", no_argument, NULL, 507},
{"49gp", no_argument, NULL, 496},
{"49gp-newrpl", no_argument, NULL, 497},
{"name", required_argument, NULL, 'n'},
{"text-scale", required_argument, NULL, 's'},
{"display-scale", required_argument, NULL, 'S'},
{"50g", no_argument, NULL, 506},
{"50g-newrpl", no_argument, NULL, 507},
{"49gp", no_argument, NULL, 496},
{"49gp-newrpl", no_argument, NULL, 497},
{"name", required_argument, NULL, 'n'},
{"text-scale", required_argument, NULL, 's'},
{"display-scale", required_argument, NULL, 'S'},
{"font", required_argument, NULL, 't'},
{"font", required_argument, NULL, 't'},
{0, 0, 0, 0 }
{0, 0, 0, 0 }
};
while ( c != EOF ) {
@ -79,8 +79,8 @@ void config_init( char* progname, int argc, char* argv[] )
" --49gp-newrpl show HP 49g+ faceplate with newRPL labels\n"
" -n --name[=<name>] set alternate UI name\n"
" -t --font[=<fontname>] set alternate UI font\n"
" -s --text-scale[=<X>] scale text by X (default: 1)\n"
" -S --display-scale[=<X>] scale LCD by X (default: 2)\n"
" -s --text-scale[=<X>] scale text by X\n"
" -S --display-scale[=<X>] scale LCD by X\n"
" -D --enable-debug[=<port>] enable the debugger interface\n"
" (default port: %u)\n"
" -d --debug use along -D to also start the debugger immediately\n"

View file

@ -24,10 +24,10 @@
#define NB_KEYS 51
#define FONT_SIZE_SYMBOL ( 28 * opt.text_scale )
#define FONT_SIZE_NUMBER ( 20 * opt.text_scale )
#define FONT_SIZE_KEY ( 12 * opt.text_scale )
#define FONT_SIZE_TINY ( 10 * opt.text_scale )
#define FONT_SIZE_SYMBOL ( ( int )( 28 * opt.text_scale ) )
#define FONT_SIZE_NUMBER ( ( int )( 20 * opt.text_scale ) )
#define FONT_SIZE_KEY ( ( int )( 12 * opt.text_scale ) )
#define FONT_SIZE_TINY ( ( int )( 10 * opt.text_scale ) )
#define TINY_TEXT_HEIGHT ( FONT_SIZE_TINY + 2 )
#define TINY_TEXT_WIDTH ( TINY_TEXT_HEIGHT / 2 )
@ -36,15 +36,15 @@
#define KB_NB_COLS_MENU 6
#define KB_NB_COLS 5
#define KB_WIDTH_6_KEYS ( 36 * opt.text_scale )
#define KB_WIDTH_5_KEYS ( 46 * opt.text_scale )
#define KB_WIDTH_6_KEYS 36
#define KB_WIDTH_5_KEYS 46
#define KB_HEIGHT_MENU_KEYS ( 22 * opt.text_scale )
#define KB_HEIGHT_SMALL_KEYS ( 28 * opt.text_scale )
#define KB_HEIGHT_BIG_KEYS ( 32 * opt.text_scale )
#define KB_HEIGHT_MENU_KEYS 22
#define KB_HEIGHT_SMALL_KEYS 28
#define KB_HEIGHT_BIG_KEYS 32
#define KB_LINE_HEIGHT ( KB_HEIGHT_BIG_KEYS + ( 1.5 * ( TINY_TEXT_HEIGHT + 2 ) ) )
#define KB_SPACING_KEYS TINY_TEXT_WIDTH
#define KB_SPACING_KEYS ( 3 * TINY_TEXT_WIDTH )
#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 )
@ -52,7 +52,7 @@
#define ANNUNCIATOR_HEIGHT 16
#define ANNUNCIATORS_HEIGHT ANNUNCIATOR_HEIGHT
#define LCD_PIXEL_SCALE opt.display_scale
#define LCD_PIXEL_SCALE ( ( int )( 2 * opt.display_scale ) )
#define LCD_WIDTH ( 131 * LCD_PIXEL_SCALE )
#define LCD_HEIGHT ( 80 * LCD_PIXEL_SCALE )
@ -68,7 +68,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "A",
.left = "Y=",
.right = NULL,
.below = NULL,
.below = "",
.column = 5,
.row = 1,
.columnbit = ( 1 << 5 ),
@ -79,7 +79,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "B",
.left = "WIN",
.right = NULL,
.below = NULL,
.below = "",
.column = 5,
.row = 2,
.columnbit = ( 1 << 5 ),
@ -90,7 +90,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "C",
.left = "GRAPH",
.right = NULL,
.below = NULL,
.below = "",
.column = 5,
.row = 3,
.columnbit = ( 1 << 5 ),
@ -101,7 +101,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "D",
.left = "2D/3D",
.right = NULL,
.below = NULL,
.below = "",
.column = 5,
.row = 4,
.columnbit = ( 1 << 5 ),
@ -112,7 +112,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "E",
.left = "TBLSET",
.right = NULL,
.below = NULL,
.below = "",
.column = 5,
.row = 5,
.columnbit = ( 1 << 5 ),
@ -123,7 +123,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "F",
.left = "TABLE",
.right = NULL,
.below = NULL,
.below = "",
.column = 5,
.row = 6,
.columnbit = ( 1 << 5 ),
@ -135,7 +135,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "G",
.left = "FILES",
.right = "BEGIN",
.below = NULL,
.below = "",
.column = 5,
.row = 7,
.columnbit = ( 1 << 5 ),
@ -146,7 +146,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "H",
.left = "CUSTOM",
.right = "END",
.below = NULL,
.below = "",
.column = 6,
.row = 5,
.columnbit = ( 1 << 6 ),
@ -157,7 +157,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "I",
.left = "i",
.right = "I",
.below = NULL,
.below = "",
.column = 6,
.row = 6,
.columnbit = ( 1 << 6 ),
@ -168,7 +168,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "",
.right = NULL,
.below = NULL,
.below = "",
.column = 6,
.row = 1,
.columnbit = ( 1 << 6 ),
@ -179,7 +179,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "J",
.left = "UPDIR",
.right = "COPY",
.below = NULL,
.below = "",
.column = 6,
.row = 7,
.columnbit = ( 1 << 6 ),
@ -190,7 +190,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "K",
.left = "RCL",
.right = "CUT",
.below = NULL,
.below = "",
.column = 7,
.row = 1,
.columnbit = ( 1 << 7 ),
@ -201,7 +201,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "L",
.left = "PREV",
.right = "PASTE",
.below = NULL,
.below = "",
.column = 7,
.row = 2,
.columnbit = ( 1 << 7 ),
@ -213,7 +213,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "",
.right = NULL,
.below = NULL,
.below = "",
.column = 6,
.row = 2,
.columnbit = ( 1 << 6 ),
@ -224,7 +224,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "",
.right = NULL,
.below = NULL,
.below = "",
.column = 6,
.row = 3,
.columnbit = ( 1 << 6 ),
@ -235,7 +235,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "",
.right = NULL,
.below = NULL,
.below = "",
.column = 6,
.row = 4,
.columnbit = ( 1 << 6 ),
@ -247,7 +247,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "M",
.left = "CMD",
.right = "UNDO",
.below = NULL,
.below = "",
.column = 4,
.row = 1,
.columnbit = ( 1 << 4 ),
@ -258,7 +258,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "N",
.left = "PRG",
.right = "CHARS",
.below = NULL,
.below = "",
.column = 3,
.row = 1,
.columnbit = ( 1 << 3 ),
@ -269,7 +269,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "O",
.left = "MTRW",
.right = "EQW",
.below = NULL,
.below = "",
.column = 2,
.row = 1,
.columnbit = ( 1 << 2 ),
@ -280,7 +280,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "P",
.left = "MTH",
.right = "CAT",
.below = NULL,
.below = "",
.column = 1,
.row = 1,
.columnbit = ( 1 << 1 ),
@ -291,7 +291,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "DEL",
.right = "CLEAR",
.below = NULL,
.below = "",
.column = 0,
.row = 1,
.columnbit = ( 1 << 0 ),
@ -303,7 +303,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "Q",
.left = "𝑒<sup>x</sup>",
.right = "LN",
.below = NULL,
.below = "",
.column = 4,
.row = 2,
.columnbit = ( 1 << 4 ),
@ -314,7 +314,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "R",
.left = "𝓍<sup>2</sup>",
.right = "<sup>x</sup>√𝓎",
.below = NULL,
.below = "",
.column = 3,
.row = 2,
.columnbit = ( 1 << 3 ),
@ -325,7 +325,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "S",
.left = "ASIN",
.right = "",
.below = NULL,
.below = "",
.column = 2,
.row = 2,
.columnbit = ( 1 << 2 ),
@ -336,7 +336,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "T",
.left = "ACOS",
.right = "",
.below = NULL,
.below = "",
.column = 1,
.row = 2,
.columnbit = ( 1 << 1 ),
@ -347,7 +347,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "U",
.left = "ATAN",
.right = "",
.below = NULL,
.below = "",
.column = 0,
.row = 2,
.columnbit = ( 1 << 0 ),
@ -359,7 +359,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "V",
.left = "10<sup>𝓍</sup>",
.right = "LOG",
.below = NULL,
.below = "",
.column = 4,
.row = 3,
.columnbit = ( 1 << 4 ),
@ -370,7 +370,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "W",
.left = "",
.right = "=",
.below = NULL,
.below = "",
.column = 3,
.row = 3,
.columnbit = ( 1 << 3 ),
@ -381,7 +381,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "X",
.left = "",
.right = "&gt;",
.below = NULL,
.below = "",
.column = 2,
.row = 3,
.columnbit = ( 1 << 2 ),
@ -392,7 +392,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "Y",
.left = "",
.right = ">",
.below = NULL,
.below = "",
.column = 1,
.row = 3,
.columnbit = ( 1 << 1 ),
@ -403,7 +403,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "Z",
.left = "ABS",
.right = "ARG",
.below = NULL,
.below = "",
.column = 0,
.row = 3,
.columnbit = ( 1 << 0 ),
@ -415,7 +415,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "USER",
.right = "ENTRY",
.below = NULL,
.below = "",
.column = 0,
.row = 0,
.columnbit = 0,
@ -426,7 +426,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "S.SLV",
.right = "NUM.SLV",
.below = NULL,
.below = "",
.column = 3,
.row = 4,
.columnbit = ( 1 << 3 ),
@ -437,7 +437,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "EXP&amp;LN",
.right = "TRIG",
.below = NULL,
.below = "",
.column = 2,
.row = 4,
.columnbit = ( 1 << 2 ),
@ -448,7 +448,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "FINANCE",
.right = "TIME",
.below = NULL,
.below = "",
.column = 1,
.row = 4,
.columnbit = ( 1 << 1 ),
@ -459,7 +459,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "[ ]",
.right = "\" \"",
.below = NULL,
.below = "",
.column = 0,
.row = 4,
.columnbit = ( 1 << 0 ),
@ -471,7 +471,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "",
.right = NULL,
.below = NULL,
.below = "",
.column = 0,
.row = 0,
.columnbit = 0,
@ -482,7 +482,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "CALC",
.right = "ALG",
.below = NULL,
.below = "",
.column = 3,
.row = 5,
.columnbit = ( 1 << 3 ),
@ -493,7 +493,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "MATRICES",
.right = "STAT",
.below = NULL,
.below = "",
.column = 2,
.row = 5,
.columnbit = ( 1 << 2 ),
@ -504,7 +504,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "CONVERT",
.right = "UNITS",
.below = NULL,
.below = "",
.column = 1,
.row = 5,
.columnbit = ( 1 << 1 ),
@ -515,7 +515,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "( )",
.right = "_",
.below = NULL,
.below = "",
.column = 0,
.row = 5,
.columnbit = ( 1 << 0 ),
@ -527,7 +527,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "",
.right = NULL,
.below = NULL,
.below = "",
.column = 0,
.row = 0,
.columnbit = 0,
@ -538,7 +538,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "ARITH",
.right = "CMPLX",
.below = NULL,
.below = "",
.column = 3,
.row = 6,
.columnbit = ( 1 << 3 ),
@ -549,7 +549,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "DEF",
.right = "LIB",
.below = NULL,
.below = "",
.column = 2,
.row = 6,
.columnbit = ( 1 << 2 ),
@ -560,7 +560,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "#",
.right = "BASE",
.below = NULL,
.below = "",
.column = 1,
.row = 6,
.columnbit = ( 1 << 1 ),
@ -571,7 +571,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "{ }",
.right = "« »",
.below = NULL,
.below = "",
.column = 0,
.row = 6,
.columnbit = ( 1 << 0 ),
@ -594,7 +594,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "",
.right = "",
.below = NULL,
.below = "",
.column = 3,
.row = 7,
.columnbit = ( 1 << 3 ),
@ -605,7 +605,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = ": :",
.right = "",
.below = NULL,
.below = "",
.column = 2,
.row = 7,
.columnbit = ( 1 << 2 ),
@ -616,7 +616,7 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.letter = "",
.left = "𝚷",
.right = ",",
.below = NULL,
.below = "",
.column = 1,
.row = 7,
.columnbit = ( 1 << 1 ),
@ -624,10 +624,10 @@ static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
.eint = 7},
{.css_class = "core",
.label = "ENTER",
.letter = NULL,
.letter = "",
.left = "ANS",
.right = "→NUM",
.below = NULL,
.below = "",
.column = 0,
.row = 7,
.columnbit = ( 1 << 0 ),
@ -651,8 +651,6 @@ char* css_global = "window {"
"button {"
" background-image: none;"
" padding: 0px;"
" margin-left: 5px;"
" margin-right: 5px;"
"}"
"button.menu {"
" background-color: #a9a9a9;"
@ -662,7 +660,6 @@ char* css_global = "window {"
"}"
"button.arrow {"
" background-color: #e0e0e0;"
" border-radius: 33%;"
"}"
"button.alpha {"
" background-color: #fae82c;"
@ -946,217 +943,219 @@ static gboolean react_to_key_event( GtkWidget* widget, GdkEventKey* event, gpoin
switch ( keyval ) {
case GDK_KEY_a:
case GDK_KEY_F1:
index = HPKEY_A;
index = 0;
break;
case GDK_KEY_b:
case GDK_KEY_F2:
index = HPKEY_B;
index = 1;
break;
case GDK_KEY_c:
case GDK_KEY_F3:
index = HPKEY_C;
index = 2;
break;
case GDK_KEY_d:
case GDK_KEY_F4:
index = HPKEY_D;
index = 3;
break;
case GDK_KEY_e:
case GDK_KEY_F5:
index = HPKEY_E;
index = 4;
break;
case GDK_KEY_f:
case GDK_KEY_F6:
index = HPKEY_F;
index = 5;
break;
case GDK_KEY_g:
index = HPKEY_G;
index = 6;
break;
case GDK_KEY_h:
index = HPKEY_H;
index = 7;
break;
case GDK_KEY_i:
index = HPKEY_I;
index = 8;
break;
case GDK_KEY_j:
index = HPKEY_J;
index = 9;
break;
case GDK_KEY_k:
index = HPKEY_K;
index = 10;
break;
case GDK_KEY_l:
index = HPKEY_L;
index = 11;
break;
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
index = HPKEY_UP;
index = 12;
break;
case GDK_KEY_Left:
case GDK_KEY_KP_Left:
index = HPKEY_LEFT;
index = 13;
break;
case GDK_KEY_Down:
case GDK_KEY_KP_Down:
index = HPKEY_DOWN;
index = 14;
break;
case GDK_KEY_Right:
case GDK_KEY_KP_Right:
index = HPKEY_RIGHT;
index = 15;
break;
case GDK_KEY_m:
index = HPKEY_M;
index = 16;
break;
case GDK_KEY_n:
index = HPKEY_N;
index = 17;
break;
case GDK_KEY_o:
case GDK_KEY_apostrophe:
index = HPKEY_O;
index = 18;
break;
case GDK_KEY_p:
index = HPKEY_P;
index = 19;
break;
case GDK_KEY_BackSpace:
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
index = HPKEY_BACKSPACE;
index = 20;
break;
case GDK_KEY_dead_circumflex:
case GDK_KEY_asciicircum:
case GDK_KEY_q:
case GDK_KEY_caret:
index = HPKEY_Q;
index = 21;
break;
case GDK_KEY_r:
index = HPKEY_R;
index = 22;
break;
case GDK_KEY_s:
index = HPKEY_S;
index = 23;
break;
case GDK_KEY_t:
index = HPKEY_T;
index = 24;
break;
case GDK_KEY_u:
index = HPKEY_U;
index = 25;
break;
case GDK_KEY_v:
index = HPKEY_V;
index = 26;
break;
case GDK_KEY_w:
index = HPKEY_W;
index = 27;
break;
case GDK_KEY_x:
index = HPKEY_X;
index = 28;
break;
case GDK_KEY_y:
index = HPKEY_Y;
index = 29;
break;
case GDK_KEY_z:
case GDK_KEY_slash:
case GDK_KEY_KP_Divide:
index = HPKEY_Z;
index = 30;
break;
case GDK_KEY_Tab:
index = 31;
break;
#ifndef __APPLE__
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Meta_L:
case GDK_KEY_Meta_R:
case GDK_KEY_Mode_switch:
#endif
index = HPKEY_ALPHA;
index = 31;
break;
#endif
case GDK_KEY_7:
case GDK_KEY_KP_7:
index = HPKEY_7;
index = 32;
break;
case GDK_KEY_8:
case GDK_KEY_KP_8:
index = HPKEY_8;
index = 33;
break;
case GDK_KEY_9:
case GDK_KEY_KP_9:
index = HPKEY_9;
index = 34;
break;
case GDK_KEY_multiply:
case GDK_KEY_KP_Multiply:
index = HPKEY_MULTIPLY;
index = 35;
break;
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
index = HPKEY_SHIFT_LEFT;
index = 36;
break;
case GDK_KEY_4:
case GDK_KEY_KP_4:
index = HPKEY_4;
index = 37;
break;
case GDK_KEY_5:
case GDK_KEY_KP_5:
index = HPKEY_5;
index = 38;
break;
case GDK_KEY_6:
case GDK_KEY_KP_6:
index = HPKEY_6;
index = 39;
break;
case GDK_KEY_minus:
case GDK_KEY_KP_Subtract:
index = HPKEY_MINUS;
index = 40;
break;
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
index = HPKEY_SHIFT_RIGHT;
index = 41;
break;
case GDK_KEY_1:
case GDK_KEY_KP_1:
index = HPKEY_1;
index = 42;
break;
case GDK_KEY_2:
case GDK_KEY_KP_2:
index = HPKEY_2;
index = 43;
break;
case GDK_KEY_3:
case GDK_KEY_KP_3:
index = HPKEY_3;
index = 44;
break;
case GDK_KEY_plus:
case GDK_KEY_KP_Add:
index = HPKEY_PLUS;
index = 45;
break;
case GDK_KEY_Escape:
index = HPKEY_ON;
index = 46;
break;
case GDK_KEY_0:
case GDK_KEY_KP_0:
index = HPKEY_0;
index = 47;
break;
case GDK_KEY_period:
case GDK_KEY_comma:
case GDK_KEY_KP_Decimal:
case GDK_KEY_KP_Separator:
index = HPKEY_PERIOD;
index = 48;
break;
case GDK_KEY_space:
case GDK_KEY_KP_Space:
index = HPKEY_SPACE;
index = 49;
break;
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
index = HPKEY_ENTER;
index = 50;
break;
/* QWERTY compat: US English, UK English, International English */
case GDK_KEY_backslash:
index = HPKEY_MULTIPLY;
index = 35;
break;
case GDK_KEY_equal:
index = HPKEY_PLUS;
index = 45;
break;
/* QWERTZ compat: German */
case GDK_KEY_ssharp:
index = HPKEY_Z;
index = 30;
break;
case GDK_KEY_numbersign:
index = HPKEY_MULTIPLY;
index = 35;
break;
case GDK_KEY_F7:
@ -1388,7 +1387,7 @@ static inline void _ui_load__newrplify_ui_keys()
ui_keys[ 43 ].left = "";
ui_keys[ 46 ].left = "";
ui_keys[ 46 ].below = NULL;
ui_keys[ 46 ].below = "";
ui_keys[ 50 ].left = "";
}
@ -1459,6 +1458,7 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
}
// create window and widgets/stuff
GtkWidget* window_container = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 );
ui->ui_ann_left = _ui_load__create_annunciator_widget( ui, "" );
ui->ui_ann_right = _ui_load__create_annunciator_widget( ui, "" );
ui->ui_ann_alpha = _ui_load__create_annunciator_widget( ui, "α" );
@ -1472,9 +1472,9 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
gtk_window_set_decorated( GTK_WINDOW( ui->window ), true );
gtk_window_set_resizable( GTK_WINDOW( ui->window ), true );
gtk_window_set_title( GTK_WINDOW( ui->window ), ui->name );
GtkWidget* window_container = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 );
gtk_widget_realize( ui->window );
gtk_container_add( GTK_CONTAINER( ui->window ), window_container );
gtk_style_context_add_class( gtk_widget_get_style_context( ui->window ), "main-window" );
g_signal_connect( G_OBJECT( ui->window ), "focus-out-event", G_CALLBACK( react_to_focus_lost ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "key-press-event", G_CALLBACK( react_to_key_event ), x49gp );
@ -1543,7 +1543,7 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
gtk_container_add( GTK_CONTAINER( keyboard_container ), rows_containers[ row ] );
for ( int column = 0; column < ( ( row == 0 ) ? KB_NB_COLS_MENU : KB_NB_COLS ); column++ ) {
keys_containers[ key_index ] = gtk_box_new( GTK_ORIENTATION_VERTICAL, 3 );
keys_containers[ key_index ] = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 );
gtk_box_set_homogeneous( GTK_BOX( keys_containers[ key_index ] ), false );
gtk_container_add( GTK_CONTAINER( rows_containers[ row ] ), keys_containers[ key_index ] );
@ -1567,10 +1567,6 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
button->button = gtk_button_new();
gtk_style_context_add_class( gtk_widget_get_style_context( button->button ), button->key->css_class );
gtk_widget_set_size_request( button->button, ( row == 0 ) ? KB_WIDTH_6_KEYS : KB_WIDTH_5_KEYS,
( row == 0 ) ? KB_HEIGHT_MENU_KEYS
: ( key_index < 40 ) ? KB_HEIGHT_SMALL_KEYS
: KB_HEIGHT_BIG_KEYS );
gtk_widget_set_can_focus( button->button, false );
gtk_widget_add_events( button->button, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK );
g_signal_connect( G_OBJECT( button->button ), "button-press-event", G_CALLBACK( react_to_button_press ), button );
@ -1581,13 +1577,14 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
gtk_container_add( GTK_CONTAINER( keys_containers[ key_index ] ), button->button );
if ( button->key->below )
gtk_container_add( GTK_CONTAINER( keys_containers[ key_index ] ),
_ui_load__create_label( "label-below", button->key->below ) );
if ( button->key->letter )
gtk_container_add( GTK_CONTAINER( keys_containers[ key_index ] ),
_ui_load__create_label( "label-letter", button->key->letter ) );
if ( button->key->below )
gtk_container_add( GTK_CONTAINER( keys_containers[ key_index ] ),
_ui_load__create_label( "label-below", button->key->below ) );
key_index++;
}
}
@ -1649,7 +1646,6 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
g_object_unref( style_provider );
// finally show the window
gtk_widget_realize( ui->window );
gtk_widget_show_all( ui->window );
return 0;

View file

@ -34,69 +34,6 @@ typedef enum {
UI_CALCULATOR_HP50G_NEWRPL
} x49gp_ui_calculator_t;
typedef enum {
HPKEY_A = 0,
HPKEY_B,
HPKEY_C,
HPKEY_D,
HPKEY_E,
HPKEY_F,
HPKEY_G,
HPKEY_H,
HPKEY_I,
HPKEY_UP,
HPKEY_J, /* 10 */
HPKEY_K,
HPKEY_L,
HPKEY_LEFT,
HPKEY_DOWN,
HPKEY_RIGHT,
HPKEY_M,
HPKEY_N,
HPKEY_O,
HPKEY_P,
HPKEY_BACKSPACE, /* 20 */
HPKEY_Q,
HPKEY_R,
HPKEY_S,
HPKEY_T,
HPKEY_U,
HPKEY_V,
HPKEY_W,
HPKEY_X,
HPKEY_Y,
HPKEY_Z, /* 30 */
HPKEY_ALPHA,
HPKEY_7,
HPKEY_8,
HPKEY_9,
HPKEY_MULTIPLY,
HPKEY_SHIFT_LEFT,
HPKEY_4,
HPKEY_5,
HPKEY_6,
HPKEY_MINUS, /* 40 */
HPKEY_SHIFT_RIGHT,
HPKEY_1,
HPKEY_2,
HPKEY_3,
HPKEY_PLUS,
HPKEY_ON,
HPKEY_0,
HPKEY_PERIOD,
HPKEY_SPACE,
HPKEY_ENTER, /* 50 */
} x49gp_ui_hpkey_t;
typedef struct {
const char* css_class;
const char* label;