Cleanup: Completely replace/remove uiBut.lock
Old leftover from pre 2.5 days. Now handled through UI_BUT_DISABLED button flag.
This commit is contained in:
parent
404a427dfd
commit
976e591e93
|
@ -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 = "";
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 = "";
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue