Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_handlers.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 4,346 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| return WM_UI_HANDLER_CONTINUE; | return WM_UI_HANDLER_CONTINUE; | ||||
| } | } | ||||
| static int ui_do_but_TEX( | static int ui_do_but_TEX( | ||||
| bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) | bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) | ||||
| { | { | ||||
| if (data->state == BUTTON_STATE_HIGHLIGHT) { | if (data->state == BUTTON_STATE_HIGHLIGHT) { | ||||
| if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && event->val == KM_PRESS) { | 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, PADENTER, RETKEY) && (!UI_but_is_utf8(but))) { | ||||
| /* pass - allow filesel, enter to execute */ | /* pass - allow filesel, enter to execute */ | ||||
| } | } | ||||
| else if (but->dt == UI_EMBOSS_NONE && !event->ctrl) { | else if (but->dt == UI_EMBOSS_NONE && !event->ctrl) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else if (!ui_but_extra_operator_icon_mouse_over_get(but, data, event)) { | else { | ||||
| if (!ui_but_extra_operator_icon_mouse_over_get(but, data, event)) { | |||||
| button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); | button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); | ||||
| } | |||||
| return WM_UI_HANDLER_BREAK; | return WM_UI_HANDLER_BREAK; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
sybren: Personally I would clarify this code by un-nesting some of the `if`-statements and just doing… | |||||
Not Done Inline ActionsMost other handlers here only filter out the cases when we want to break, and otherwise let execution go on to the single return WM_UI_HANDLER_CONTINUE at the end of the function. So there is a consistency argument here. This code is a mess either way. There's not much we can do to change that at this granular level I'm afraid. In the end it doesn't really matter how we do this exactly. Severin: Most other handlers here only filter out the cases when we want to break, and otherwise let… | |||||
| else if (data->state == BUTTON_STATE_TEXT_EDITING) { | else if (data->state == BUTTON_STATE_TEXT_EDITING) { | ||||
| ui_do_but_textedit(C, block, but, data, event); | ui_do_but_textedit(C, block, but, data, event); | ||||
| return WM_UI_HANDLER_BREAK; | return WM_UI_HANDLER_BREAK; | ||||
| } | } | ||||
| else if (data->state == BUTTON_STATE_TEXT_SELECTING) { | else if (data->state == BUTTON_STATE_TEXT_SELECTING) { | ||||
| ui_do_but_textedit_select(C, block, but, data, event); | ui_do_but_textedit_select(C, block, but, data, event); | ||||
| return WM_UI_HANDLER_BREAK; | return WM_UI_HANDLER_BREAK; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 6,582 Lines • Show Last 20 Lines | |||||
Personally I would clarify this code by un-nesting some of the if-statements and just doing return WM_UI_HANDLER_CONTINUE; instead of /* pass */.