From 315a17ae5baf9aede999ea0671a4f5516ff20ebf Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Wed, 13 May 2009 18:17:24 +0000 Subject: [PATCH] Double-clicking a palette color to open the palette now requires a time of less than 0.5 seconds between clicks git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@803 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 14 ++++++++++++-- misc.h | 1 - 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/buttons.c b/buttons.c index 9606662a..af07085f 100644 --- a/buttons.c +++ b/buttons.c @@ -274,12 +274,22 @@ void Button_Pal_right_fast(void) //-------------------- item de la forecolor dans le menu -------------------- void Button_Select_forecolor(void) { + static long time_click = 0; + long time_previous; + int color=Pick_color_in_palette(); + time_previous = time_click; + time_click = SDL_GetTicks(); + if (color == Fore_color) { - // Open palette window - Button_Palette(); + // Check if it's a double-click + if (time_click - time_previous < 500) + { + // Open palette window + Button_Palette(); + } } else if (color!=-1) { diff --git a/misc.h b/misc.h index f1f86e37..51a4d4f7 100644 --- a/misc.h +++ b/misc.h @@ -24,7 +24,6 @@ void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width); void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width); void Scroll_picture(short x_offset,short y_offset); -void Set_mouse_video_mode_number(void); void Set_mouse_position(void); void Wait_end_of_click(void); void Mouse_sensitivity(word x,word y);