Squashed commit of the following:
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 21 Nov 2013 13:43:08 +0000 (14:43 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 21 Nov 2013 13:43:08 +0000 (14:43 +0100)
commit 6f97e194e58aab38d351c796bf7bb6abca33f5f9
Author: Bastien Montagne <montagne29@wanadoo.fr>
Date:   Wed Nov 20 21:18:20 2013 +0100

    Code cleanup: Move some uiBut->flag to uiBut->drawflag, make those flags anonymous enums.

    Summary:
    Make some room in but->flag (I did not add another flag, we already have drawflag, which was nearly not used up till now).

    Note: I’m not sure whether REDALERT (and perhaps even DISABLED?) should not go to but->drawflag as well...

    Related to D8

    Reviewers: brecht

    Differential Revision: http://developer.blender.org/D22

12 files changed:
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/space_buttons/buttons_texture.c
source/blender/editors/space_file/file_panels.c
source/blender/editors/space_node/node_templates.c
source/blender/editors/space_view3d/view3d_buttons.c

index 50e2e53dbf0c293985c52455b393cb124be78a74..53bfc94dfddef86070621d2bd000e07138aee81c 100644 (file)
@@ -93,7 +93,7 @@ typedef struct uiLayout uiLayout;
 /* use for clamping popups within the screen */
 #define UI_SCREEN_MARGIN 10
 
-/* uiBlock->dt */
+/* uiBlock->dt and uiBut->dt */
 #define UI_EMBOSS       0   /* use widget style for drawing */
 #define UI_EMBOSSN      1   /* Nothing, only icon and/or text */
 #define UI_EMBOSSP      2   /* Pulldown menu style */
@@ -130,8 +130,7 @@ typedef struct uiLayout uiLayout;
 #define UI_BLOCK_POPUP_MEMORY   (1 << 12)
 #define UI_BLOCK_CLIP_EVENTS    (1 << 13)  /* stop handling mouse events */
 
-/* XXX This comment is no more valid! Maybe it is now bits 14-17? */
-/* block->flag bits 12-15 are identical to but->flag bits */
+/* block->flag bits 14-17 are identical to but->drawflag bits */
 
 #define UI_BLOCK_LIST_ITEM   (1 << 19)
 
@@ -148,46 +147,51 @@ typedef struct uiLayout uiLayout;
 #define UI_PNL_CLOSE    (1 << 5)
 #define UI_PNL_SCALE    (1 << 9)
 
-/* warning the first 6 flags are internal */
-/* but->flag */
-#define UI_TEXT_LEFT         (1 << 6)
-#define UI_ICON_LEFT         (1 << 7)
-#define UI_ICON_SUBMENU      (1 << 8)
-#define UI_ICON_PREVIEW      (1 << 9)
-
-#define UI_TEXT_RIGHT        (1 << 10)
-#define UI_BUT_NODE_LINK     (1 << 11)
-#define UI_BUT_NODE_ACTIVE   (1 << 12)
-#define UI_BUT_DRAG_LOCK     (1 << 13)
-
-/* button align flag, for drawing groups together */
-#define UI_BUT_ALIGN         (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN)
-#define UI_BUT_ALIGN_TOP     (1 << 14)
-#define UI_BUT_ALIGN_LEFT    (1 << 15)
-#define UI_BUT_ALIGN_RIGHT   (1 << 16)
-#define UI_BUT_ALIGN_DOWN    (1 << 17)
-
-#define UI_BUT_DISABLED      (1 << 18)
-#define UI_BUT_COLOR_LOCK    (1 << 19)
-#define UI_BUT_ANIMATED      (1 << 20)
-#define UI_BUT_ANIMATED_KEY  (1 << 21)
-#define UI_BUT_DRIVEN        (1 << 22)
-#define UI_BUT_REDALERT      (1 << 23)
-#define UI_BUT_INACTIVE      (1 << 24)
-#define UI_BUT_LAST_ACTIVE   (1 << 25)
-#define UI_BUT_UNDO          (1 << 26)
-#define UI_BUT_IMMEDIATE     (1 << 27)
-#define UI_BUT_NO_TOOLTIP    (1 << 28)
-#define UI_BUT_NO_UTF8       (1 << 29)
-
-#define UI_BUT_VEC_SIZE_LOCK (1 << 30) /* used to flag if color hsv-circle should keep luminance */
-#define UI_BUT_COLOR_CUBIC   (1 << 31) /* cubic saturation for the color wheel */
+/* but->flag - general state flags. */
+enum {
+       /* warning, the first 6 flags are internal */
+       UI_ICON_SUBMENU      = (1 << 6),
+       UI_ICON_PREVIEW      = (1 << 7),
+
+       UI_BUT_NODE_LINK     = (1 << 8),
+       UI_BUT_NODE_ACTIVE   = (1 << 9),
+       UI_BUT_DRAG_LOCK     = (1 << 10),
+       UI_BUT_DISABLED      = (1 << 11),
+       UI_BUT_COLOR_LOCK    = (1 << 12),
+       UI_BUT_ANIMATED      = (1 << 13),
+       UI_BUT_ANIMATED_KEY  = (1 << 14),
+       UI_BUT_DRIVEN        = (1 << 15),
+       UI_BUT_REDALERT      = (1 << 16),
+       UI_BUT_INACTIVE      = (1 << 17),
+       UI_BUT_LAST_ACTIVE   = (1 << 18),
+       UI_BUT_UNDO          = (1 << 19),
+       UI_BUT_IMMEDIATE     = (1 << 20),
+       UI_BUT_NO_UTF8       = (1 << 21),
+
+       UI_BUT_VEC_SIZE_LOCK = (1 << 22),  /* used to flag if color hsv-circle should keep luminance */
+       UI_BUT_COLOR_CUBIC   = (1 << 23),  /* cubic saturation for the color wheel */
+};
 
 #define UI_PANEL_WIDTH          340
 #define UI_COMPACT_PANEL_WIDTH  160
 
-/* uiBut->drawflag */
-#define UI_BUT_DRAW_ENUM_ARROWS    (1 << 0) /* draw enum-like up/down arrows for button */
+/* but->drawflag - these flags should only affect how the button is drawn. */
+enum {
+       /* draw enum-like up/down arrows for button */
+       UI_BUT_DRAW_ENUM_ARROWS  = (1 << 0),
+       /* Text and icon alignment (by default, they are centered). */
+       UI_BUT_TEXT_LEFT         = (1 << 1),
+       UI_BUT_ICON_LEFT         = (1 << 2),
+       UI_BUT_TEXT_RIGHT        = (1 << 3),
+       /* Prevent the button to show any tooltip. */
+       UI_BUT_NO_TOOLTIP        = (1 << 4),
+       /* button align flag, for drawing groups together (also used in uiBlock->flag!) */
+       UI_BUT_ALIGN_TOP         = (1 << 14),
+       UI_BUT_ALIGN_LEFT        = (1 << 15),
+       UI_BUT_ALIGN_RIGHT       = (1 << 16),
+       UI_BUT_ALIGN_DOWN        = (1 << 17),
+       UI_BUT_ALIGN             = (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN),
+};
 
 /* scale fixed button widths by this to account for DPI */
 
index 83b100db1b23e5d9b22063f891303c2c05a38367..800fee648e7df29fae81fa563ddf333a7d8881ad 100644 (file)
@@ -2604,7 +2604,7 @@ static void ui_block_do_align_but(uiBut *first, short nr)
                        next = NULL;
 
                /* clear old flag */
-               but->flag &= ~UI_BUT_ALIGN;
+               but->drawflag &= ~UI_BUT_ALIGN;
                        
                if (flag == 0) {  /* first case */
                        if (next) {
@@ -2683,7 +2683,7 @@ static void ui_block_do_align_but(uiBut *first, short nr)
                        }
                }
                
-               but->flag |= flag;
+               but->drawflag |= flag;
                
                /* merge coordinates */
                if (prev) {
@@ -2863,10 +2863,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
        if ((block->flag & UI_BLOCK_LOOP) ||
            ELEM8(but->type, MENU, TEX, LABEL, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK))
        {
-               but->flag |= (UI_TEXT_LEFT | UI_ICON_LEFT);
+               but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
        }
 
-       but->flag |= (block->flag & UI_BUT_ALIGN);
+       but->drawflag |= (block->flag & UI_BUT_ALIGN);
 
        if (but->lock == TRUE) {
                if (but->lockstr) {
@@ -3041,7 +3041,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
        if (icon) {
                but->icon = (BIFIconID)icon;
                but->flag |= UI_HAS_ICON;
-               but->flag |= UI_ICON_LEFT;
+               but->drawflag |= UI_BUT_ICON_LEFT;
        }
        
        if (!RNA_property_editable(&but->rnapoin, prop)) {
@@ -3430,7 +3430,7 @@ uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const ch
 {
        uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
        ui_check_but_and_iconize(but, icon);
-       but->flag |= UI_ICON_LEFT;
+       but->drawflag |= UI_BUT_ICON_LEFT;
        return but;
 }
 static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2,  const char *tip)
@@ -3481,7 +3481,7 @@ uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const c
        uiBut *but;
        but = ui_def_but_rna_propname(block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, a1, a2, tip);
        ui_check_but_and_iconize(but, icon);
-       but->flag |= UI_ICON_LEFT;
+       but->drawflag |= UI_BUT_ICON_LEFT;
        return but;
 }
 uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2,  const char *tip)
@@ -3489,7 +3489,7 @@ uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, co
        uiBut *but;
        but = ui_def_but_rna(block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
        ui_check_but_and_iconize(but, icon);
-       but->flag |= UI_ICON_LEFT;
+       but->drawflag |= UI_BUT_ICON_LEFT;
        return but;
 }
 uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip)
@@ -3497,7 +3497,7 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int o
        uiBut *but;
        but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
        ui_check_but_and_iconize(but, icon);
-       but->flag |= UI_ICON_LEFT;
+       but->drawflag |= UI_BUT_ICON_LEFT;
        return but;
 }
 uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip)
