From 980715dea6a560b7f1a817940ca30385c3c746c2 Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Wed, 23 Nov 2005 22:25:41 +0000 Subject: [PATCH] Mouse scroll wheel now scrolls in Open dialog. Cursor was disappearing if at far left scrolling up in Open dialog. Fixed. --- docs/CHANGES.txt | 9 ++++++++- src/tuxpaint.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 1dcf92092..5e564acef 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -7,7 +7,7 @@ bill@newbreedsoftware.com http://www.newbreedsoftware.com/tuxpaint/ -2005.November.20 (0.9.15) +2005.November.23 (0.9.15) * Speed improvements: ------------------- @@ -170,6 +170,8 @@ http://www.newbreedsoftware.com/tuxpaint/ by pressing the [Alt]+[S] keys. (Note: does not enable sounds if "nosound" is set in configuration file or via command-line.) + * Scroll wheel can be used to scroll through thumbnails in Open dialog. + * Printing improvements: ---------------------- * Now printing directly via Postscript. @@ -246,6 +248,11 @@ http://www.newbreedsoftware.com/tuxpaint/ * Failed to install default locale fonts. Fixed. kyjo44 + * Scroll wheel motion was being perceived as clicks in Open dialog. Fixed. + + * Thumbnail cursor could fall of screen when scrolling in Open dialog. + Fixed. + * Compiling, porting and packaging updates: ----------------------------------------- * Added support for system and user configuration files on Windows. diff --git a/src/tuxpaint.c b/src/tuxpaint.c index f5970a4fd..dde03070d 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -14218,7 +14218,7 @@ void do_open(void) do_setcursor(cursor_arrow); } - if (which > cur + 16) + if (which >= cur + 16) which = which - 4; } else if (event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET - 48) && @@ -14271,6 +14271,38 @@ void do_open(void) want_erase = 1; } } + else if (event.type == SDL_MOUSEBUTTONDOWN && + event.button.button >= 4 && + event.button.button <= 5 && + wheely) + { + /* Scroll wheel! */ + + if (event.button.button == 4 && cur > 0) + { + cur = cur - 4; + update_list = 1; + playsound(1, SND_SCROLL, 1); + + if (cur == 0) + do_setcursor(cursor_arrow); + + if (which >= cur + 16) + which = which - 4; + } + else if (event.button.button == 5 && cur < num_files - 16) + { + cur = cur + 4; + update_list = 1; + playsound(1, SND_SCROLL, 1); + + if (cur >= num_files - 16) + do_setcursor(cursor_arrow); + + if (which < cur) + which = which + 4; + } + } else if (event.type == SDL_MOUSEMOTION) { /* Deal with mouse pointer shape! */