diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-03-08 05:38:35 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-03-08 05:38:35 +0300 |
commit | 3e8b4ed8b64e4c5fbef6dfafeeab52942674e42e (patch) | |
tree | fc2a3b640746abb52a6d491e3f739d06d94f7ec0 /source | |
parent | b13cd8226e758c44c4393bb02bdeeaa6e8d36795 (diff) |
The BUTM button type (used for 'R' button in StretchTo/LimitDist constraints) now acts like a button when clicked on.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/interface.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index daff1a29011..1075937ae8b 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -2687,15 +2687,42 @@ static uiBlock *ui_do_but_BLOCK(uiBut *but, int event) static int ui_do_but_BUTM(uiBut *but) { - - ui_set_but_val(but, but->min); - UIafterfunc_butm= but->butm_func; - UIafterfunc_arg1= but->butm_func_arg; - UIafterval= but->a2; + int activated; - uibut_do_func(but); + do { + int oflag= but->flag; + short mval[2]; + + uiGetMouse(mywinget(), mval); + + if (uibut_contains_pt(but, mval)) + but->flag |= UI_SELECT; + else + but->flag &= ~UI_SELECT; + + if (but->flag != oflag) { + ui_draw_but(but); + ui_block_flush_back(but->block); + } + + PIL_sleep_ms(10); + } while (get_mbut() & L_MOUSE); + + activated= (but->flag & UI_SELECT); + + if (activated) { + ui_set_but_val(but, but->min); + UIafterfunc_butm= but->butm_func; + UIafterfunc_arg1= but->butm_func_arg; + UIafterval= but->a2; + + uibut_do_func(but); + } - return but->retval; + but->flag &= ~UI_SELECT; + ui_draw_but(but); + + return activated?but->retval:0; } static int ui_do_but_LABEL(uiBut *but) |