Cleanup: Completely replace/remove uiBut.lock
authorJulian Eisel <eiseljulian@gmail.com>
Sun, 18 Sep 2016 23:49:17 +0000 (01:49 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Sun, 18 Sep 2016 23:49:17 +0000 (01:49 +0200)
Old leftover from pre 2.5 days. Now handled through UI_BUT_DISABLED button flag.

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

index cbe8654ceb6a015a98a312684dc487934f909e97..6d4c8f0ab98e038916c6e4fe09b26d60b5ede447 100644 (file)
@@ -1247,7 +1247,6 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2])
 
                        if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) {
                                but->flag |= UI_BUT_DISABLED;
-                               but->lock = true;
                        }
 
                        if (but->context)
@@ -3122,7 +3121,6 @@ static uiBut *ui_def_but(
        but->a2 = a2;
        but->tip = tip;
 
-       but->lock = block->lock;
        but->lockstr = block->lockstr;
        but->dt = block->dt;
        but->pie_dir = UI_RADIAL_NONE;
@@ -3171,10 +3169,8 @@ static uiBut *ui_def_but(
 
        but->drawflag |= (block->flag & UI_BUT_ALIGN);
 
-       if (but->lock == true) {
-               if (but->lockstr) {
-                       but->flag |= UI_BUT_DISABLED;
-               }
+       if (block->lock == true) {
+               but->flag |= UI_BUT_DISABLED;
        }
 
        /* keep track of UI_interface.h */
@@ -3222,7 +3218,6 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag)
 static void ui_def_but_rna__disable(uiBut *but)
 {
        but->flag |= UI_BUT_DISABLED;
-       but->lock = true;
        but->lockstr = "";
 }
 
@@ -3548,7 +3543,6 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
 
        if (!ot) {
                but->flag |= UI_BUT_DISABLED;
-               but->lock = true;
                but->lockstr = "";
        }
 
index 4972e16bf2ec885f10f4e2e30daf777d567f5158..5e9fc53de163ff15859b7a204e248c26d88ef31b 100644 (file)
@@ -2248,7 +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->lock  == true) {
+       if (mode == 'v' && (but->flag & UI_BUT_DISABLED)) {
                return;
        }
 
@@ -7100,8 +7100,7 @@ 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)) {
-               /* this should become disabled button .. */
-               if (but->lock == true) {
+               if (but->flag & UI_BUT_DISABLED) {
                        if (but->lockstr) {
                                WM_report(RPT_INFO, but->lockstr);
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
index 8336efa381bbab4af10654ca4e9a8982f9d47a46..c274210e52aeec96257eca219eb939881702bc29 100644 (file)
@@ -274,7 +274,6 @@ struct uiBut {
        const char *lockstr;
 
        BIFIconID icon;
-       bool lock;
        char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */
        signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */
        char changed; /* could be made into a single flag */
index e802cf82b8ecb30f4e00525a2ca869a6eec2b595..672bd74745d11b327aa70142f036c2d7fb77fc84 100644 (file)
@@ -745,7 +745,6 @@ static void ui_item_disabled(uiLayout *layout, const char *name)
 
        but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
        but->flag |= UI_BUT_DISABLED;
-       but->lock = true;
        but->lockstr = "";
 }
 
index 7a506c5c45161821513dd55cbc449d8e9ee2d7f3..8073fb3552f2101411f26d0fc7bdaa82eaab2276 100644 (file)
@@ -456,7 +456,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
        }
 
        /* button is disabled, we may be able to tell user why */
-       if ((but->flag & UI_BUT_DISABLED) || but->lock) {
+       if (but->flag & UI_BUT_DISABLED) {
                const char *disabled_msg = NULL;
 
                /* if operator poll check failed, it can give pretty precise info why */