17
17
#include "ui.h"
18
18
#include "ui_inner.h"
19
19
20
- #define _KEYBOARD_HEIGHT ( BUTTONS[ LAST_HPKEY ].y + BUTTONS[ LAST_HPKEY ].h )
21
- #define _KEYBOARD_WIDTH ( BUTTONS[ LAST_HPKEY ].x + BUTTONS[ LAST_HPKEY ].w )
20
+ #define KEYBOARD_HEIGHT ( BUTTONS[ LAST_HPKEY ].y + BUTTONS[ LAST_HPKEY ].h )
21
+ #define KEYBOARD_WIDTH ( BUTTONS[ LAST_HPKEY ].x + BUTTONS[ LAST_HPKEY ].w )
22
22
23
- #define _TOP_SKIP 65
24
- #define _SIDE_SKIP 20
25
- #define _BOTTOM_SKIP 25
26
- #define _DISP_KBD_SKIP 65
27
- #define _KBD_UPLINE 25
23
+ #define TOP_SKIP 65
24
+ #define SIDE_SKIP 20
25
+ #define BOTTOM_SKIP 25
26
+ #define DISP_KBD_SKIP 65
27
+ #define KBD_UPLINE 25
28
28
29
- #define _DISPLAY_WIDTH ( 264 + 8 )
30
- #define _DISPLAY_HEIGHT ( 128 + 16 + 8 )
31
- #define _DISPLAY_OFFSET_X ( SIDE_SKIP + ( 286 - DISPLAY_WIDTH ) / 2 )
32
- #define _DISPLAY_OFFSET_Y TOP_SKIP
29
+ #define DISPLAY_WIDTH ( 264 + 8 )
30
+ #define DISPLAY_HEIGHT ( 128 + 16 + 8 )
31
+ #define DISPLAY_OFFSET_X ( SIDE_SKIP + ( 286 - DISPLAY_WIDTH ) / 2 )
32
+ #define DISPLAY_OFFSET_Y TOP_SKIP
33
33
34
- #define _DISP_FRAME 8
34
+ #define DISP_FRAME 8
35
35
36
- #define _KEYBOARD_OFFSET_X SIDE_SKIP
37
- #define _KEYBOARD_OFFSET_Y ( TOP_SKIP + DISPLAY_HEIGHT + DISP_KBD_SKIP )
36
+ #define KEYBOARD_OFFSET_X SIDE_SKIP
37
+ #define KEYBOARD_OFFSET_Y ( TOP_SKIP + DISPLAY_HEIGHT + DISP_KBD_SKIP )
38
38
39
39
/***********/
40
40
/* typedef */
@@ -47,9 +47,7 @@ typedef struct sdl_surfaces_on_off_struct_t {
47
47
/*************/
48
48
/* variables */
49
49
/*************/
50
- // This will take the value of the defines, but can be run-time modified
51
- static unsigned KEYBOARD_HEIGHT , KEYBOARD_WIDTH , TOP_SKIP , SIDE_SKIP , BOTTOM_SKIP , DISP_KBD_SKIP , DISPLAY_WIDTH , DISPLAY_HEIGHT ,
52
- DISPLAY_OFFSET_X , DISPLAY_OFFSET_Y , DISP_FRAME , KEYBOARD_OFFSET_X , KEYBOARD_OFFSET_Y , KBD_UPLINE ;
50
+ static int display_offset_x , display_offset_y ;
53
51
54
52
static unsigned int ARGBColors [ NB_COLORS ];
55
53
static sdl_surfaces_on_off_struct_t sdl_buttons [ NB_KEYS ];
@@ -497,9 +495,9 @@ static void _draw_header( void )
497
495
// insert the HP Logo
498
496
surf = bitmap_to_surface ( hp_width , hp_height , hp_bitmap , ARGBColors [ LOGO ], ARGBColors [ LOGO_BACK ] );
499
497
if ( opt_gx )
500
- x = DISPLAY_OFFSET_X - 6 ;
498
+ x = display_offset_x - 6 ;
501
499
else
502
- x = DISPLAY_OFFSET_X ;
500
+ x = display_offset_x ;
503
501
504
502
SDL_Rect srect ;
505
503
SDL_Rect drect ;
@@ -515,18 +513,18 @@ static void _draw_header( void )
515
513
SDL_FreeSurface ( surf );
516
514
517
515
if ( !opt_gx ) {
518
- lineColor ( sdlwindow , DISPLAY_OFFSET_X , 9 , DISPLAY_OFFSET_X + hp_width - 1 , 9 , bgra2argb ( ARGBColors [ FRAME ] ) );
519
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - 1 , 10 , DISPLAY_OFFSET_X - 1 , 10 + hp_height - 1 , bgra2argb ( ARGBColors [ FRAME ] ) );
520
- lineColor ( sdlwindow , DISPLAY_OFFSET_X , 10 + hp_height , DISPLAY_OFFSET_X + hp_width - 1 , 10 + hp_height ,
516
+ lineColor ( sdlwindow , display_offset_x , 9 , display_offset_x + hp_width - 1 , 9 , bgra2argb ( ARGBColors [ FRAME ] ) );
517
+ lineColor ( sdlwindow , display_offset_x - 1 , 10 , display_offset_x - 1 , 10 + hp_height - 1 , bgra2argb ( ARGBColors [ FRAME ] ) );
518
+ lineColor ( sdlwindow , display_offset_x , 10 + hp_height , display_offset_x + hp_width - 1 , 10 + hp_height ,
521
519
bgra2argb ( ARGBColors [ FRAME ] ) );
522
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + hp_width , 10 , DISPLAY_OFFSET_X + hp_width , 10 + hp_height - 1 ,
520
+ lineColor ( sdlwindow , display_offset_x + hp_width , 10 , display_offset_x + hp_width , 10 + hp_height - 1 ,
523
521
bgra2argb ( ARGBColors [ FRAME ] ) );
524
522
}
525
523
526
524
// write the name of it
527
525
528
526
if ( opt_gx ) {
529
- x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + gx_128K_ram_x_hot + 2 ;
527
+ x = display_offset_x + display_width - gx_128K_ram_width + gx_128K_ram_x_hot + 2 ;
530
528
y = 10 + gx_128K_ram_y_hot ;
531
529
532
530
surf = bitmap_to_surface ( gx_128K_ram_width , gx_128K_ram_height , gx_128K_ram_bitmap , ARGBColors [ LABEL ], ARGBColors [ DISP_PAD ] );
@@ -541,7 +539,7 @@ static void _draw_header( void )
541
539
SDL_BlitSurface ( surf , & srect , sdlwindow , & drect );
542
540
SDL_FreeSurface ( surf );
543
541
544
- x = DISPLAY_OFFSET_X + hp_width ;
542
+ x = display_offset_x + hp_width ;
545
543
y = hp_height + 8 - hp48gx_height ;
546
544
surf = bitmap_to_surface ( hp48gx_width , hp48gx_height , hp48gx_bitmap , ARGBColors [ LOGO ], ARGBColors [ DISP_PAD ] );
547
545
srect .x = 0 ;
@@ -555,7 +553,7 @@ static void _draw_header( void )
555
553
SDL_BlitSurface ( surf , & srect , sdlwindow , & drect );
556
554
SDL_FreeSurface ( surf );
557
555
558
- x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + gx_silver_x_hot + 2 ;
556
+ x = display_offset_x + DISPLAY_WIDTH - gx_128K_ram_width + gx_silver_x_hot + 2 ;
559
557
y = 10 + gx_silver_y_hot ;
560
558
surf = bitmap_to_surface ( gx_silver_width , gx_silver_height , gx_silver_bitmap , ARGBColors [ LOGO ],
561
559
0 ); // Background transparent: draw only silver line
@@ -570,7 +568,7 @@ static void _draw_header( void )
570
568
SDL_BlitSurface ( surf , & srect , sdlwindow , & drect );
571
569
SDL_FreeSurface ( surf );
572
570
573
- x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + gx_green_x_hot + 2 ;
571
+ x = display_offset_x + display_width - gx_128K_ram_width + gx_green_x_hot + 2 ;
574
572
y = 10 + gx_green_y_hot ;
575
573
surf = bitmap_to_surface ( gx_green_width , gx_green_height , gx_green_bitmap , ARGBColors [ RIGHT ],
576
574
0 ); // Background transparent: draw only green menu
@@ -585,7 +583,7 @@ static void _draw_header( void )
585
583
SDL_BlitSurface ( surf , & srect , sdlwindow , & drect );
586
584
SDL_FreeSurface ( surf );
587
585
} else {
588
- x = DISPLAY_OFFSET_X ;
586
+ x = display_offset_x ;
589
587
y = TOP_SKIP - DISP_FRAME - hp48sx_height - 3 ;
590
588
surf = bitmap_to_surface ( hp48sx_width , hp48sx_height , hp48sx_bitmap , ARGBColors [ RIGHT ],
591
589
0 ); // Background transparent: draw only green menu
@@ -600,7 +598,7 @@ static void _draw_header( void )
600
598
SDL_BlitSurface ( surf , & srect , sdlwindow , & drect );
601
599
SDL_FreeSurface ( surf );
602
600
603
- x = DISPLAY_OFFSET_X + display_width - 1 - science_width ;
601
+ x = display_offset_x + display_width - 1 - science_width ;
604
602
y = TOP_SKIP - DISP_FRAME - science_height - 4 ;
605
603
surf = bitmap_to_surface ( science_width , science_height , science_bitmap , ARGBColors [ RIGHT ],
606
604
0 ); // Background transparent: draw only green menu
@@ -975,68 +973,61 @@ static void _draw_keypad( void )
975
973
976
974
static void _draw_bezel_LCD ( void )
977
975
{
978
- unsigned int i ;
979
- int display_height = DISPLAY_HEIGHT ;
980
- int display_width = DISPLAY_WIDTH ;
981
-
982
- // draw the frame around the display
983
- for ( i = 0 ; i < DISP_FRAME ; i ++ ) {
984
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - i , DISPLAY_OFFSET_Y + display_height + 2 * i , DISPLAY_OFFSET_X + display_width + i ,
985
- DISPLAY_OFFSET_Y + display_height + 2 * i , bgra2argb ( ARGBColors [ DISP_PAD_TOP ] ) );
986
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - i , DISPLAY_OFFSET_Y + display_height + 2 * i + 1 , DISPLAY_OFFSET_X + display_width + i ,
987
- DISPLAY_OFFSET_Y + display_height + 2 * i + 1 , bgra2argb ( ARGBColors [ DISP_PAD_TOP ] ) );
988
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + display_width + i , DISPLAY_OFFSET_Y - i , DISPLAY_OFFSET_X + display_width + i ,
989
- DISPLAY_OFFSET_Y + display_height + 2 * i , bgra2argb ( ARGBColors [ DISP_PAD_TOP ] ) );
990
- }
991
-
992
- for ( i = 0 ; i < DISP_FRAME ; i ++ ) {
993
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - i - 1 , DISPLAY_OFFSET_Y - i - 1 , DISPLAY_OFFSET_X + display_width + i - 1 ,
994
- DISPLAY_OFFSET_Y - i - 1 , bgra2argb ( ARGBColors [ DISP_PAD_BOT ] ) );
995
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - i - 1 , DISPLAY_OFFSET_Y - i - 1 , DISPLAY_OFFSET_X - i - 1 ,
996
- DISPLAY_OFFSET_Y + display_height + 2 * i - 1 , bgra2argb ( ARGBColors [ DISP_PAD_BOT ] ) );
976
+ for ( int i = 0 ; i < DISP_FRAME ; i ++ ) {
977
+ lineColor ( sdlwindow , display_offset_x - i , display_offset_y + DISPLAY_HEIGHT + 2 * i , display_offset_x + DISPLAY_WIDTH + i ,
978
+ display_offset_y + DISPLAY_HEIGHT + 2 * i , bgra2argb ( ARGBColors [ DISP_PAD_TOP ] ) );
979
+ lineColor ( sdlwindow , display_offset_x - i , display_offset_y + DISPLAY_HEIGHT + 2 * i + 1 , display_offset_x + DISPLAY_WIDTH + i ,
980
+ display_offset_y + DISPLAY_HEIGHT + 2 * i + 1 , bgra2argb ( ARGBColors [ DISP_PAD_TOP ] ) );
981
+ lineColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH + i , display_offset_y - i , display_offset_x + DISPLAY_WIDTH + i ,
982
+ display_offset_y + DISPLAY_HEIGHT + 2 * i , bgra2argb ( ARGBColors [ DISP_PAD_TOP ] ) );
983
+
984
+ lineColor ( sdlwindow , display_offset_x - i - 1 , display_offset_y - i - 1 , display_offset_x + DISPLAY_WIDTH + i - 1 ,
985
+ display_offset_y - i - 1 , bgra2argb ( ARGBColors [ DISP_PAD_BOT ] ) );
986
+ lineColor ( sdlwindow , display_offset_x - i - 1 , display_offset_y - i - 1 , display_offset_x - i - 1 ,
987
+ display_offset_y + DISPLAY_HEIGHT + 2 * i - 1 , bgra2argb ( ARGBColors [ DISP_PAD_BOT ] ) );
997
988
}
998
989
999
990
// round off corners
1000
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - DISP_FRAME , DISPLAY_OFFSET_Y - DISP_FRAME , DISPLAY_OFFSET_X - DISP_FRAME + 3 ,
1001
- DISPLAY_OFFSET_Y - DISP_FRAME , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1002
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - DISP_FRAME , DISPLAY_OFFSET_Y - DISP_FRAME , DISPLAY_OFFSET_X - DISP_FRAME ,
1003
- DISPLAY_OFFSET_Y - DISP_FRAME + 3 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1004
- pixelColor ( sdlwindow , DISPLAY_OFFSET_X - DISP_FRAME + 1 , DISPLAY_OFFSET_Y - DISP_FRAME + 1 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1005
-
1006
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4 , DISPLAY_OFFSET_Y - DISP_FRAME ,
1007
- DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 , DISPLAY_OFFSET_Y - DISP_FRAME , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1008
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 , DISPLAY_OFFSET_Y - DISP_FRAME ,
1009
- DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 , DISPLAY_OFFSET_Y - DISP_FRAME + 3 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1010
- pixelColor ( sdlwindow , DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2 , DISPLAY_OFFSET_Y - DISP_FRAME + 1 ,
991
+ lineColor ( sdlwindow , display_offset_x - DISP_FRAME , display_offset_y - DISP_FRAME , display_offset_x - DISP_FRAME + 3 ,
992
+ display_offset_y - DISP_FRAME , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
993
+ lineColor ( sdlwindow , display_offset_x - DISP_FRAME , display_offset_y - DISP_FRAME , display_offset_x - DISP_FRAME ,
994
+ display_offset_y - DISP_FRAME + 3 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
995
+ pixelColor ( sdlwindow , display_offset_x - DISP_FRAME + 1 , display_offset_y - DISP_FRAME + 1 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
996
+
997
+ lineColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 4 , display_offset_y - DISP_FRAME ,
998
+ display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1 , display_offset_y - DISP_FRAME , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
999
+ lineColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1 , display_offset_y - DISP_FRAME ,
1000
+ display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1 , display_offset_y - DISP_FRAME + 3 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1001
+ pixelColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 2 , display_offset_y - DISP_FRAME + 1 ,
1011
1002
bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1012
1003
1013
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - DISP_FRAME , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4 ,
1014
- DISPLAY_OFFSET_X - DISP_FRAME , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1015
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - DISP_FRAME , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ,
1016
- DISPLAY_OFFSET_X - DISP_FRAME + 3 , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ,
1004
+ lineColor ( sdlwindow , display_offset_x - DISP_FRAME , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ,
1005
+ display_offset_x - DISP_FRAME , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 , bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1006
+ lineColor ( sdlwindow , display_offset_x - DISP_FRAME , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ,
1007
+ display_offset_x - DISP_FRAME + 3 , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ,
1017
1008
bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1018
- pixelColor ( sdlwindow , DISPLAY_OFFSET_X - DISP_FRAME + 1 , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2 ,
1009
+ pixelColor ( sdlwindow , display_offset_x - DISP_FRAME + 1 , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ,
1019
1010
bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1020
1011
1021
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4 ,
1022
- DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ,
1012
+ lineColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1 , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ,
1013
+ display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1 , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ,
1023
1014
bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1024
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4 , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ,
1025
- DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ,
1015
+ lineColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 4 , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ,
1016
+ display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1 , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ,
1026
1017
bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1027
- pixelColor ( sdlwindow , DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2 , DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2 ,
1018
+ pixelColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 2 , display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ,
1028
1019
bgra2argb ( ARGBColors [ DISP_PAD ] ) );
1029
1020
1030
1021
// simulate rounded lcd corners
1031
1022
1032
- lineColor ( sdlwindow , DISPLAY_OFFSET_X - 1 , DISPLAY_OFFSET_Y + 1 , DISPLAY_OFFSET_X - 1 , DISPLAY_OFFSET_Y + display_height - 2 ,
1023
+ lineColor ( sdlwindow , display_offset_x - 1 , display_offset_y + 1 , display_offset_x - 1 , display_offset_y + DISPLAY_HEIGHT - 2 ,
1033
1024
bgra2argb ( ARGBColors [ LCD ] ) );
1034
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + 1 , DISPLAY_OFFSET_Y - 1 , DISPLAY_OFFSET_X + display_width - 2 , DISPLAY_OFFSET_Y - 1 ,
1025
+ lineColor ( sdlwindow , display_offset_x + 1 , display_offset_y - 1 , display_offset_x + DISPLAY_WIDTH - 2 , display_offset_y - 1 ,
1035
1026
bgra2argb ( ARGBColors [ LCD ] ) );
1036
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + 1 , DISPLAY_OFFSET_Y + display_height , DISPLAY_OFFSET_X + display_width - 2 ,
1037
- DISPLAY_OFFSET_Y + display_height , bgra2argb ( ARGBColors [ LCD ] ) );
1038
- lineColor ( sdlwindow , DISPLAY_OFFSET_X + display_width , DISPLAY_OFFSET_Y + 1 , DISPLAY_OFFSET_X + display_width ,
1039
- DISPLAY_OFFSET_Y + display_height - 2 , bgra2argb ( ARGBColors [ LCD ] ) );
1027
+ lineColor ( sdlwindow , display_offset_x + 1 , display_offset_y + DISPLAY_HEIGHT , display_offset_x + DISPLAY_WIDTH - 2 ,
1028
+ display_offset_y + DISPLAY_HEIGHT , bgra2argb ( ARGBColors [ LCD ] ) );
1029
+ lineColor ( sdlwindow , display_offset_x + DISPLAY_WIDTH , display_offset_y + 1 , display_offset_x + DISPLAY_WIDTH ,
1030
+ display_offset_y + DISPLAY_HEIGHT - 2 , bgra2argb ( ARGBColors [ LCD ] ) );
1040
1031
}
1041
1032
1042
1033
static void _draw_background ( int width , int height , int w_top , int h_top )
@@ -1058,8 +1049,8 @@ static void _draw_background_LCD( void )
1058
1049
{
1059
1050
SDL_Rect rect ;
1060
1051
1061
- rect .x = DISPLAY_OFFSET_X ;
1062
- rect .y = DISPLAY_OFFSET_Y ;
1052
+ rect .x = display_offset_x ;
1053
+ rect .y = display_offset_y ;
1063
1054
rect .w = DISPLAY_WIDTH ;
1064
1055
rect .h = DISPLAY_HEIGHT ;
1065
1056
SDL_FillRect ( sdlwindow , & rect , ARGBColors [ LCD ] );
@@ -1166,8 +1157,8 @@ static void _draw_serial_devices_path( void )
1166
1157
static void sdl_draw_nibble ( int nx , int ny , int val )
1167
1158
{
1168
1159
int x , y ;
1169
- int xoffset = DISPLAY_OFFSET_X + 5 ;
1170
- int yoffset = DISPLAY_OFFSET_Y + 20 ;
1160
+ int xoffset = display_offset_x + 5 ;
1161
+ int yoffset = display_offset_y + 20 ;
1171
1162
1172
1163
SDL_LockSurface ( sdlwindow );
1173
1164
unsigned char * buffer = ( unsigned char * )sdlwindow -> pixels ;
@@ -1396,16 +1387,16 @@ void sdl_draw_annunc( void )
1396
1387
srect .y = 0 ;
1397
1388
srect .w = ann_tbl [ i ].width ;
1398
1389
srect .h = ann_tbl [ i ].height ;
1399
- drect .x = DISPLAY_OFFSET_X + ann_tbl [ i ].x ;
1400
- drect .y = DISPLAY_OFFSET_Y + ann_tbl [ i ].y ;
1390
+ drect .x = display_offset_x + ann_tbl [ i ].x ;
1391
+ drect .y = display_offset_y + ann_tbl [ i ].y ;
1401
1392
drect .w = ann_tbl [ i ].width ;
1402
1393
drect .h = ann_tbl [ i ].height ;
1403
1394
1404
1395
SDL_BlitSurface ( ( annunc_state ) ? sdl_ann_tbl [ i ].surfaceon : sdl_ann_tbl [ i ].surfaceoff , & srect , sdlwindow , & drect );
1405
1396
}
1406
1397
1407
1398
// Always immediately update annunciators
1408
- SDL_UpdateRect ( sdlwindow , DISPLAY_OFFSET_X + ann_tbl [ 0 ].x , DISPLAY_OFFSET_Y + ann_tbl [ 0 ].y ,
1399
+ SDL_UpdateRect ( sdlwindow , display_offset_x + ann_tbl [ 0 ].x , display_offset_y + ann_tbl [ 0 ].y ,
1409
1400
ann_tbl [ 5 ].x + ann_tbl [ 5 ].width - ann_tbl [ 0 ].x , ann_tbl [ 5 ].y + ann_tbl [ 5 ].height - ann_tbl [ 0 ].y );
1410
1401
}
1411
1402
@@ -1452,31 +1443,17 @@ void init_sdl_ui( int argc, char** argv )
1452
1443
// On exit: clean SDL
1453
1444
atexit ( SDL_Quit );
1454
1445
1455
- // Initialize the geometric values
1456
- KEYBOARD_HEIGHT = _KEYBOARD_HEIGHT ;
1457
- KEYBOARD_WIDTH = _KEYBOARD_WIDTH ;
1458
- TOP_SKIP = _TOP_SKIP ;
1459
- SIDE_SKIP = _SIDE_SKIP ;
1460
- BOTTOM_SKIP = _BOTTOM_SKIP ;
1461
- DISP_KBD_SKIP = _DISP_KBD_SKIP ;
1462
- DISPLAY_WIDTH = _DISPLAY_WIDTH ;
1463
- DISPLAY_HEIGHT = _DISPLAY_HEIGHT ;
1464
- DISPLAY_OFFSET_X = _DISPLAY_OFFSET_X ;
1465
- DISPLAY_OFFSET_Y = _DISPLAY_OFFSET_Y ;
1466
- DISP_FRAME = _DISP_FRAME ;
1467
- KEYBOARD_OFFSET_X = _KEYBOARD_OFFSET_X ;
1468
- KEYBOARD_OFFSET_Y = _KEYBOARD_OFFSET_Y ;
1469
- KBD_UPLINE = _KBD_UPLINE ;
1470
-
1471
1446
unsigned int width , height ;
1447
+ display_offset_x = DISPLAY_OFFSET_X ;
1448
+ display_offset_y = DISPLAY_OFFSET_Y ;
1449
+ width = ( BUTTONS [ LAST_HPKEY ].x + BUTTONS [ LAST_HPKEY ].w ) + 2 * SIDE_SKIP ;
1450
+ height = display_offset_y + DISPLAY_HEIGHT + DISP_KBD_SKIP + BUTTONS [ LAST_HPKEY ].y + BUTTONS [ LAST_HPKEY ].h + BOTTOM_SKIP ;
1451
+
1472
1452
if ( config .hide_chrome ) {
1473
1453
width = DISPLAY_WIDTH ;
1474
1454
height = DISPLAY_HEIGHT ;
1475
- DISPLAY_OFFSET_X = 0 ;
1476
- DISPLAY_OFFSET_Y = 0 ;
1477
- } else {
1478
- width = ( BUTTONS [ LAST_HPKEY ].x + BUTTONS [ LAST_HPKEY ].w ) + 2 * SIDE_SKIP ;
1479
- height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + BUTTONS [ LAST_HPKEY ].y + BUTTONS [ LAST_HPKEY ].h + BOTTOM_SKIP ;
1455
+ display_offset_x = 0 ;
1456
+ display_offset_y = 0 ;
1480
1457
}
1481
1458
1482
1459
uint32_t sdl_window_flags = SDL_SWSURFACE | SDL_RESIZABLE ;
@@ -1490,8 +1467,6 @@ void init_sdl_ui( int argc, char** argv )
1490
1467
exit ( 1 );
1491
1468
}
1492
1469
1493
- /* BUTTONS = opt_gx ? BUTTONS_gx : BUTTONS_sx; */
1494
-
1495
1470
colors_setup ();
1496
1471
1497
1472
if ( !config .hide_chrome ) {
0 commit comments