projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20060517-1-src
[rocksndiamonds.git]
/
src
/
libgame
/
gadgets.c
diff --git
a/src/libgame/gadgets.c
b/src/libgame/gadgets.c
index 9322fd84a84dd6e05ea92ae41be19f7aeef930e5..ede8cfc7f54cad4888b0209ef96a99db72a93f24 100644
(file)
--- 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 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;
int scrollbar_mouse_pos = 0;
struct GadgetInfo *new_gi, *gi;
boolean press_event;
@@
-1463,7
+1464,7
@@
boolean HandleGadgets(int mx, int my, int button)
{
CheckRangeOfNumericInputGadget(gi);
{
CheckRangeOfNumericInputGadget(gi);
- if (
strcmp(gi->textinput.value, gi->textinput.last_value) != 0
)
+ if (
!strEqual(gi->textinput.last_value, gi->textinput.value)
)
strcpy(gi->textinput.last_value, gi->textinput.value);
else
gadget_changed = FALSE;
strcpy(gi->textinput.last_value, gi->textinput.value);
else
gadget_changed = FALSE;
@@
-1511,6
+1512,10
@@
boolean HandleGadgets(int mx, int my, int button)
gadget_released_inside_select_area = FALSE;
}
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;
/* 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 &&
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;
{
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);
}
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;
{
int old_index = gi->selectbox.current_index;
@@
-1713,6
+1720,12
@@
boolean HandleGadgets(int mx, int my, int button)
return TRUE;
}
}
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);
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 (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;
{
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 (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;
!gadget_released_inside_select_area) /* selectbox stays open */
{
deactivate_gadget = FALSE;
@@
-1897,7
+1911,7
@@
boolean HandleGadgetsKeyInput(Key key)
{
CheckRangeOfNumericInputGadget(gi);
{
CheckRangeOfNumericInputGadget(gi);
- if (
strcmp(gi->textinput.value, gi->textinput.last_value) != 0
)
+ if (
!strEqual(gi->textinput.last_value, gi->textinput.value)
)
strcpy(gi->textinput.last_value, gi->textinput.value);
else
gadget_changed = FALSE;
strcpy(gi->textinput.last_value, gi->textinput.value);
else
gadget_changed = FALSE;