Magic tools can now be both painted and full-image.

Negative tool now does this.
This commit is contained in:
William Kendrick 2008-07-09 02:46:54 +00:00
parent 8c6fbb8cf5
commit 472692fbab
38 changed files with 453 additions and 79 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

View file

@ -19,10 +19,18 @@ $Id$
* BlurAll, Sharpen and BlackandWhite * BlurAll, Sharpen and BlackandWhite
Andrew Corcoran <akanewbie@gmail.com> Andrew Corcoran <akanewbie@gmail.com>
* Magic Tool Plug-in API Updates: * Magic Tool Improvememnts:
------------------------------- --------------------------
* Added "_switchin()" and "_switchout()" functions, to tell Magic tools * Added "_switchin()" and "_switchout()" functions to Magic tool API,
when they are selected or deselected. to tell Magic tools when they are selected or deselected.
* Added "_modes()" function to Magic tool API, so Magic tool plugins
can tell Tux Paint what modes it accepts, 'paint' or 'fullscreen'.
* "Paint" and "Fullscreen" control buttons added to Magic tool
selector UI. Can be disabled with "--nomagiccontrols".
* "Negative" tool can now affect the entire image.
* Build System Improvements * Build System Improvements
------------------------- -------------------------

View file

@ -9,7 +9,7 @@ Options Documentation
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
July 7, 2008 July 8, 2008
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -324,6 +324,12 @@ Windows Users
have their size changed. This option disables the controls, and have their size changed. This option disables the controls, and
only provides the basic stamps. only provides the basic stamps.
nomagiccontrols=yes
Some Magic tools have the option of acting like a paintbrush, or
affecting the entire canvas at once. This option disables the
controls, and only provides the default functionality (usually
paint-mode).
mirrorstamps=yes mirrorstamps=yes
For stamps that can be mirrored, this option sets them to their For stamps that can be mirrored, this option sets them to their
@ -701,6 +707,7 @@ Windows Users
--nooutlines --nooutlines
--nostamps --nostamps
--nostampcontrols --nostampcontrols
--nomagiccontrols
--sysfonts --sysfonts
--mirrorstamps --mirrorstamps
--stampsize=SIZE --stampsize=SIZE
@ -741,6 +748,7 @@ Windows Users
--outlines --outlines
--stamps --stamps
--stampcontrols --stampcontrols
--magiccontrols
--nosysfonts --nosysfonts
--dontmirrorstamps --dontmirrorstamps
--stampsize=default --stampsize=default

View file

@ -23,7 +23,7 @@ New Breed Software</p>
<a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p> <a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p>
<p>July 7, 2008</p> <p>July 8, 2008</p>
</center> </center>
@ -407,6 +407,14 @@ New Breed Software</p>
and only provides the basic stamps. and only provides the basic stamps.
</dd> </dd>
<dt><code><b>nomagiccontrols=yes</b></code></dt>
<dd>
Some <b>Magic</b> tools have the option of acting like a paintbrush,
or affecting the entire canvas at once.
This option disables the controls, and only provides the default
functionality (usually paint-mode).
</dd>
<dt><code><b>mirrorstamps=yes</b></code></dt> <dt><code><b>mirrorstamps=yes</b></code></dt>
<dd> <dd>
<p>For stamps that can be mirrored, this option sets them to their <p>For stamps that can be mirrored, this option sets them to their
@ -1076,6 +1084,7 @@ New Breed Software</p>
--nooutlines<br> --nooutlines<br>
--nostamps<br> --nostamps<br>
--nostampcontrols<br> --nostampcontrols<br>
--nomagiccontrols<br>
--sysfonts<br> --sysfonts<br>
--mirrorstamps<br> --mirrorstamps<br>
--stampsize=<i>SIZE</i><br> --stampsize=<i>SIZE</i><br>
@ -1119,6 +1128,7 @@ New Breed Software</p>
--outlines<br> --outlines<br>
--stamps<br> --stamps<br>
--stampcontrols<br> --stampcontrols<br>
--magiccontrols<br>
--nosysfonts<br> --nosysfonts<br>
--dontmirrorstamps<br> --dontmirrorstamps<br>
--stampsize=default<br> --stampsize=default<br>

View file

@ -6,7 +6,7 @@
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
July 5, 2007 - July 7, 2008 July 5, 2007 - July 8, 2008
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -236,6 +236,24 @@ Interfaces
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
* int modes(magic_api * api, int which)
This lets you tell Tux Paint what modes your tool can be used in
(either as a tool the user can paint with, or a tool that
affects the entire drawing at once)
You must return a value that's some combination of one or more
of available modes:
* MODE_PAINT
* MODE_FULLSCREEN
e.g., if your tool is only one that the user can paint with,
return "MODE_PAINT". If the user can do both, return
"MODE_PAINT | MODE_FULLSCREEN" to tell Tux Paint it can do both.
Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()").
Note: Added to Tux Paint 0.9.21; Magic API version '0x00000002'
* void shutdown(magic_api * api) * void shutdown(magic_api * api)
The plugin should do any cleanup here. If you allocated any The plugin should do any cleanup here. If you allocated any
memory or used SDL_Mixer to load any sounds during init(), for memory or used SDL_Mixer to load any sounds during init(), for

