From 71849cda38aca3716fba1cf969a966403d003d8e Mon Sep 17 00:00:00 2001 From: perepujal Date: Mon, 05 Sep 2011 23:11:09 +0000 Subject: Buttons to change the onscreen keyboard layout now are purple. --- diff --git a/data/images/ui/btnsm_nav.png b/data/images/ui/btnsm_nav.png new file mode 100644 index 0000000..c1c1ea3 --- /dev/null +++ b/data/images/ui/btnsm_nav.png Binary files differ diff --git a/src/onscreen_keyboard.c b/src/onscreen_keyboard.c index 224217b..f83cea9 100644 --- a/src/onscreen_keyboard.c +++ b/src/onscreen_keyboard.c @@ -31,7 +31,7 @@ static struct osk_layout *load_layout(on_screen_keyboard *keyboard, char *layout static void print_composemap(osk_composenode *composemap, char * sp); #endif -struct osk_keyboard *osk_create(char *layout_name, SDL_Surface *canvas, SDL_Surface *button_up, SDL_Surface *button_down, SDL_Surface *button_off, int disable_change) +struct osk_keyboard *osk_create(char *layout_name, SDL_Surface *canvas, SDL_Surface *button_up, SDL_Surface *button_down, SDL_Surface *button_off, SDL_Surface *button_nav, int disable_change) { SDL_Surface *surface; osk_layout *layout; @@ -77,6 +77,7 @@ struct osk_keyboard *osk_create(char *layout_name, SDL_Surface *canvas, SDL_Surf keyboard->button_up = button_up; keyboard->button_down = button_down; keyboard->button_off = button_off; + keyboard->button_nav = button_nav; keyboard->composing = layout->composemap; keyboard->composed = NULL; keyboard->last_key_pressed = NULL; @@ -1050,12 +1051,19 @@ static void draw_key(osk_key key, on_screen_keyboard * keyboard, int hot) if( strncmp("NULL", text, 4) != 0 && key.keycode != 0) { if (!hot) - skey = stretch_surface(keyboard->button_up, key.width * keyboard->button_up->w); + { + if (key.keycode == 1 || key.keycode == 2) + { + skey = stretch_surface(keyboard->button_nav, key.width * keyboard->button_nav->w); + } + else + skey = stretch_surface(keyboard->button_up, key.width * keyboard->button_up->w); + } else skey = stretch_surface(keyboard->button_down, key.width * keyboard->button_down->w); } else - skey = stretch_surface(keyboard->button_off, key.width * keyboard->button_up->w); + skey = stretch_surface(keyboard->button_off, key.width * keyboard->button_off->w); apply_surface(key.x, key.y, skey, keyboard->surface, NULL); @@ -1378,7 +1386,7 @@ struct osk_keyboard * osk_clicked(on_screen_keyboard *keyboard, int x, int y) } - new_keyboard = osk_create(strdup(name), keyboard->surface, keyboard->button_up, keyboard->button_down, keyboard->button_off, keyboard->disable_change); + new_keyboard = osk_create(strdup(name), keyboard->surface, keyboard->button_up, keyboard->button_down, keyboard->button_off, keyboard->button_nav, keyboard->disable_change); printf("freeeeeeeeeeeeeeeeeeeeeee\n"); free(aux_list); diff --git a/src/onscreen_keyboard.h b/src/onscreen_keyboard.h index 53c467c..6e14dcf 100644 --- a/src/onscreen_keyboard.h +++ b/src/onscreen_keyboard.h @@ -95,6 +95,7 @@ typedef struct osk_keyboard SDL_Surface *button_up; /* The surfaces containing the buttons */ SDL_Surface *button_down; SDL_Surface *button_off; + SDL_Surface *button_nav; int changed; /* If the surface has been modified (painted) */ SDL_Rect rect; /* The rectangle that has changed */ int recreated; /* If the surface has been deleted and newly created */ @@ -111,7 +112,7 @@ typedef struct osk_keyboard osk_key * last_key_pressed; /* The last key pressed */ } on_screen_keyboard; -struct osk_keyboard *osk_create(char *layout_name, SDL_Surface *canvas, SDL_Surface *button_up, SDL_Surface *button_down, SDL_Surface * button_off, int disable_change); +struct osk_keyboard *osk_create(char *layout_name, SDL_Surface *canvas, SDL_Surface *button_up, SDL_Surface *button_down, SDL_Surface *button_off, SDL_Surface *button_nav, int disable_change); struct osk_layout *osk_load_layout(char *layout_name); diff --git a/src/tuxpaint.c b/src/tuxpaint.c index f671071..ff45b1c 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -1298,7 +1298,7 @@ static int have_to_rec_label_node_back; static SDL_Surface *img_title, *img_title_credits, *img_title_tuxpaint; static SDL_Surface *img_btn_up, *img_btn_down, *img_btn_off; static SDL_Surface *img_btnsm_up, *img_btnsm_off, *img_btnsm_down; -static SDL_Surface *img_btn_nav; +static SDL_Surface *img_btn_nav, *img_btnsm_nav; static SDL_Surface *img_prev, *img_next; static SDL_Surface *img_mirror, *img_flip; static SDL_Surface *img_dead40x40; @@ -3395,9 +3395,9 @@ static void mainloop(void) if (kbd == NULL) { if (onscreen_keyboard_layout) - kbd = osk_create(onscreen_keyboard_layout, screen, img_btnsm_up, img_btnsm_down, img_btnsm_off, onscreen_keyboard_disable_change); + kbd = osk_create(onscreen_keyboard_layout, screen, img_btnsm_up, img_btnsm_down, img_btnsm_off, img_btnsm_nav, onscreen_keyboard_disable_change); else - kbd = osk_create("default", screen, img_btnsm_up, img_btnsm_down, img_btnsm_off, onscreen_keyboard_disable_change); + kbd = osk_create("default", screen, img_btnsm_up, img_btnsm_down, img_btnsm_off, img_btnsm_nav, onscreen_keyboard_disable_change); } if (kbd == NULL) printf("kbd = NULL\n"); @@ -22752,6 +22752,7 @@ static void setup(void) img_btnsm_down = loadimage(DATA_PREFIX "images/ui/btnsm_down.png"); img_btn_nav = loadimage(DATA_PREFIX "images/ui/btn_nav.png"); + img_btnsm_nav = loadimage(DATA_PREFIX "images/ui/btnsm_nav.png"); img_sfx = loadimage(DATA_PREFIX "images/tools/sfx.png"); img_speak = loadimage(DATA_PREFIX "images/tools/speak.png"); -- cgit v0.9.1