From 9b4257b61cb3a6591852818b478f339c823940d5 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Thu, 7 Apr 2022 02:28:14 -0700 Subject: [PATCH] WIP Starting work on autorepeat scroll in New/Open dialogs For https://sourceforge.net/p/tuxpaint/feature-requests/173/ --- docs/CHANGES.txt | 6 +++--- src/tuxpaint.c | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index f75a54362..a964ca5aa 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt) http://www.tuxpaint.org/ -2022.April.6 (0.9.28) +2022.April.7 (0.9.28) * Improvements to "Paint" and "Lines" tools: ------------------------------------------ * Brush spacing may now be altered within Tux Paint. @@ -130,8 +130,8 @@ http://www.tuxpaint.org/ * Other Improvements: ------------------- - * The "Tools" section's up & down scroll buttons auto-repeat if - you click/tap and hold them. + * The "Tools" section's, [WIP] "Open" dialog's, and [WIP] "New" dialogs' + up & down scroll buttons auto-repeat if you click/tap and hold them. For https://sourceforge.net/p/tuxpaint/feature-requests/173/ Bill Kendrick diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 9b8e316a6..a54c5b018 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - April 6, 2022 + June 14, 2002 - April 7, 2022 */ #include "platform.h" @@ -1257,7 +1257,7 @@ static int wheely = 1; static int keymouse = 0; static int no_button_distinction; static int button_down; -static int scrolling_selector, scrolling_tool; +static int scrolling_selector, scrolling_tool, scrolling_dialog; static int promptless_save = SAVE_OVER_UNSET; static int _promptless_save_over, _promptless_save_over_ask, _promptless_save_over_new; @@ -1958,7 +1958,7 @@ typedef enum #define NUM_EDGES 4 -static SDL_Event scrolltimer_selector_event, scrolltimer_tool_event; +static SDL_Event scrolltimer_selector_event, scrolltimer_tool_event, scrolltimer_dialog_event; int non_left_click_count = 0; @@ -2135,6 +2135,7 @@ static SDL_Surface *do_render_button_label(const char *const label); static void create_button_labels(void); static Uint32 scrolltimer_selector_callback(Uint32 interval, void *param); static Uint32 scrolltimer_tool_callback(Uint32 interval, void *param); +static Uint32 scrolltimer_dialog_callback(Uint32 interval, void *param); static Uint32 drawtext_callback(Uint32 interval, void *param); static void control_drawtext_timer(Uint32 interval, const char *const text, Uint8 locale_text); static const char *great_str(void); @@ -2360,7 +2361,7 @@ static void mainloop(void) int line_start_y = 0; int stamp_size_selector_clicked = 0; int stamp_xored = 0; - SDL_TimerID scrolltimer_selector = NULL, scrolltimer_tool = NULL; + SDL_TimerID scrolltimer_selector = NULL, scrolltimer_tool = NULL, scrolltimer_dialog = NULL; SDL_Event event; SDLKey key; SDLMod mod; @@ -2396,6 +2397,8 @@ static void mainloop(void) scrolltimer_selector = 0; scrolling_tool = 0; scrolltimer_tool = 0; + scrolling_dialog = 0; + scrolltimer_dialog = 0; val_x = 0; val_y = 0; valhat_x = 0; @@ -5421,7 +5424,7 @@ static void mainloop(void) scrolling_selector = 0; SDL_QuitSubSystem(SDL_INIT_TIMER); - DEBUG_PRINTF("Killing selector srolling\n"); + DEBUG_PRINTF("Killing selector scrolling\n"); } else if (scrolling_tool) @@ -5434,7 +5437,7 @@ static void mainloop(void) scrolling_tool = 0; SDL_QuitSubSystem(SDL_INIT_TIMER); - DEBUG_PRINTF("Killing tool srolling\n"); + DEBUG_PRINTF("Killing tool scrolling\n"); } /* Erase the xor drawed at click */ @@ -18474,6 +18477,27 @@ static Uint32 scrolltimer_tool_callback(Uint32 interval, void *param) } +/** + * FIXME + */ +/* Scroll Timer for Dialogs (Open & New) */ +static Uint32 scrolltimer_dialog_callback(Uint32 interval, void *param) +{ + /* printf("scrolltimer_dialog_callback(%d) -- ", interval); */ + if (scrolling_dialog) + { + DEBUG_PRINTF("(Still scrolling dialog)\n"); + SDL_PushEvent((SDL_Event *) param); + return interval; + } + else + { + DEBUG_PRINTF("(all done scrolling dialog)\n"); + return 0; + } +} + + /** * FIXME */