Cleanup: USE_UI_* prefix for UI defines
Otherwise there is no quick way to see where this comes from.
This commit is contained in:
parent
52502ad0a4
commit
6ff89166a8
|
@ -1244,10 +1244,10 @@ void UI_widgetbase_draw_cache_flush(void);
|
|||
void UI_widgetbase_draw_cache_end(void);
|
||||
|
||||
/* Special drawing for toolbar, mainly workarounds for inflexible icon sizing. */
|
||||
#define USE_TOOLBAR_HACK
|
||||
#define USE_UI_TOOLBAR_HACK
|
||||
|
||||
/* Support click-drag motion which presses the button and closes a popover (like a menu). */
|
||||
#define USE_POPOVER_ONCE
|
||||
#define USE_UI_POPOVER_ONCE
|
||||
|
||||
bool UI_but_is_tool(const uiBut *but);
|
||||
|
||||
|
|
|
@ -506,7 +506,7 @@ bool ui_but_is_toggle(const uiBut *but)
|
|||
);
|
||||
}
|
||||
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
bool ui_but_is_popover_once_compat(const uiBut *but)
|
||||
{
|
||||
return (
|
||||
|
@ -8362,7 +8362,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
|
|||
data->cancel = true;
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
break;
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
case LEFTMOUSE:
|
||||
{
|
||||
if (event->val == KM_RELEASE) {
|
||||
|
@ -9527,7 +9527,7 @@ static int ui_handle_menu_event(
|
|||
retval = ui_handle_menu_button(C, event, menu);
|
||||
}
|
||||
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
if (block->flag & UI_BLOCK_POPOVER_ONCE) {
|
||||
if ((event->type == LEFTMOUSE) && (event->val == KM_RELEASE)) {
|
||||
UI_popover_once_clear(menu->popup_create_vars.arg);
|
||||
|
|
|
@ -1252,7 +1252,7 @@ static void icon_draw_size(
|
|||
/* We need to flush widget base first to ensure correct ordering. */
|
||||
UI_widgetbase_draw_cache_flush();
|
||||
|
||||
#ifdef USE_TOOLBAR_HACK
|
||||
#ifdef USE_UI_TOOLBAR_HACK
|
||||
/* TODO(campbell): scale icons up for toolbar, we need a way to detect larger buttons and do this automatic. */
|
||||
{
|
||||
float scale = (float)ICON_DEFAULT_HEIGHT_TOOLBAR / (float)ICON_DEFAULT_HEIGHT;
|
||||
|
|
|
@ -87,7 +87,7 @@ struct uiPopover {
|
|||
uiMenuCreateFunc menu_func;
|
||||
void *menu_arg;
|
||||
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
bool is_once;
|
||||
#endif
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
|
|||
UI_block_region_set(block, handle->region);
|
||||
UI_block_layout_resolve(block, &width, &height);
|
||||
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_KEEP_OPEN | UI_BLOCK_POPOVER);
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
if (pup->is_once) {
|
||||
UI_block_flag_enable(block, UI_BLOCK_POPOVER_ONCE);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ uiPopupBlockHandle *ui_popover_panel_create(
|
|||
pup->menu_func = menu_func;
|
||||
pup->menu_arg = arg;
|
||||
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
pup->is_once = true;
|
||||
#endif
|
||||
|
||||
|
@ -365,7 +365,7 @@ uiLayout *UI_popover_layout(uiPopover *pup)
|
|||
return pup->layout;
|
||||
}
|
||||
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
void UI_popover_once_clear(uiPopover *pup)
|
||||
{
|
||||
pup->is_once = false;
|
||||
|
|
|
@ -2010,7 +2010,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
|||
|
||||
/* XXX add way to draw icons at a different size!
|
||||
* Use small icons for popup. */
|
||||
#ifdef USE_TOOLBAR_HACK
|
||||
#ifdef USE_UI_TOOLBAR_HACK
|
||||
const float aspect_orig = but->block->aspect;
|
||||
if (is_tool && (but->block->flag & UI_BLOCK_POPOVER)) {
|
||||
but->block->aspect *= 2.0f;
|
||||
|
@ -2021,7 +2021,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
|||
int icon_size_init = is_tool ? ICON_DEFAULT_HEIGHT_TOOLBAR : ICON_DEFAULT_HEIGHT;
|
||||
const float icon_size = icon_size_init / (but->block->aspect / UI_DPI_FAC);
|
||||
|
||||
#ifdef USE_TOOLBAR_HACK
|
||||
#ifdef USE_UI_TOOLBAR_HACK
|
||||
if (is_tool) {
|
||||
/* pass (even if its a menu toolbar) */
|
||||
but->drawflag |= UI_BUT_TEXT_LEFT;
|
||||
|
@ -2043,7 +2043,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
|||
|
||||
widget_draw_icon(but, icon, alpha, rect, show_menu_icon);
|
||||
|
||||
#ifdef USE_TOOLBAR_HACK
|
||||
#ifdef USE_UI_TOOLBAR_HACK
|
||||
but->block->aspect = aspect_orig;
|
||||
#endif
|
||||
|
||||
|
@ -4372,7 +4372,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
|||
uiFontStyle *fstyle = &style->widget;
|
||||
uiWidgetType *wt = NULL;
|
||||
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
const rcti rect_orig = *rect;
|
||||
#endif
|
||||
|
||||
|
@ -4426,7 +4426,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
|||
break;
|
||||
|
||||
case UI_BTYPE_BUT:
|
||||
#ifdef USE_TOOLBAR_HACK
|
||||
#ifdef USE_UI_TOOLBAR_HACK
|
||||
if (UI_but_is_tool(but)) {
|
||||
wt = widget_type(UI_WTYPE_TOOLBAR_ITEM);
|
||||
}
|
||||
|
@ -4652,7 +4652,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
|||
if (disabled)
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
#ifdef USE_POPOVER_ONCE
|
||||
#ifdef USE_UI_POPOVER_ONCE
|
||||
if (but->block->flag & UI_BLOCK_POPOVER_ONCE) {
|
||||
if ((state & UI_ACTIVE) && ui_but_is_popover_once_compat(but)) {
|
||||
uiWidgetType wt_back = *wt;
|
||||
|
|
Loading…
Reference in New Issue