From b2535d59ba3a53a6617a26d96ba58fffac7e03de Mon Sep 17 00:00:00 2001
From: Bill Kendrick get_tool_count()").
Uint8 accepted_sizes(magic_api * api, int which)Uint8 accepted_sizes(magic_api * api, int which, int mode)- Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
+ Return how many size variations the 'Magic' tool accepts, in the given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 default_size(magic_api * api, int which)Uint8 default_size(magic_api * api, int which, int mode)
- Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in accepted_sizes().
accepted_sizes().
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
void set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the 'Magic' tool size option chosen. (It will be called whenever one of the plugin's Magic tools that accept sizes becomes active, and whenever the user picks a new size while such a tool is currently active.)
diff --git a/docs/es_ES.UTF-8/MAGIC-API.txt b/docs/es_ES.UTF-8/MAGIC-API.txt index 1059a085b..96906f1de 100644 --- a/docs/es_ES.UTF-8/MAGIC-API.txt +++ b/docs/es_ES.UTF-8/MAGIC-API.txt @@ -312,23 +312,24 @@ Magic Tool Plugin API Documentation Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 accepted_sizes(magic_api * api, int which) + Uint8 accepted_sizes(magic_api * api, int which, int mode) - Return how many size variations the 'Magic' tool accepts. Return a - '0' if the 'Magic' tool should not offer sizing options. Returning - '1' is the same as returning '0'. + Return how many size variations the 'Magic' tool accepts, in the + given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' + if the 'Magic' tool should not offer sizing options. Returning '1' + is the same as returning '0'. Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 default_size(magic_api * api, int which) + Uint8 default_size(magic_api * api, int which, int mode) - Return the default size the 'Magic' tool accepts. This will be the - default setting for the tool the first time it is used during a - Tux Paint session. If Tux Paint is being invoked with the sizing - option disabled, this will be the only size requested by Tux - Paint. Return a number between '1' and the amount you returned in - accepted_sizes(). + Return the default size the 'Magic' tool accepts, in the given + mode. This will be the default setting for the tool the first time + it is used during a Tux Paint session. If Tux Paint is being + invoked with the sizing option disabled, this will be the only + size requested by Tux Paint. Return a number between '1' and the + amount you returned in accepted_sizes(). Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). @@ -405,7 +406,7 @@ Magic Tool Plugin API Documentation Note: Changed most recently in Tux Paint 0.9.29; Magic API version 0x00000007. - void set_size(magic_api * api, int which, SDL_Surface * canvas, + void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the diff --git a/docs/es_ES.UTF-8/html/MAGIC-API.html b/docs/es_ES.UTF-8/html/MAGIC-API.html index e3b308b1b..3a5f43e6e 100644 --- a/docs/es_ES.UTF-8/html/MAGIC-API.html +++ b/docs/es_ES.UTF-8/html/MAGIC-API.html @@ -395,18 +395,18 @@ Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 accepted_sizes(magic_api * api, int which)Uint8 accepted_sizes(magic_api * api, int which, int mode)- Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
+ Return how many size variations the 'Magic' tool accepts, in the given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 default_size(magic_api * api, int which)Uint8 default_size(magic_api * api, int which, int mode)
- Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in accepted_sizes().
accepted_sizes().
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
void set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the 'Magic' tool size option chosen. (It will be called whenever one of the plugin's Magic tools that accept sizes becomes active, and whenever the user picks a new size while such a tool is currently active.)
diff --git a/docs/fr_FR.UTF-8/MAGIC-API.txt b/docs/fr_FR.UTF-8/MAGIC-API.txt index 607ff530a..1a522388f 100644 --- a/docs/fr_FR.UTF-8/MAGIC-API.txt +++ b/docs/fr_FR.UTF-8/MAGIC-API.txt @@ -312,23 +312,24 @@ Magic Tool Plugin API Documentation Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 accepted_sizes(magic_api * api, int which) + Uint8 accepted_sizes(magic_api * api, int which, int mode) - Return how many size variations the 'Magic' tool accepts. Return a - '0' if the 'Magic' tool should not offer sizing options. Returning - '1' is the same as returning '0'. + Return how many size variations the 'Magic' tool accepts, in the + given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' + if the 'Magic' tool should not offer sizing options. Returning '1' + is the same as returning '0'. Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 default_size(magic_api * api, int which) + Uint8 default_size(magic_api * api, int which, int mode) - Return the default size the 'Magic' tool accepts. This will be the - default setting for the tool the first time it is used during a - Tux Paint session. If Tux Paint is being invoked with the sizing - option disabled, this will be the only size requested by Tux - Paint. Return a number between '1' and the amount you returned in - accepted_sizes(). + Return the default size the 'Magic' tool accepts, in the given + mode. This will be the default setting for the tool the first time + it is used during a Tux Paint session. If Tux Paint is being + invoked with the sizing option disabled, this will be the only + size requested by Tux Paint. Return a number between '1' and the + amount you returned in accepted_sizes(). Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). @@ -405,7 +406,7 @@ Magic Tool Plugin API Documentation Note: Changed most recently in Tux Paint 0.9.29; Magic API version 0x00000007. - void set_size(magic_api * api, int which, SDL_Surface * canvas, + void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the diff --git a/docs/fr_FR.UTF-8/html/MAGIC-API.html b/docs/fr_FR.UTF-8/html/MAGIC-API.html index 2a8a48245..2fa9669ea 100644 --- a/docs/fr_FR.UTF-8/html/MAGIC-API.html +++ b/docs/fr_FR.UTF-8/html/MAGIC-API.html @@ -395,18 +395,18 @@ Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 accepted_sizes(magic_api * api, int which)Uint8 accepted_sizes(magic_api * api, int which, int mode)- Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
+ Return how many size variations the 'Magic' tool accepts, in the given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 default_size(magic_api * api, int which)Uint8 default_size(magic_api * api, int which, int mode)
- Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in accepted_sizes().
accepted_sizes().
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
void set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the 'Magic' tool size option chosen. (It will be called whenever one of the plugin's Magic tools that accept sizes becomes active, and whenever the user picks a new size while such a tool is currently active.)
diff --git a/docs/gl_ES.UTF-8/MAGIC-API.txt b/docs/gl_ES.UTF-8/MAGIC-API.txt index 7ead11323..ec1480bc4 100644 --- a/docs/gl_ES.UTF-8/MAGIC-API.txt +++ b/docs/gl_ES.UTF-8/MAGIC-API.txt @@ -312,23 +312,24 @@ Magic Tool Plugin API Documentation Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 accepted_sizes(magic_api * api, int which) + Uint8 accepted_sizes(magic_api * api, int which, int mode) - Return how many size variations the 'Magic' tool accepts. Return a - '0' if the 'Magic' tool should not offer sizing options. Returning - '1' is the same as returning '0'. + Return how many size variations the 'Magic' tool accepts, in the + given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' + if the 'Magic' tool should not offer sizing options. Returning '1' + is the same as returning '0'. Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 default_size(magic_api * api, int which) + Uint8 default_size(magic_api * api, int which, int mode) - Return the default size the 'Magic' tool accepts. This will be the - default setting for the tool the first time it is used during a - Tux Paint session. If Tux Paint is being invoked with the sizing - option disabled, this will be the only size requested by Tux - Paint. Return a number between '1' and the amount you returned in - accepted_sizes(). + Return the default size the 'Magic' tool accepts, in the given + mode. This will be the default setting for the tool the first time + it is used during a Tux Paint session. If Tux Paint is being + invoked with the sizing option disabled, this will be the only + size requested by Tux Paint. Return a number between '1' and the + amount you returned in accepted_sizes(). Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). @@ -405,7 +406,7 @@ Magic Tool Plugin API Documentation Note: Changed most recently in Tux Paint 0.9.29; Magic API version 0x00000007. - void set_size(magic_api * api, int which, SDL_Surface * canvas, + void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the diff --git a/docs/gl_ES.UTF-8/html/MAGIC-API.html b/docs/gl_ES.UTF-8/html/MAGIC-API.html index 9306b01ad..af1559e22 100644 --- a/docs/gl_ES.UTF-8/html/MAGIC-API.html +++ b/docs/gl_ES.UTF-8/html/MAGIC-API.html @@ -395,18 +395,18 @@ Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 accepted_sizes(magic_api * api, int which)Uint8 accepted_sizes(magic_api * api, int which, int mode)- Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
+ Return how many size variations the 'Magic' tool accepts, in the given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 default_size(magic_api * api, int which)Uint8 default_size(magic_api * api, int which, int mode)
- Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in accepted_sizes().
accepted_sizes().
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
void set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the 'Magic' tool size option chosen. (It will be called whenever one of the plugin's Magic tools that accept sizes becomes active, and whenever the user picks a new size while such a tool is currently active.)
diff --git a/docs/ja_JP.UTF-8/MAGIC-API.txt b/docs/ja_JP.UTF-8/MAGIC-API.txt index 85aa08116..76e142a64 100644 --- a/docs/ja_JP.UTF-8/MAGIC-API.txt +++ b/docs/ja_JP.UTF-8/MAGIC-API.txt @@ -312,23 +312,24 @@ Magic Tool Plugin API Documentation Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 accepted_sizes(magic_api * api, int which) + Uint8 accepted_sizes(magic_api * api, int which, int mode) - Return how many size variations the 'Magic' tool accepts. Return a - '0' if the 'Magic' tool should not offer sizing options. Returning - '1' is the same as returning '0'. + Return how many size variations the 'Magic' tool accepts, in the + given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' + if the 'Magic' tool should not offer sizing options. Returning '1' + is the same as returning '0'. Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). - Uint8 default_size(magic_api * api, int which) + Uint8 default_size(magic_api * api, int which, int mode) - Return the default size the 'Magic' tool accepts. This will be the - default setting for the tool the first time it is used during a - Tux Paint session. If Tux Paint is being invoked with the sizing - option disabled, this will be the only size requested by Tux - Paint. Return a number between '1' and the amount you returned in - accepted_sizes(). + Return the default size the 'Magic' tool accepts, in the given + mode. This will be the default setting for the tool the first time + it is used during a Tux Paint session. If Tux Paint is being + invoked with the sizing option disabled, this will be the only + size requested by Tux Paint. Return a number between '1' and the + amount you returned in accepted_sizes(). Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()"). @@ -405,7 +406,7 @@ Magic Tool Plugin API Documentation Note: Changed most recently in Tux Paint 0.9.29; Magic API version 0x00000007. - void set_size(magic_api * api, int which, SDL_Surface * canvas, + void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the diff --git a/docs/ja_JP.UTF-8/html/MAGIC-API.html b/docs/ja_JP.UTF-8/html/MAGIC-API.html index 7a260300e..ff4362094 100644 --- a/docs/ja_JP.UTF-8/html/MAGIC-API.html +++ b/docs/ja_JP.UTF-8/html/MAGIC-API.html @@ -395,18 +395,18 @@ Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 accepted_sizes(magic_api * api, int which)Uint8 accepted_sizes(magic_api * api, int which, int mode)- Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
+ Return how many size variations the 'Magic' tool accepts, in the given mode (i.e., 'MODE_PAINT' or 'MODE_FULLSCREEN). Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'.
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
Uint8 default_size(magic_api * api, int which)Uint8 default_size(magic_api * api, int which, int mode)
- Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in accepted_sizes().
accepted_sizes().
Note: Called once for each Magic tool your plugin claims to contain (by your "get_tool_count()").
void set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) void set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect) Tux Paint will call this function to inform the plugin of the 'Magic' tool size option chosen. (It will be called whenever one of the plugin's Magic tools that accept sizes becomes active, and whenever the user picks a new size while such a tool is currently active.)
diff --git a/magic/src/blur.c b/magic/src/blur.c index 29ec607d0..36d35905a 100644 --- a/magic/src/blur.c +++ b/magic/src/blur.c @@ -55,11 +55,11 @@ void blur_release(magic_api * api, int which, SDL_Surface * canvas, void blur_shutdown(magic_api * api); void blur_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect); -void blur_set_size(magic_api * api, int which, SDL_Surface * canvas, +void blur_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 sz, SDL_Rect * update_rect); int blur_requires_colors(magic_api * api, int which); -Uint8 blur_accepted_sizes(magic_api * api, int which); -Uint8 blur_default_size(magic_api * api, int which); +Uint8 blur_accepted_sizes(magic_api * api, int which, int mode); +Uint8 blur_default_size(magic_api * api, int which, int mode); void blur_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas); void blur_switchout(magic_api * api, int which, int mode, @@ -319,7 +319,7 @@ void blur_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED } // Record the size from Tux Paint: -void blur_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, +void blur_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 sz, SDL_Rect * update_rect ATTRIBUTE_UNUSED) { blur_RADIUS = sz * 4; @@ -333,11 +333,14 @@ int blur_requires_colors(magic_api * api ATTRIBUTE_UNUSED, } -Uint8 blur_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { - return 8; +Uint8 blur_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode) { + if (mode == MODE_PAINT) + return 8; + else + return 0; } -Uint8 blur_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { +Uint8 blur_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return 4; } diff --git a/magic/src/kalidescope.c b/magic/src/kalidescope.c index ae2caace0..ad5f43925 100644 --- a/magic/src/kalidescope.c +++ b/magic/src/kalidescope.c @@ -83,12 +83,13 @@ void kalidescope_release(magic_api * api, int which, SDL_Surface * canvas, SDL_Rect * update_rect); void kalidescope_shutdown(magic_api * api); int kalidescope_requires_colors(magic_api * api, int which); -Uint8 kalidescope_accepted_sizes(magic_api * api, int which); -Uint8 kalidescope_default_size(magic_api * api, int which); +Uint8 kalidescope_accepted_sizes(magic_api * api, int which, int mode); +Uint8 kalidescope_default_size(magic_api * api, int which, int mode); void kalidescope_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect); -void kalidescope_set_size(magic_api * api, int which, SDL_Surface * canvas, - SDL_Surface * last, Uint8 sz, SDL_Rect * update_rect); +void kalidescope_set_size(magic_api * api, int which, int mode, + SDL_Surface * canvas, SDL_Surface * last, + Uint8 sz, SDL_Rect * update_rect); void kalidescope_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas); void kalidescope_switchout(magic_api * api, int which, int mode, @@ -307,20 +308,21 @@ void kalidescope_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE // Use sizes: Uint8 kalidescope_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, - int which ATTRIBUTE_UNUSED) + int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return KAL_MAX_SIZE; } Uint8 kalidescope_default_size(magic_api * api ATTRIBUTE_UNUSED, - int which ATTRIBUTE_UNUSED) + int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return KAL_DEF_SIZE; } // Record the size from Tux Paint: -void kalidescope_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, - SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 sz, SDL_Rect * update_rect ATTRIBUTE_UNUSED) +void kalidescope_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, + SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED, + Uint8 sz, SDL_Rect * update_rect ATTRIBUTE_UNUSED) { kalidescope_sz = (sz * 2); } diff --git a/src/tuxpaint.c b/src/tuxpaint.c index dbad59aca..4e0ba2f1f 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -1567,11 +1567,11 @@ typedef struct magic_funcs_s SDL_Surface *(*get_icon)(magic_api *, int); char *(*get_description)(magic_api *, int, int); int (*requires_colors)(magic_api *, int); - Uint8 (*accepted_sizes)(magic_api *, int); - Uint8 (*default_size)(magic_api *, int); + Uint8 (*accepted_sizes)(magic_api *, int, int); + Uint8 (*default_size)(magic_api *, int, int); int (*modes)(magic_api *, int); void (*set_color)(magic_api *, int, SDL_Surface *, SDL_Surface *, Uint8, Uint8, Uint8, SDL_Rect *); - void (*set_size)(magic_api *, int, SDL_Surface *, SDL_Surface *, Uint8, SDL_Rect *); + void (*set_size)(magic_api *, int, int, SDL_Surface *, SDL_Surface *, Uint8, SDL_Rect *); int (*init)(magic_api *, Uint32); Uint32(*api_version) (void); void (*shutdown)(magic_api *); @@ -1594,9 +1594,9 @@ typedef struct magic_s int mode; /* Current mode (paint or fullscreen) */ int avail_modes; /* Available modes (paint &/or fullscreen) */ int colors; /* Whether magic tool accepts colors */ - int sizes; /* Whether magic tool accepts sizes */ - int default_size; /* Magic tool's default size setting */ - int size; /* Magic tool's size setting */ + int sizes[MAX_MODES]; /* Whether magic tool accepts sizes */ + int default_size[MAX_MODES]; /* Magic tool's default size setting */ + int size[MAX_MODES]; /* Magic tool's size setting */ int group; /* Which group of magic tools this lives in */ char *name; /* Name of magic tool */ char *tip[MAX_MODES]; /* Description of magic tool, in each possible mode */ @@ -4543,21 +4543,25 @@ static void mainloop(void) } playsound(screen, 0, SND_CLICK, 0, SNDPOS_CENTER, SNDDIST_NEAR); } else if (!disable_magic_sizes) { - if (magics[grp][cur].sizes > 1) { + int mode; + + mode = magic_modeint(magics[grp][cur].mode); + + if (magics[grp][cur].sizes[mode] > 1) { int old_size, new_size; - old_size = magics[grp][cur].size; + old_size = magics[grp][cur].size[mode]; - new_size = ((magics[grp][cur].sizes * (event.button.x - (WINDOW_WIDTH - r_ttoolopt.w))) / r_ttoolopt.w) + 1; + new_size = ((magics[grp][cur].sizes[mode] * (event.button.x - (WINDOW_WIDTH - r_ttoolopt.w))) / r_ttoolopt.w) + 1; if (new_size != old_size) { - magics[grp][cur].size = new_size; + magics[grp][cur].size[mode] = new_size; magic_set_size(); draw_magic(); update_screen_rect(&r_toolopt); - if (new_size < old_size) + if (new_size < old_size) playsound(screen, 0, SND_SHRINK, 0, SNDPOS_CENTER, SNDDIST_NEAR); else playsound(screen, 0, SND_GROW, 0, SNDPOS_CENTER, SNDDIST_NEAR); @@ -10554,25 +10558,27 @@ static void draw_magic(void) if (!disable_magic_sizes) { - int grp, cur; + int grp, cur, mode; grp = magic_group; cur = cur_magic[magic_group]; + mode = magic_modeint(magics[grp][cur].mode); - if (magics[grp][cur].sizes > 1) { - int i, xx, yy; + if (magics[grp][cur].sizes[mode] > 1) { + int i, xx, yy, sizes; float x_per, y_per; SDL_Surface * blnk, * btn; - x_per = (float) r_ttoolopt.w / (float) magics[grp][cur].sizes; - y_per = (float) button_h / (float) (magics[grp][cur].sizes + 1); + sizes = magics[grp][cur].sizes[mode]; + x_per = (float) r_ttoolopt.w / (float) sizes; + y_per = (float) button_h / (float) (sizes + 1); - for (i = 1; i < magics[grp][cur].sizes + 1; i++) + for (i = 1; i < sizes + 1; i++) { xx = ceil(x_per); yy = ceil(y_per * (float) i); - if (i <= magics[grp][cur].size) + if (i <= magics[grp][cur].size[mode]) btn = thumbnail(img_btn_down, xx, yy, 0); else btn = thumbnail(img_btn_up, xx, yy, 0); @@ -22835,22 +22841,45 @@ static void load_magic_plugins(void) magics[group][idx].colors = magic_funcs[num_plugin_files].requires_colors (magic_api_struct, i); - magics[group][idx].sizes = - magic_funcs[num_plugin_files].accepted_sizes - (magic_api_struct, i); - if (magic_funcs[num_plugin_files].accepted_sizes) { - magics[group][idx].default_size = - magic_funcs[num_plugin_files].default_size - (magic_api_struct, i); - if (magics[group][idx].default_size < 1 || - magics[group][idx].default_size > magics[group][idx].sizes) { - fprintf(stderr, - "Warning: plugin %s mode # %d default size (%d) out of range (1-%d)\n", - fname, i, magics[group][idx].default_size, magics[group][idx].sizes); - magics[group][idx].default_size = 1; + + for (j = 0; j < MAX_MODES; j++) + { + int mode_bit; + + mode_bit = 0; + + if (j == 1 && magics[group][idx].avail_modes & MODE_FULLSCREEN) { + mode_bit = MODE_FULLSCREEN; + } else { + if (magics[group][idx].avail_modes & MODE_PAINT) { + mode_bit = MODE_PAINT; + } else if (magics[group][idx].avail_modes & MODE_ONECLICK) { + mode_bit = MODE_ONECLICK; + } else if (magics[group][idx].avail_modes & MODE_PAINT_WITH_PREVIEW) { + mode_bit = MODE_PAINT_WITH_PREVIEW; + } + } + + if (mode_bit != 0) { + magics[group][idx].sizes[j] = + magic_funcs[num_plugin_files].accepted_sizes + (magic_api_struct, i, mode_bit); + if (magics[group][idx].sizes[j] > 1) { + magics[group][idx].default_size[j] = + magic_funcs[num_plugin_files].default_size + (magic_api_struct, i, mode_bit); + if (magics[group][idx].default_size[j] < 1 || + magics[group][idx].default_size[j] > magics[group][idx].sizes[j]) { + fprintf(stderr, + "Warning: plugin %s tool # %d for %d mode (%x) default size (%d) out of range (1-%d)\n", + fname, i, j, mode_bit, magics[group][idx].default_size[j], magics[group][idx].sizes[j]); + magics[group][idx].default_size[j] = 1; + } + magics[group][idx].size[j] = magics[group][idx].default_size[j]; + } } - magics[group][idx].size = magics[group][idx].default_size; } + if (magics[group][idx].avail_modes & MODE_PAINT) magics[group][idx].mode = MODE_PAINT; else if (magics[group][idx].avail_modes & MODE_ONECLICK) @@ -27249,9 +27278,10 @@ static void magic_set_size() { magic_funcs[magics[magic_group][cur_magic[magic_group]].handle_idx]. set_size(magic_api_struct, magics[magic_group][cur_magic[magic_group]].idx, + magics[magic_group][cur_magic[magic_group]].mode, canvas, last, - magics[magic_group][cur_magic[magic_group]].size, + magics[magic_group][cur_magic[magic_group]].size[magic_modeint(magics[magic_group][cur_magic[magic_group]].mode)], &update_rect); if (update_rect.w > 0 && update_rect.h > 0) {