From ca6d9ce760f56c9e8c4495d6c835837c67cbc976 Mon Sep 17 00:00:00 2001 From: Pere Pujal i Carabantes Date: Mon, 5 Sep 2011 23:11:09 +0000 Subject: [PATCH] Buttons to change the onscreen keyboard layout now are purple. --- data/images/ui/btnsm_nav.png | Bin 0 -> 1183 bytes src/onscreen_keyboard.c | 16 ++++++++++++---- src/onscreen_keyboard.h | 3 ++- src/tuxpaint.c | 7 ++++--- 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 data/images/ui/btnsm_nav.png diff --git a/data/images/ui/btnsm_nav.png b/data/images/ui/btnsm_nav.png new file mode 100644 index 0000000000000000000000000000000000000000..c1c1ea3e582d6c379ca71e650d664e3022b9e20e GIT binary patch literal 1183 zcmV;Q1YrA#P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy32;bRa{vGf5dZ)S5dnW>Uy%R+010+*L1zE}02lxO02lyxOr@p( z00WUpL_t(I%Z-&yXk1kk$N%TNd*8>*o0)t}nvsdvFO)*SSqLd86x`H>x@bWV+!euv z8&|GfiF+49$WCxqtkI1NAt0q)CAQrdLZGBcG#_S~%-4JG-g8_`QY3NO-qmk&|M#B% zIro1_RRI*;!ToQ(Uzz_&#S;f00D$5QD2M>47h-OG`r+J{pV)E?zyMH@mG6FBp1;G^ zTz>EEWU@v9gGik}1yVR-q9Ew+wby>RyF7mSNvQy^}JYzci_jRbQPx zeEipgg~e-Me`b7MtlnM%Q)OnlyY-SP$6A${>BEh`S8p%9^VKc0v$EFRJphPQyIcE2 zJhbygBC0B+3Q%|VU}t5`Y~6bV1v7V^?8TKdFa|^~>>5;k;RZ(?CKmBq_a2$uhwC5^ zbMdqv6r^ED%%gNfk53U%muE$-AJnC-V)uzuyl`@-=1F51!1cErp4m(ifgT61a&i1~^+8t&S zm&(<8eXQAtYAFY!g-)&}Ub6O)I_V!BW&K{(?iiotVN@!WtF`)6tuY;qrwABBmqbs4 zS1>>X=d-vZ-Qs9xzw`7U&w2)6Yr}G-R+*SgC&ukq2?1f0N&iu_uIMLxQYh#;aCK<1WK8lkx3=>0^g^8Zs2>$~z zbRC9l7$$L&hG8U0)l`~O*v{fGF=VJvWQqVFfB-oI{n(S8-#Z@^LSB!ncwR&T3KjLvyCQ2|Z*gcC!18 zGBXK)hToA4ihq9ov%mC&vX>6p2+6gXiTB^&*aG+$hK~)wZ6GaG0000bbVXQnWMOn= zI%9HWVRU5xGB7bQEig1KGB{K*H##ygIx;vbFfuwYFs}!VB>(^bC3HntbYx+4Wjbwd xWNBu305UK!F)c7OEiyM$GBP?dI65*kD=;!TFfhx-S``2Q002ovPDHLkV1iB?_Tm5l literal 0 HcmV?d00001 diff --git a/src/onscreen_keyboard.c b/src/onscreen_keyboard.c index 224217b50..f83cea916 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 53c467c65..6e14dcf13 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 f6710710b..ff45b1caa 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");