@@ -3553,7 +3553,7 @@ void uiBlockFlipOrder(uiBlock *block)
                return;
        
        for (but = block->buttons.first; but; but = but->next) {
-               if (but->flag & UI_BUT_ALIGN) return;
+               if (but->drawflag & UI_BUT_ALIGN) return;
                if (but->rect.ymin < miny) miny = but->rect.ymin;
                if (but->rect.ymax > maxy) maxy = but->rect.ymax;
        }
@@ -3794,7 +3794,7 @@ uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, in
        but->icon = (BIFIconID) icon;
        but->flag |= UI_HAS_ICON;
 
-       but->flag |= UI_ICON_LEFT;
+       but->drawflag |= UI_BUT_ICON_LEFT;
        but->flag |= UI_ICON_SUBMENU;
 
        but->menu_create_func = func;
@@ -3809,7 +3809,7 @@ uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int ic
 
        but->icon = (BIFIconID) icon;
        but->flag |= UI_HAS_ICON;
-       but->flag &= ~UI_ICON_LEFT;
+       but->drawflag &= ~UI_BUT_ICON_LEFT;
 
        but->menu_create_func = func;
        ui_check_but(but);
@@ -3825,7 +3825,7 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
        /* XXX temp, old menu calls pass on icon arrow, which is now UI_ICON_SUBMENU flag */
        if (icon != ICON_RIGHTARROW_THIN) {
                but->icon = (BIFIconID) icon;
-               but->flag |= UI_ICON_LEFT;
+               but->drawflag |= UI_BUT_ICON_LEFT;
        }
        but->flag |= UI_HAS_ICON;
        but->flag |= UI_ICON_SUBMENU;
