Use UI_BUT_ prefix as other flags do

This commit is contained in:
2014-08-30 17:11:07 +10:00
parent 526ae635d1
commit ec76d47a48
2 changed files with 13 additions and 8 deletions

View File

@@ -180,7 +180,7 @@ enum {
UI_BUT_DRAG_MULTI = (1 << 25), /* edit this button as well as the active button (not just dragging) */
UI_BUT_SCA_LINK_GREY = (1 << 26), /* used to flag if sca links shoud be grey out */
UI_BUT_HAS_SEP_CHAR = (1 << 27), /* but->str contains UI_SEP_CHAR, used for key shortcuts */
UI_OPTION_TOOLTIPS = (1 << 28), /* force show tooltips when holding option/alt if U's USER_TOOLTIPS is off */
UI_BUT_TIP_FORCE = (1 << 28), /* force show tooltips when holding option/alt if U's USER_TOOLTIPS is off */
};
#define UI_PANEL_WIDTH 340

View File

@@ -6714,10 +6714,13 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
data->tooltiptimer = NULL;
}
if ((U.flag & USER_TOOLTIPS) || (but->flag & UI_OPTION_TOOLTIPS))
if (!but->block->tooltipdisabled)
if (!wm->drags.first)
if ((U.flag & USER_TOOLTIPS) || (but->flag & UI_BUT_TIP_FORCE)) {
if (!but->block->tooltipdisabled) {
if (!wm->drags.first) {
data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
}
}
}
}
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state)
@@ -7226,11 +7229,13 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar)
if (event->type == MOUSEMOVE) {
but = ui_but_find_mouse_over(ar, event);
if (but) {
if (event->alt)
if (event->alt) {
/* display tooltips if holding alt on mouseover when tooltips are off in prefs */
but->flag |= UI_OPTION_TOOLTIPS;
else
but->flag &= ~UI_OPTION_TOOLTIPS;
but->flag |= UI_BUT_TIP_FORCE;
}
else {
but->flag &= ~UI_BUT_TIP_FORCE;
}
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
}