From 288fb914211c3965804baffcdae96a2bffd7d989 Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Wed, 14 Jan 2004 09:08:48 +0000 Subject: [PATCH] Fixed tool scrolling crash bug (thanks Kevin & John!). Made shape tool default to a reasonable sized shape if user doesn't drag. --- docs/CHANGES.txt | 8 ++++++++ docs/TODO.txt | 2 ++ src/tuxpaint.c | 27 ++++++++++++++++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index ccdb5de7e..f3285bdd4 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -9,6 +9,14 @@ http://www.newbreedsoftware.com/tuxpaint/ 2004.Jan.14 (0.9.14) [cvs] * Made sure KDE icon directories exist before trying to copy files to them. + + * Fixed crash bug when switching from different tools with scrolling + collections, and then scrolling. + Thanks to Kevin Jarrett for the report, and John Popplewell for a + replicable way of crashing it. + + * Made sure shape tool never made a tiny shape. + (Should hint users that they should click-and-drag.) * Updated/corrected Tamil translation Mugunth diff --git a/docs/TODO.txt b/docs/TODO.txt index cec04a09c..7a16d07f0 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -34,6 +34,8 @@ HIGH-PRIORITY IMPLEMENTATION CHANGES: LOW-PRIORITY IMPLEMENTATION CHANGES: ------------------------------------ + * Allow keyboard buttons to alter shapes (+/- for size, e.g.) + * Fix and use scanline fill for filled shapes. * Fix "update_shape()" function and use it to replace SDL_Flip()'s diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 5aa9e150c..669a54198 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -3,7 +3,7 @@ Tux Paint - A simple drawing program for children. - Copyright (c) 2003 by Bill Kendrick + Copyright (c) 2004 by Bill Kendrick bill@newbreedsoftware.com http://www.newbreedsoftware.com/tuxpaint/ @@ -21,12 +21,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - June 14, 2002 - December 26, 2003 + June 14, 2002 - January 14, 2004 */ #define VER_VERSION "0.9.14" -#define VER_DATE "2003.12.26" +#define VER_DATE "2004.01.14" /* #define DEBUG */ @@ -1231,28 +1231,33 @@ void mainloop(void) if (cur_tool == TOOL_BRUSH) { + cur_thing = cur_brush; draw_brushes(); draw_colors(1); } else if (cur_tool == TOOL_STAMP) { + cur_thing = cur_stamp; draw_stamps(); draw_colors(stamp_colorable(cur_stamp) || stamp_tintable(cur_stamp)); } else if (cur_tool == TOOL_LINES) { + cur_thing = cur_brush; draw_brushes(); draw_colors(1); } else if (cur_tool == TOOL_SHAPES) { + cur_thing = cur_shape; draw_shapes(); draw_colors(1); shape_tool_mode = SHAPE_TOOL_MODE_DONE; } else if (cur_tool == TOOL_TEXT) { + cur_thing = cur_font; draw_fonts(); draw_colors(1); } @@ -1420,6 +1425,7 @@ void mainloop(void) } else if (cur_tool == TOOL_MAGIC) { + cur_thing = cur_magic; rainbow_color = 0; draw_magic(); @@ -6882,6 +6888,12 @@ void render_brush(void) Uint8 r, g, b, a; + /* Kludge; not sure why cur_brush would become greater! */ + + if (cur_brush >= num_brushes) + cur_brush = 0; + + /* Free the old rendered brush (if any): */ if (img_cur_brush != NULL) @@ -8829,6 +8841,15 @@ void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush) } + /* Is the shape tiny? Make it SOME size, first! */ + + if (rx < 15 && ry < 15) + { + rx = 15; + ry = 15; + } + + /* Render a default brush: */ if (use_brush)