Code cleanup: UI, unnecessary float/int conversion
authorCampbell Barton <ideasman42@gmail.com>
Mon, 2 Jun 2014 03:15:29 +0000 (13:15 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 Jun 2014 14:47:11 +0000 (00:47 +1000)
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_layout.c

index 94a9d55b70e2a8b638598ffb392e3a0a6b24b043..ea349f2a98a45412747a75cfa04da25717e08a6a 100644 (file)
@@ -3159,12 +3159,12 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
                }
                else {
                        if (item->icon) {
-                               uiDefIconTextButF(block, BUTM, B_NOP, item->icon, item->name, 0, 0,
-                                                 UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, (float) item->value, 0.0, 0, -1, item->description);
+                               uiDefIconTextButI(block, BUTM, B_NOP, item->icon, item->name, 0, 0,
+                                                 UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
                        }
                        else {
-                               uiDefButF(block, BUTM, B_NOP, item->name, 0, 0,
-                                         UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, (float) item->value, 0.0, 0, -1, item->description);
+                               uiDefButI(block, BUTM, B_NOP, item->name, 0, 0,
+                                         UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
                        }
                }
        }
index 3fe6452e56b2fa714ef09b90bc43832e48ba1d50..d44aacf7e53040068460ed251f1388970427cd95 100644 (file)
@@ -455,7 +455,7 @@ struct uiPopupBlockHandle {
        /* return values */
        int butretval;
        int menuretval;
-       float retvalue;
+       int   retvalue;
        float retvec[4];
 
        /* menu direction */
index 0bc679dede0f9a4b9cf2b7b773431a0044462316..a3d631db801bddf5239197041ac058c939b17c6f 100644 (file)
@@ -1759,7 +1759,7 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
 {
        /* label */
        uiBlock *block = layout->root->block;
-       float *retvalue = (block->handle) ? &block->handle->retvalue : NULL;
+       int *retvalue = (block->handle) ? &block->handle->retvalue : NULL;
        int w;
 
        uiBlockSetCurLayout(block, layout);
@@ -1772,11 +1772,11 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
        w = ui_text_icon_width(layout, name, icon, 0);
 
        if (icon && name[0])
-               uiDefIconTextButF(block, BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
+               uiDefIconTextButI(block, BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
        else if (icon)
-               uiDefIconButF(block, BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
+               uiDefIconButI(block, BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
        else
-               uiDefButF(block, BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
+               uiDefButI(block, BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
 }
 
 /* separator item */