Buttons to change the onscreen keyboard layout now are purple.

This commit is contained in:
Pere Pujal i Carabantes 2011-09-05 23:11:09 +00:00
parent afbc59eba8
commit ca6d9ce760
4 changed files with 18 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -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); static void print_composemap(osk_composenode *composemap, char * sp);
#endif #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; SDL_Surface *surface;
osk_layout *layout; 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_up = button_up;
keyboard->button_down = button_down; keyboard->button_down = button_down;
keyboard->button_off = button_off; keyboard->button_off = button_off;
keyboard->button_nav = button_nav;
keyboard->composing = layout->composemap; keyboard->composing = layout->composemap;
keyboard->composed = NULL; keyboard->composed = NULL;
keyboard->last_key_pressed = 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( strncmp("NULL", text, 4) != 0 && key.keycode != 0)
{ {
if (!hot) 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 else
skey = stretch_surface(keyboard->button_down, key.width * keyboard->button_down->w); skey = stretch_surface(keyboard->button_down, key.width * keyboard->button_down->w);
} }
else 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); 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"); printf("freeeeeeeeeeeeeeeeeeeeeee\n");
free(aux_list); free(aux_list);

View file

@ -95,6 +95,7 @@ typedef struct osk_keyboard
SDL_Surface *button_up; /* The surfaces containing the buttons */ SDL_Surface *button_up; /* The surfaces containing the buttons */
SDL_Surface *button_down; SDL_Surface *button_down;
SDL_Surface *button_off; SDL_Surface *button_off;
SDL_Surface *button_nav;
int changed; /* If the surface has been modified (painted) */ int changed; /* If the surface has been modified (painted) */
SDL_Rect rect; /* The rectangle that has changed */ SDL_Rect rect; /* The rectangle that has changed */
int recreated; /* If the surface has been deleted and newly created */ 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 */ osk_key * last_key_pressed; /* The last key pressed */
} on_screen_keyboard; } 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); struct osk_layout *osk_load_layout(char *layout_name);

View file

@ -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_title, *img_title_credits, *img_title_tuxpaint;
static SDL_Surface *img_btn_up, *img_btn_down, *img_btn_off; 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_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_prev, *img_next;
static SDL_Surface *img_mirror, *img_flip; static SDL_Surface *img_mirror, *img_flip;
static SDL_Surface *img_dead40x40; static SDL_Surface *img_dead40x40;
@ -3395,9 +3395,9 @@ static void mainloop(void)
if (kbd == NULL) if (kbd == NULL)
{ {
if (onscreen_keyboard_layout) 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 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) if (kbd == NULL)
printf("kbd = NULL\n"); printf("kbd = NULL\n");
@ -22752,6 +22752,7 @@ static void setup(void)
img_btnsm_down = loadimage(DATA_PREFIX "images/ui/btnsm_down.png"); img_btnsm_down = loadimage(DATA_PREFIX "images/ui/btnsm_down.png");
img_btn_nav = loadimage(DATA_PREFIX "images/ui/btn_nav.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_sfx = loadimage(DATA_PREFIX "images/tools/sfx.png");
img_speak = loadimage(DATA_PREFIX "images/tools/speak.png"); img_speak = loadimage(DATA_PREFIX "images/tools/speak.png");