@@ -3844,7 +3844,7 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int
        but->icon = (BIFIconID) icon;
        but->flag |= UI_HAS_ICON;
        
-       but->flag |= UI_ICON_LEFT;
+       but->drawflag |= UI_BUT_ICON_LEFT;
        
        but->block_create_func = func;
        ui_check_but(but);
@@ -3879,7 +3879,7 @@ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxle
        but->icon = (BIFIconID) icon;
        but->flag |= UI_HAS_ICON;
        
-       but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT;
+       but->drawflag |= UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT;
        
        ui_check_but(but);
        
index 2b8b7643f39661593ba0d5a4eac58d43b4e3e1b1..33a054318b6e7229d1b51cc430def9a80b588cfd 100644 (file)
@@ -881,7 +881,7 @@ static bool ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, const wmEvent *eve
        if (but->imb) {
                /* use button size itself */
        }
-       else if (but->flag & UI_ICON_LEFT) {
+       else if (but->drawflag & UI_BUT_ICON_LEFT) {
                rect.xmax = rect.xmin + (BLI_rcti_size_y(&rect));
        }
        else {
index 5ecd1e5508656347bcb3aa686d082f4e92387405..30a0eb424e0e5060793cd06688053e89623ac9d2 100644 (file)
@@ -108,13 +108,15 @@ typedef enum {
 #define UI_PANEL_MINY   70
 
 /* uiBut->flag */
-#define UI_SELECT       1   /* use when the button is pressed */
-#define UI_SCROLLED     2   /* temp hidden, scrolled away */
-#define UI_ACTIVE       4
-#define UI_HAS_ICON     8
-#define UI_TEXTINPUT    16
-#define UI_HIDDEN       32
-/* warn: rest of uiBut->flag in UI_interface.h */
+enum {
+       UI_SELECT       = (1 << 0),  /* use when the button is pressed */
+       UI_SCROLLED     = (1 << 1),  /* temp hidden, scrolled away */
+       UI_ACTIVE       = (1 << 2),
+       UI_HAS_ICON     = (1 << 3),
+       UI_TEXTINPUT    = (1 << 4),
+       UI_HIDDEN       = (1 << 5),
+       /* warn: rest of uiBut->flag in UI_interface.h */
+};
 
 /* internal panel drawing defines */
 #define PNL_GRID    (UI_UNIT_Y / 5) /* 4 default */
index 0f6034ba1cda13526f19f03692d37090f9ba9c89..4517c09820203eef625c8459bd4b3865a958b0c6 100644 (file)
@@ -580,7 +580,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
                }
 
                if (ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
-                       but->flag |= UI_TEXT_LEFT;
+                       but->drawflag |= UI_BUT_TEXT_LEFT;
        }
        uiBlockSetCurLayout(block, layout);
 
@@ -762,7 +762,7 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
 
        /* text alignment for toolbar buttons */
        if ((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
-               but->flag |= UI_TEXT_LEFT;
+               but->drawflag |= UI_BUT_TEXT_LEFT;
 
        if (flag & UI_ITEM_R_NO_BG)
                uiBlockSetEmboss(block, UI_EMBOSS);
@@ -912,7 +912,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
 
                                        uiItemL(column, item->name, ICON_NONE);
                                        but = block->buttons.last;
-                                       but->flag = UI_TEXT_LEFT;
+                                       but->drawflag = UI_BUT_TEXT_LEFT;
                                        ui_but_tip_from_enum_item(but, item);
                                }
                                else {  /* XXX bug here, colums draw bottom item badly */
@@ -1336,7 +1336,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
 
                                        uiItemL(column, item[i].name, ICON_NONE);
                                        bt = block->buttons.last;
-                                       bt->flag = UI_TEXT_LEFT;
+                                       bt->drawflag = UI_BUT_TEXT_LEFT;
 
                                        ui_but_tip_from_enum_item(bt, &item[i]);
                                }
@@ -1486,7 +1486,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
                but->hardmax = MAX2(but->hardmax, 256.0f);
                but->rnasearchpoin = *searchptr;
                but->rnasearchprop = searchprop;
-               but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT;
+               but->drawflag |= UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT;
 
                if (RNA_property_type(prop) == PROP_ENUM) {
                        /* XXX, this will have a menu string,
@@ -1629,7 +1629,7 @@ static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCre
            (force_menu && layout->root->type != UI_LAYOUT_MENU))  /* We never want a dropdown in menu! */
        {
                but->type = MENU;
-               but->flag |= UI_TEXT_LEFT;
+               but->drawflag |= UI_BUT_TEXT_LEFT;
        }
 }
 
@@ -1681,8 +1681,8 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
         * make text aligned right if the layout is aligned right.
         */
        if (uiLayoutGetAlignment(layout) == UI_LAYOUT_ALIGN_RIGHT) {
-               but->flag &= ~UI_TEXT_LEFT;     /* default, needs to be unset */
-               but->flag |= UI_TEXT_RIGHT;
+               but->drawflag &= ~UI_BUT_TEXT_LEFT;     /* default, needs to be unset */
+               but->drawflag |= UI_BUT_TEXT_RIGHT;
        }
 
        /* Mark as a label inside a listbox. */
index 1de0a278b56ea4d5d5f7ed7e331a9d053ca6206f..f869c5de8e66641a0964e2884998c99bd9196f86 100644 (file)
@@ -443,7 +443,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
        uiStringInfo rna_struct = {BUT_GET_RNASTRUCT_IDENTIFIER, NULL};
        uiStringInfo rna_prop = {BUT_GET_RNAPROP_IDENTIFIER, NULL};
 
-       if (but->flag & UI_BUT_NO_TOOLTIP)
+       if (but->drawflag & UI_BUT_NO_TOOLTIP)
                return NULL;
 
        /* create tooltip data */
@@ -1389,9 +1389,9 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 
        /* widget_roundbox_set has this correction too, keep in sync */
        if (but->type != PULLDOWN) {
-               if (but->flag & UI_BUT_ALIGN_TOP)
+               if (but->drawflag & UI_BUT_ALIGN_TOP)
                        butrct.ymax += U.pixelsize;
-               if (but->flag & UI_BUT_ALIGN_LEFT)
+               if (but->drawflag & UI_BUT_ALIGN_LEFT)
                        butrct.xmin -= U.pixelsize;
        }
        
@@ -1840,7 +1840,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
                else {
                        uiItemL(layout, md->title, ICON_NONE);
                        bt = block->buttons.last;
-                       bt->flag = UI_TEXT_LEFT;
+                       bt->drawflag = UI_BUT_TEXT_LEFT;
                }
        }
 
@@ -1876,7 +1876,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
                        if (entry->str[0]) {
                                uiItemL(column, entry->str, entry->icon);
                                bt = block->buttons.last;
-                               bt->flag = UI_TEXT_LEFT;
+                               bt->drawflag = UI_BUT_TEXT_LEFT;
                        }
                        else {
                                uiItemS(column);
@@ -2560,7 +2560,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
                }
                else {
                        but = uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-                       but->flag = UI_TEXT_LEFT;
+                       but->drawflag = UI_BUT_TEXT_LEFT;
                }
        }
 
index ef9b16f5445b2446f026ed6717b6ffdb96ca42ca..1d1b7dbb835a31ad6a359401566883ed672a2616 100644 (file)
@@ -443,7 +443,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
                        but->icon = RNA_struct_ui_icon(type);
                        /* default dragging of icon for id browse buttons */
                        uiButSetDragID(but, id);
-                       uiButSetFlag(but, UI_HAS_ICON | UI_ICON_LEFT);
+                       uiButSetFlag(but, UI_HAS_ICON);
+                       uiButSetDrawFlag(but, UI_BUT_ICON_LEFT);
                }
 
                if ((idfrom && idfrom->lib) || !editable)
