switchin() and switchout() now accept mode.

This commit is contained in:
William Kendrick 2008-07-10 20:26:38 +00:00
parent 0b7b36c734
commit f556b503b9
34 changed files with 103 additions and 82 deletions

View file

@ -6,7 +6,7 @@
bill@newbreedsoftware.com
http://www.tuxpaint.org/
July 5, 2007 - July 8, 2008
July 5, 2007 - July 10, 2008
----------------------------------------------------------------------
@ -271,9 +271,9 @@ Interfaces
Plugin event functions:
* void switchin(magic_api * api, int which,
* void switchin(magic_api * api, int which, int mode,
SDL_Surface * snapshot, SDL_Surface * canvas)
void switchout(magic_api * api, int which,
void switchout(magic_api * api, int which, int mode,
SDL_Surface * snapshot, SDL_Surface * canvas)
switchin() is called whenever one of the plugin's Magic tools
becomes active, and switchout() is called whenever one becomes
@ -290,6 +290,11 @@ Interfaces
tool is first 'switched-out', and then 'switched-back-in',
usually moments later.
Finally, it can also happen when the user changes the 'mode' of
a tool (i.e., from paint mode to full-image mode). First
switchout() is called for the old mode, then switchin() is
called for the new mode.
These functions allow users to interact in complicated was with
Magic tools (for example, a tool that lets the user draw
multiple freehand strokes, and then uses that as input such as

View file

@ -15,7 +15,7 @@ New Breed Software</p>
<p><a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a><br>
<a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p>
<p>July 5, 2007 - July 8, 2008</p>
<p>July 5, 2007 - July 10, 2008</p>
</center>
<hr size=2 noshade>
@ -352,11 +352,11 @@ then the names of your functions must begin with "<code><b>zoom_</b></code>"
<ul>
<li><code><b>void switchin(magic_api&nbsp;*&nbsp;api,
int&nbsp;which,
int&nbsp;which, int&nbsp;mode,
SDL_Surface&nbsp;*&nbsp;snapshot, SDL_Surface&nbsp;*&nbsp;canvas)
</b></code><br>
<code><b>void switchout(magic_api&nbsp;*&nbsp;api,
int&nbsp;which,
int&nbsp;which, int&nbsp;mode,
SDL_Surface&nbsp;*&nbsp;snapshot, SDL_Surface&nbsp;*&nbsp;canvas)
</b></code><br>
<code>switchin()</code> is called whenever one of the plugin's Magic
@ -374,6 +374,11 @@ then the names of your functions must begin with "<code><b>zoom_</b></code>"
Magic tool is first 'switched-out', and then 'switched-back-in', usually
moments later.<br>
<br>
Finally, it can also happen when the user changes the 'mode' of a tool
(i.e., from paint mode to full-image mode). First
<code>switchout()</code> is called for the old mode, then
<code>switchin()</code> is called for the new mode.<br>
<br>
These functions allow users to interact in complicated was with Magic
tools (for example, a tool that lets the user draw <i>multiple</i>
freehand strokes, and then uses that as input such as handwriting &mdash;

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
Last modified: 2008.07.09
Last modified: 2008.07.10
*/
@ -489,13 +489,18 @@ void example_line_callback(void * ptr, int which,
// This happens whenever a Magic tool is enabled, either because the
// user just selected it, or they just came back to "Magic" after using
// another tool (e.g., Brush or Text), and this was the most-recently
// selected Magic tool. (This also applies to momentary tools, like
// selected Magic tool.
//
// (This also applies to momentary tools, like
// Undo and Redo, and image-changing tools such as New and Open.)
//
// It also happens when a Magic tool's mode changes (it first
// receives a 'switchout()', below, for the old mode).
//
// Our example doesn't do anything when we switch to, or away from, our
// Magic tools, so we just do nothing here.
void example_switchin(magic_api * api, int which, SDL_Surface * canvas)
void example_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
{
}
@ -504,14 +509,17 @@ void example_switchin(magic_api * api, int which, SDL_Surface * canvas)
// This happens whenever a Magic tool is disabled, either because the
// user selected a different Magic tool, or they selected a completely
// different tool (e.g., Brush or Text).
//
// (This also applies to momentary tools, like Undo and Redo, and
// image-changing tools such as New and Open, in which case the
// switchin() function will be called moments later.)
//
// It also happens when a Magic tool's mode changes (it then
// receives a 'switchin()', above, for the new mode).
//
// Our example doesn't do anything when we switch to, or away from, our
// Magic tools, so we just do nothing here.
void example_switchout(magic_api * api, int which, SDL_Surface * canvas)
void example_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
{
}