From cdd7f212655a9504183c6bb93ce2145956609388 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 26 Feb 2011 17:43:55 +0000 Subject: [PATCH] Fxed and simplified double-click handling in Listboxes (Skins window, Text window, Factory window). Double-clicking a font in Text window 'accepts' the rendering and closes the window. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1736 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/buttons.c | 9 +++------ src/engine.c | 5 +++-- src/factory.c | 11 ++++------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/buttons.c b/src/buttons.c index 221c0b42..53374938 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -1424,12 +1424,12 @@ void Button_Skins(void) { case 1 : // OK break; - case 2 : // doesn't happen + case 2 : // double-click file: do nothing break; case 3 : // doesn't happen break; case 4 : // a file is selected - need_load=1; + need_load=1; break; case 5 : // Font dropdown selected_font = Window_attribute2; // Get the index of the chosen font. @@ -5009,10 +5009,6 @@ void Button_Text(void) /* Cannot happen, event is catched by the list control */ break; - case 6: // Selecteur de fonte - /* Cannot happen, event is catched by the list control */ - break; - case 13: // Font selection selected_font_index = Window_attribute2; Hide_cursor(); @@ -5056,6 +5052,7 @@ void Button_Text(void) break; + case 6: // Double-click font selector case 11: // OK // Save the selector settings list_start = font_list->List_start; diff --git a/src/engine.c b/src/engine.c index 5c9bdd59..e140c9a1 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3199,10 +3199,11 @@ short Window_clicked_button(void) if (old_mouse_k==0 && last_list_number==list->Number && time_now - time_last_click < Config.Double_click_speed) { time_last_click = time_now; + Input_sticky_control=0; // Store the selected value as attribute2 Window_attribute2=list->List_start + list->Cursor_position; - // Return the control ID of the list. - return list->Number; + // Return the control ID of the "special button" that covers the list. + return list->Entry_button->Number; } time_last_click = time_now; last_list_number=list->Number; diff --git a/src/factory.c b/src/factory.c index 693c319d..e8068e67 100644 --- a/src/factory.c +++ b/src/factory.c @@ -1706,13 +1706,10 @@ void Button_Brush_Factory(void) switch (clicked_button) { - case 4: - if (last_selected_item == scriptlist->List_start + scriptlist->Cursor_position) - { - // Double click - clicked_button=5; - break; - } + case 2: // Double-click an entry in script list + clicked_button=5; + break; + case 4: // Select script last_selected_item = scriptlist->List_start + scriptlist->Cursor_position; Hide_cursor(); Draw_script_information(Get_item_by_index(&Scripts_selector,