forked from Miroirs/x49gp
build keyboard by rows and columns
This commit is contained in:
parent
3c38e3e46e
commit
3b8474337d
1 changed files with 74 additions and 68 deletions
|
@ -1722,11 +1722,13 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
|||
if ( ui->calculator == UI_CALCULATOR_HP49GP_NEWRPL || ui->calculator == UI_CALCULATOR_HP50G_NEWRPL )
|
||||
_ui_load__newrplify_ui_keys();
|
||||
|
||||
for ( int i = 0; i < NB_KEYS; i++ ) {
|
||||
button = &ui->buttons[ i ];
|
||||
int key_index = 0;
|
||||
for ( int row = 0; row < 10; row++ ) {
|
||||
for ( int column = 0; column < ( ( row == 0 ) ? 6 : 5 ); column++ ) {
|
||||
button = &ui->buttons[ key_index ];
|
||||
|
||||
button->x49gp = x49gp;
|
||||
button->key = &ui_keys[ i ];
|
||||
button->key = &ui_keys[ key_index ];
|
||||
|
||||
button->button = gtk_button_new();
|
||||
gtk_widget_set_size_request( button->button, button->key->width, button->key->height );
|
||||
|
@ -1775,8 +1777,10 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
|||
x2 = button->key->x + button->key->width - _tiny_text_width( button->key->right );
|
||||
|
||||
if ( _tiny_text_width( button->key->right ) + _tiny_text_width( button->key->left ) > button->key->width ) {
|
||||
x -= ( ( _tiny_text_width( button->key->right ) + _tiny_text_width( button->key->left ) ) - button->key->width ) / 2;
|
||||
x2 += ( ( _tiny_text_width( button->key->right ) + _tiny_text_width( button->key->left ) ) - button->key->width ) / 2;
|
||||
x -=
|
||||
( ( _tiny_text_width( button->key->right ) + _tiny_text_width( button->key->left ) ) - button->key->width ) / 2;
|
||||
x2 +=
|
||||
( ( _tiny_text_width( button->key->right ) + _tiny_text_width( button->key->left ) ) - button->key->width ) / 2;
|
||||
}
|
||||
|
||||
gtk_fixed_put( GTK_FIXED( keyboard_container ), ui_left, x, KEYBOARD_PADDING + y );
|
||||
|
@ -1806,8 +1810,10 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
|||
y = button->key->y + button->key->height + 2;
|
||||
gtk_fixed_put( GTK_FIXED( keyboard_container ), ui_below, x, KEYBOARD_PADDING + y );
|
||||
}
|
||||
}
|
||||
|
||||
key_index++;
|
||||
}
|
||||
}
|
||||
// Right-click menu
|
||||
ui->menu = gtk_menu_new();
|
||||
|
||||
|
|
Loading…
Reference in a new issue