Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2016-09-19 03:25:59 +0300
committerJulian Eisel <eiseljulian@gmail.com>2016-09-19 03:41:10 +0300
commitc2d7d4764e86d8a133168ff8ea9aedbd78b5cd72 (patch)
tree421fef350fcdcbb8f0bc25f26390951cc9ee2121 /source/blender/editors/interface/interface_handlers.c
parent976e591e93dd97de2c8f5be639a78c22e6505bae (diff)
Various cleanups related to button locking
* Rename uiBut.lockstr to disabled_info * Remove unreachable code * Replace duplicated check with assert * Replace overly ambitious check with assert * Add comments
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 5e9fc53de16..933beaf6afb 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2248,9 +2248,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
bool buf_paste_alloc = false;
bool show_report = false; /* use to display errors parsing paste input */
- if (mode == 'v' && (but->flag & UI_BUT_DISABLED)) {
- return;
- }
+ BLI_assert((but->flag & UI_BUT_DISABLED) == 0); /* caller should check */
if (mode == 'c') {
/* disallow copying from any passwords */
@@ -6974,6 +6972,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
if (but->flag & UI_BUT_DISABLED)
return WM_UI_HANDLER_CONTINUE;
+ /* if but->pointype is set, but->poin should be too */
+ BLI_assert(!but->pointype || but->poin);
+
if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) {
/* handle copy-paste */
if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS &&
@@ -7098,23 +7099,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
}
}
- /* verify if we can edit this button */
- if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
- if (but->flag & UI_BUT_DISABLED) {
- if (but->lockstr) {
- WM_report(RPT_INFO, but->lockstr);
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
- }
- }
- else if (but->pointype && but->poin == NULL) {
- /* there's a pointer needed */
- BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str);
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
- }
- }
-
switch (but->type) {
case UI_BTYPE_BUT:
retval = ui_do_but_BUT(C, but, data, event);