@@ -2939,7 +2940,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
 
                                        but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
                                                             active_dataptr, activeprop, 0, 0, org_i, 0, 0, NULL);
-                                       uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
+                                       uiButSetDrawFlag(but, UI_BUT_NO_TOOLTIP);
 
                                        sub = uiLayoutRow(overlap, FALSE);
 
@@ -3026,7 +3027,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
 
                                        but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
                                                             active_dataptr, activeprop, 0, 0, org_i, 0, 0, NULL);
-                                       uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
+                                       uiButSetDrawFlag(but, UI_BUT_NO_TOOLTIP);
 
                                        sub = uiLayoutRow(overlap, FALSE);
 
index 97dd4f59ff6397130a833a78fd1b6a1a6c240f0e..76be6ff1c84f4e4e56fb7210d43ea869dea2d7d5 100644 (file)
@@ -890,7 +890,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, const rcti
        if (icon && icon != ICON_BLANK1) {
                float ofs = 1.0f / aspect;
                
-               if (but->flag & UI_ICON_LEFT) {
+               if (but->drawflag & UI_BUT_ICON_LEFT) {
                        if (but->block->flag & UI_BLOCK_LOOP) {
                                if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK))
                                        xs = rect->xmin + 4.0f * ofs;
@@ -956,7 +956,7 @@ static void ui_text_clip_give_next_off(uiBut *but)
  */
 static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
-       int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
+       int border = (but->drawflag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
        int okwidth = BLI_rcti_size_x(rect) - border;
 
        if (but->flag & UI_HAS_ICON)
@@ -991,7 +991,7 @@ static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
  */
 static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
-       int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
+       int border = (but->drawflag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
        int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
        if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
 
@@ -1055,7 +1055,7 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rec
  */
 static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
-       int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
+       int border = (but->drawflag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
        int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
        char *cpoin = NULL;
        int drawstr_len = strlen(but->drawstr);
@@ -1140,9 +1140,9 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 
        uiStyleFontSet(fstyle);
        
-       if (but->editstr || (but->flag & UI_TEXT_LEFT))
+       if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT))
                fstyle->align = UI_STYLE_TEXT_LEFT;
-       else if (but->flag & UI_TEXT_RIGHT)
+       else if (but->drawflag & UI_BUT_TEXT_RIGHT)
                fstyle->align = UI_STYLE_TEXT_RIGHT;
        else
                fstyle->align = UI_STYLE_TEXT_CENTER;
@@ -1310,17 +1310,17 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
                /* icons default draw 0.8f x height */
                rect->xmin += (int)(0.8f * BLI_rcti_size_y(rect));
 
-               if (but->editstr || (but->flag & UI_TEXT_LEFT)) {
+               if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT)) {
                        rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
                }
-               else if ((but->flag & UI_TEXT_RIGHT)) {
+               else if ((but->drawflag & UI_BUT_TEXT_RIGHT)) {
                        rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
                }
        }
-       else if ((but->flag & UI_TEXT_LEFT)) {
+       else if ((but->drawflag & UI_BUT_TEXT_LEFT)) {
                rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
        }
-       else if ((but->flag & UI_TEXT_RIGHT)) {
+       else if ((but->drawflag & UI_BUT_TEXT_RIGHT)) {
                rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect;
        }
        
@@ -3139,15 +3139,15 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
        int roundbox = UI_CNR_ALL;
 
        /* alignment */
-       if ((but->flag & UI_BUT_ALIGN) && but->type != PULLDOWN) {
+       if ((but->drawflag & UI_BUT_ALIGN) && but->type != PULLDOWN) {
                
                /* ui_block_position has this correction too, keep in sync */
-               if (but->flag & UI_BUT_ALIGN_TOP)
+               if (but->drawflag & UI_BUT_ALIGN_TOP)
                        rect->ymax += U.pixelsize;
-               if (but->flag & UI_BUT_ALIGN_LEFT)
+               if (but->drawflag & UI_BUT_ALIGN_LEFT)
                        rect->xmin -= U.pixelsize;
                
-               switch (but->flag & UI_BUT_ALIGN) {
+               switch (but->drawflag & UI_BUT_ALIGN) {
                        case UI_BUT_ALIGN_TOP:
                                roundbox = UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT;
                                break;
@@ -3295,7 +3295,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
                        case OPTIONN:
                                if (!(but->flag & UI_HAS_ICON)) {
                                        wt = widget_type(UI_WTYPE_OPTION);
-                                       but->flag |= UI_TEXT_LEFT;
+                                       but->drawflag |= UI_BUT_TEXT_LEFT;
                                }
                                else
                                        wt = widget_type(UI_WTYPE_TOGGLE);
index 8508123f9422ea642606af7028f8a61a179570d3..975123f244cc439154b63738cd79e0ae2f1e5dab 100644 (file)
@@ -516,7 +516,7 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
                if (!last_category || strcmp(last_category, user->category) != 0) {
                        uiItemL(layout, user->category, ICON_NONE);
                        but = block->buttons.last;
-                       but->flag = UI_TEXT_LEFT;
+                       but->drawflag = UI_BUT_TEXT_LEFT;
                }
 
                /* create button */
@@ -577,7 +577,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
 
        /* some cosmetic tweaks */
        but->type = MENU;
-       but->flag |= UI_TEXT_LEFT;
+       but->drawflag |= UI_BUT_TEXT_LEFT;
        but->flag &= ~UI_ICON_SUBMENU;
 }
 
index f4161c7da1c1c55b272e12c250845194c31f98cc..1809c6cb83562b59a9b2d0532cf8b9711cb2f9c2 100644 (file)
@@ -116,7 +116,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
                but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nr, 0, i, 0, 0, entry);
                uiButSetFunc(but, file_panel_cb, entry, NULL);
                uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
-               uiButSetFlag(but, UI_ICON_LEFT | UI_TEXT_LEFT);
+               uiButSetDrawFlag(but, UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT);
 
                /* create delete button */
                if (allow_delete && fsmenu_can_save(fsmenu, category, i)) {
index a67a8791a6402ced8af6b14a15189e9f88068693..f8eb0ede262e2988210b2baea8c4df99cd251966 100644 (file)
@@ -461,7 +461,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
                                
                                uiItemL(column, IFACE_(cname), ICON_NODE);
                                but = block->buttons.last;
-                               but->flag = UI_TEXT_LEFT;
+                               but->drawflag = UI_BUT_TEXT_LEFT;
                                
                                first = 0;
                        }
@@ -471,7 +471,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
                                        cur_node_name = items[i].node_name;
                                        uiItemL(column, IFACE_(cur_node_name), ICON_NODE);
                                        but = block->buttons.last;
-                                       but->flag = UI_TEXT_LEFT;
+                                       but->drawflag = UI_BUT_TEXT_LEFT;
                                }
                                
                                BLI_snprintf(name, UI_MAX_NAME_STR, "  %s", IFACE_(items[i].socket_name));
@@ -528,7 +528,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
        if (sock->link) {
                uiItemL(column, IFACE_("Link"), ICON_NONE);
                but = block->buttons.last;
-               but->flag = UI_TEXT_LEFT;
+               but->drawflag = UI_BUT_TEXT_LEFT;
 
                but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
                               NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input"));
@@ -564,7 +564,8 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
                but = uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
 
        but->type = MENU;
-       but->flag |= UI_TEXT_LEFT | UI_BUT_NODE_LINK;
+       but->drawflag |= UI_BUT_TEXT_LEFT;
+       but->flag |= UI_BUT_NODE_LINK;
        but->poin = (char *)but;
        but->func_argN = arg;
 
@@ -654,7 +655,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
 
        uiItemL(row, label, ICON_NONE);
        bt = block->buttons.last;
-       bt->flag = UI_TEXT_LEFT;
+       bt->drawflag = UI_BUT_TEXT_LEFT;
 
        if (dependency_loop) {
                row = uiLayoutRow(split, FALSE);
index c4fdacaa9151cedff6ece8a85eaadb8d002fc060..dc6f3a0274c049d89c6b24d7f00cbc14e9983d45 100644 (file)
@@ -859,7 +859,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
                                                            xco, yco, (x = UI_UNIT_X * 5), UI_UNIT_Y, "");
                                        but_ptr = uiButGetOperatorPtrRNA(but);
                                        RNA_int_set(but_ptr, "weight_group", i);
-                                       uiButSetFlag(but, UI_TEXT_RIGHT);
+                                       uiButSetDrawFlag(but, UI_BUT_TEXT_RIGHT);
                                        if (ob->actdef != i + 1) {
                                                uiButSetFlag(but, UI_BUT_INACTIVE);
                                        }
@@ -873,7 +873,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
                                        but = uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + i, "",
                                                        xco, yco, (x = UI_UNIT_X * 4), UI_UNIT_Y,
                                                        &dw->weight, 0.0, 1.0, 1, 3, "");
-                                       uiButSetFlag(but, UI_TEXT_LEFT);
+                                       uiButSetDrawFlag(but, UI_BUT_TEXT_LEFT);
                                        if (locked) {
                                                lock_count++;
                                        }