From 4d765f70b0accf29a631e833e7ddfd57ef8bbfee Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 2 Apr 2006 12:42:04 +0200 Subject: [PATCH] rnd-20060402-1-src * fixed handling of over-large selectboxes (less error-prone now) --- ChangeLog | 3 +++ src/conftime.h | 2 +- src/editor.c | 4 ++++ src/libgame/gadgets.c | 24 +++++++++++++++++++----- src/main.h | 1 + 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c54da87..a57b005d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-04-02 + * fixed handling of over-large selectboxes (less error-prone now) + 2006-04-01 * added use of "Insert" and "Delete" keys to navigate element list in level editor to start of custom elements or start of group elements diff --git a/src/conftime.h b/src/conftime.h index cb6b7aa8..ad07cdb0 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-04-01 21:21]" +#define COMPILE_DATE_STRING "[2006-04-02 12:38]" diff --git a/src/editor.c b/src/editor.c index 9e29e561..d628b8be 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1751,6 +1751,8 @@ static struct ValueTextInfo options_action_arg_number[] = { CA_ARG_4, "4" }, { CA_ARG_5, "5" }, { CA_ARG_10, "10" }, + { CA_ARG_100, "100" }, + { CA_ARG_1000, "1000" }, { CA_ARG_UNDEFINED, " " }, { CA_ARG_NUMBER_MIN, "min" }, { CA_ARG_NUMBER_MAX, "max" }, @@ -1786,6 +1788,8 @@ static struct ValueTextInfo options_action_arg_value[] = { CA_ARG_4, "4" }, { CA_ARG_5, "5" }, { CA_ARG_10, "10" }, + { CA_ARG_100, "100" }, + { CA_ARG_1000, "1000" }, { CA_ARG_UNDEFINED, " " }, { CA_ARG_NUMBER_MIN, "min" }, { CA_ARG_NUMBER_MAX, "max" }, diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 9322fd84..00a41a8b 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -1385,6 +1385,7 @@ boolean HandleGadgets(int mx, int my, int button) static int last_button = 0; static int last_mx = 0, last_my = 0; static int pressed_mx = 0, pressed_my = 0; + static boolean keep_selectbox_open = FALSE; int scrollbar_mouse_pos = 0; struct GadgetInfo *new_gi, *gi; boolean press_event; @@ -1511,6 +1512,10 @@ boolean HandleGadgets(int mx, int my, int button) gadget_released_inside_select_area = FALSE; } + /* setting state for handling over-large selectbox */ + if (keep_selectbox_open && (press_event || !mouse_inside_select_line)) + keep_selectbox_open = FALSE; + /* if new gadget pressed, store this gadget */ if (gadget_pressed) last_gi = new_gi; @@ -1527,8 +1532,9 @@ boolean HandleGadgets(int mx, int my, int button) if (gadget_released) { if (gi->type & GD_TYPE_SELECTBOX && - (mouse_released_where_pressed || - !gadget_released_inside_select_area)) /* selectbox stays open */ + (keep_selectbox_open || + mouse_released_where_pressed || + !gadget_released_inside_select_area)) /* selectbox stays open */ { gi->selectbox.stay_open = TRUE; pressed_mx = 0; @@ -1589,7 +1595,8 @@ boolean HandleGadgets(int mx, int my, int button) if (gi->textarea.cursor_position != old_cursor_position) DrawGadget(gi, DG_PRESSED, gi->direct_draw); } - else if (gi->type & GD_TYPE_SELECTBOX && gi->selectbox.open) + else if (gi->type & GD_TYPE_SELECTBOX && gi->selectbox.open && + !keep_selectbox_open) { int old_index = gi->selectbox.current_index; @@ -1713,6 +1720,12 @@ boolean HandleGadgets(int mx, int my, int button) return TRUE; } } + else if (gi->type & GD_TYPE_SELECTBOX) + { + /* keep selectbox open in case of over-large selectbox */ + keep_selectbox_open = (mouse_inside_select_line && + mouse_inside_select_area); + } DrawGadget(gi, DG_PRESSED, gi->direct_draw); @@ -1746,7 +1759,7 @@ boolean HandleGadgets(int mx, int my, int button) else if (gadget_moving_off_borders && gi->state == GD_BUTTON_PRESSED) DrawGadget(gi, DG_UNPRESSED, gi->direct_draw); } - else if (gi->type & GD_TYPE_SELECTBOX) + else if (gi->type & GD_TYPE_SELECTBOX && !keep_selectbox_open) { int old_index = gi->selectbox.current_index; @@ -1818,7 +1831,8 @@ boolean HandleGadgets(int mx, int my, int button) if (gi->type & GD_TYPE_SELECTBOX) { - if (mouse_released_where_pressed || + if (keep_selectbox_open || + mouse_released_where_pressed || !gadget_released_inside_select_area) /* selectbox stays open */ { deactivate_gadget = FALSE; diff --git a/src/main.h b/src/main.h index 31740d33..682f8b53 100644 --- a/src/main.h +++ b/src/main.h @@ -670,6 +670,7 @@ #define GFX_ELEMENT(e) (element_info[e].use_gfx_element ? \ element_info[e].gfx_element : e) +/* !!! CHECK THIS !!! */ #if 1 #define TILE_GFX_ELEMENT(x, y) \ (GfxElement[x][y] != EL_UNDEFINED && \ -- 2.34.1