Adding an auto option for button sizes, see https://sourceforge.net/p/tuxpaint/feature-requests/218/
This commit is contained in:
parent
f838704282
commit
333f4b05a4
1 changed files with 16 additions and 6 deletions
|
|
@ -764,6 +764,7 @@ static float render_scale; /* Scale factor for the render */
|
||||||
|
|
||||||
static int button_w; /* was 48 */
|
static int button_w; /* was 48 */
|
||||||
static int button_h; /* was 48 */
|
static int button_h; /* was 48 */
|
||||||
|
static int button_size_auto = 0; /* if the size of buttons should be autocalculated */
|
||||||
static float button_scale; /* scale factor to be applied to the size of buttons */
|
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_w; /* was 32 */
|
||||||
static int color_button_h; /* was 48 */
|
static int color_button_h; /* was 48 */
|
||||||
|
|
@ -26576,12 +26577,18 @@ static void setup_config(char *argv[])
|
||||||
}
|
}
|
||||||
if (tmpcfg.button_size)
|
if (tmpcfg.button_size)
|
||||||
{
|
{
|
||||||
if (strtof(tmpcfg.button_size, NULL) < 24 || strtof(tmpcfg.button_size, NULL) > 192)
|
if (strstr(tmpcfg.button_size, "auto"))
|
||||||
{
|
button_size_auto = 1;
|
||||||
fprintf(stderr, "Button size (now %s) must be between 24 and 192.\n", tmpcfg.button_size);
|
else
|
||||||
exit(1);
|
{
|
||||||
}
|
button_size_auto = 0; /* raw size */
|
||||||
button_scale = strtof(tmpcfg.button_size, NULL) / ORIGINAL_BUTTON_SIZE;
|
if (strtof(tmpcfg.button_size, NULL) < 24 || strtof(tmpcfg.button_size, NULL) > 192)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Button size (now %s) must be between 24 and 192.\n", tmpcfg.button_size);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
button_scale = strtof(tmpcfg.button_size, NULL) / ORIGINAL_BUTTON_SIZE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
button_scale = 1;
|
button_scale = 1;
|
||||||
|
|
@ -27715,6 +27722,9 @@ static void setup(void)
|
||||||
|
|
||||||
/* (Need to do this after native screen resolution is handled) */
|
/* (Need to do this after native screen resolution is handled) */
|
||||||
|
|
||||||
|
if (button_size_auto) /* Automatic size of buttons, see https://sourceforge.net/p/tuxpaint/feature-requests/218/ */
|
||||||
|
button_scale = (float) min((48 * screen->w) / 800, (48 * screen->h) / 600) / ORIGINAL_BUTTON_SIZE;
|
||||||
|
|
||||||
setup_screen_layout();
|
setup_screen_layout();
|
||||||
set_color_picker_crosshair_size();
|
set_color_picker_crosshair_size();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue