Activating the ability to have more than one colors row.
Usefull for people with coarse input devices that need bigger buttons but got color buttons too narrow. Just added the option, all the support code where already in place.
This commit is contained in:
parent
81ef0aa10b
commit
43d4f8b494
3 changed files with 20 additions and 2 deletions
|
|
@ -164,6 +164,7 @@ wheelmouse, POSBOOL(wheely)
|
|||
windowed, NEGBOOL(fullscreen)
|
||||
windowsize, MULTI(parsertmp_windowsize)
|
||||
buttonsize, MULTI(button_size)
|
||||
colorsrows, MULTI(colors_rows)
|
||||
mouse-accessibility, POSBOOL(mouseaccessibility)
|
||||
onscreen-keyboard, POSBOOL(onscreen_keyboard)
|
||||
onscreen-keyboard-layout, MULTI(onscreen_keyboard_layout)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ struct cfginfo
|
|||
const char *parsertmp_sysconfig;
|
||||
const char *parsertmp_windowsize;
|
||||
const char *button_size;
|
||||
const char *colors_rows;
|
||||
const char *print_delay;
|
||||
const char *printcommand;
|
||||
// const char *promptless_save;
|
||||
|
|
|
|||
|
|
@ -713,6 +713,7 @@ static int button_h; /* was 48 */
|
|||
static float button_scale; /* scale factor to be applied to the size of buttons */
|
||||
static int color_button_w; /* was 32 */
|
||||
static int color_button_h; /* was 48 */
|
||||
static int colors_rows;
|
||||
|
||||
static int buttons_tall; /* promoted to a global variable from setup_normal_screen_layout() */
|
||||
|
||||
|
|
@ -774,10 +775,10 @@ static void setup_normal_screen_layout(void)
|
|||
r_ttoolopt.x = WINDOW_WIDTH - r_ttoolopt.w;
|
||||
r_ttoolopt.y = 0;
|
||||
|
||||
gd_colors.rows = 1;
|
||||
gd_colors.rows = colors_rows;
|
||||
gd_colors.cols = (NUM_COLORS + gd_colors.rows - 1) / gd_colors.rows;
|
||||
|
||||
r_colors.h = 48 * button_scale;
|
||||
r_colors.h = 48 * button_scale * gd_colors.rows;
|
||||
color_button_h = r_colors.h / gd_colors.rows;
|
||||
r_tcolors.h = r_colors.h;
|
||||
|
||||
|
|
@ -8547,6 +8548,10 @@ static unsigned draw_colors(unsigned action)
|
|||
if (colors_state == old_colors_state)
|
||||
return old_colors_state;
|
||||
|
||||
/* If more than one colors rows, fill the parts of the r_tcolors not covered by the title. */
|
||||
if (gd_colors.rows > 1)
|
||||
SDL_FillRect(screen, &r_tcolors, SDL_MapRGBA(screen->format, 255,255,255,255));
|
||||
|
||||
if (colors_state == COLORSEL_ENABLE)
|
||||
{
|
||||
SDL_BlitSurface(img_title_large_on, NULL, screen, &r_tcolors);
|
||||
|
|
@ -23293,6 +23298,17 @@ static void setup_config(char *argv[])
|
|||
}
|
||||
else
|
||||
button_scale = 1;
|
||||
if (tmpcfg.colors_rows)
|
||||
{
|
||||
if (strtof(tmpcfg.colors_rows, NULL) > 3)
|
||||
{
|
||||
fprintf(stderr, "Color rows (now %s) must be between 1 and 3.\n", tmpcfg.colors_rows);
|
||||
exit(1);
|
||||
}
|
||||
colors_rows = strtof(tmpcfg.colors_rows, NULL);
|
||||
}
|
||||
else
|
||||
colors_rows = 1;
|
||||
if (tmpcfg.stamp_size_override)
|
||||
{
|
||||
if (!strcmp(tmpcfg.stamp_size_override, "default"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue