Commit: 870f911e360d8a2db095173ed824d1080bcd11d8
Author: Sergey Sharybin
Date:   Fri Mar 18 16:45:58 2016 +0500
Branches: blender-v2.77-release
https://developer.blender.org/rB870f911e360d8a2db095173ed824d1080bcd11d8

Revert "Fix button display clamping values"

This reverts commit e4e21480d6331903c90ab073746484498441e1ac.

===================================================================

M       source/blender/editors/interface/interface.c
M       source/blender/editors/interface/interface_handlers.c
M       source/blender/editors/interface/interface_intern.h

===================================================================

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 5f74dd7..ffebd39 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2787,12 +2787,7 @@ void UI_block_emboss_set(uiBlock *block, char dt)
        block->dt = dt;
 }
 
-/**
- * \param but: Button to update.
- * \param validate: When set, this function may change the button value.
- * Otherwise treat the button value as read-only.
- */
-void ui_but_update_ex(uiBut *but, const bool validate)
+void ui_but_update(uiBut *but)
 {
        /* if something changed in the button */
        double value = UI_BUT_VALUE_UNSET;
@@ -2814,19 +2809,13 @@ void ui_but_update_ex(uiBut *but, const bool validate)
                case UI_BTYPE_NUM:
                case UI_BTYPE_SCROLL:
                case UI_BTYPE_NUM_SLIDER:
-                       if (validate) {
-                               UI_GET_BUT_VALUE_INIT(but, value);
-                               if      (value < (double)but->hardmin) {
-                                       ui_but_value_set(but, but->hardmin);
-                               }
-                               else if (value > (double)but->hardmax) {
-                                       ui_but_value_set(but, but->hardmax);
-                               }
+                       UI_GET_BUT_VALUE_INIT(but, value);
+                       if      (value < (double)but->hardmin) 
ui_but_value_set(but, but->hardmin);
+                       else if (value > (double)but->hardmax) 
ui_but_value_set(but, but->hardmax);
 
-                               /* max must never be smaller than min! Both 
being equal is allowed though */
-                               BLI_assert(but->softmin <= but->softmax &&
-                                          but->hardmin <= but->hardmax);
-                       }
+                       /* max must never be smaller than min! Both being equal 
is allowed though */
+                       BLI_assert(but->softmin <= but->softmax &&
+                                  but->hardmin <= but->hardmax);
                        break;
                        
                case UI_BTYPE_ICON_TOGGLE:
@@ -3000,15 +2989,6 @@ void ui_but_update_ex(uiBut *but, const bool validate)
        /* text clipping moved to widget drawing code itself */
 }
 
-void ui_but_update(uiBut *but)
-{
-       ui_but_update_ex(but, false);
-}
-
-void ui_but_update_edited(uiBut *but)
-{
-       ui_but_update_ex(but, true);
-}
 
 void UI_block_align_begin(uiBlock *block)
 {
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 8614fba..91818f8 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -822,7 +822,7 @@ static void ui_apply_but_BLOCK(bContext *C, uiBut *but, 
uiHandleButtonData *data
        if (but->type == UI_BTYPE_MENU)
                ui_but_value_set(but, data->value);
 
-       ui_but_update_edited(but);
+       ui_but_update(but);
        ui_apply_but_func(C, but);
        data->retval = but->retval;
        data->applied = true;
@@ -842,9 +842,7 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, 
uiHandleButtonData *data)
                else   lvalue = UI_BITBUT_SET(lvalue, but->bitnr);
                
                ui_but_value_set(but, (double)lvalue);
-               if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == 
UI_BTYPE_ICON_TOGGLE_N) {
-                       ui_but_update_edited(but);
-               }
+               if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == 
UI_BTYPE_ICON_TOGGLE_N) ui_but_update(but);
        }
        else {
                
@@ -853,9 +851,7 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, 
uiHandleButtonData *data)
                
                if (ELEM(but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, 
UI_BTYPE_CHECKBOX_N)) push = !push;
                ui_but_value_set(but, (double)push);
-               if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == 
UI_BTYPE_ICON_TOGGLE_N) {
-                       ui_but_update_edited(but);
-               }
+               if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == 
UI_BTYPE_ICON_TOGGLE_N) ui_but_update(but);
        }
        
        ui_apply_but_func(C, but);
@@ -873,11 +869,9 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, 
uiBut *but, uiHandleBu
        ui_apply_but_func(C, but);
 
        /* states of other row buttons */
-       for (bt = block->buttons.first; bt; bt = bt->next) {
-               if (bt != but && bt->poin == but->poin && ELEM(bt->type, 
UI_BTYPE_ROW, UI_BTYPE_LISTROW)) {
-                       ui_but_update_edited(bt);
-               }
-       }
+       for (bt = block->buttons.first; bt; bt = bt->next)
+               if (bt != but && bt->poin == but->poin && ELEM(bt->type, 
UI_BTYPE_ROW, UI_BTYPE_LISTROW))
+                       ui_but_update(bt);
 
        data->retval = but->retval;
        data->applied = true;
@@ -889,7 +883,7 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, 
uiHandleButtonData *data)
                return;
 
        ui_but_string_set(C, but, data->str);
-       ui_but_update_edited(but);
+       ui_but_update(but);
 
        /* give butfunc a copy of the original text too.
         * feature used for bone renaming, channels, etc.
@@ -920,11 +914,10 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, 
uiHandleButtonData *data)
                        return;
                }
        }
-       else {
+       else
                ui_but_value_set(but, data->value);
-       }
 
-       ui_but_update_edited(but);
+       ui_but_update(but);
        ui_apply_but_func(C, but);
 
        data->retval = but->retval;
@@ -934,7 +927,7 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, 
uiHandleButtonData *data)
 static void ui_apply_but_VEC(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
        ui_but_v3_set(but, data->vec);
-       ui_but_update_edited(but);
+       ui_but_update(but);
        ui_apply_but_func(C, but);
 
        data->retval = but->retval;
@@ -1245,7 +1238,7 @@ static bool ui_drag_toggle_set_xy_xy(
                                                if (is_set_but != is_set) {
                                                        UI_but_execute(C, but);
                                                        if (do_check) {
-                                                               
ui_but_update_edited(but);
+                                                               
ui_but_update(but);
                                                        }
                                                        changed = true;
                                                }
@@ -3469,7 +3462,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock 
*block, uiBut *but, uiHandle
                        ui_apply_but(C, block, but, data, true);
                }
                else {
-                       ui_but_update_edited(but);
+                       ui_but_update(but);
                }
                but->changed = true;
                
diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index f0b8391..66510fb 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -484,9 +484,7 @@ extern uiButExtraIconType ui_but_icon_extra_get(uiBut *but);
 
 extern void ui_but_default_set(struct bContext *C, const bool all, const bool 
use_afterfunc);
 
-extern void ui_but_update_ex(uiBut *but, const bool validate);
 extern void ui_but_update(uiBut *but);
-extern void ui_but_update_edited(uiBut *but);
 extern bool ui_but_is_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
 extern bool ui_but_is_bool(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
 extern bool ui_but_is_unit(const uiBut *but) ATTR_WARN_UNUSED_RESULT;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to