From f381073d48d5e44686156ba5da42f254d494b29a Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 21 Sep 2021 00:24:26 -0700 Subject: [PATCH] Putting more Magic tools into groups... --- magic/src/clone.c | 9 ++++++++- magic/src/confetti.c | 8 ++++++++ magic/src/distortion.c | 13 +++++++++++-- magic/src/fisheye.c | 8 +++++++- magic/src/flower.c | 14 +++++++++++--- magic/src/foam.c | 11 +++++++++-- magic/src/glasstile.c | 11 +++++++++-- magic/src/grass.c | 11 +++++++++-- magic/src/halftone.c | 12 +++++++++++- magic/src/kalidescope.c | 12 ++++++++++-- magic/src/light.c | 11 +++++++++-- magic/src/metalpaint.c | 11 +++++++++-- 12 files changed, 111 insertions(+), 20 deletions(-) diff --git a/magic/src/clone.c b/magic/src/clone.c index c5db10d0e..91062e34a 100644 --- a/magic/src/clone.c +++ b/magic/src/clone.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: February 20, 2021 + Last updated: September 21, 2021 $Id$ */ @@ -70,6 +70,7 @@ Uint32 clone_api_version(void); int clone_get_tool_count(magic_api * api); SDL_Surface *clone_get_icon(magic_api * api, int which); char *clone_get_name(magic_api * api, int which); +int clone_get_group(magic_api * api, int which); char *clone_get_description(magic_api * api, int which, int mode); void clone_drag(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect); @@ -132,6 +133,12 @@ char *clone_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE return (strdup(gettext_noop("Clone"))); } +// Return our groups: +int clone_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_DISTORTS; +} + // Return our descriptions, localized: char *clone_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/confetti.c b/magic/src/confetti.c index 7d5dbc419..8cdd62ebf 100644 --- a/magic/src/confetti.c +++ b/magic/src/confetti.c @@ -1,3 +1,5 @@ +/* Last updated 2021-09-21 */ + #include //For time() #include "tp_magic_api.h" @@ -23,6 +25,7 @@ int confetti_init(magic_api * api); int confetti_get_tool_count(magic_api * api); SDL_Surface *confetti_get_icon(magic_api * api, int which); char *confetti_get_name(magic_api * api, int which); +int confetti_get_group(magic_api * api, int which); char *confetti_get_description(magic_api * api, int which, int mode); int confetti_requires_colors(magic_api * api, int which); void confetti_release(magic_api * api, int which, @@ -83,6 +86,11 @@ char *confetti_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UN return strdup(gettext_noop("Confetti")); } +int confetti_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + char *confetti_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Click to throw confetti!")); diff --git a/magic/src/distortion.c b/magic/src/distortion.c index e61b4e4bf..ed64e5232 100644 --- a/magic/src/distortion.c +++ b/magic/src/distortion.c @@ -4,7 +4,7 @@ Distortion Magic Tool Plugin 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 http://www.tuxpaint.org/ @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: July 8, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -59,6 +59,7 @@ int distortion_init(magic_api * api); int distortion_get_tool_count(magic_api * api); SDL_Surface *distortion_get_icon(magic_api * api, int which); char *distortion_get_name(magic_api * api, int which); +int distortion_get_group(magic_api * api, int which); char *distortion_get_description(magic_api * api, int which, int mode); int distortion_requires_colors(magic_api * api, int which); void distortion_shutdown(magic_api * api); @@ -135,6 +136,14 @@ char *distortion_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_ } +// Report our "Magic" tool groups + +int distortion_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_DISTORTS; +} + + // Report our "Magic" tool descriptions char *distortion_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, diff --git a/magic/src/fisheye.c b/magic/src/fisheye.c index a856c91e1..e7e14186f 100644 --- a/magic/src/fisheye.c +++ b/magic/src/fisheye.c @@ -41,6 +41,7 @@ int fisheye_init(magic_api * api); int fisheye_get_tool_count(magic_api * api); SDL_Surface *fisheye_get_icon(magic_api * api, int which); char *fisheye_get_name(magic_api * api, int which); +int fisheye_get_group(magic_api * api, int which); char *fisheye_get_description(magic_api * api, int which, int mode); int fisheye_requires_colors(magic_api * api, int which); void fisheye_release(magic_api * api, int which, @@ -99,7 +100,12 @@ SDL_Surface *fisheye_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED) char *fisheye_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Fisheye")); -} //Needs better name +} + +int fisheye_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_DISTORTS; +} char *fisheye_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/flower.c b/magic/src/flower.c index 89688d79e..469548a11 100644 --- a/magic/src/flower.c +++ b/magic/src/flower.c @@ -4,7 +4,7 @@ Flower Magic Tool Plugin 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 http://www.tuxpaint.org/ @@ -23,13 +23,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: April 26, 2011 + Last updated: September 21, 2021 $Id$ */ #include #include #include +#include #include "tp_magic_api.h" #include "SDL_image.h" #include "SDL_mixer.h" @@ -69,6 +70,7 @@ int flower_init(magic_api * api); int flower_get_tool_count(magic_api * api); SDL_Surface *flower_get_icon(magic_api * api, int which); char *flower_get_name(magic_api * api, int which); +int flower_get_group(magic_api * api, int which); char *flower_get_description(magic_api * api, int which, int mode); static void flower_predrag(magic_api * api, SDL_Surface * canvas, SDL_Surface * last, int ox, int oy, int x, int y); void flower_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -144,6 +146,12 @@ char *flower_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS return (strdup(gettext_noop("Flower"))); } +// Return our groups: +int flower_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_ARTISTIC; +} + // Return our descriptions, localized: char *flower_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { @@ -381,7 +389,7 @@ static void flower_drawstalk(magic_api * api ATTRIBUTE_UNUSED, SDL_Surface * can else side = LEAFSIDE_RIGHT_UP; } - else if (abs(curve[i - 2].x - curve[i + 2].x) < 5) + else if (fabs(curve[i - 2].x - curve[i + 2].x) < 5) { /* Mostly up; stick left- or right-downward: */ diff --git a/magic/src/foam.c b/magic/src/foam.c index 2537e6898..0b93fd2a6 100644 --- a/magic/src/foam.c +++ b/magic/src/foam.c @@ -4,7 +4,7 @@ Foam Magic Tool Plugin 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 http://www.tuxpaint.org/ @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: July 8, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -53,6 +53,7 @@ void foam_click(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect); SDL_Surface *foam_get_icon(magic_api * api, int which); char *foam_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED); +int foam_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED); void foam_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas); void foam_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas); void foam_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b); @@ -114,6 +115,12 @@ char *foam_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED return (strdup(gettext_noop("Foam"))); } +// Return our groups +int foam_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + // Return our descriptions, localized: char *foam_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/glasstile.c b/magic/src/glasstile.c index 232d15a3c..b19d75cbc 100644 --- a/magic/src/glasstile.c +++ b/magic/src/glasstile.c @@ -4,7 +4,7 @@ Glass Tile Magic Tool Plugin 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 http://www.tuxpaint.org/ @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: July 9, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -44,6 +44,7 @@ int glasstile_init(magic_api * api); int glasstile_get_tool_count(magic_api * api); SDL_Surface *glasstile_get_icon(magic_api * api, int which); char *glasstile_get_name(magic_api * api, int which); +int glasstile_get_group(magic_api * api, int which); char *glasstile_get_description(magic_api * api, int which, int mode); static void do_glasstile(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); void glasstile_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -104,6 +105,12 @@ char *glasstile_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_U return (strdup(gettext_noop("Glass Tile"))); } +// Return our groups +int glasstile_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_DISTORTS; +} + // Return our descriptions, localized: char *glasstile_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode) { diff --git a/magic/src/grass.c b/magic/src/grass.c index e5d6105e3..20f1a0755 100644 --- a/magic/src/grass.c +++ b/magic/src/grass.c @@ -5,7 +5,7 @@ Tux Paint - A simple drawing program for children. by Albert Cahalan - 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 http://www.tuxpaint.org/ @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: July 8, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -47,6 +47,7 @@ Uint32 grass_api_version(void); int grass_get_tool_count(magic_api * api); SDL_Surface *grass_get_icon(magic_api * api, int which); char *grass_get_name(magic_api * api, int which); +int grass_get_group(magic_api * api, int which); char *grass_get_description(magic_api * api, int which, int mode); void grass_drag(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect); @@ -107,6 +108,12 @@ char *grass_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE return (strdup(gettext_noop("Grass"))); } +// Return our groups: +int grass_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + // Return our descriptions, localized: char *grass_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/halftone.c b/magic/src/halftone.c index bee550b6f..fda08efe3 100644 --- a/magic/src/halftone.c +++ b/magic/src/halftone.c @@ -1,6 +1,6 @@ /* halftone.c - Last modified: 2021.09.04 + Last modified: 2021.09.21 */ @@ -41,6 +41,10 @@ const char *names[NUM_TOOLS] = { gettext_noop("Halftone"), }; +const int groups[NUM_TOOLS] = { + MAGIC_TYPE_DISTORTS, +}; + const char *descs[NUM_TOOLS] = { gettext_noop("Click and drag to turn your drawing into a newspaper."), }; @@ -59,6 +63,7 @@ int halftone_init(magic_api * api); int halftone_get_tool_count(magic_api * api); SDL_Surface *halftone_get_icon(magic_api * api, int which); char *halftone_get_name(magic_api * api, int which); +int halftone_get_group(magic_api * api, int which); char *halftone_get_description(magic_api * api, int which, int mode); int halftone_requires_colors(magic_api * api, int which); int halftone_modes(magic_api * api, int which); @@ -121,6 +126,11 @@ char *halftone_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) return (strdup(our_name_localized)); } +int halftone_get_group(magic_api * api ATTRIBUTE_UNUSED, int which) +{ + return groups[which]; +} + char *halftone_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) { const char *our_desc_english; diff --git a/magic/src/kalidescope.c b/magic/src/kalidescope.c index 28b76048b..53244b9ce 100644 --- a/magic/src/kalidescope.c +++ b/magic/src/kalidescope.c @@ -4,7 +4,7 @@ Kaleidoscope Magic Tool Plugin 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 http://www.tuxpaint.org/ @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: July 8, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -65,6 +65,7 @@ int kalidescope_init(magic_api * api); int kalidescope_get_tool_count(magic_api * api); SDL_Surface *kalidescope_get_icon(magic_api * api, int which); char *kalidescope_get_name(magic_api * api, int which); +int kalidescope_get_group(magic_api * api, int which); char *kalidescope_get_description(magic_api * api, int which, int mode); static void do_kalidescope(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); void kalidescope_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -136,6 +137,13 @@ char *kalidescope_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) } } +// Return our group (all the same): +int kalidescope_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PATTERN_PAINTING; +} + + // Return our descriptions, localized: char *kalidescope_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/light.c b/magic/src/light.c index fec3df08c..bc718f885 100644 --- a/magic/src/light.c +++ b/magic/src/light.c @@ -4,7 +4,7 @@ Light Magic Tool Plugin 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 http://www.tuxpaint.org/ @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: July 8, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -45,6 +45,7 @@ int light_init(magic_api * api); int light_get_tool_count(magic_api * api); SDL_Surface *light_get_icon(magic_api * api, int which); char *light_get_name(magic_api * api, int which); +int light_get_group(magic_api * api, int which); char *light_get_description(magic_api * api, int which, int mode); static void do_light(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); void light_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -103,6 +104,12 @@ char *light_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE return (strdup(gettext_noop("Light"))); } +// Return our groups: +int light_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + // Return our descriptions, localized: char *light_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/metalpaint.c b/magic/src/metalpaint.c index e2efb56af..ccac92214 100644 --- a/magic/src/metalpaint.c +++ b/magic/src/metalpaint.c @@ -4,7 +4,7 @@ Metal Paint Magic Tool Plugin 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 http://www.tuxpaint.org/ @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: July 8, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -43,6 +43,7 @@ int metalpaint_init(magic_api * api); int metalpaint_get_tool_count(magic_api * api); SDL_Surface *metalpaint_get_icon(magic_api * api, int which); char *metalpaint_get_name(magic_api * api, int which); +int metalpaint_get_group(magic_api * api, int which); char *metalpaint_get_description(magic_api * api, int which, int mode); static void do_metalpaint(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -98,6 +99,12 @@ char *metalpaint_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_ return (strdup(gettext_noop("Metal Paint"))); } +// Return our groups: +int metalpaint_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + // Return our descriptions, localized: char *metalpaint_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)