Show Magic tool group pagination buttons

Make room for them, but they don't do anything yet.
This commit is contained in:
Bill Kendrick 2021-09-20 23:21:19 -07:00
parent 3eece8635c
commit 3963d74f43
4 changed files with 93 additions and 17 deletions

View file

@ -4,7 +4,7 @@
Fade and Darken Magic Tools Plugin Fade and Darken Magic Tools Plugin
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt Copyright (c) 2002-2021 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
Last updated: July 9, 2008 Last updated: September 20, 2021
$Id$ $Id$
*/ */
@ -49,6 +49,7 @@ int fade_darken_init(magic_api * api);
Uint32 fade_darken_api_version(void); Uint32 fade_darken_api_version(void);
int fade_darken_get_tool_count(magic_api * api); int fade_darken_get_tool_count(magic_api * api);
SDL_Surface *fade_darken_get_icon(magic_api * api, int which); SDL_Surface *fade_darken_get_icon(magic_api * api, int which);
int fade_darken_get_group(magic_api * api, int which);
char *fade_darken_get_name(magic_api * api, int which); char *fade_darken_get_name(magic_api * api, int which);
char *fade_darken_get_description(magic_api * api, int which, int mode); char *fade_darken_get_description(magic_api * api, int which, int mode);
static void do_fade_darken(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); static void do_fade_darken(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
@ -118,6 +119,12 @@ char *fade_darken_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (NULL); return (NULL);
} }
// Return our group (all the same):
int fade_darken_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_COLOR_FILTERS;
}
// Return our description, localized: // Return our description, localized:
char *fade_darken_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode) char *fade_darken_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{ {

View file

@ -4,7 +4,7 @@
Mirror and Flip Magic Tools Plugin Mirror and Flip Magic Tools Plugin
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt Copyright (c) 2002-2021 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
Last updated: July 8, 2008 Last updated: September 20, 2021
$Id$ $Id$
*/ */
@ -50,6 +50,7 @@ Uint32 mirror_flip_api_version(void);
int mirror_flip_get_tool_count(magic_api *); int mirror_flip_get_tool_count(magic_api *);
SDL_Surface *mirror_flip_get_icon(magic_api *, int); SDL_Surface *mirror_flip_get_icon(magic_api *, int);
char *mirror_flip_get_name(magic_api *, int); char *mirror_flip_get_name(magic_api *, int);
int mirror_flip_get_group(magic_api *, int);
char *mirror_flip_get_description(magic_api *, int, int); char *mirror_flip_get_description(magic_api *, int, int);
void mirror_flip_drag(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *); void mirror_flip_drag(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *);
void mirror_flip_release(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *); void mirror_flip_release(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *);
@ -114,6 +115,12 @@ char *mirror_flip_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (NULL); return (NULL);
} }
// Return our group (the same):
int mirror_flip_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_WARPS;
}
// Return our descriptions, localized: // Return our descriptions, localized:
char *mirror_flip_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) char *mirror_flip_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{ {

View file

@ -27,7 +27,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
Last updated: September 4, 2021 Last updated: September 20, 2021
$Id$ $Id$
*/ */
@ -54,6 +54,7 @@ int perspective_init(magic_api * api);
int perspective_get_tool_count(magic_api * api); int perspective_get_tool_count(magic_api * api);
SDL_Surface *perspective_get_icon(magic_api * api, int which); SDL_Surface *perspective_get_icon(magic_api * api, int which);
char *perspective_get_name(magic_api * api, int which); char *perspective_get_name(magic_api * api, int which);
int perspective_get_group(magic_api * api, int which);
char *perspective_get_description(magic_api * api, int which, int mode); char *perspective_get_description(magic_api * api, int which, int mode);
@ -199,6 +200,12 @@ char *perspective_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(perspective_names[which]))); return (strdup(gettext_noop(perspective_names[which])));
} }
// Return our group (the same):
int perspective_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_WARPS;
}
// Return our descriptions, localized: // Return our descriptions, localized:
char *perspective_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) char *perspective_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{ {

View file

@ -3617,6 +3617,11 @@ static void mainloop(void)
else if (cur_tool == TOOL_MAGIC) else if (cur_tool == TOOL_MAGIC)
{ {
if (!disable_magic_controls) if (!disable_magic_controls)
{
gd_controls.rows = 2;
gd_controls.cols = 2;
}
else
{ {
gd_controls.rows = 1; gd_controls.rows = 1;
gd_controls.cols = 2; gd_controls.cols = 2;
@ -3803,8 +3808,12 @@ static void mainloop(void)
} }
else if (cur_tool == TOOL_MAGIC) else if (cur_tool == TOOL_MAGIC)
{ {
/* Magic pagination */
if (which == 0 || which == 1)
printf("FIXME: Paginate!\n");
/* Magic controls! */ /* Magic controls! */
if (which == 1 && magics[cur_magic].avail_modes & MODE_FULLSCREEN) if (which == 3 && magics[cur_magic].avail_modes & MODE_FULLSCREEN)
{ {
magic_switchout(canvas); magic_switchout(canvas);
magics[cur_magic].mode = MODE_FULLSCREEN; magics[cur_magic].mode = MODE_FULLSCREEN;
@ -3812,7 +3821,7 @@ static void mainloop(void)
draw_magic(); draw_magic();
update_screen_rect(&r_toolopt); update_screen_rect(&r_toolopt);
} }
else if (which == 0 && magics[cur_magic].avail_modes & MODE_PAINT) else if (which == 2 && magics[cur_magic].avail_modes & MODE_PAINT)
{ {
magic_switchout(canvas); magic_switchout(canvas);
magics[cur_magic].mode = MODE_PAINT; magics[cur_magic].mode = MODE_PAINT;
@ -3820,7 +3829,7 @@ static void mainloop(void)
draw_magic(); draw_magic();
update_screen_rect(&r_toolopt); update_screen_rect(&r_toolopt);
} }
else if (which == 0 && magics[cur_magic].avail_modes & MODE_PAINT_WITH_PREVIEW) else if (which == 2 && magics[cur_magic].avail_modes & MODE_PAINT_WITH_PREVIEW)
{ {
magic_switchout(canvas); magic_switchout(canvas);
magics[cur_magic].mode = MODE_PAINT_WITH_PREVIEW; magics[cur_magic].mode = MODE_PAINT_WITH_PREVIEW;
@ -3828,7 +3837,7 @@ static void mainloop(void)
draw_magic(); draw_magic();
update_screen_rect(&r_toolopt); update_screen_rect(&r_toolopt);
} }
else if (which == 0 && magics[cur_magic].avail_modes & MODE_ONECLICK) else if (which == 2 && magics[cur_magic].avail_modes & MODE_ONECLICK)
{ {
magic_switchout(canvas); magic_switchout(canvas);
magics[cur_magic].mode = MODE_ONECLICK; magics[cur_magic].mode = MODE_ONECLICK;
@ -4933,6 +4942,11 @@ static void mainloop(void)
else if (cur_tool == TOOL_MAGIC) else if (cur_tool == TOOL_MAGIC)
{ {
if (!disable_magic_controls) if (!disable_magic_controls)
{
gd_controls.rows = 2;
gd_controls.cols = 2;
}
else
{ {
gd_controls.rows = 1; gd_controls.rows = 1;
gd_controls.cols = 2; gd_controls.cols = 2;
@ -5394,8 +5408,12 @@ static void mainloop(void)
if (cur_tool == TOOL_TEXT && !disable_stamp_controls) if (cur_tool == TOOL_TEXT && !disable_stamp_controls)
control_rows = 2; control_rows = 2;
if (cur_tool == TOOL_MAGIC && !disable_magic_controls) if (cur_tool == TOOL_MAGIC)
control_rows = 1; {
control_rows = 1;
if (!disable_magic_controls)
control_rows = 2;
}
if (cur_tool == TOOL_SHAPES && !disable_shape_controls) if (cur_tool == TOOL_SHAPES && !disable_shape_controls)
control_rows = 1; control_rows = 1;
int num_places = buttons_tall * gd_toolopt.cols - control_rows * gd_toolopt.cols; int num_places = buttons_tall * gd_toolopt.cols - control_rows * gd_toolopt.cols;
@ -8605,14 +8623,16 @@ static void draw_magic(void)
int magic, i, max, off_y; int magic, i, max, off_y;
SDL_Rect dest; SDL_Rect dest;
int most; int most;
SDL_Surface *button_color;
SDL_Surface *button_body;
draw_image_title(TITLE_MAGIC, r_ttoolopt); draw_image_title(TITLE_MAGIC, r_ttoolopt);
/* How many can we show? */ /* How many can we show? */
most = (buttons_tall * gd_toolopt.cols) - gd_toolopt.cols - TOOLOFFSET; /* was 12 */ most = (buttons_tall * gd_toolopt.cols) - gd_toolopt.cols - TOOLOFFSET - 2;
if (disable_magic_controls) if (disable_magic_controls)
most = most + gd_toolopt.cols; /* was 14 */ most = most + gd_toolopt.cols;
if (num_magics > most + TOOLOFFSET) if (num_magics > most + TOOLOFFSET)
{ {
@ -8686,6 +8706,41 @@ static void draw_magic(void)
} }
/* Draw group pagination buttons: */
/* Show prev button: */
button_color = img_black;
button_body = img_btn_nav;
dest.x = WINDOW_WIDTH - r_ttoolopt.w;
dest.y = r_ttoolopt.h + (((most + TOOLOFFSET) / 2) * button_h);
SDL_BlitSurface(button_body, NULL, screen, &dest);
dest.x = WINDOW_WIDTH - r_ttoolopt.w + (button_w - img_prev->w) / 2;
dest.y = (r_ttoolopt.h + (((most + TOOLOFFSET) / 2) * button_h) + (button_h - img_prev->h) / 2);
SDL_BlitSurface(button_color, NULL, img_prev, NULL);
SDL_BlitSurface(img_prev, NULL, screen, &dest);
/* Show next button: */
button_color = img_black;
button_body = img_btn_nav;
dest.x = WINDOW_WIDTH - button_w;
dest.y = r_ttoolopt.h + (((most + TOOLOFFSET) / gd_toolopt.cols) * button_h);
SDL_BlitSurface(button_body, NULL, screen, &dest);
dest.x = WINDOW_WIDTH - button_w + (button_w - img_next->w) / 2;
dest.y = (r_ttoolopt.h + (((most + TOOLOFFSET) / gd_toolopt.cols) * button_h) + (button_h - img_next->h) / 2);
SDL_BlitSurface(button_color, NULL, img_next, NULL);
SDL_BlitSurface(img_next, NULL, screen, &dest);
/* Draw magic controls: */ /* Draw magic controls: */
if (!disable_magic_controls) if (!disable_magic_controls)
@ -8704,12 +8759,12 @@ static void draw_magic(void)
button_color = img_btn_off; /* Unavailable */ button_color = img_btn_off; /* Unavailable */
dest.x = WINDOW_WIDTH - r_ttoolopt.w; dest.x = WINDOW_WIDTH - r_ttoolopt.w;
dest.y = r_ttoolopt.h + ((most / gd_toolopt.cols + TOOLOFFSET / gd_toolopt.cols) * button_h); dest.y = r_ttoolopt.h + ((most / gd_toolopt.cols + (TOOLOFFSET + 2) / gd_toolopt.cols) * button_h);
SDL_BlitSurface(button_color, NULL, screen, &dest); SDL_BlitSurface(button_color, NULL, screen, &dest);
dest.x = WINDOW_WIDTH - r_ttoolopt.w + (button_w - img_magic_paint->w) / 2; dest.x = WINDOW_WIDTH - r_ttoolopt.w + (button_w - img_magic_paint->w) / 2;
dest.y = (r_ttoolopt.h + ((most / gd_toolopt.cols + TOOLOFFSET / gd_toolopt.cols) * button_h) + (button_h - img_magic_paint->h) / 2); dest.y = (r_ttoolopt.h + ((most / gd_toolopt.cols + (TOOLOFFSET + 2) / gd_toolopt.cols) * button_h) + (button_h - img_magic_paint->h) / 2);
SDL_BlitSurface(img_magic_paint, NULL, screen, &dest); SDL_BlitSurface(img_magic_paint, NULL, screen, &dest);
@ -8724,12 +8779,12 @@ static void draw_magic(void)
button_color = img_btn_off; /* Unavailable */ button_color = img_btn_off; /* Unavailable */
dest.x = WINDOW_WIDTH - button_w; dest.x = WINDOW_WIDTH - button_w;
dest.y = r_ttoolopt.h + ((most / gd_toolopt.cols + TOOLOFFSET / gd_toolopt.cols) * button_h); dest.y = r_ttoolopt.h + ((most / gd_toolopt.cols + (TOOLOFFSET + 2) / gd_toolopt.cols) * button_h);
SDL_BlitSurface(button_color, NULL, screen, &dest); SDL_BlitSurface(button_color, NULL, screen, &dest);
dest.x = WINDOW_WIDTH - button_w + (button_w - img_magic_fullscreen->w) / 2; dest.x = WINDOW_WIDTH - button_w + (button_w - img_magic_fullscreen->w) / 2;
dest.y = (r_ttoolopt.h + ((most / gd_toolopt.cols + TOOLOFFSET / gd_toolopt.cols) * button_h) + (button_h - img_magic_fullscreen->h) / 2); dest.y = (r_ttoolopt.h + ((most / gd_toolopt.cols + (TOOLOFFSET + 2) / gd_toolopt.cols) * button_h) + (button_h - img_magic_fullscreen->h) / 2);
SDL_BlitSurface(img_magic_fullscreen, NULL, screen, &dest); SDL_BlitSurface(img_magic_fullscreen, NULL, screen, &dest);
} }