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.
This commit is contained in:
Bill Kendrick 2021-09-21 01:02:22 -07:00
parent 5882a48412
commit 1d5dd8eb9f
16 changed files with 209 additions and 60 deletions

View file

@ -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