View file

@ -15,7 +15,7 @@ New Breed Software</p>
<p><a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a><br> <p><a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a><br>
<a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p> <a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p>
<p>July 5, 2007 - July 7, 2008</p> <p>July 5, 2007 - July 8, 2008</p>
</center> </center>
<hr size=2 noshade> <hr size=2 noshade>
@ -305,6 +305,30 @@ then the names of your functions must begin with "<code><b>zoom_</b></code>"
contain (by your "<code>get_tool_count()</code>").<br> contain (by your "<code>get_tool_count()</code>").<br>
<br> <br>
<li><code><b>int modes(magic_api&nbsp;*&nbsp;api,
int&nbsp;which)</b></code><br>
This lets you tell Tux&nbsp;Paint what modes your tool can be used in
(either as a tool the user can paint with, or a tool that affects
the entire drawing at once)<br>
<br>
You must return a value that's some combination of one or more of
available modes:
<ul>
<li><code>MODE_PAINT</code>
<li><code>MODE_FULLSCREEN</code>
</ul>
e.g., if your tool is only one that the user can paint with,
return "<code>MODE_PAINT</code>". If the user can do both,
return "<code>MODE_PAINT&nbsp;|&nbsp;MODE_FULLSCREEN</code>"
to tell Tux&nbsp;Paint it can do both.<br>
<br>
<b>Note:</b> Called once for each Magic tool your plugin claims to
contain (by your "<code>get_tool_count()</code>").<br>
<br>
<i>Note: Added to Tux&nbsp;Paint 0.9.21; Magic API version
'0x00000002'</i><br>
<br>
<li><code><b>void shutdown(magic_api&nbsp;*&nbsp;api)</b></code><br> <li><code><b>void shutdown(magic_api&nbsp;*&nbsp;api)</b></code><br>
The plugin should do any cleanup here. If you allocated any memory The plugin should do any cleanup here. If you allocated any memory
or used SDL_Mixer to load any sounds during <code>init()</code>, or used SDL_Mixer to load any sounds during <code>init()</code>,

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c /* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint An example of a "Magic" tool plugin for Tux Paint
Last modified: 2008.07.07 Last modified: 2008.07.08
*/ */
@ -282,6 +282,17 @@ int example_requires_colors(magic_api * api, int which)
} }
// Report what modes we work in
int example_modes(magic_api * api, int which)
{
// Both of our tools are painted (neither affect the full-screen),
// so we're always returning 'MODE_PAINT'
return MODE_PAINT;
}
// Shut down // Shut down
// //
// Tux Paint is quitting. When it quits, it asks all of the plugins // Tux Paint is quitting. When it quits, it asks all of the plugins

View file

