From 1d5dd8eb9fc6259f8f7af45040e05c95880bfd0c Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 21 Sep 2021 01:02:22 -0700 Subject: [PATCH] Finished organizing Magic tools; updated docs Added group code to `tp_magic_example.c`, and documented in the "Creating Tux Paint Magic Tool Plugins" docs. --- magic/docs/en/README.txt | 29 ++++++++++++++++- magic/docs/en/html/README.html | 22 ++++++++++++- magic/docs/tp_magic_example.c | 27 +++++++++++++++- magic/src/pixels.c | 11 +++++-- magic/src/puzzle.c | 10 +++++- magic/src/rails.c | 7 ++++ magic/src/rainbow.c | 11 +++++-- magic/src/ripples.c | 11 +++++-- magic/src/rosette.c | 10 +++++- magic/src/sharpen.c | 7 ++++ magic/src/smudge.c | 14 ++++++-- magic/src/string.c | 59 ++++++++++++++-------------------- magic/src/tint.c | 11 +++++-- magic/src/toothpaste.c | 15 +++++++-- magic/src/tornado.c | 11 +++++-- magic/src/xor.c | 14 +++++--- 16 files changed, 209 insertions(+), 60 deletions(-) diff --git a/magic/docs/en/README.txt b/magic/docs/en/README.txt index 672494c2d..ebca41f46 100644 --- a/magic/docs/en/README.txt +++ b/magic/docs/en/README.txt @@ -3,7 +3,7 @@ Copyright 2007-2021 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - July 5, 2007 - February 20, 2021 + July 5, 2007 - September 21, 2021 ---------------------------------------------------------------------- @@ -204,6 +204,33 @@ Interfaces Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). + * int get_group(magic_api * api, int which) + Use this to group tools together within sections of the 'Magic' + selector. A number of groups are pre-defined within an enum + found in "tp_magic_api.h": + * MAGIC_TYPE_DISTORTS mdash; Tools that distort the shape of + the image, like Blur, Emboss, and Ripples + * MAGIC_TYPE_COLOR_FILTERS mdash; Tools that mostly affect + the colors of the image without distortion, like Darken, + Negative, and Tint + * MAGIC_TYPE_PICTURE_WARPS mdash; Tools that warp or move the + entire picture, like Shift, Flip, and Waves + * MAGIC_TYPE_PAINTING mdash; Tools that generally paint new + content at the cursor position, like Grass, Bricks, and + Rails + * MAGIC_TYPE_PATTERN_PAINTING mdash; Tools that paint in + multiple places at once, like Kaleidoscope and the Symmetry + tools + * MAGIC_TYPE_PICTURE_DECORATIONS mdash; Tools that apply + decorations to the entire picture, like Blinds and + Checkboard + * MAGIC_TYPE_ARTISTIC mdash; Special-purpose artistic tools, + like Flower, the String tools, and the Rainbow-arc-drawing + tools. + Note: Called once for each Magic tool your plugin claims to + contain (by your "get_tool_count()"). + Note: Added to Tux Paint 0.9.27; Magic API version '0x00000005' + * SDL_Surface * get_icon(magic_api * api, int which) This should return an SDL_Surface containing the icon representing the tool. (A greyscale image with alpha, no larger diff --git a/magic/docs/en/html/README.html b/magic/docs/en/html/README.html index 23b246a99..74c0c826e 100644 --- a/magic/docs/en/html/README.html +++ b/magic/docs/en/html/README.html @@ -12,7 +12,7 @@ alink="#FF00FF">

Copyright 2007-2021 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/

-

July 5, 2007 - February 20, 2021

+

July 5, 2007 - September 21, 2021


@@ -266,6 +266,26 @@ then the names of your functions must begin with "zoom_" contain (by your "get_tool_count()").

+
  • int get_group(magic_api * api, + int which)
    + Use this to group tools together within sections of the + 'Magic' selector. A number of groups are pre-defined within + an enum found in "tp_magic_api.h": + + Note: Called once for each Magic tool your plugin claims to + contain (by your "get_tool_count()").
    + Note: Added to Tux Paint 0.9.27; Magic API version + '0x00000005'
    +
    +
  • SDL_Surface * get_icon(magic_api * api, int which)
    This should return an SDL_Surface containing the icon representing diff --git a/magic/docs/tp_magic_example.c b/magic/docs/tp_magic_example.c index 096204794..8d0e615c6 100644 --- a/magic/docs/tp_magic_example.c +++ b/magic/docs/tp_magic_example.c @@ -1,7 +1,7 @@ /* tp_magic_example.c An example of a "Magic" tool plugin for Tux Paint - Last modified: 2008.07.10 + Last modified: 2021.09.21 */ @@ -56,6 +56,15 @@ const char *names[NUM_TOOLS] = { }; +/* How to group the tools with other similar tools, + within the 'Magic' selector: */ + +const int groups[NUM_TOOLS] = { + MAGIC_TYPE_PAINTING, + MAGIC_TYPE_DISTORTS +}; + + /* A list of descriptions of the tools */ const char *descs[NUM_TOOLS] = { @@ -225,6 +234,22 @@ char *example_get_name(magic_api * api, int which) } +// Report our "Magic" tool groups +// +// When Tux Paint is starting up and loading plugins, it asks us to +// specify where the tool should be grouped. + +int example_get_group(magic_api * api, int which) +{ + // Return our group from the "groups[]" array. + // + // We use 'which' (which of our tools Tux Paint is asking about) + // as an index into the array. + + return (groups[which]); +} + + // Report our "Magic" tool descriptions // // When Tux Paint is starting up and loading plugins, it asks us to diff --git a/magic/src/pixels.c b/magic/src/pixels.c index 06daf40bb..4b47f13f5 100644 --- a/magic/src/pixels.c +++ b/magic/src/pixels.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: January 6, 2021 + Last updated: September 21, 2021 $Id$ */ @@ -55,6 +55,7 @@ Uint32 pixels_api_version(void); int pixels_get_tool_count(magic_api * api); SDL_Surface *pixels_get_icon(magic_api * api, int which); char *pixels_get_name(magic_api * api, int which); +int pixels_get_group(magic_api * api, int which); char *pixels_get_description(magic_api * api, int which, int mode); void pixels_drag(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect); @@ -103,11 +104,15 @@ SDL_Surface *pixels_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED) // Return our names, localized: char *pixels_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { - /* Both are named "Pixels", at the moment: */ - return (strdup(gettext_noop("Pixels"))); } +// Return our group (both the same): +int pixels_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + // Return our descriptions, localized: char *pixels_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/puzzle.c b/magic/src/puzzle.c index 58c6fa083..cdb766d0b 100644 --- a/magic/src/puzzle.c +++ b/magic/src/puzzle.c @@ -6,7 +6,7 @@ Author: Adam 'foo-script' Rakowski ; foo-script@o2.pl - Copyright (c) 2002-2009 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,6 +24,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) + + Last updated: September 21, 2021 */ @@ -52,6 +54,7 @@ int puzzle_init(magic_api * api); int puzzle_get_tool_count(magic_api * api); SDL_Surface *puzzle_get_icon(magic_api * api, int which); char *puzzle_get_name(magic_api * api, int which); +int puzzle_get_group(magic_api * api, int which); char *puzzle_get_description(magic_api * api, int which, int mode); void puzzle_release(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect); @@ -103,6 +106,11 @@ char *puzzle_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS return (strdup(gettext_noop("Puzzle"))); } +int puzzle_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_DISTORTS; +} + char *puzzle_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode) { diff --git a/magic/src/rails.c b/magic/src/rails.c index d203f8227..0488d3550 100644 --- a/magic/src/rails.c +++ b/magic/src/rails.c @@ -1,3 +1,4 @@ +/* Last modified: 2021-09-21 */ #include "tp_magic_api.h" #include "SDL_image.h" #include "SDL_mixer.h" @@ -44,6 +45,7 @@ int rails_init(magic_api * api); int rails_get_tool_count(magic_api * api); SDL_Surface *rails_get_icon(magic_api * api, int which); char *rails_get_name(magic_api * api, int which); +int rails_get_group(magic_api * api, int which); char *rails_get_description(magic_api * api, int which, int mode); int rails_requires_colors(magic_api * api, int which); void rails_release(magic_api * api, int which, @@ -129,6 +131,11 @@ char *rails_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE return strdup(gettext_noop("Rails")); } +int rails_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + char *rails_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Click and drag to draw train track rails on your picture.")); diff --git a/magic/src/rainbow.c b/magic/src/rainbow.c index cf0728ded..012270acc 100644 --- a/magic/src/rainbow.c +++ b/magic/src/rainbow.c @@ -4,7 +4,7 @@ Rainbow 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$ */ @@ -72,6 +72,7 @@ Uint32 rainbow_api_version(void); int rainbow_get_tool_count(magic_api * api); SDL_Surface *rainbow_get_icon(magic_api * api, int which); char *rainbow_get_name(magic_api * api, int which); +int rainbow_get_group(magic_api * api, int which); char *rainbow_get_description(magic_api * api, int which, int mode); static void rainbow_linecb(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); @@ -133,6 +134,12 @@ char *rainbow_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU return (strdup(gettext_noop("Rainbow"))); } +// Return our group: +int rainbow_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PAINTING; +} + // Return our descriptions, localized: char *rainbow_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/ripples.c b/magic/src/ripples.c index 07a65970b..32ad614db 100644 --- a/magic/src/ripples.c +++ b/magic/src/ripples.c @@ -4,7 +4,7 @@ Ripples 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$ */ @@ -46,6 +46,7 @@ int ripples_init(magic_api * api); int ripples_get_tool_count(magic_api * api); SDL_Surface *ripples_get_icon(magic_api * api, int which); char *ripples_get_name(magic_api * api, int which); +int ripples_get_group(magic_api * api, int which); char *ripples_get_description(magic_api * api, int which, int mode); void ripples_drag(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect); @@ -102,6 +103,12 @@ char *ripples_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU return (strdup(gettext_noop("Ripples"))); } +// Return our groups: +int ripples_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_DISTORTS; +} + // Return our descriptions, localized: char *ripples_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/rosette.c b/magic/src/rosette.c index 25b4e55bf..d680c5740 100644 --- a/magic/src/rosette.c +++ b/magic/src/rosette.c @@ -6,7 +6,7 @@ Credits: Adam 'foo-script' Rakowski - 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,6 +24,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) + + Last updated: September 21, 2021 */ // sound only plays on release @@ -54,6 +56,7 @@ int rosette_init(magic_api * api); int rosette_get_tool_count(magic_api * api); SDL_Surface *rosette_get_icon(magic_api * api, int which); char *rosette_get_name(magic_api * api, int which); +int rosette_get_group(magic_api * api, int which); char *rosette_get_description(magic_api * api, int which, int mode); int rosette_requires_colors(magic_api * api, int which); void rosette_release(magic_api * api, int which, @@ -117,6 +120,11 @@ char *rosette_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) return strdup(gettext_noop("Picasso")); } +int rosette_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_PATTERN_PAINTING; +} + char *rosette_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) { if (!which) diff --git a/magic/src/sharpen.c b/magic/src/sharpen.c index 5cb80844e..49b0e2b2b 100644 --- a/magic/src/sharpen.c +++ b/magic/src/sharpen.c @@ -92,6 +92,7 @@ int sharpen_init(magic_api * api); int sharpen_get_tool_count(magic_api * api); SDL_Surface *sharpen_get_icon(magic_api * api, int which); char *sharpen_get_name(magic_api * api, int which); +int sharpen_get_group(magic_api * api, int which); char *sharpen_get_description(magic_api * api, int which, int mode); static int sharpen_grey(Uint8 r1, Uint8 g1, Uint8 b1); static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); @@ -155,6 +156,12 @@ char *sharpen_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) return (strdup(gettext_noop(sharpen_names[which]))); } +// Return our group (all the same): +int sharpen_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_DISTORTS; +} + // Return our descriptions, localized: char *sharpen_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode) { diff --git a/magic/src/smudge.c b/magic/src/smudge.c index efa9506e2..1d287abd2 100644 --- a/magic/src/smudge.c +++ b/magic/src/smudge.c @@ -7,7 +7,7 @@ Smudge by Albert Cahalan Wet Paint addition by Bill Kendrick - Copyright (c) 2002-2011 + Copyright (c) 2002-2021 http://www.tuxpaint.org/ This program is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: Oconter 8, 2009 + Last updated: September 21, 2021 $Id$ */ @@ -44,6 +44,7 @@ int smudge_init(magic_api * api); Uint32 smudge_api_version(void); SDL_Surface *smudge_get_icon(magic_api * api, int which); char *smudge_get_name(magic_api * api, int which); +int smudge_get_group(magic_api * api, int which); char *smudge_get_description(magic_api * api, int which, int mode); static void do_smudge(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); void smudge_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -104,6 +105,15 @@ char *smudge_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) return (strdup(gettext_noop("Wet Paint"))); } +// Return our groups +int smudge_get_group(magic_api * api ATTRIBUTE_UNUSED, int which) +{ + if (which == 0) + return MAGIC_TYPE_DISTORTS; /* Smudge */ + else + return MAGIC_TYPE_PAINTING; /* Wet Paint */ +} + // Return our descriptions, localized: char *smudge_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/string.c b/magic/src/string.c index 24b3c16c6..23aaf98c6 100644 --- a/magic/src/string.c +++ b/magic/src/string.c @@ -1,7 +1,7 @@ /* * Strings -- draws string art. * - * Last modified: 2019-08-29 + * Last modified: 2021-09-21 */ #include "tp_magic_api.h" #include "SDL_image.h" @@ -59,6 +59,7 @@ void string_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b); int string_get_tool_count(magic_api * api); SDL_Surface *string_get_icon(magic_api * api, int which); char *string_get_name(magic_api * api, int which); +int string_get_group(magic_api * api, int which); char *string_get_description(magic_api * api, int which, int mode); int string_requires_colors(magic_api * api, int which); void string_release(magic_api * api, int which, @@ -77,7 +78,7 @@ Uint32 string_api_version(void) return (TP_MAGIC_API_VERSION); } -int string_modes( __attribute__ ((unused)) magic_api * api, int which) +int string_modes(magic_api * api ATTRIBUTE_UNUSED, int which) { if (which == STRING_TOOL_FULL_BY_OFFSET) return (MODE_PAINT); @@ -85,7 +86,7 @@ int string_modes( __attribute__ ((unused)) magic_api * api, int which) return (MODE_PAINT_WITH_PREVIEW); } -void string_set_color( __attribute__ ((unused)) magic_api * api, Uint8 r, Uint8 g, Uint8 b) +void string_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b) { string_r = r; string_g = g; @@ -94,7 +95,7 @@ void string_set_color( __attribute__ ((unused)) magic_api * api, Uint8 r, Uint8 -int string_get_tool_count( __attribute__ ((unused)) magic_api * api) +int string_get_tool_count(magic_api * api ATTRIBUTE_UNUSED) { return STRING_NUMTOOLS; } @@ -120,8 +121,7 @@ SDL_Surface *string_get_icon(magic_api * api, int which) } -char *string_get_name( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused)) - int which) +char *string_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { switch (which) { @@ -136,8 +136,12 @@ char *string_get_name( __attribute__ ((unused)) magic_api * api, __attribute__ ( } } -char *string_get_description( __attribute__ ((unused)) magic_api * api, int which, __attribute__ ((unused)) - int mode) +int string_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_ARTISTIC; +} + +char *string_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) { switch (which) { @@ -154,8 +158,7 @@ char *string_get_description( __attribute__ ((unused)) magic_api * api, int whic } } -int string_requires_colors( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused)) - int which) +int string_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return 1; } @@ -180,7 +183,7 @@ void string_release(magic_api * api, int which, } } -int string_init( __attribute__ ((unused)) magic_api * api) +int string_init(magic_api * api ATTRIBUTE_UNUSED) { char fname[1024]; @@ -196,7 +199,7 @@ int string_init( __attribute__ ((unused)) magic_api * api) return (1); } -void string_shutdown( __attribute__ ((unused)) magic_api * api) +void string_shutdown(magic_api * api ATTRIBUTE_UNUSED) { int i = 0; @@ -211,19 +214,14 @@ void string_shutdown( __attribute__ ((unused)) magic_api * api) } } -void string_switchin( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused)) - int which, __attribute__ ((unused)) - int mode, SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot) +void string_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED) { canvas_backup = SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask); } -void string_switchout( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused)) - int which, __attribute__ ((unused)) - int mode, __attribute__ ((unused)) SDL_Surface * canvas, - __attribute__ ((unused)) SDL_Surface * snapshot) +void string_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED) { SDL_FreeSurface(canvas_backup); canvas_backup = NULL; @@ -232,8 +230,7 @@ void string_switchout( __attribute__ ((unused)) magic_api * api, __attribute__ ( // Interactivity functions -void string_callback(void *ptr, __attribute__ ((unused)) - int which, SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot, int x, int y) +void string_callback(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y) { magic_api *api = (magic_api *) ptr; @@ -241,8 +238,7 @@ void string_callback(void *ptr, __attribute__ ((unused)) } -void string_click(magic_api * api, int which, __attribute__ ((unused)) - int mode, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect) +void string_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect) { SDL_BlitSurface(canvas, NULL, canvas_backup, NULL); @@ -253,8 +249,7 @@ void string_click(magic_api * api, int which, __attribute__ ((unused)) string_drag(api, which, canvas, snapshot, x, y, x, y, update_rect); } -static void string_draw_full_by_offset(void *ptr, __attribute__ ((unused)) - int which, SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot, +static void string_draw_full_by_offset(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect) { magic_api *api = (magic_api *) ptr; @@ -377,9 +372,7 @@ void string_draw_triangle_preview(magic_api * api, int which, } void string_draw_angle_preview(magic_api * api, int which, - SDL_Surface * canvas, SDL_Surface * snapshot, __attribute__ ((unused)) - int ox, __attribute__ ((unused)) - int oy, int x, int y, SDL_Rect * update_rect) + SDL_Surface * canvas, SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect) { int middle_x, middle_y; int dx, dy; @@ -411,11 +404,8 @@ void string_draw_angle_preview(magic_api * api, int which, } -void string_draw_angle(magic_api * api, __attribute__ ((unused)) - int which, - SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot, __attribute__ ((unused)) - int ox, __attribute__ ((unused)) - int oy, int x, int y, SDL_Rect * update_rect) +void string_draw_angle(magic_api * api, int which ATTRIBUTE_UNUSED, + SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect) { float first_arm_step_x, first_arm_step_y, second_arm_step_x, second_arm_step_y; int i; @@ -445,8 +435,7 @@ void string_draw_angle(magic_api * api, __attribute__ ((unused)) } } -void string_draw_triangle(magic_api * api, __attribute__ ((unused)) - int which, +void string_draw_triangle(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect) { diff --git a/magic/src/tint.c b/magic/src/tint.c index b17c66098..502353550 100644 --- a/magic/src/tint.c +++ b/magic/src/tint.c @@ -10,7 +10,7 @@ Credits: Andrew Corcoran - Copyright (c) 2002-2009 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/ @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: May 6, 2009 + Last updated: September 21, 2021 $Id$ */ @@ -87,6 +87,7 @@ Uint32 tint_api_version(void); int tint_get_tool_count(magic_api * api); SDL_Surface *tint_get_icon(magic_api * api, int which); char *tint_get_name(magic_api * api, int which); +int tint_get_group(magic_api * api, int which); char *tint_get_description(magic_api * api, int which, int mode); static int tint_grey(Uint8 r1, Uint8 g1, Uint8 b1); static void do_tint_pixel(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); @@ -144,6 +145,12 @@ char *tint_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) return (strdup(gettext_noop(tint_names[which]))); } +// Return our group (both the same): +int tint_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_COLOR_FILTERS; +} + // Return our descriptions, localized: char *tint_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode) { diff --git a/magic/src/toothpaste.c b/magic/src/toothpaste.c index 11f452af5..b2ddaee98 100644 --- a/magic/src/toothpaste.c +++ b/magic/src/toothpaste.c @@ -6,7 +6,7 @@ Credits: Andrew Corcoran - Copyright (c) 2002-2007 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/ @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: June 6, 2008 + Last updated: September 21, 2021 $Id$ */ @@ -68,6 +68,10 @@ const char *toothpaste_names[toothpaste_NUM_TOOLS] = { gettext_noop("Toothpaste"), }; +const int toothpaste_groups[toothpaste_NUM_TOOLS] = { + MAGIC_TYPE_PAINTING, +}; + const char *toothpaste_descs[toothpaste_NUM_TOOLS] = { gettext_noop("Click and drag to squirt toothpaste onto your picture."), }; @@ -78,6 +82,7 @@ int toothpaste_init(magic_api * api); int toothpaste_get_tool_count(magic_api * api); SDL_Surface *toothpaste_get_icon(magic_api * api, int which); char *toothpaste_get_name(magic_api * api, int which); +int toothpaste_get_group(magic_api * api, int which); char *toothpaste_get_description(magic_api * api, int which, int mode); static void do_toothpaste(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y); void toothpaste_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -156,6 +161,12 @@ char *toothpaste_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) return (strdup(gettext_noop(toothpaste_names[which]))); } +// Return our groups: +int toothpaste_get_group(magic_api * api ATTRIBUTE_UNUSED, int which) +{ + return toothpaste_groups[which]; +} + // Return our descriptions, localized: char *toothpaste_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/tornado.c b/magic/src/tornado.c index ad08e376d..857879593 100644 --- a/magic/src/tornado.c +++ b/magic/src/tornado.c @@ -4,7 +4,7 @@ Tornado 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/ @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: May 29, 2009 + Last updated: September 21, 2021 $Id$ */ @@ -78,6 +78,7 @@ int tornado_init(magic_api * api); int tornado_get_tool_count(magic_api * api); SDL_Surface *tornado_get_icon(magic_api * api, int which); char *tornado_get_name(magic_api * api, int which); +int tornado_get_group(magic_api * api, int which); char *tornado_get_description(magic_api * api, int which, int mode); @@ -153,6 +154,12 @@ char *tornado_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU return (strdup(gettext_noop("Tornado"))); } +// Return our groups: +int tornado_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_ARTISTIC; +} + // Return our descriptions, localized: char *tornado_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/magic/src/xor.c b/magic/src/xor.c index 8eff1df69..d5701fe00 100644 --- a/magic/src/xor.c +++ b/magic/src/xor.c @@ -6,11 +6,7 @@ Tux Paint - A simple drawing program for children. - Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt - bill@newbreedsoftware.com - http://www.tuxpaint.org/ - - Copyright (c) 2013 by Lukasz Dmitrowski + Copyright (c) 2013-2021 by Lukasz Dmitrowski This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +22,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) + + Last updated: September 21, 2021 */ #include @@ -41,6 +39,7 @@ int xor_init(magic_api * api); int xor_get_tool_count(magic_api * api); SDL_Surface *xor_get_icon(magic_api * api, int which); char *xor_get_name(magic_api * api, int which); +int xor_get_group(magic_api * api, int which); char *xor_get_description(magic_api * api, int which, int mode); void xor_drag(magic_api * api, int which, SDL_Surface * canvas, @@ -93,6 +92,11 @@ char *xor_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) return (strdup(gettext_noop("Xor Colors"))); } +int xor_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return MAGIC_TYPE_COLOR_FILTERS; +} + char *xor_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode) { if (mode == MODE_PAINT)