From ac19535954d3b0ea4e4be832798efd6c46c784ba Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Sun, 8 Feb 2015 13:42:52 +0000 Subject: [PATCH] Left and right togle preview windows --- src/computer.c | 1 + src/computer.h | 1 + src/menu_sdl.c | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/computer.c b/src/computer.c index 2b254b4..24b3813 100644 --- a/src/computer.c +++ b/src/computer.c @@ -175,6 +175,7 @@ void computer_init () { //Called only on start-up ordenador.tape_loop_counter = 0; ordenador.kbd_buffer_pointer = 0; ordenador.vk_is_active=0; + ordenador.show_preview=1; ordenador.key = SDL_GetKeyState(NULL); #ifdef HW_RVL ordenador.joybuttonkey[0][3]=SDLK_LALT; //Fire button to wiimote1 button 2 diff --git a/src/computer.h b/src/computer.h index e9cc33d..580dd37 100644 --- a/src/computer.h +++ b/src/computer.h @@ -270,6 +270,7 @@ struct computer { unsigned char vk_is_active; unsigned char autoconf; unsigned char ignore_z80_joy_conf; + unsigned char show_preview; //Port variables unsigned char port; //SD, USB, SMB or FTP diff --git a/src/menu_sdl.c b/src/menu_sdl.c index b8b4c83..7c9af0a 100644 --- a/src/menu_sdl.c +++ b/src/menu_sdl.c @@ -734,7 +734,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_typ if (font_type==FONT_ALT) y_start = p_menu->y1 + line_height+2/RATIO; else y_start = p_menu->y1 + line_height+4/RATIO; - if ((draw_scr)&&(RATIO==1)) max_string = 30; else max_string = 52; + if ((draw_scr)&&(RATIO==1)&&ordenador.show_preview) max_string = 30; else max_string = 52; //if ( p_menu->n_entries * line_height > p_menu->y2 ) //y_start = p_menu->y1 + line_height; @@ -781,7 +781,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_typ y = (i - p_menu->start_entry_visible) * line_height; r.x = p_menu->x1+2/RATIO; r.y = p_menu->y1 + line_height +y; - if ((draw_scr)&&(RATIO==1)) r.w = 365; //Only in 640 mode + if ((draw_scr)&&(RATIO==1)&&ordenador.show_preview) r.w = 365; //Only in 640 mode else r.w = p_menu->x2 - p_menu->x1-4/RATIO; r.h = line_height; @@ -912,7 +912,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_typ } } - if ((draw_scr)&&(RATIO==1)) //Only in 640 mode + if ((draw_scr)&&(RATIO==1)&&ordenador.show_preview) //Only in 640 mode { r.x = 367; r.y = 39; @@ -1264,9 +1264,19 @@ static int menu_select_internal(SDL_Surface *screen, else if (keys & KEY_PAGEDOWN) {select_next(p_menu, 0, 19, 0);play_click(0);} else if (keys & KEY_LEFT) - {select_next(p_menu, -1, 0 ,1);play_click(0);} + { + if (draw_scr) + ordenador.show_preview = 1; + else + {select_next(p_menu, -1, 0 ,1);play_click(0);} + } else if (keys & KEY_RIGHT) - {select_next(p_menu, 1, 0 ,1);play_click(0);} + { + if (draw_scr) + ordenador.show_preview = 0; + else + {select_next(p_menu, 1, 0 ,1);play_click(0);} + } else if (keys & KEY_ESCAPE) {play_click(2);break;} else if (keys & KEY_SELECT)