@ -4,6 +4,8 @@
blackAndWhite, Convert the image to greyscale or threshold it into pure black and pure white blackAndWhite, Convert the image to greyscale or threshold it into pure black and pure white
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
FIXME: Credits
Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
@ -23,7 +25,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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -162,7 +164,7 @@ void blackAndWhite_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void blackAndWhite_click(magic_api * api, int which, void blackAndWhite_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect){ int x, int y, SDL_Rect * update_rect){
update_rect->x = 0; update_rect->x = 0;
@ -211,3 +213,7 @@ void blackAndWhite_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int blackAndWhite_modes(magic_api * api, int which)
{
return(MODE_FULLSCREEN); /* FIXME - Can also be turned into a painted effect */
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -62,7 +62,7 @@ static void blocks_chalk_drip_linecb(void * ptr, int which,
void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas, void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect); SDL_Rect * update_rect);
void blocks_chalk_drip_click(magic_api * api, int which, void blocks_chalk_drip_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect); int x, int y, SDL_Rect * update_rect);
void blocks_chalk_drip_release(magic_api * api, int which, void blocks_chalk_drip_release(magic_api * api, int which,
@ -285,7 +285,7 @@ void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void blocks_chalk_drip_click(magic_api * api, int which, void blocks_chalk_drip_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -329,3 +329,7 @@ void blocks_chalk_drip_switchout(magic_api * api, int which, SDL_Surface * canva
{ {
} }
int blocks_chalk_drip_modes(magic_api * api, int which)
{
return(MODE_PAINT); /* FIXME - Blocks and Chalk, at least, can also be turned into a full-image effect */
}

View file

@ -25,7 +25,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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -174,7 +174,7 @@ void blur_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void blur_click(magic_api * api, int which, void blur_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -213,3 +213,7 @@ void blur_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int blur_modes(magic_api * api, int which)
{
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */ /* FIXME: Merge with blurAll */
}

View file

@ -4,6 +4,8 @@
blurAll, Blur the whole image blurAll, Blur the whole image
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
FIXME: Credits
Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
@ -23,7 +25,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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -145,7 +147,7 @@ void blurAll_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void blurAll_click(magic_api * api, int which, void blurAll_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect){ int x, int y, SDL_Rect * update_rect){
update_rect->x = 0; update_rect->x = 0;
@ -194,3 +196,7 @@ void blurAll_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int blurAll_modes(magic_api * api, int which)
{
return(MODE_FULLSCREEN); /* FIXME - Can also be turned into a painted effect */ /* FIXME: Merge with blur */
}

View file

@ -25,7 +25,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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -224,7 +224,7 @@ void bricks_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void bricks_click(magic_api * api, int which, void bricks_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -302,3 +302,7 @@ void bricks_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int bricks_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -252,7 +252,7 @@ void calligraphy_drag(magic_api * api, int which, SDL_Surface * canvas,
api->playsound(calligraphy_snd, (x * 255) / canvas->w, 255); api->playsound(calligraphy_snd, (x * 255) / canvas->w, 255);
} }
void calligraphy_click(magic_api * api, int which, void calligraphy_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -428,3 +428,7 @@ void calligraphy_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int calligraphy_modes(magic_api * api, int which)
{
return(MODE_FULLSCREEN);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -191,7 +191,7 @@ void cartoon_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void cartoon_click(magic_api * api, int which, void cartoon_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -231,3 +231,7 @@ void cartoon_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int cartoon_modes(magic_api * api, int which)
{
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -150,7 +150,7 @@ void distortion_shutdown(magic_api * api)
// Affect the canvas on click: // Affect the canvas on click:
void distortion_click(magic_api * api, int which, void distortion_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, SDL_Surface * canvas, SDL_Surface * snapshot,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -234,3 +234,7 @@ void distortion_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int distortion_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -147,7 +147,7 @@ void emboss_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void emboss_click(magic_api * api, int which, void emboss_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -187,3 +187,7 @@ void emboss_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int emboss_modes(magic_api * api, int which)
{
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -56,7 +56,7 @@ static void do_fade_darken(void * ptr, int which,
void fade_darken_drag(magic_api * api, int which, SDL_Surface * canvas, void fade_darken_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect); SDL_Rect * update_rect);
void fade_darken_click(magic_api * api, int which, void fade_darken_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect); int x, int y, SDL_Rect * update_rect);
void fade_darken_release(magic_api * api, int which, void fade_darken_release(magic_api * api, int which,
@ -195,7 +195,7 @@ void fade_darken_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Ask Tux Paint to call our 'do_fade_darken()' callback at a single point // Ask Tux Paint to call our 'do_fade_darken()' callback at a single point
void fade_darken_click(magic_api * api, int which, void fade_darken_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -239,3 +239,7 @@ void fade_darken_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int fade_darken_modes(magic_api * api, int which)
{
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
}

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: July 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -103,7 +103,7 @@ void fill_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void fill_click(magic_api * api, int which, void fill_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -254,3 +254,7 @@ void fill_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int fill_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -192,7 +192,7 @@ void flower_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void flower_click(magic_api * api, int which, void flower_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -602,3 +602,7 @@ void flower_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int flower_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -161,7 +161,7 @@ void foam_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void foam_click(magic_api * api, int which, void foam_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -425,3 +425,7 @@ void foam_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int foam_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -218,7 +218,7 @@ void glasstile_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void glasstile_click(magic_api * api, int which, void glasstile_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -287,3 +287,7 @@ void glasstile_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int glasstile_modes(magic_api * api, int which)
{
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
}

View file

@ -24,7 +24,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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -119,7 +119,7 @@ void grass_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void grass_click(magic_api * api, int which, void grass_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -252,3 +252,7 @@ void grass_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int grass_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -128,7 +128,7 @@ void kalidescope_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void kalidescope_click(magic_api * api, int which, void kalidescope_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -172,3 +172,7 @@ void kalidescope_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int kalidescope_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -171,7 +171,7 @@ void light_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void light_click(magic_api * api, int which, void light_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -215,3 +215,7 @@ void light_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int light_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -138,7 +138,7 @@ void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void metalpaint_click(magic_api * api, int which, void metalpaint_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -181,3 +181,7 @@ void metalpaint_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int metalpaint_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -127,7 +127,7 @@ void mirror_flip_release(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void mirror_flip_click(magic_api * api, int which, void mirror_flip_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, int x, int y,
SDL_Rect * update_rect) SDL_Rect * update_rect)
@ -206,3 +206,7 @@ void mirror_flip_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int mirror_flip_modes(magic_api * api, int which)
{
return(MODE_FULLSCREEN);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -126,16 +126,42 @@ void negative_drag(magic_api * api, int which, SDL_Surface * canvas,
api->playsound(negative_snd, (x * 255) / canvas->w, 255); api->playsound(negative_snd, (x * 255) / canvas->w, 255);
SDL_UnlockSurface(canvas); SDL_UnlockSurface(canvas);
SDL_UnlockSurface(last); SDL_UnlockSurface(last);
} }
// Ask Tux Paint to call our 'do_negative()' callback at a single point // Ask Tux Paint to call our 'do_negative()' callback at a single point
void negative_click(magic_api * api, int which, void negative_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
negative_drag(api, which, canvas, last, x, y, x, y, update_rect); if (mode == MODE_PAINT)
negative_drag(api, which, canvas, last, x, y, x, y, update_rect);
else
{
int xx, yy;
Uint8 r, g, b;
for (yy = 0; yy < canvas->h; yy++)
{
for (xx = 0; xx < canvas->w; xx++)
{
SDL_GetRGB(api->getpixel(last, xx, yy), last->format, &r, &g, &b);
r = 0xFF - r;
g = 0xFF - g;
b = 0xFF - b;
api->putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, r, g, b));
}
}
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
}
} }
@ -171,3 +197,7 @@ void negative_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int negative_modes(magic_api * api, int which)
{
return(MODE_PAINT | MODE_FULLSCREEN);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -160,7 +160,7 @@ void rainbow_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void rainbow_click(magic_api * api, int which, void rainbow_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, int x, int y,
SDL_Rect * update_rect) SDL_Rect * update_rect)
@ -201,3 +201,7 @@ void rainbow_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int rainbow_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -113,7 +113,7 @@ static void ripples_linecb(void * ptr, int which,
} }
// Affect the canvas on click: // Affect the canvas on click:
void ripples_click(magic_api * api, int which, void ripples_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -185,3 +185,7 @@ void ripples_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int ripples_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -4,6 +4,8 @@
Sharpen, Trace Contour and Silhouette Magic Tool Plugin Sharpen, Trace Contour and Silhouette Magic Tool Plugin
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
FIXME: Credits
Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
@ -23,7 +25,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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -223,7 +225,7 @@ void sharpen_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void sharpen_click(magic_api * api, int which, void sharpen_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -274,3 +276,7 @@ void sharpen_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int sharpen_modes(magic_api * api, int which)
{
return(MODE_FULLSCREEN); /* FIXME - Can also be turned into a painted effect */
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -55,7 +55,7 @@ char * shift_get_description(magic_api * api, int which);
void shift_drag(magic_api * api, int which, SDL_Surface * canvas, void shift_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect); SDL_Rect * update_rect);
void shift_click(magic_api * api, int which, void shift_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect); int x, int y, SDL_Rect * update_rect);
void shift_release(magic_api * api, int which, void shift_release(magic_api * api, int which,
@ -284,7 +284,7 @@ static void shift_doit(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU
} }
// Affect the canvas on click: // Affect the canvas on click:
void shift_click(magic_api * api, int which, void shift_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -331,3 +331,7 @@ void shift_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int shift_modes(magic_api * api, int which)
{
return(MODE_FULLSCREEN);
}

View file

@ -24,7 +24,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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -140,7 +140,7 @@ void smudge_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void smudge_click(magic_api * api, int which, void smudge_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -180,3 +180,7 @@ void smudge_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int smudge_modes(magic_api * api, int which)
{
return(MODE_PAINT);
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -143,7 +143,7 @@ void tint_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void tint_click(magic_api * api, int which, void tint_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -186,3 +186,7 @@ void tint_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int tint_modes(magic_api * api, int which)
{
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
}

View file

@ -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 7, 2008 Last updated: July 8, 2008
$Id$ $Id$
*/ */
@ -121,7 +121,7 @@ void waves_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void waves_click(magic_api * api, int which, void waves_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -161,3 +161,8 @@ void waves_switchin(magic_api * api, int which, SDL_Surface * canvas)
void waves_switchout(magic_api * api, int which, SDL_Surface * canvas) void waves_switchout(magic_api * api, int which, SDL_Surface * canvas)
{ {
} }
int waves_modes(magic_api * api, int which)
{
return(MODE_FULLSCREEN);
}

View file

@ -1,5 +1,5 @@
.\" tuxpaint.1 - 2008.06.19 .\" tuxpaint.1 - 2008.07.08
.TH TUXPAINT 1 "19 June 2008" "0.9.20" "Tux Paint" .TH TUXPAINT 1 "8 July 2008" "0.9.21" "Tux Paint"
.SH NAME .SH NAME
tuxpaint -- "Tux Paint", a drawing program for young children. tuxpaint -- "Tux Paint", a drawing program for young children.
@ -55,6 +55,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
.br .br
[\-\-nostampcontrols] [\-\-nostampcontrols]
.br .br
[\-\-nomagiccontrols]
.br
[\-\-mirrorstamps] [\-\-mirrorstamps]
.br .br
[\-\-stampsize=\fISIZE\fP] [\-\-stampsize=\fISIZE\fP]
@ -121,6 +123,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
.br .br
[\-\-stampcontrols] [\-\-stampcontrols]
.br .br
[\-\-magiccontrols]
.br
[\-\-dontmirrorstamps] [\-\-dontmirrorstamps]
.br .br
[\-\-stampsize=default] [\-\-stampsize=default]
@ -323,6 +327,13 @@ Disable or enable (default) buttons to control stamps. Controls include
mirror, flip, shrink and grow. (Note: Not all stamps will be controllable mirror, flip, shrink and grow. (Note: Not all stamps will be controllable
in all ways.) in all ways.)
.TP 8
.B \-\-nomagiccontrols \-\-magiccontrols
Disable or enable (default) buttons to control Magic tools. Controls include
controlling whether a Magic tool is used like a paint brush, or if it
affects the entire image at once. (Note: Not all Magic tools will be
controllable.)
.TP 8 .TP 8
.B \-\-mirrorstamps \-\-dontmirrorstamps .B \-\-mirrorstamps \-\-dontmirrorstamps
With \fImirrorstamps\fP set, stamps which can be mirrored will appear With \fImirrorstamps\fP set, stamps which can be mirrored will appear

View file

@ -39,7 +39,6 @@
/* The image has been mirrored (so starter should be, too) */ /* The image has been mirrored (so starter should be, too) */
/* (as of API version 0x00000001) */ /* (as of API version 0x00000001) */
#define SPECIAL_MIRROR 0x0001 #define SPECIAL_MIRROR 0x0001
/* The image has been flipped (so starter should be, too) */ /* The image has been flipped (so starter should be, too) */
@ -47,6 +46,12 @@
#define SPECIAL_FLIP 0x0002 #define SPECIAL_FLIP 0x0002
/* Flags you return when asked what modes you work in */
/* (as of API version 0x00000002) */
#define MODE_PAINT 0x0001 /* User can paint the tool, freehand */
#define MODE_FULLSCREEN 0x0002 /* User can apply effect to entire canvas at once */
typedef struct magic_api_t { typedef struct magic_api_t {
/* A string containing the current version of Tux Paint (e.g., "0.9.18") */ /* A string containing the current version of Tux Paint (e.g., "0.9.18") */
char * tp_version; char * tp_version;

View file

@ -875,7 +875,9 @@ static int
dont_do_xor, dont_load_stamps, mirrorstamps, disable_stamp_controls, dont_do_xor, dont_load_stamps, mirrorstamps, disable_stamp_controls,
stamp_size_override, stamp_size_override,
simple_shapes, only_uppercase; simple_shapes, only_uppercase,
disable_magic_controls;
static int starter_mirrored, starter_flipped, starter_personal; static int starter_mirrored, starter_flipped, starter_personal;
static Uint8 canvas_color_r, canvas_color_g, canvas_color_b; static Uint8 canvas_color_r, canvas_color_g, canvas_color_b;
@ -895,11 +897,12 @@ typedef struct magic_funcs_s {
SDL_Surface * (*get_icon)(magic_api *, int); SDL_Surface * (*get_icon)(magic_api *, int);
char * (*get_description)(magic_api *, int); char * (*get_description)(magic_api *, int);
int (*requires_colors)(magic_api *, int); int (*requires_colors)(magic_api *, int);
int (*modes)(magic_api *, int);
void (*set_color)(magic_api *, Uint8, Uint8, Uint8); void (*set_color)(magic_api *, Uint8, Uint8, Uint8);
int (*init)(magic_api *); int (*init)(magic_api *);
Uint32 (*api_version)(void); Uint32 (*api_version)(void);
void (*shutdown)(magic_api *); void (*shutdown)(magic_api *);
void (*click)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, SDL_Rect *); void (*click)(magic_api *, int, int, SDL_Surface *, SDL_Surface *, int, int, SDL_Rect *);
void (*drag)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *); void (*drag)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *);
void (*release)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, SDL_Rect *); void (*release)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, SDL_Rect *);
void (*switchin)(magic_api *, int, SDL_Surface *, SDL_Surface *); void (*switchin)(magic_api *, int, SDL_Surface *, SDL_Surface *);
@ -911,6 +914,8 @@ typedef struct magic_s {
int place; int place;
int handle_idx; // Index to magic funcs for each magic tool (shared objs may report more than 1 tool) int handle_idx; // Index to magic funcs for each magic tool (shared objs may report more than 1 tool)
int idx; // Index to magic tools within shared objects (shared objs may report more than 1 tool) int idx; // Index to magic tools within shared objects (shared objs may report more than 1 tool)
int mode; // Current mode (paint or fullscreen)
int avail_modes; // Available modes (paint &/or fullscreen)
int colors; // Whether magic tool accepts colors int colors; // Whether magic tool accepts colors
char * name; // Name of magic tool char * name; // Name of magic tool
char * tip; // Description of magic tool char * tip; // Description of magic tool
@ -985,6 +990,7 @@ static SDL_Surface *img_cursor_starter_up, *img_cursor_starter_down;
static SDL_Surface *img_scroll_up, *img_scroll_down; static SDL_Surface *img_scroll_up, *img_scroll_down;
static SDL_Surface *img_scroll_up_off, *img_scroll_down_off; static SDL_Surface *img_scroll_up_off, *img_scroll_down_off;
static SDL_Surface *img_grow, *img_shrink; static SDL_Surface *img_grow, *img_shrink;
static SDL_Surface *img_magic_paint, *img_magic_fullscreen;
static SDL_Surface *img_bold, *img_italic; static SDL_Surface *img_bold, *img_italic;
static SDL_Surface *img_color_picker, *img_color_picker_thumb, *img_paintwell; static SDL_Surface *img_color_picker, *img_color_picker_thumb, *img_paintwell;
int color_picker_x, color_picker_y; int color_picker_x, color_picker_y;
@ -2720,6 +2726,13 @@ static void mainloop(void)
{ {
2, 2}; 2, 2};
} }
else if (cur_tool == TOOL_MAGIC)
{
if (!disable_magic_controls)
gd_controls = (grid_dims)
{
1, 2};
}
// number of whole or partial rows that will be needed // number of whole or partial rows that will be needed
// (can make this per-tool if variable columns needed) // (can make this per-tool if variable columns needed)
@ -2886,7 +2899,24 @@ static void mainloop(void)
update_stamp_xor(); update_stamp_xor();
} }
} }
else // not TOOL_STAMP, so must be TOOL_TEXT else if (cur_tool == TOOL_MAGIC)
{
/* Magic controls! */
if (which == 1 && magics[cur_magic].avail_modes & MODE_FULLSCREEN)
{
magics[cur_magic].mode = MODE_FULLSCREEN;
draw_magic();
update_screen_rect(&r_toolopt);
}
else if (which == 0 && magics[cur_magic].avail_modes & MODE_PAINT)
{
magics[cur_magic].mode = MODE_PAINT;
draw_magic();
update_screen_rect(&r_toolopt);
}
/* FIXME: Sfx */
}
else if (cur_tool == TOOL_TEXT)
{ {
/* Text controls! */ /* Text controls! */
int control_sound = -1; int control_sound = -1;
@ -3362,6 +3392,7 @@ static void mainloop(void)
magic_funcs[magics[cur_magic].handle_idx].click(magic_api_struct, magic_funcs[magics[cur_magic].handle_idx].click(magic_api_struct,
magics[cur_magic].idx, magics[cur_magic].idx,
magics[cur_magic].mode,
canvas, last, canvas, last,
old_x, old_y, old_x, old_y,
&update_rect); &update_rect);
@ -3473,6 +3504,13 @@ static void mainloop(void)
{ {
2, 2}; 2, 2};
} }
else if (cur_tool == TOOL_MAGIC)
{
if (!disable_magic_controls)
gd_controls = (grid_dims)
{
1, 2};
}
// number of whole or partial rows that will be needed // number of whole or partial rows that will be needed
// (can make this per-tool if variable columns needed) // (can make this per-tool if variable columns needed)
@ -3798,6 +3836,8 @@ static void mainloop(void)
max = 8; // was 10 before left/right group buttons -bjk 2007.05.03 max = 8; // was 10 before left/right group buttons -bjk 2007.05.03
if (cur_tool == TOOL_TEXT && !disable_stamp_controls) if (cur_tool == TOOL_TEXT && !disable_stamp_controls)
max = 10; max = 10;
if (cur_tool == TOOL_MAGIC && !disable_magic_controls)
max = 12;
if (num_things > max + TOOLOFFSET) if (num_things > max + TOOLOFFSET)
@ -5025,6 +5065,7 @@ static void show_usage(FILE * f, char *prg)
" %s [--stamps | --nostamps]\n" " %s [--stamps | --nostamps]\n"
" %s [--sysfonts | --nosysfonts]\n" " %s [--sysfonts | --nosysfonts]\n"
" %s [--nostampcontrols | --stampcontrols]\n" " %s [--nostampcontrols | --stampcontrols]\n"
" %s [--nomagiccontrols | --magiccontrols]\n"
" %s [--mirrorstamps | --dontmirrorstamps]\n" " %s [--mirrorstamps | --dontmirrorstamps]\n"
" %s [--stampsize=[0-10] | --stampsize=default]\n" " %s [--stampsize=[0-10] | --stampsize=default]\n"
" %s [--saveoverask | --saveover | --saveovernew]\n" " %s [--saveoverask | --saveover | --saveovernew]\n"
@ -6180,6 +6221,7 @@ static void setup(int argc, char *argv[])
no_system_fonts = 1; no_system_fonts = 1;
mirrorstamps = 0; mirrorstamps = 0;
disable_stamp_controls = 0; disable_stamp_controls = 0;
disable_magic_controls = 0;
#ifndef WINDOW_WIDTH #ifndef WINDOW_WIDTH
WINDOW_WIDTH = 800; WINDOW_WIDTH = 800;
@ -6371,6 +6413,14 @@ static void setup(int argc, char *argv[])
{ {
disable_stamp_controls = 0; disable_stamp_controls = 0;
} }
else if (strcmp(argv[i], "--nomagiccontrols") == 0)
{
disable_magic_controls = 1;
}
else if (strcmp(argv[i], "--magiccontrols") == 0)
{
disable_magic_controls = 0;
}
else if (strcmp(argv[i], "--noshortcuts") == 0) else if (strcmp(argv[i], "--noshortcuts") == 0)
{ {
noshortcuts = 1; noshortcuts = 1;
@ -7543,6 +7593,9 @@ static void setup(int argc, char *argv[])
img_grow = loadimage(DATA_PREFIX "images/ui/grow.png"); img_grow = loadimage(DATA_PREFIX "images/ui/grow.png");
img_shrink = loadimage(DATA_PREFIX "images/ui/shrink.png"); img_shrink = loadimage(DATA_PREFIX "images/ui/shrink.png");
img_magic_paint = loadimage(DATA_PREFIX "images/ui/magic_paint.png");
img_magic_fullscreen = loadimage(DATA_PREFIX "images/ui/magic_fullscreen.png");
img_bold = loadimage(DATA_PREFIX "images/ui/bold.png"); img_bold = loadimage(DATA_PREFIX "images/ui/bold.png");
img_italic = loadimage(DATA_PREFIX "images/ui/italic.png"); img_italic = loadimage(DATA_PREFIX "images/ui/italic.png");
@ -8151,14 +8204,21 @@ 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;
draw_image_title(TITLE_MAGIC, r_ttoolopt); draw_image_title(TITLE_MAGIC, r_ttoolopt);
if (num_magics > 14 + TOOLOFFSET) /* How many can we show? */
most = 12;
if (disable_magic_controls)
most = 14;
if (num_magics > most + TOOLOFFSET)
{ {
off_y = 24; off_y = 24;
max = 12 + TOOLOFFSET; max = (most - 2) + TOOLOFFSET;
dest.x = WINDOW_WIDTH - 96; dest.x = WINDOW_WIDTH - 96;
dest.y = 40; dest.y = 40;
@ -8173,9 +8233,9 @@ static void draw_magic(void)
} }
dest.x = WINDOW_WIDTH - 96; dest.x = WINDOW_WIDTH - 96;
dest.y = 40 + 24 + ((6 + TOOLOFFSET / 2) * 48); dest.y = 40 + 24 + ((((most - 2) / 2) + TOOLOFFSET / 2) * 48);
if (magic_scroll < num_magics - 12 - TOOLOFFSET) if (magic_scroll < num_magics - (most - 2) - TOOLOFFSET)
{ {
SDL_BlitSurface(img_scroll_down, NULL, screen, &dest); SDL_BlitSurface(img_scroll_down, NULL, screen, &dest);
} }
@ -8187,7 +8247,7 @@ static void draw_magic(void)
else else
{ {
off_y = 0; off_y = 0;
max = 14 + TOOLOFFSET; max = most + TOOLOFFSET;
} }
@ -8227,6 +8287,53 @@ static void draw_magic(void)
SDL_BlitSurface(img_btn_off, NULL, screen, &dest); SDL_BlitSurface(img_btn_off, NULL, screen, &dest);
} }
} }
/* Draw text controls: */
if (!disable_magic_controls)
{
SDL_Surface *button_color;
/* Show paint button: */
if (magics[cur_magic].mode == MODE_PAINT)
button_color = img_btn_down; // Active
else if (magics[cur_magic].avail_modes & MODE_PAINT)
button_color = img_btn_up; // Available, but not active
else
button_color = img_btn_off; // Unavailable
dest.x = WINDOW_WIDTH - 96;
dest.y = 40 + ((6 + TOOLOFFSET / 2) * 48);
SDL_BlitSurface(button_color, NULL, screen, &dest);
dest.x = WINDOW_WIDTH - 96 + (48 - img_magic_paint->w) / 2;
dest.y = (40 + ((6 + TOOLOFFSET / 2) * 48) + (48 - img_magic_paint->h) / 2);
SDL_BlitSurface(img_magic_paint, NULL, screen, &dest);
/* Show fullscreen button: */
if (magics[cur_magic].mode == MODE_FULLSCREEN)
button_color = img_btn_down; // Active
else if (magics[cur_magic].avail_modes & MODE_FULLSCREEN)
button_color = img_btn_up; // Available, but not active
else
button_color = img_btn_off; // Unavailable
dest.x = WINDOW_WIDTH - 48;
dest.y = 40 + ((6 + TOOLOFFSET / 2) * 48);
SDL_BlitSurface(button_color, NULL, screen, &dest);
dest.x = WINDOW_WIDTH - 48 + (48 - img_magic_fullscreen->w) / 2;
dest.y = (40 + ((6 + TOOLOFFSET / 2) * 48) + (48 - img_magic_fullscreen->h) / 2);
SDL_BlitSurface(img_magic_fullscreen, NULL, screen, &dest);
}
} }
@ -11906,6 +12013,9 @@ static void cleanup(void)
free_surface(&img_grow); free_surface(&img_grow);
free_surface(&img_shrink); free_surface(&img_shrink);
free_surface(&img_magic_paint);
free_surface(&img_magic_fullscreen);
free_surface(&img_bold); free_surface(&img_bold);
free_surface(&img_italic); free_surface(&img_italic);
@ -15625,6 +15735,15 @@ static void parse_options(FILE * fi)
{ {
disable_stamp_controls = 0; disable_stamp_controls = 0;
} }
else if (strcmp(str, "nomagiccontrols=yes") == 0)
{
disable_magic_controls = 1;
}
else if (strcmp(str, "nomagiccontrols=no") == 0 ||
strcmp(str, "magiccontrols=yes") == 0)
{
disable_magic_controls = 0;
}
else if (strcmp(str, "mirrorstamps=yes") == 0) else if (strcmp(str, "mirrorstamps=yes") == 0)
{ {
mirrorstamps = 1; mirrorstamps = 1;
@ -16881,6 +17000,11 @@ void load_magic_plugins(void)
magic_funcs[num_plugin_files].requires_colors = magic_funcs[num_plugin_files].requires_colors =
SDL_LoadFunction(magic_handle[num_plugin_files], funcname); SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
snprintf(funcname, sizeof(funcname), "%s_%s", objname,
"modes");
magic_funcs[num_plugin_files].modes=
SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
snprintf(funcname, sizeof(funcname), "%s_%s", objname, snprintf(funcname, sizeof(funcname), "%s_%s", objname,
"set_color"); "set_color");
magic_funcs[num_plugin_files].set_color = magic_funcs[num_plugin_files].set_color =
@ -16937,6 +17061,8 @@ void load_magic_plugins(void)
(int) magic_funcs[num_plugin_files].get_description); (int) magic_funcs[num_plugin_files].get_description);
printf("requires_colors = 0x%x\n", printf("requires_colors = 0x%x\n",
(int) magic_funcs[num_plugin_files].requires_colors); (int) magic_funcs[num_plugin_files].requires_colors);
printf("modes = 0x%x\n",
(int) magic_funcs[num_plugin_files].modes);
printf("set_color = 0x%x\n", printf("set_color = 0x%x\n",
(int) magic_funcs[num_plugin_files].set_color); (int) magic_funcs[num_plugin_files].set_color);
printf("init = 0x%x\n", printf("init = 0x%x\n",
@ -16989,6 +17115,12 @@ void load_magic_plugins(void)
fname); fname);
err = 1; err = 1;
} }
if (magic_funcs[num_plugin_files].modes == NULL)
{
fprintf(stderr, "Error: plugin %s is missing modes\n",
fname);
err = 1;
}
if (magic_funcs[num_plugin_files].set_color == NULL) if (magic_funcs[num_plugin_files].set_color == NULL)
{ {
fprintf(stderr, "Error: plugin %s is missing set_color\n", fprintf(stderr, "Error: plugin %s is missing set_color\n",
@ -17083,11 +17215,17 @@ void load_magic_plugins(void)
magics[num_magics].name = magic_funcs[num_plugin_files].get_name(magic_api_struct, i); magics[num_magics].name = magic_funcs[num_plugin_files].get_name(magic_api_struct, i);
magics[num_magics].tip = magic_funcs[num_plugin_files].get_description(magic_api_struct, i); magics[num_magics].tip = magic_funcs[num_plugin_files].get_description(magic_api_struct, i);
magics[num_magics].colors = magic_funcs[num_plugin_files].requires_colors(magic_api_struct, i); magics[num_magics].colors = magic_funcs[num_plugin_files].requires_colors(magic_api_struct, i);
magics[num_magics].avail_modes = magic_funcs[num_plugin_files].modes(magic_api_struct, i);
if (magics[num_magics].avail_modes & MODE_PAINT)
magics[num_magics].mode = MODE_PAINT;
else
magics[num_magics].mode = MODE_FULLSCREEN;
magics[num_magics].img_icon = magic_funcs[num_plugin_files].get_icon(magic_api_struct, i); magics[num_magics].img_icon = magic_funcs[num_plugin_files].get_icon(magic_api_struct, i);
#ifdef DEBUG #ifdef DEBUG
printf("-- %s\n", magics[num_magics].name); printf("-- %s\n", magics[num_magics].name);
printf("avail_modes = %d\n", magics[num_magics].avail_modes);
#endif #endif
num_magics++; num_magics++;