From 61998e4d00c849a5787a1c6b10ded1ef67d14cf0 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 25 Aug 2020 22:00:43 -0700 Subject: [PATCH] Larger OSK on larger windows; larger OSK font On-screen keyboard (visible when the feature is enabled, while using the "Text" and "Label" tools) now appears with larger (48x48 pixel, vs 24x24 pixel) buttons, when Tux Paint's window (or fullscreen) size is large enough to fit them with the chosen layout. (h/t Anat & Aviv, who suggested it to help with users of eye-tracking systems) Also, on-screen keyboard buttons use a slightly larger font (16pt vs 12pt, previously seen on the small keyboard; 32pt on the large keyboard). --- data/images/ui/btn_hold.png | Bin 0 -> 8031 bytes docs/CHANGES.txt | 12 ++++ src/onscreen_keyboard.c | 113 ++++++++++++++++++++++++++++++------ src/onscreen_keyboard.h | 45 +++++++++++--- src/tuxpaint.c | 32 +++++++--- 5 files changed, 168 insertions(+), 34 deletions(-) create mode 100644 data/images/ui/btn_hold.png diff --git a/data/images/ui/btn_hold.png b/data/images/ui/btn_hold.png new file mode 100644 index 0000000000000000000000000000000000000000..4ccc0b9e055e2059313087d706bc130a07e1f049 GIT binary patch literal 8031 zcmV-lAE4lgP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O?W#a^$#@g#Y6da|Gr4;x(iLMnHX(4> ze~!i7`?h<(=_+?#j#Is(Gp8{B*{}Jl#((l_&Y7AbXY1!&F)lCUG7Lpdubf3d+tdV7k*>dBASR)5S>c2e!hEbKtzh`;$V>l=XJN6mjpwU|b*qHoK5q zcD8t5oMRp<0qTt0hv)|pa4Gr4AbkuWds95D#J#zuxO=WoK6@R8n+QY-ITT{kLMK=; zCh${Y1w%cB6jMq$l~he?sppVmPC4h2MRL7_5=$z%lu}D8y@ncVs=1b0YpcEa7U00t zax1O2)_V7*bE8gQo%1_Kh96uo_6|Y)ZVE6^7{{>=H96J8!4SvKBLA_Q_4pdPIQtK zGa}}rBjQC70MK4Bv(?4u6*;yijA}(6 zfPUSMC$F5~x8<2;bF0=9`{*UExzjYA=b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hRD5II{XwC`@ zCP)A)ScC&J3o!%SZAEQ$S3rFxaDa$N5Fs#N40A9c*Q(5rW0)+@EN(D|F*rjA5=2C- zet+UtcSX-U7OxU9Gq_-8Cl&@WoZ*gSkZCT?IBs*s4cXuhcOXL;PCVUu1fnyKMLl~u zg6ry;q0B@8OkjWk?8vp@k6jPdq29e&*#t;nA}E8HKwz9b9rel6kqA(BR%Xb|-i&Op zX+(5Ceq3x|)r)%u7{XwNvqG5&Po9ptcA^jl5gbA!b<8k_B@hD+cMvV7kyg_Kz*0jP z1VrKxA_!ycM4`{Dx7JRzzM0GlLRfC9m~0S+Vad(3Y^W;-%X=1HJJot-y~P05pICjE z-t2H788Xe4c$|?9nUD+)WIurN8ioS6xY7Ff=3IBRip^n;+T$3=%OJ_}eEr3Z>g(c0 zs{!=vTJa8hQ~p-)qS>CObC%TnnC|UU3kdSCwwfvXvui~I=;`&&#@g90A55~DGc3b- zTIV@<;U$)UX;I+0_GN?RjkU8+uXpC5_odAad4hXN0M9j4FEJl>q_MCQ+aKZpvonRn@529Q7%8KKMvu?;!0) z{>_wfPOf>H?e}T0Dlu&{(=m>AMH|MWs}{!Dpr zC;zpr_N~F_$~S4uN(8CEdSFd@$o==(Dwidth, layout->height); #endif + if (layout->width * LG_button_up->w >= canvas->w * 0.9 || + layout->height * LG_button_up->h >= canvas->h * 0.5) { + /* Full-size buttons too large, use small buttons */ + button_up = SM_button_up; + button_down = SM_button_down; + button_off = SM_button_off; + button_nav = SM_button_nav; + button_hold = SM_button_hold; + oskdel = SM_oskdel; + osktab = SM_osktab; + oskenter = SM_oskenter; + oskcapslock = SM_oskcapslock; + oskshift = SM_oskshift; + } else { + button_up = LG_button_up; + button_down = LG_button_down; + button_off = LG_button_off; + button_nav = LG_button_nav; + button_hold = LG_button_hold; + oskdel = LG_oskdel; + osktab = LG_osktab; + oskenter = LG_oskenter; + oskcapslock = LG_oskcapslock; + oskshift = LG_oskshift; + } + surface = SDL_CreateRGBSurface(canvas->flags, layout->width * button_up->w, layout->height * button_up->h, @@ -126,6 +164,7 @@ struct osk_keyboard *osk_create(char *layout_name, SDL_Surface * canvas, SDL_Sur return NULL; } // keyboard->name = layout_name; + keyboard->canvas_ptr = canvas; keyboard->layout = layout; keyboard->surface = surface; keyboard->rect.x = 0; @@ -159,6 +198,27 @@ struct osk_keyboard *osk_create(char *layout_name, SDL_Surface * canvas, SDL_Sur keyboard->kmdf.dead3 = NULL; keyboard->kmdf.dead4 = NULL; + keyboard->LG_button_up = LG_button_up; + keyboard->LG_button_down = LG_button_down; + keyboard->LG_button_off = LG_button_off; + keyboard->LG_button_nav = LG_button_nav; + keyboard->LG_button_hold = LG_button_hold; + keyboard->LG_oskdel = LG_oskdel; + keyboard->LG_osktab = LG_osktab; + keyboard->LG_oskenter = LG_oskenter; + keyboard->LG_oskcapslock = LG_oskcapslock; + keyboard->LG_oskshift = LG_oskshift; + keyboard->SM_button_up = SM_button_up; + keyboard->SM_button_down = SM_button_down; + keyboard->SM_button_off = SM_button_off; + keyboard->SM_button_nav = SM_button_nav; + keyboard->SM_button_hold = SM_button_hold; + keyboard->SM_oskdel = SM_oskdel; + keyboard->SM_osktab = SM_osktab; + keyboard->SM_oskenter = SM_oskenter; + keyboard->SM_oskcapslock = SM_oskcapslock; + keyboard->SM_oskshift = SM_oskshift; + SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, keyboard->layout->bgcolor.r, keyboard->layout->bgcolor.g, keyboard->layout->bgcolor.b)); @@ -1005,36 +1065,40 @@ static int is_blank_or_comment(char *line) /* } */ -/* Fixme: Is it safe to supose that if a font is loaded at one size, it will be loaded at any size? */ -/* Fixme: sizes should be dynamically adapted to the button size */ -/* Fixme: starting a layout with one font causes all other layouts be in that font */ +/* FIXME: Is it safe to supose that if a font is loaded at one size, it will be loaded at any size? */ +/* FIXME: starting a layout with one font causes all other layouts be in that font */ static void keybd_prepare(on_screen_keyboard * keyboard) { char *fontname; - + int font_height; + + /* Pick a height (e.g., 16pt for small (24x24), 32pt for large (48x48) buttons) */ + font_height = ((keyboard->button_up->h * 2) / 3); + fontname = malloc(sizeof(char) * 255); if (keyboard->osk_fonty == NULL) { + if (keyboard->layout->fontpath) { /* First try if it is an absolute path */ - keyboard->osk_fonty = TTF_OpenFont(keyboard->layout->fontpath, 12); + keyboard->osk_fonty = TTF_OpenFont(keyboard->layout->fontpath, font_height); if (keyboard->osk_fonty == NULL) { /* Now trying if it is relative to DATA_PREFIX/fonts/ */ snprintf(fontname, 255, "%s/fonts/%s", DATA_PREFIX, keyboard->layout->fontpath); - keyboard->osk_fonty = TTF_OpenFont(fontname, 12); + keyboard->osk_fonty = TTF_OpenFont(fontname, font_height); if (keyboard->osk_fonty == NULL) { /* Perhaps it is relative to DATA_PREFIX only? */ snprintf(fontname, 255, "%s/%s", DATA_PREFIX, keyboard->layout->fontpath); - keyboard->osk_fonty = TTF_OpenFont(fontname, 12); + keyboard->osk_fonty = TTF_OpenFont(fontname, font_height); if (keyboard->osk_fonty == NULL) { /* Or to DATA_PREFIX/fonts/locale/ ? */ snprintf(fontname, 255, "%s/fonts/locale/%s", DATA_PREFIX, keyboard->layout->fontpath); - keyboard->osk_fonty = TTF_OpenFont(fontname, 12); + keyboard->osk_fonty = TTF_OpenFont(fontname, font_height); } } } @@ -1044,7 +1108,7 @@ static void keybd_prepare(on_screen_keyboard * keyboard) { /* Going with the default */ sprintf(fontname, "%s/fonts/FreeSansBold.ttf", DATA_PREFIX); - keyboard->osk_fonty = TTF_OpenFont(fontname, 12); + keyboard->osk_fonty = TTF_OpenFont(fontname, font_height); } if (keyboard->osk_fonty == NULL) @@ -1687,9 +1751,20 @@ struct osk_keyboard *osk_clicked(on_screen_keyboard * keyboard, int x, int y) new_keyboard = - osk_create(name, keyboard->surface, keyboard->button_up, keyboard->button_down, keyboard->button_off, - keyboard->button_nav, keyboard->button_hold, keyboard->oskdel, keyboard->osktab, - keyboard->oskenter, keyboard->oskcapslock, keyboard->oskshift, keyboard->disable_change); + osk_create(name, keyboard->canvas_ptr, + keyboard->LG_button_up, keyboard->LG_button_down, + keyboard->LG_button_off, keyboard->LG_button_nav, + keyboard->LG_button_hold, + keyboard->LG_oskdel, keyboard->LG_osktab, + keyboard->LG_oskenter, keyboard->LG_oskcapslock, + keyboard->LG_oskshift, + keyboard->SM_button_up, keyboard->SM_button_down, + keyboard->SM_button_off, keyboard->SM_button_nav, + keyboard->SM_button_hold, + keyboard->SM_oskdel, keyboard->SM_osktab, + keyboard->SM_oskenter, keyboard->SM_oskcapslock, + keyboard->SM_oskshift, + keyboard->disable_change); free(aux_list_ptr); diff --git a/src/onscreen_keyboard.h b/src/onscreen_keyboard.h index 717b7f06e..fdec10888 100644 --- a/src/onscreen_keyboard.h +++ b/src/onscreen_keyboard.h @@ -104,13 +104,15 @@ typedef struct osk_keyboard { char *name; /* The name of the keyboard */ char *keyboard_list; /* The names of the keyboards allowed from this one */ - SDL_Surface *surface; /* The surface containing the keyboard */ - SDL_Surface *button_up; /* The surfaces containing the buttons */ + SDL_Surface *surface; /* The surface containing the current layout's keyboard */ + /* The surfaces containing the current layout's button backgrounds*/ + SDL_Surface *button_up; SDL_Surface *button_down; SDL_Surface *button_off; SDL_Surface *button_nav; SDL_Surface *button_hold; - SDL_Surface *oskdel; /* The surfaces containing some symbols for the buttons, delete arrow */ + /* The surfaces containing some symbols for the current layout's buttons */ + SDL_Surface *oskdel; /* delete arrow */ SDL_Surface *osktab; /* Tab arrows */ SDL_Surface *oskenter; /* Return hook/arrow */ SDL_Surface *oskcapslock; /* CapsLock */ @@ -131,12 +133,41 @@ typedef struct osk_keyboard int composed_type; /* 1 if the value stored in composed is yet the unicode value */ osk_composenode *composing; /* The node in the middle of a compose sequence */ osk_key *last_key_pressed; /* The last key pressed */ + SDL_Surface * canvas_ptr; /* Canvas drawing surface, for bpp and sizing needs when cycling through keyboard layouts */ + /* Large and small buttons, to pass back to osk_create() when cycling through keyboard layouts */ + SDL_Surface *LG_button_up; + SDL_Surface *LG_button_down; + SDL_Surface *LG_button_off; + SDL_Surface *LG_button_nav; + SDL_Surface *LG_button_hold; + SDL_Surface *LG_oskdel; + SDL_Surface *LG_osktab; + SDL_Surface *LG_oskenter; + SDL_Surface *LG_oskcapslock; + SDL_Surface *LG_oskshift; + SDL_Surface *SM_button_up; + SDL_Surface *SM_button_down; + SDL_Surface *SM_button_off; + SDL_Surface *SM_button_nav; + SDL_Surface *SM_button_hold; + SDL_Surface *SM_oskdel; + SDL_Surface *SM_osktab; + SDL_Surface *SM_oskenter; + SDL_Surface *SM_oskcapslock; + SDL_Surface *SM_oskshift; } 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, SDL_Surface * button_nav, - SDL_Surface * button_hold, SDL_Surface * oskdel, SDL_Surface * osktab, - SDL_Surface * oskenter, SDL_Surface * oskcapslock, SDL_Surface * oskshift, +struct osk_keyboard *osk_create(char * layout_name, SDL_Surface * canvas, + SDL_Surface * LG_button_up, SDL_Surface * LG_button_down, + SDL_Surface * LG_button_off, SDL_Surface * LG_button_nav, + SDL_Surface * LG_button_hold, + SDL_Surface * LG_oskdel, SDL_Surface * LG_osktab, SDL_Surface * LG_oskenter, + SDL_Surface * LG_oskcapslock, SDL_Surface * LG_oskshift, + SDL_Surface * SM_button_up, SDL_Surface * SM_button_down, + SDL_Surface * SM_button_off, SDL_Surface * SM_button_nav, + SDL_Surface * SM_button_hold, + SDL_Surface * SM_oskdel, SDL_Surface * SM_osktab, SDL_Surface * SM_oskenter, + SDL_Surface * SM_oskcapslock, SDL_Surface * SM_oskshift, int disable_change); struct osk_layout *osk_load_layout(char *layout_name); diff --git a/src/tuxpaint.c b/src/tuxpaint.c index d97015638..105694a9d 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - August 16, 2020 + June 14, 2002 - August 25, 2020 */ @@ -1430,7 +1430,7 @@ static int text_undo[NUM_UNDO_BUFS]; static int have_to_rec_label_node; 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_btn_up, *img_btn_down, *img_btn_off, *img_btn_hold; static SDL_Surface *img_btnsm_up, *img_btnsm_off, *img_btnsm_down, *img_btnsm_hold; static SDL_Surface *img_btn_nav, *img_btnsm_nav; static SDL_Surface *img_prev, *img_next; @@ -3132,15 +3132,29 @@ static void mainloop(void) { if (onscreen_keyboard_layout) kbd = - osk_create(onscreen_keyboard_layout, screen, img_btnsm_up, img_btnsm_down, - img_btnsm_off, img_btnsm_nav, img_btnsm_hold, img_oskdel, - img_osktab, img_oskenter, img_oskcapslock, img_oskshift, + osk_create(onscreen_keyboard_layout, screen, + img_btn_up, img_btn_down, img_btn_off, + img_btn_nav, img_btn_hold, + img_oskdel, img_osktab, img_oskenter, + img_oskcapslock, img_oskshift, + img_btnsm_up, img_btnsm_down, img_btnsm_off, + img_btnsm_nav, img_btnsm_hold, + /* FIXME */ + img_oskdel, img_osktab, img_oskenter, + img_oskcapslock, img_oskshift, onscreen_keyboard_disable_change); else kbd = - osk_create(strdup("default.layout"), screen, img_btnsm_up, img_btnsm_down, - img_btnsm_off, img_btnsm_nav, img_btnsm_hold, img_oskdel, - img_osktab, img_oskenter, img_oskcapslock, img_oskshift, + osk_create(strdup("default.layout"), screen, + img_btn_up, img_btn_down, img_btn_off, + img_btn_nav, img_btn_hold, + img_oskdel, img_osktab, img_oskenter, + img_oskcapslock, img_oskshift, + img_btnsm_up, img_btnsm_down, img_btnsm_off, + img_btnsm_nav, img_btnsm_hold, + /* FIXME */ + img_oskdel, img_osktab, img_oskenter, + img_oskcapslock, img_oskshift, onscreen_keyboard_disable_change); } if (kbd == NULL) @@ -12644,6 +12658,7 @@ static void cleanup(void) free_surface(&img_btn_up); free_surface(&img_btn_down); free_surface(&img_btn_off); + free_surface(&img_btn_hold); free_surface(&img_btnsm_up); free_surface(&img_btnsm_off); @@ -24355,6 +24370,7 @@ static void setup(void) img_btn_up = loadimage(DATA_PREFIX "images/ui/btn_up.png"); img_btn_down = loadimage(DATA_PREFIX "images/ui/btn_down.png"); img_btn_off = loadimage(DATA_PREFIX "images/ui/btn_off.png"); + img_btn_hold = loadimage(DATA_PREFIX "images/ui/btn_hold.png"); img_btnsm_up = loadimage(DATA_PREFIX "images/ui/btnsm_up.png"); img_btnsm_off = loadimage(DATA_PREFIX "images/ui/btnsm_off.png");