+2006-08-04
+ * fixed bug with scrollbars inside editor when using the Windows mouse
+ enhancement tool "True X-Mouse" (which injects key events to the event
+ queue to insert selected stuff into the Windows clipboard, which gets
+ confused with the "Insert" key for jumping to the last editor cascade
+ block in the element list)
+
2006-08-01
* added selection of preferred fullscreen mode to setup / graphics menu
(useful if default mode 800 x 600 does not match screen aspect ratio)
setup menu (input devices section) by using standard button gadgets
* added support for mouse scroll wheel (caused buggy behaviour before)
* added support for scrolling horizontal scrollbars with mouse wheel by
- holding "Ctrl" key pressed while scrolling the wheel
+ holding "Shift" key pressed while scrolling the wheel
* added support for single step mouse wheel scrolling by holding "Alt"
- key pressed while scrolling the wheel
+ key pressed while scrolling the wheel (can be combined with "Shift")
* changed output file "stderr.txt" on Windows platform now always to be
created in the R'n'D sub-directory of the personal documents directory
* added Windows message box to direct to "stderr.txt" after error aborts
-#define COMPILE_DATE_STRING "[2006-08-02 21:42]"
+#define COMPILE_DATE_STRING "[2006-08-04 19:20]"
case KSYM_Insert:
case KSYM_Delete:
-#if 1
- /* IS_EDITOR_CASCADE */
+
+ /* this is needed to prevent interference with running "True X-Mouse" */
+ if (GetKeyModStateFromEvents() & KMOD_Control)
+ break;
+
+ /* check for last or next editor cascade block in element list */
for (i = 0; i < num_editor_elements; i++)
{
if ((key == KSYM_Insert && i == element_shift) ||
ModifyEditorElementList();
-#else
-
- for (i = 0; i < num_editor_elements; i++)
- {
- int e = editor_elements[i];
-
- if ((key == KSYM_Insert &&
- (e == EL_INTERNAL_CASCADE_CE ||
- e == EL_INTERNAL_CASCADE_CE_ACTIVE)) ||
- (key == KSYM_Delete &&
- (e == EL_INTERNAL_CASCADE_GE ||
- e == EL_INTERNAL_CASCADE_GE_ACTIVE)))
- break;
- }
-
- if (i < num_editor_elements)
- {
- element_shift = i;
-
- if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
- element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
-
- ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
- GDI_SCROLLBAR_ITEM_POSITION,
- element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
-
- ModifyEditorElementList();
- }
-#endif
-
break;
case KSYM_Escape:
DrawDrawingWindow();
edit_mode = ED_MODE_DRAWING;
}
+
break;
default:
void HandleButtonEvent(ButtonEvent *event)
{
+#if 0
+ printf("::: BUTTON EVENT: button %d %s\n", event->button,
+ event->type == EVENT_BUTTONPRESS ? "pressed" : "released");
+#endif
+
motion_status = FALSE;
if (event->type == EVENT_BUTTONPRESS)
Key key = GetEventKey(event, with_modifiers);
Key keymod = (with_modifiers ? GetEventKey(event, FALSE) : key);
+#if 0
+ printf("::: KEY EVENT: %d %s\n", GetEventKey(event, TRUE),
+ event->type == EVENT_KEYPRESS ? "pressed" : "released");
+#endif
+
HandleKeyModState(keymod, key_status);
HandleKey(key, key_status);
}
{
int move_dir_horizontal = player->effective_action & MV_HORIZONTAL;
int move_dir_vertical = player->effective_action & MV_VERTICAL;
- boolean player_is_snapping = player->effective_action & JOY_BUTTON_1;
+ boolean player_is_snapping = (player->effective_action & JOY_BUTTON_1);
int jx = player->jx, jy = player->jy;
boolean player_is_moving_to_valid_field =
(!player_is_snapping &&
break;
case GDI_ACTIVE:
- /* take care here: "boolean" is typedef'ed as "unsigned char",
- which gets promoted to "int" */
gi->active = (boolean)va_arg(ap, int);
break;
case GDI_DIRECT_DRAW:
- /* take care here: "boolean" is typedef'ed as "unsigned char",
- which gets promoted to "int" */
gi->direct_draw = (boolean)va_arg(ap, int);
break;
case GDI_CHECKED:
- /* take care here: "boolean" is typedef'ed as "unsigned char",
- which gets promoted to "int" */
gi->checked = (boolean)va_arg(ap, int);
break;
(gadget_pressed_inside_select_line && !mouse_inside_select_area)))
{
struct GadgetInfo *gi = last_gi;
- boolean gadget_changed = (gi->event_mask & GD_EVENT_TEXT_LEAVING);
+ boolean gadget_changed = ((gi->event_mask & GD_EVENT_TEXT_LEAVING) != 0);
/* check if text gadget has changed its value */
if (gi->type & GD_TYPE_TEXT_INPUT)
if (IS_WHEEL_BUTTON(button))
{
- boolean scroll_single_step = (GetKeyModState() & KMOD_Alt);
+ boolean scroll_single_step = ((GetKeyModState() & KMOD_Alt) != 0);
item_steps = (scroll_single_step ? 1 : DEFAULT_WHEEL_STEPS);
item_direction = (button == MB_WHEEL_UP ||
if (key == KSYM_Return) /* valid for both text input and selectbox */
{
- boolean gadget_changed = (gi->event_mask & GD_EVENT_TEXT_RETURN);
+ boolean gadget_changed = ((gi->event_mask & GD_EVENT_TEXT_RETURN) != 0);
if (gi->type & GD_TYPE_TEXT_INPUT)
{
do
{
- *x = i * aspect_ratio;
+ *x = i * aspect_ratio + 0.000001;
*y = i;
aspect_ratio_new = (float)*x / (float)*y;
i++;
}
- while (aspect_ratio_new != aspect_ratio && *x < screen_mode->width);
+ while (aspect_ratio_new != aspect_ratio && *y < screen_mode->height);
}
static void FreeCustomArtworkList(struct ArtworkListInfo *,
{
static KeyMod current_modifiers = KMOD_None;
-#if !defined(TARGET_SDL)
if (key != KSYM_UNDEFINED) /* new key => check for modifier key change */
{
KeyMod new_modifier = KMOD_None;
else
current_modifiers &= ~new_modifier;
}
-#endif
return current_modifiers;
}
#endif
}
+KeyMod GetKeyModStateFromEvents()
+{
+ /* always use key modifier state as tracked from key events (this is needed
+ if the modifier key event was injected into the event queue, but the key
+ was not really pressed on keyboard -- SDL_GetModState() seems to directly
+ query the keys as held pressed on the keyboard) -- this case is currently
+ only used to filter out clipboard insert events from "True X-Mouse" tool */
+
+ return HandleKeyModState(KSYM_UNDEFINED, 0);
+}
+
boolean CheckCloseWindowEvent(ClientMessageEvent *event)
{
if (event->type != EVENT_CLIENTMESSAGE)
Key GetEventKey(KeyEvent *, boolean);
KeyMod HandleKeyModState(Key, int);
KeyMod GetKeyModState();
+KeyMod GetKeyModStateFromEvents();
boolean CheckCloseWindowEvent(ClientMessageEvent *);
void InitJoysticks();
#include <string.h>
#include <sys/types.h>
-typedef unsigned char boolean;
+typedef int boolean;
#if !defined(PLATFORM_WIN32)
typedef unsigned char byte;
for (i = 0; video.fullscreen_modes[i].width != -1; i++)
{
TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
- char identifier[20], name[20];
+ char identifier[32], name[32];
int x = video.fullscreen_modes[i].width;
int y = video.fullscreen_modes[i].height;
int xx, yy;
static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS];
static int request_gadget_id = -1;
-static int preview_tilesize = 4;
+static int preview_tilesize = TILEX / 8;
static char *print_if_not_empty(int element)
{
if (lev_fieldy < preview_size_y)
ypos += (preview_size_y - lev_fieldy) / 2 * preview_tilesize;
+#if 1
+ xpos += MICRO_TILEX;
+ ypos += MICRO_TILEY;
+#else
xpos += preview_tilesize;
ypos += preview_tilesize;
+#endif
for (x = -1; x <= preview_size_x; x++)
{