diff options
author | Ray Molenkamp <github@lazydodo.com> | 2020-03-18 19:38:37 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2020-03-18 19:38:37 +0300 |
commit | b88ca3e6d113d161dd119bf1cec959c73b797af7 (patch) | |
tree | 6a8b73ca95f8a21742cba1e764d1e24cc5ae8db5 /source/blender/editors/interface | |
parent | 9e382dd2a3d8569201a3e5c1a8478166c77e9029 (diff) |
Cleanup: Resolve HKEY conflict
Both the MS headers and blender headers define the HKEY
which gives all kind of inclusion order issues.
This diff renames all *KEY constants to EVT_*KEY to resolve
this conflict.
Reviewed By: brecht , dfelinto
Differential Revision: http://developer.blender.org/D7164
Diffstat (limited to 'source/blender/editors/interface')
7 files changed, 250 insertions, 247 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index f6da9663daf..7a300860583 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -233,7 +233,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg) /* XXX this guess_opname can potentially return a different keymap * than being found on adding later... */ km = WM_keymap_guess_opname(C, idname); - kmi = WM_keymap_add_item(km, idname, AKEY, KM_PRESS, 0, 0); + kmi = WM_keymap_add_item(km, idname, EVT_AKEY, KM_PRESS, 0, 0); kmi_id = kmi->id; /* This takes ownership of prop, or prop can be NULL for reset. */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f4dd114c312..27549ed60b5 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -634,8 +634,8 @@ static enum eSnapType ui_event_to_snap(const wmEvent *event) static bool ui_event_is_snap(const wmEvent *event) { - return (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY) || - ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)); + return (ELEM(event->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY) || + ELEM(event->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)); } static void ui_color_snap_hue(const enum eSnapType snap, float *r_hue) @@ -3513,7 +3513,7 @@ static void ui_do_but_textedit( break; case RIGHTMOUSE: - case ESCKEY: + case EVT_ESCKEY: if (event->val == KM_PRESS) { #ifdef WITH_INPUT_IME /* skips button handling since it is not wanted */ @@ -3584,24 +3584,24 @@ static void ui_do_but_textedit( if (event->val == KM_PRESS && !is_ime_composing) { switch (event->type) { - case VKEY: - case XKEY: - case CKEY: + case EVT_VKEY: + case EVT_XKEY: + case EVT_CKEY: if (IS_EVENT_MOD(event, ctrl, oskey)) { - if (event->type == VKEY) { + if (event->type == EVT_VKEY) { changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_PASTE); } - else if (event->type == CKEY) { + else if (event->type == EVT_CKEY) { changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_COPY); } - else if (event->type == XKEY) { + else if (event->type == EVT_XKEY) { changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_CUT); } retval = WM_UI_HANDLER_BREAK; } break; - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: ui_textedit_move(but, data, STRCUR_DIR_NEXT, @@ -3609,7 +3609,7 @@ static void ui_do_but_textedit( event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: ui_textedit_move(but, data, STRCUR_DIR_PREV, @@ -3618,7 +3618,7 @@ static void ui_do_but_textedit( retval = WM_UI_HANDLER_BREAK; break; case WHEELDOWNMOUSE: - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: if (data->searchbox) { #ifdef USE_KEYNAV_LIMIT ui_mouse_motion_keynav_init(&data->searchbox_keynav_state, event); @@ -3630,12 +3630,12 @@ static void ui_do_but_textedit( break; } ATTR_FALLTHROUGH; - case ENDKEY: + case EVT_ENDKEY: ui_textedit_move(but, data, STRCUR_DIR_NEXT, event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; case WHEELUPMOUSE: - case UPARROWKEY: + case EVT_UPARROWKEY: if (data->searchbox) { #ifdef USE_KEYNAV_LIMIT ui_mouse_motion_keynav_init(&data->searchbox_keynav_state, event); @@ -3647,28 +3647,28 @@ static void ui_do_but_textedit( break; } ATTR_FALLTHROUGH; - case HOMEKEY: + case EVT_HOMEKEY: ui_textedit_move(but, data, STRCUR_DIR_PREV, event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; - case PADENTER: - case RETKEY: + case EVT_PADENTER: + case EVT_RETKEY: button_activate_state(C, but, BUTTON_STATE_EXIT); retval = WM_UI_HANDLER_BREAK; break; - case DELKEY: + case EVT_DELKEY: changed = ui_textedit_delete( but, data, 1, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; - case BACKSPACEKEY: + case EVT_BACKSPACEKEY: changed = ui_textedit_delete( but, data, 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; - case AKEY: + case EVT_AKEY: /* Ctrl + A: Select all */ #if defined(__APPLE__) @@ -3685,7 +3685,7 @@ static void ui_do_but_textedit( } break; - case TABKEY: + case EVT_TABKEY: /* there is a key conflict here, we can't tab with autocomplete */ if (but->autocomplete_func || data->searchbox) { int autocomplete = ui_textedit_autocomplete(C, but, data); @@ -3719,7 +3719,7 @@ static void ui_do_but_textedit( /* exception that's useful for number buttons, some keyboard * numpads have a comma instead of a period */ if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { /* could use data->min*/ - if (event->type == PADPERIOD && ascii == ',') { + if (event->type == EVT_PADPERIOD && ascii == ',') { ascii = '.'; utf8_buf = NULL; /* force ascii fallback */ } @@ -4194,7 +4194,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, cons button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH); return WM_UI_HANDLER_BREAK; } @@ -4218,7 +4218,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { but->drawstr[0] = 0; but->modifier_key = 0; button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); @@ -4229,11 +4229,11 @@ static int ui_do_but_HOTKEYEVT(bContext *C, if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { return WM_UI_HANDLER_CONTINUE; } - else if (event->type == UNKNOWNKEY) { + else if (event->type == EVT_UNKNOWNKEY) { WM_report(RPT_WARNING, "Unsupported key: Unknown"); return WM_UI_HANDLER_CONTINUE; } - else if (event->type == CAPSLOCKKEY) { + else if (event->type == EVT_CAPSLOCKKEY) { WM_report(RPT_WARNING, "Unsupported key: CapsLock"); return WM_UI_HANDLER_CONTINUE; } @@ -4272,7 +4272,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, ED_region_tag_redraw(data->region); if (event->val == KM_PRESS) { - if (ISHOTKEY(event->type) && (event->type != ESCKEY)) { + if (ISHOTKEY(event->type) && (event->type != EVT_ESCKEY)) { if (WM_key_event_string(event->type, false)[0]) { ui_but_value_set(but, event->type); } @@ -4283,7 +4283,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } - else if (event->type == ESCKEY) { + else if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -4302,7 +4302,7 @@ static int ui_do_but_KEYEVT(bContext *C, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); return WM_UI_HANDLER_BREAK; } @@ -4349,7 +4349,7 @@ static int ui_do_but_TAB( button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); return WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY)) { + else if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY)) { int event_val = (is_property) ? KM_PRESS : KM_CLICK; if (event->val == event_val) { button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4373,8 +4373,9 @@ static int ui_do_but_TEX( bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && event->val == KM_PRESS) { - if (ELEM(event->type, PADENTER, RETKEY) && (!UI_but_is_utf8(but))) { + if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY) && + event->val == KM_PRESS) { + if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && (!UI_but_is_utf8(but))) { /* pass - allow filesel, enter to execute */ } else if (but->dt == UI_EMBOSS_NONE && !event->ctrl) { @@ -4404,7 +4405,7 @@ static int ui_do_but_SEARCH_UNLINK( bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { /* unlink icon is on right */ - if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY)) { + if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY)) { /* doing this on KM_PRESS calls eyedropper after clicking unlink icon */ if ((event->val == KM_RELEASE) && ui_do_but_extra_operator_icon(C, but, data, event)) { return WM_UI_HANDLER_BREAK; @@ -4426,7 +4427,7 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons if (data->state == BUTTON_STATE_HIGHLIGHT) { bool do_activate = false; - if (ELEM(event->type, PADENTER, RETKEY)) { + if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY)) { if (event->val == KM_PRESS) { do_activate = true; } @@ -4511,7 +4512,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con } #endif - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { int ret = WM_UI_HANDLER_BREAK; /* XXX (a bit ugly) Special case handling for filebrowser drag button */ if (but->dragpoin && but->imb && ui_but_contains_point_px_icon(but, data->region, event)) { @@ -4910,7 +4911,7 @@ static int ui_do_but_NUM( click = 1; } else if (event->val == KM_PRESS) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } @@ -4919,10 +4920,10 @@ static int ui_do_but_NUM( button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); retval = WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { click = 1; } - else if (event->type == MINUSKEY && event->val == KM_PRESS) { + else if (event->type == EVT_MINUSKEY && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); data->value = -data->value; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4935,7 +4936,7 @@ static int ui_do_but_NUM( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5214,7 +5215,7 @@ static int ui_do_but_SLI( click = 2; } else if (event->val == KM_PRESS) { - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } @@ -5238,10 +5239,10 @@ static int ui_do_but_SLI( button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); retval = WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { click = 1; } - else if (event->type == MINUSKEY && event->val == KM_PRESS) { + else if (event->type == EVT_MINUSKEY && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); data->value = -data->value; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -5253,7 +5254,7 @@ static int ui_do_but_SLI( #endif } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5420,7 +5421,7 @@ static int ui_do_but_SCROLL( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5472,7 +5473,7 @@ static int ui_do_but_GRIP( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -5505,7 +5506,7 @@ static int ui_do_but_LISTROW(bContext *C, /* hack to pass on ctrl+click and double click to overlapping text * editing field for editing list item names */ - if ((ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS && + if ((ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS && event->ctrl) || (event->type == LEFTMOUSE && event->val == KM_DBL_CLICK)) { uiBut *labelbut = ui_but_list_row_text_activate( @@ -5543,7 +5544,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co } #endif /* regular open menu */ - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -5716,7 +5717,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } #endif /* regular open menu */ - if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) { ui_palette_set_active(but); button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; @@ -5748,7 +5749,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co ui_apply_but(C, but->block, but, data, true); return WM_UI_HANDLER_BREAK; } - else if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == DELKEY && + else if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == EVT_DELKEY && event->val == KM_PRESS) { Palette *palette = (Palette *)but->rnapoin.owner_id; PaletteColor *color = but->rnapoin.data; @@ -5874,7 +5875,7 @@ static int ui_do_but_UNITVEC( } } } - else if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + else if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -6167,7 +6168,7 @@ static int ui_do_but_HSVCUBE( } #endif /* WITH_INPUT_NDOF */ /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { int len; @@ -6199,7 +6200,7 @@ static int ui_do_but_HSVCUBE( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -6443,7 +6444,7 @@ static int ui_do_but_HSVCIRCLE( } #endif /* WITH_INPUT_NDOF */ /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { int len; /* reset only saturation */ @@ -6474,7 +6475,7 @@ static int ui_do_but_HSVCIRCLE( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY || event->type == RIGHTMOUSE) { + if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -6598,7 +6599,7 @@ static int ui_do_but_COLORBAND( else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) { + else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) { if (event->val == KM_PRESS) { data->dragcbd->pos = data->dragfstart; BKE_colorband_update_sort(data->coba); @@ -7024,7 +7025,7 @@ static int ui_do_but_CURVEPROFILE( ui_window_to_block(data->region, block, &mx, &my); /* Move selected control points. */ - if (event->type == GKEY && event->val == KM_RELEASE) { + if (event->type == EVT_GKEY && event->val == KM_RELEASE) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -7036,7 +7037,7 @@ static int ui_do_but_CURVEPROFILE( CurveProfile *profile = (CurveProfile *)but->poin; /* Delete selected control points. */ - if (event->type == XKEY && event->val == KM_RELEASE) { + if (event->type == EVT_XKEY && event->val == KM_RELEASE) { BKE_curveprofile_remove_by_flag(profile, PROF_SELECT); BKE_curveprofile_update(profile, false); button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -7213,7 +7214,7 @@ static int ui_do_but_HISTOGRAM( return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { Histogram *hist = (Histogram *)but->poin; hist->ymax = 1.f; @@ -7222,7 +7223,7 @@ static int ui_do_but_HISTOGRAM( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -7289,7 +7290,7 @@ static int ui_do_but_WAVEFORM( return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) { + else if (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS) { Scopes *scopes = (Scopes *)but->poin; scopes->wavefrm_yfac = 1.f; @@ -7298,7 +7299,7 @@ static int ui_do_but_WAVEFORM( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -7384,7 +7385,7 @@ static int ui_do_but_TRACKPREVIEW( } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == EVT_ESCKEY) { if (event->val == KM_PRESS) { data->cancel = true; data->escapecancel = true; @@ -7428,8 +7429,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* handle copy and paste */ bool is_press_ctrl_but_no_shift = event->val == KM_PRESS && IS_EVENT_MOD(event, ctrl, oskey) && !event->shift; - bool do_copy = event->type == CKEY && is_press_ctrl_but_no_shift; - bool do_paste = event->type == VKEY && is_press_ctrl_but_no_shift; + bool do_copy = event->type == EVT_CKEY && is_press_ctrl_but_no_shift; + bool do_paste = event->type == EVT_VKEY && is_press_ctrl_but_no_shift; /* Specific handling for listrows, we try to find their overlapping tex button. */ if ((do_copy || do_paste) && but->type == UI_BTYPE_LISTROW) { @@ -7470,7 +7471,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * } if ((data->state == BUTTON_STATE_HIGHLIGHT) && - ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && + ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY) && (event->val == KM_RELEASE) && /* Only returns true if the event was handled. */ ui_do_but_extra_operator_icon(C, but, data, event)) { @@ -7602,7 +7603,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * data = but->active; if (data && data->state == BUTTON_STATE_HIGHLIGHT) { if ((retval == WM_UI_HANDLER_CONTINUE) && - (event->type == BACKSPACEKEY && event->val == KM_PRESS)) { + (event->type == EVT_BACKSPACEKEY && event->val == KM_PRESS)) { /* ctrl+backspace = reset active button; backspace = reset a whole array*/ ui_but_default_set(C, !event->ctrl, true); ED_region_tag_redraw(data->region); @@ -8896,7 +8897,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi } if (val == KM_PRESS) { - if ((ELEM(type, UPARROWKEY, DOWNARROWKEY) && !IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) || + if ((ELEM(type, EVT_UPARROWKEY, EVT_DOWNARROWKEY) && + !IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) || ((ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->ctrl && !IS_EVENT_MOD(event, shift, alt, oskey)))) { const int value_orig = RNA_property_int_get(&listbox->rnapoin, listbox->rnaprop); @@ -8905,10 +8907,10 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi /* activate up/down the list */ value = value_orig; if ((ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) != 0) { - inc = ELEM(type, UPARROWKEY, WHEELUPMOUSE) ? 1 : -1; + inc = ELEM(type, EVT_UPARROWKEY, WHEELUPMOUSE) ? 1 : -1; } else { - inc = ELEM(type, UPARROWKEY, WHEELUPMOUSE) ? -1 : 1; + inc = ELEM(type, EVT_UPARROWKEY, WHEELUPMOUSE) ? -1 : 1; } if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) { @@ -9563,7 +9565,7 @@ static int ui_handle_menu_event(bContext *C, break; /* Closing sub-levels of pull-downs. */ - case LEFTARROWKEY: + case EVT_LEFTARROWKEY: if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) { if (block->saferct.first) { menu->menuretval = UI_RETURN_OUT; @@ -9574,7 +9576,7 @@ static int ui_handle_menu_event(bContext *C, break; /* Opening sub-levels of pull-downs. */ - case RIGHTARROWKEY: + case EVT_RIGHTARROWKEY: if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) { if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) { @@ -9630,12 +9632,12 @@ static int ui_handle_menu_event(bContext *C, } ATTR_FALLTHROUGH; } - case UPARROWKEY: - case DOWNARROWKEY: - case PAGEUPKEY: - case PAGEDOWNKEY: - case HOMEKEY: - case ENDKEY: + case EVT_UPARROWKEY: + case EVT_DOWNARROWKEY: + case EVT_PAGEUPKEY: + case EVT_PAGEDOWNKEY: + case EVT_HOMEKEY: + case EVT_ENDKEY: /* arrowkeys: only handle for block_loop blocks */ if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { /* pass */ @@ -9654,13 +9656,13 @@ static int ui_handle_menu_event(bContext *C, uiMenuScrollType scrolltype; bool ui_block_flipped = (block->flag & UI_BLOCK_IS_FLIP) != 0; - if (ELEM(type, PAGEUPKEY, HOMEKEY)) { + if (ELEM(type, EVT_PAGEUPKEY, EVT_HOMEKEY)) { scrolltype = ui_block_flipped ? MENU_SCROLL_TOP : MENU_SCROLL_BOTTOM; } - else if (ELEM(type, PAGEDOWNKEY, ENDKEY)) { + else if (ELEM(type, EVT_PAGEDOWNKEY, EVT_ENDKEY)) { scrolltype = ui_block_flipped ? MENU_SCROLL_BOTTOM : MENU_SCROLL_TOP; } - else if (ELEM(type, UPARROWKEY, WHEELUPMOUSE)) { + else if (ELEM(type, EVT_UPARROWKEY, WHEELUPMOUSE)) { scrolltype = ui_block_flipped ? MENU_SCROLL_UP : MENU_SCROLL_DOWN; } else { @@ -9709,60 +9711,60 @@ static int ui_handle_menu_event(bContext *C, break; - case ONEKEY: - case PAD1: + case EVT_ONEKEY: + case EVT_PAD1: act = 1; ATTR_FALLTHROUGH; - case TWOKEY: - case PAD2: + case EVT_TWOKEY: + case EVT_PAD2: if (act == 0) { act = 2; } ATTR_FALLTHROUGH; - case THREEKEY: - case PAD3: + case EVT_THREEKEY: + case EVT_PAD3: if (act == 0) { act = 3; } ATTR_FALLTHROUGH; - case FOURKEY: - case PAD4: + case EVT_FOURKEY: + case EVT_PAD4: if (act == 0) { act = 4; } ATTR_FALLTHROUGH; - case FIVEKEY: - case PAD5: + case EVT_FIVEKEY: + case EVT_PAD5: if (act == 0) { act = 5; } ATTR_FALLTHROUGH; - case SIXKEY: - case PAD6: + case EVT_SIXKEY: + case EVT_PAD6: if (act == 0) { act = 6; } ATTR_FALLTHROUGH; - case SEVENKEY: - case PAD7: + case EVT_SEVENKEY: + case EVT_PAD7: if (act == 0) { act = 7; } ATTR_FALLTHROUGH; - case EIGHTKEY: - case PAD8: + case EVT_EIGHTKEY: + case EVT_PAD8: if (act == 0) { act = 8; } ATTR_FALLTHROUGH; - case NINEKEY: - case PAD9: + case EVT_NINEKEY: + case EVT_PAD9: if (act == 0) { act = 9; } ATTR_FALLTHROUGH; - case ZEROKEY: - case PAD0: + case EVT_ZEROKEY: + case EVT_PAD0: if (act == 0) { act = 10; } @@ -9823,32 +9825,32 @@ static int ui_handle_menu_event(bContext *C, break; /* Handle keystrokes on menu items */ - case AKEY: - case BKEY: - case CKEY: - case DKEY: - case EKEY: - case FKEY: - case GKEY: - case HKEY: - case IKEY: - case JKEY: - case KKEY: - case LKEY: - case MKEY: - case NKEY: - case OKEY: - case PKEY: - case QKEY: - case RKEY: - case SKEY: - case TKEY: - case UKEY: - case VKEY: - case WKEY: - case XKEY: - case YKEY: - case ZKEY: { + case EVT_AKEY: + case EVT_BKEY: + case EVT_CKEY: + case EVT_DKEY: + case EVT_EKEY: + case EVT_FKEY: + case EVT_GKEY: + case EVT_HKEY: + case EVT_IKEY: + case EVT_JKEY: + case EVT_KKEY: + case EVT_LKEY: + case EVT_MKEY: + case EVT_NKEY: + case EVT_OKEY: + case EVT_PKEY: + case EVT_QKEY: + case EVT_RKEY: + case EVT_SKEY: + case EVT_TKEY: + case EVT_UKEY: + case EVT_VKEY: + case EVT_WKEY: + case EVT_XKEY: + case EVT_YKEY: + case EVT_ZKEY: { if ((event->val == KM_PRESS || event->val == KM_DBL_CLICK) && !IS_EVENT_MOD(event, shift, ctrl, oskey)) { if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) { @@ -9930,11 +9932,11 @@ static int ui_handle_menu_event(bContext *C, retval = WM_UI_HANDLER_BREAK; } #endif - else if (event->type == ESCKEY && event->val == KM_PRESS) { + else if (event->type == EVT_ESCKEY && event->val == KM_PRESS) { /* Escape cancels this and all preceding menus. */ menu->menuretval = UI_RETURN_CANCEL; } - else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) { + else if (ELEM(event->type, EVT_RETKEY, EVT_PADENTER) && event->val == KM_PRESS) { uiBut *but_default = ui_region_find_first_but_test_flag( region, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN); if ((but_default != NULL) && (but_default->active == NULL)) { @@ -10367,37 +10369,37 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } break; - case ESCKEY: + case EVT_ESCKEY: case RIGHTMOUSE: menu->menuretval = UI_RETURN_CANCEL; break; - case AKEY: - case BKEY: - case CKEY: - case DKEY: - case EKEY: - case FKEY: - case GKEY: - case HKEY: - case IKEY: - case JKEY: - case KKEY: - case LKEY: - case MKEY: - case NKEY: - case OKEY: - case PKEY: - case QKEY: - case RKEY: - case SKEY: - case TKEY: - case UKEY: - case VKEY: - case WKEY: - case XKEY: - case YKEY: - case ZKEY: { + case EVT_AKEY: + case EVT_BKEY: + case EVT_CKEY: + case EVT_DKEY: + case EVT_EKEY: + case EVT_FKEY: + case EVT_GKEY: + case EVT_HKEY: + case EVT_IKEY: + case EVT_JKEY: + case EVT_KKEY: + case EVT_LKEY: + case EVT_MKEY: + case EVT_NKEY: + case EVT_OKEY: + case EVT_PKEY: + case EVT_QKEY: + case EVT_RKEY: + case EVT_SKEY: + case EVT_TKEY: + case EVT_UKEY: + case EVT_VKEY: + case EVT_WKEY: + case EVT_XKEY: + case EVT_YKEY: + case EVT_ZKEY: { if ((event->val == KM_PRESS || event->val == KM_DBL_CLICK) && !IS_EVENT_MOD(event, shift, ctrl, oskey)) { for (but = block->buttons.first; but; but = but->next) { @@ -10410,8 +10412,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } #define CASE_NUM_TO_DIR(n, d) \ - case (ZEROKEY + n): \ - case (PAD0 + n): { \ + case (EVT_ZEROKEY + n): \ + case (EVT_PAD0 + n): { \ if (num_dir == UI_RADIAL_NONE) \ num_dir = d; \ } \ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 3173c962830..1984372f398 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -567,14 +567,14 @@ static DrawInfo *g_di_event_list = NULL; int UI_icon_from_event_type(short event_type, short event_value) { - if (event_type == RIGHTSHIFTKEY) { - event_type = LEFTSHIFTKEY; + if (event_type == EVT_RIGHTSHIFTKEY) { + event_type = EVT_LEFTSHIFTKEY; } - else if (event_type == RIGHTCTRLKEY) { - event_type = LEFTCTRLKEY; + else if (event_type == EVT_RIGHTCTRLKEY) { + event_type = EVT_LEFTCTRLKEY; } - else if (event_type == RIGHTALTKEY) { - event_type = LEFTALTKEY; + else if (event_type == EVT_RIGHTALTKEY) { + event_type = EVT_LEFTALTKEY; } else if (event_type == EVT_TWEAK_L) { event_type = LEFTMOUSE; @@ -648,54 +648,54 @@ static void init_event_icons(void) const int w = 16; /* DUMMY */ - INIT_EVENT_ICON(ICON_EVENT_A, AKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_B, BKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_C, CKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_D, DKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_E, EKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F, FKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_G, GKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_H, HKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_I, IKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_J, JKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_K, KKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_L, LKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_M, MKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_N, NKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_O, OKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_P, PKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_Q, QKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_R, RKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_S, SKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_T, TKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_U, UKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_V, VKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_W, WKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_X, XKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_Y, YKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_Z, ZKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_SHIFT, LEFTSHIFTKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_CTRL, LEFTCTRLKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_ALT, LEFTALTKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_OS, OSKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F1, F1KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F2, F2KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F3, F3KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F4, F4KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F5, F5KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F6, F6KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F7, F7KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F8, F8KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F9, F9KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F10, F10KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F11, F11KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_F12, F12KEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_ESC, ESCKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_TAB, TABKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_PAGEUP, PAGEUPKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_PAGEDOWN, PAGEDOWNKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_RETURN, RETKEY, KM_ANY); - INIT_EVENT_ICON(ICON_EVENT_SPACEKEY, SPACEKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_A, EVT_AKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_B, EVT_BKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_C, EVT_CKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_D, EVT_DKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_E, EVT_EKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F, EVT_FKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_G, EVT_GKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_H, EVT_HKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_I, EVT_IKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_J, EVT_JKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_K, EVT_KKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_L, EVT_LKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_M, EVT_MKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_N, EVT_NKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_O, EVT_OKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_P, EVT_PKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Q, EVT_QKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_R, EVT_RKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_S, EVT_SKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_T, EVT_TKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_U, EVT_UKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_V, EVT_VKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_W, EVT_WKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_X, EVT_XKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Y, EVT_YKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Z, EVT_ZKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_SHIFT, EVT_LEFTSHIFTKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_CTRL, EVT_LEFTCTRLKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_ALT, EVT_LEFTALTKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_OS, EVT_OSKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F1, EVT_F1KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F2, EVT_F2KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F3, EVT_F3KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F4, EVT_F4KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F5, EVT_F5KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F6, EVT_F6KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F7, EVT_F7KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F8, EVT_F8KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F9, EVT_F9KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F10, EVT_F10KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F11, EVT_F11KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F12, EVT_F12KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_ESC, EVT_ESCKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_TAB, EVT_TABKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_PAGEUP, EVT_PAGEUPKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_PAGEDOWN, EVT_PAGEDOWNKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_RETURN, EVT_RETKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_SPACEKEY, EVT_SPACEKEY, KM_ANY); g_di_event_list = di_next; diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c index 9a967c3b8f3..9398d1c0cd4 100644 --- a/source/blender/editors/interface/interface_icons_event.c +++ b/source/blender/editors/interface/interface_icons_event.c @@ -142,19 +142,19 @@ void icon_draw_rect_input(float x, .ymax = y + h, }; - if ((event_type >= AKEY) && (event_type <= ZKEY)) { - char str[2] = {'A' + (event_type - AKEY), '\0'}; + if ((event_type >= EVT_AKEY) && (event_type <= EVT_ZKEY)) { + char str[2] = {'A' + (event_type - EVT_AKEY), '\0'}; icon_draw_rect_input_text(&rect, color, str, 13); } - else if ((event_type >= F1KEY) && (event_type <= F12KEY)) { + else if ((event_type >= EVT_F1KEY) && (event_type <= EVT_F12KEY)) { char str[4]; - SNPRINTF(str, "F%d", 1 + (event_type - F1KEY)); - icon_draw_rect_input_text(&rect, color, str, event_type > F9KEY ? 8 : 10); + SNPRINTF(str, "F%d", 1 + (event_type - EVT_F1KEY)); + icon_draw_rect_input_text(&rect, color, str, event_type > EVT_F9KEY ? 8 : 10); } - else if (event_type == LEFTSHIFTKEY) { + else if (event_type == EVT_LEFTSHIFTKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x87, 0xa7, 0x0}); } - else if (event_type == LEFTCTRLKEY) { + else if (event_type == EVT_LEFTCTRLKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8c, 0x83, 0x0}); } @@ -162,7 +162,7 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "Ctrl", 9); } } - else if (event_type == LEFTALTKEY) { + else if (event_type == EVT_LEFTALTKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8c, 0xa5, 0x0}); } @@ -170,7 +170,7 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "Alt", 10); } } - else if (event_type == OSKEY) { + else if (event_type == EVT_OSKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8c, 0x98, 0x0}); } @@ -181,22 +181,22 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "OS", 10); } } - else if (event_type == DELKEY) { + else if (event_type == EVT_DELKEY) { icon_draw_rect_input_text(&rect, color, "Del", 9); } - else if (event_type == TABKEY) { + else if (event_type == EVT_TABKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0xad, 0xbe, 0x0}); } - else if (event_type == HOMEKEY) { + else if (event_type == EVT_HOMEKEY) { icon_draw_rect_input_text(&rect, color, "Home", 6); } - else if (event_type == ENDKEY) { + else if (event_type == EVT_ENDKEY) { icon_draw_rect_input_text(&rect, color, "End", 8); } - else if (event_type == RETKEY) { + else if (event_type == EVT_RETKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8f, 0x8e, 0x0}); } - else if (event_type == ESCKEY) { + else if (event_type == EVT_ESCKEY) { if (platform == MACOS) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x8e, 0x8b, 0x0}); } @@ -204,25 +204,25 @@ void icon_draw_rect_input(float x, icon_draw_rect_input_text(&rect, color, "Esc", 8); } } - else if (event_type == PAGEUPKEY) { + else if (event_type == EVT_PAGEUPKEY) { icon_draw_rect_input_text(&rect, color, (const char[]){'P', 0xe2, 0x86, 0x91, 0x0}, 8); } - else if (event_type == PAGEDOWNKEY) { + else if (event_type == EVT_PAGEDOWNKEY) { icon_draw_rect_input_text(&rect, color, (const char[]){'P', 0xe2, 0x86, 0x93, 0x0}, 8); } - else if (event_type == LEFTARROWKEY) { + else if (event_type == EVT_LEFTARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x90, 0x0}); } - else if (event_type == UPARROWKEY) { + else if (event_type == EVT_UPARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x91, 0x0}); } - else if (event_type == RIGHTARROWKEY) { + else if (event_type == EVT_RIGHTARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x92, 0x0}); } - else if (event_type == DOWNARROWKEY) { + else if (event_type == EVT_DOWNARROWKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x86, 0x93, 0x0}); } - else if (event_type == SPACEKEY) { + else if (event_type == EVT_SPACEKEY) { icon_draw_rect_input_symbol(&rect, color, (const char[]){0xe2, 0x90, 0xa3, 0x0}); } } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 1f5855aed9e..6e56dd96cb0 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1584,13 +1584,13 @@ static void ui_handle_panel_header( /* XXX weak code, currently it assumes layout style for location of widgets */ /* check open/collapsed button */ - if (event == RETKEY) { + if (event == EVT_RETKEY) { button = 1; } - else if (event == AKEY) { + else if (event == EVT_AKEY) { button = 1; } - else if (ELEM(event, 0, RETKEY, LEFTMOUSE) && shift) { + else if (ELEM(event, 0, EVT_RETKEY, LEFTMOUSE) && shift) { if (block->panel->type->parent == NULL) { block->panel->flag ^= PNL_PIN; button = 2; @@ -2305,7 +2305,7 @@ int ui_handler_panel_region(bContext *C, retval = WM_UI_HANDLER_BREAK; } } - else if ((event->type == TABKEY && event->ctrl) || + else if ((event->type == EVT_TABKEY && event->ctrl) || ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) { /* cycle tabs */ retval = ui_handle_panel_category_cycling(event, region, active_but); @@ -2340,7 +2340,8 @@ int ui_handler_panel_region(bContext *C, /* XXX hardcoded key warning */ if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER) && event->val == KM_PRESS) { - if (event->type == AKEY && ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) { + if (event->type == EVT_AKEY && + ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) { if (pa->flag & PNL_CLOSEDY) { if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) { @@ -2366,9 +2367,9 @@ int ui_handler_panel_region(bContext *C, if (event->val == KM_PRESS) { /* open close on header */ - if (ELEM(event->type, RETKEY, PADENTER)) { + if (ELEM(event->type, EVT_RETKEY, EVT_PADENTER)) { if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) { - ui_handle_panel_header(C, block, mx, my, RETKEY, event->ctrl, event->shift); + ui_handle_panel_header(C, block, mx, my, EVT_RETKEY, event->ctrl, event->shift); retval = WM_UI_HANDLER_BREAK; break; } @@ -2395,7 +2396,7 @@ int ui_handler_panel_region(bContext *C, break; } } - else if (event->type == ESCKEY) { + else if (event->type == EVT_ESCKEY) { /*XXX 2.50*/ #if 0 if (block->handler) { @@ -2405,7 +2406,7 @@ int ui_handler_panel_region(bContext *C, } #endif } - else if (event->type == PADPLUSKEY || event->type == PADMINUS) { + else if (event->type == EVT_PADPLUSKEY || event->type == EVT_PADMINUS) { #if 0 /* XXX make float panel exception? */ int zoom = 0; diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 89eb0658d5e..b10d5be5136 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -283,11 +283,11 @@ void ui_searchbox_event(bContext *C, ARegion *region, uiBut *but, const wmEvent switch (type) { case WHEELUPMOUSE: - case UPARROWKEY: + case EVT_UPARROWKEY: ui_searchbox_select(C, region, but, -1); break; case WHEELDOWNMOUSE: - case DOWNARROWKEY: + case EVT_DOWNARROWKEY: ui_searchbox_select(C, region, but, 1); break; case MOUSEMOVE: diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 2c9803d1dd3..8116029af59 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -306,7 +306,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) } #endif default: - if (event->type == vpd->invoke_event || event->type == ESCKEY) { + if (event->type == vpd->invoke_event || event->type == EVT_ESCKEY) { if (event->val == KM_RELEASE) { /* calculate overall delta mouse-movement for redo */ RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); @@ -1244,7 +1244,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event /* apply zooming */ view_zoomdrag_apply(C, op); } - else if (event->type == vzd->invoke_event || event->type == ESCKEY) { + else if (event->type == vzd->invoke_event || event->type == EVT_ESCKEY) { if (event->val == KM_RELEASE) { /* for redo, store the overall deltas - need to respect zoom-locks here... */ |