diff options
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 522 |
1 files changed, 263 insertions, 259 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 8fc8816aa33..77825caaf0a 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -109,7 +109,7 @@ static int rna_property_enum_step(const bContext *C, PointerRNA *ptr, PropertyRN return value; } -int ui_step_name_menu(uiBut *but, int direction) +int ui_but_menu_step(uiBut *but, int direction) { /* currenly only RNA buttons */ if ((but->rnaprop == NULL) || (RNA_property_type(but->rnaprop) != PROP_ENUM)) { @@ -122,7 +122,7 @@ int ui_step_name_menu(uiBut *but, int direction) /******************** Creating Temporary regions ******************/ -static ARegion *ui_add_temporary_region(bScreen *sc) +static ARegion *ui_region_temp_add(bScreen *sc) { ARegion *ar; @@ -135,7 +135,7 @@ static ARegion *ui_add_temporary_region(bScreen *sc) return ar; } -static void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar) +static void ui_region_temp_remove(bContext *C, bScreen *sc, ARegion *ar) { wmWindow *win = CTX_wm_window(C); if (win) @@ -225,7 +225,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) wmOrtho2_region_ui(ar); /* draw background */ - ui_draw_tooltip_background(UI_GetStyle(), NULL, &bbox); + ui_draw_tooltip_background(UI_style_get(), NULL, &bbox); /* set background_color */ rgb_uchar_to_float(background_color, (const unsigned char *)theme->inner); @@ -268,15 +268,15 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) fstyle_header.shadx = fstyle_header.shady = 0; fstyle_header.shadowalpha = 1.0f; - uiStyleFontSet(&fstyle_header); + UI_fontstyle_set(&fstyle_header); glColor3fv(tip_colors[UI_TIP_LC_MAIN]); - uiStyleFontDraw(&fstyle_header, &bbox, data->header); + UI_fontstyle_draw(&fstyle_header, &bbox, data->header); xofs = BLF_width(fstyle_header.uifont_id, data->header, sizeof(data->header)); bbox.xmin += xofs; glColor3fv(tip_colors[UI_TIP_LC_ACTIVE]); - uiStyleFontDraw(&data->fstyle, &bbox, data->active_info); + UI_fontstyle_draw(&data->fstyle, &bbox, data->active_info); bbox.xmin -= xofs; } @@ -284,18 +284,18 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) uiFontStyle fstyle_mono = data->fstyle; fstyle_mono.uifont_id = blf_mono_font; - uiStyleFontSet(&fstyle_mono); + UI_fontstyle_set(&fstyle_mono); /* XXX, needed because we dont have mono in 'U.uifonts' */ BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.pixelsize, U.dpi); glColor3fv(tip_colors[data->format[i].color_id]); - uiStyleFontDraw(&fstyle_mono, &bbox, data->lines[i]); + UI_fontstyle_draw(&fstyle_mono, &bbox, data->lines[i]); } else { BLI_assert(data->format[i].style == UI_TIP_STYLE_NORMAL); /* draw remaining data */ - uiStyleFontSet(&data->fstyle); + UI_fontstyle_set(&data->fstyle); glColor3fv(tip_colors[data->format[i].color_id]); - uiStyleFontDraw(&data->fstyle, &bbox, data->lines[i]); + UI_fontstyle_draw(&data->fstyle, &bbox, data->lines[i]); } if ((i + 1 != data->totline) && data->format[i + 1].is_pad) { bbox.ymax -= data->lineh * UI_TIP_PAD_FAC; @@ -324,7 +324,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) { const float pad_px = UI_TIP_PADDING; wmWindow *win = CTX_wm_window(C); - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); static ARegionType type; ARegion *ar; uiTooltipData *data; @@ -351,7 +351,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - uiButGetStrInfo(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &prop_keymap, &rna_struct, &rna_prop, NULL); + UI_but_string_info_get(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &prop_keymap, &rna_struct, &rna_prop, NULL); /* Tip */ if (but_tip.strinfo) { @@ -364,7 +364,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->totline++; /* special case enum rna buttons */ - if ((but->type & ROW) && but->rnaprop && RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG) { + if ((but->type & UI_BTYPE_ROW) && but->rnaprop && RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG) { BLI_strncpy(data->lines[data->totline], IFACE_("(Shift-click to select multiple)"), sizeof(data->lines[0])); data->format[data->totline].color_id = UI_TIP_LC_NORMAL; @@ -396,11 +396,11 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->totline++; } - if (ELEM(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { /* better not show the value of a password */ if ((but->rnaprop && (RNA_property_subtype(but->rnaprop) == PROP_PASSWORD)) == 0) { /* full string */ - ui_get_but_string(but, buf, sizeof(buf)); + ui_but_string_get(but, buf, sizeof(buf)); if (buf[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf); data->format[data->totline].is_pad = true; @@ -411,7 +411,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } if (but->rnaprop) { - int unit_type = uiButGetUnitType(but); + int unit_type = UI_but_unit_type_get(but); if (unit_type == PROP_UNIT_ROTATION) { if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { @@ -445,7 +445,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) else if (but->optype) { PointerRNA *opptr; char *str; - opptr = uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */ + opptr = UI_but_operator_ptr_get(but); /* allocated when needed, the button owns it */ /* so the context is passed to itemf functions (some py itemf functions use it) */ WM_operator_properties_sanitize(opptr, false); @@ -556,7 +556,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } /* create area region */ - ar = ui_add_temporary_region(CTX_wm_screen(C)); + ar = ui_region_temp_add(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); type.draw = ui_tooltip_region_draw_cb; @@ -568,7 +568,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->fstyle = style->widget; /* copy struct */ ui_fontscale(&data->fstyle.points, aspect); - uiStyleFontSet(&data->fstyle); + UI_fontstyle_set(&data->fstyle); /* these defines tweaked depending on font */ #define TIP_BORDER_X (16.0f / aspect) @@ -693,7 +693,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) void ui_tooltip_free(bContext *C, ARegion *ar) { - ui_remove_temporary_region(C, CTX_wm_screen(C), ar); + ui_region_temp_remove(C, CTX_wm_screen(C), ar); } @@ -728,11 +728,11 @@ typedef struct uiSearchboxData { /* exported for use by search callbacks */ /* returns zero if nothing to add */ -bool uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid) +bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid) { /* hijack for autocomplete */ if (items->autocpl) { - autocomplete_do_name(items->autocpl, name); + UI_autocomplete_update_name(items->autocpl, name); return true; } @@ -767,17 +767,17 @@ bool uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int ico return true; } -int uiSearchBoxHeight(void) +int UI_searchbox_size_y(void) { return SEARCH_ITEMS * UI_UNIT_Y + 2 * MENU_TOP; } -int uiSearchBoxWidth(void) +int UI_searchbox_size_x(void) { return 12 * UI_UNIT_X; } -int uiSearchItemFindIndex(uiSearchItems *items, const char *name) +int UI_search_items_find_index(uiSearchItems *items, const char *name) { int i; for (i = 0; i < items->totitem; i++) { @@ -817,7 +817,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step) } else { /* only let users step into an 'unset' state for unlink buttons */ - data->active = (but->type == SEARCH_MENU_UNLINK) ? -1 : 0; + data->active = (but->type == UI_BTYPE_SEARCH_MENU_UNLINK) ? -1 : 0; } } @@ -860,7 +860,7 @@ static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr int ui_searchbox_find_index(ARegion *ar, const char *name) { uiSearchboxData *data = ar->regiondata; - return uiSearchItemFindIndex(&data->items, name); + return UI_search_items_find_index(&data->items, name); } /* x and y in screencoords */ @@ -888,7 +888,7 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar) return true; } - else if (but->type == SEARCH_MENU_UNLINK) { + else if (but->type == UI_BTYPE_SEARCH_MENU_UNLINK) { /* It is valid for _UNLINK flavor to have no active element (it's a valid way to unlink). */ but->editstr[0] = '\0'; @@ -1014,11 +1014,11 @@ int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str) int match = AUTOCOMPLETE_NO_MATCH; if (str[0]) { - data->items.autocpl = autocomplete_begin(str, ui_get_but_string_max_length(but)); + data->items.autocpl = UI_autocomplete_begin(str, ui_but_string_get_max_length(but)); but->search_func(C, but->search_arg, but->editstr, &data->items); - match = autocomplete_end(data->items.autocpl, str); + match = UI_autocomplete_end(data->items.autocpl, str); data->items.autocpl = NULL; } @@ -1118,7 +1118,7 @@ static void ui_searchbox_region_free_cb(ARegion *ar) ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) { wmWindow *win = CTX_wm_window(C); - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); static ARegionType type; ARegion *ar; uiSearchboxData *data; @@ -1129,7 +1129,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) int i; /* create area region */ - ar = ui_add_temporary_region(CTX_wm_screen(C)); + ar = ui_region_temp_add(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); type.draw = ui_searchbox_region_draw_cb; @@ -1144,7 +1144,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) data->fstyle = style->widget; /* copy struct */ data->fstyle.align = UI_STYLE_TEXT_CENTER; ui_fontscale(&data->fstyle.points, aspect); - uiStyleFontSet(&data->fstyle); + UI_fontstyle_set(&data->fstyle); ar->regiondata = data; @@ -1188,13 +1188,13 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) } } else { - const int searchbox_width = uiSearchBoxWidth(); + const int searchbox_width = UI_searchbox_size_x(); const int margin = UI_POPUP_MARGIN; rect_fl.xmin = but->rect.xmin - 5; /* align text with button */ rect_fl.xmax = but->rect.xmax + 5; /* symmetrical */ rect_fl.ymax = but->rect.ymin; - rect_fl.ymin = rect_fl.ymax - uiSearchBoxHeight(); + rect_fl.ymin = rect_fl.ymax - UI_searchbox_size_y(); ofsx = (but->block->panel) ? but->block->panel->ofsx : 0; ofsy = (but->block->panel) ? but->block->panel->ofsy : 0; @@ -1282,12 +1282,12 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) void ui_searchbox_free(bContext *C, ARegion *ar) { - ui_remove_temporary_region(C, CTX_wm_screen(C), ar); + ui_region_temp_remove(C, CTX_wm_screen(C), ar); } /* sets red alert if button holds a string it can't find */ /* XXX weak: search_func adds all partial matches... */ -void ui_but_search_test(uiBut *but) +void ui_but_search_refresh(uiBut *but) { uiSearchItems *items; int x1; @@ -1311,11 +1311,11 @@ void ui_but_search_test(uiBut *but) /* only redalert when we are sure of it, this can miss cases when >10 matches */ if (items->totitem == 0) { - uiButSetFlag(but, UI_BUT_REDALERT); + UI_but_flag_enable(but, UI_BUT_REDALERT); } else if (items->more == 0) { - if (uiSearchItemFindIndex(items, but->drawstr) == -1) { - uiButSetFlag(but, UI_BUT_REDALERT); + if (UI_search_items_find_index(items, but->drawstr) == -1) { + UI_but_flag_enable(but, UI_BUT_REDALERT); } } @@ -1343,7 +1343,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, ui_block_to_window_rctf(butregion, but->block, &butrct, &but->rect); /* widget_roundbox_set has this correction too, keep in sync */ - if (but->type != PULLDOWN) { + if (but->type != UI_BTYPE_PULLDOWN) { if (but->drawflag & UI_BUT_ALIGN_TOP) butrct.ymax += U.pixelsize; if (but->drawflag & UI_BUT_ALIGN_LEFT) @@ -1385,8 +1385,12 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, winy = WM_window_pixels_y(window); // wm_window_get_size(window, &winx, &winy); - if (block->direction & UI_CENTER) center = ysize / 2; - else center = 0; + if (block->direction & UI_DIR_CENTER_Y) { + center = ysize / 2; + } + else { + center = 0; + } /* check if there's space at all */ if (butrct.xmin - xsize > 0.0f) left = 1; @@ -1401,65 +1405,65 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, down = 1; } - dir1 = block->direction & UI_DIRECTION; + dir1 = (block->direction & UI_DIR_ALL); /* secundary directions */ - if (dir1 & (UI_TOP | UI_DOWN)) { - if (dir1 & UI_LEFT) dir2 = UI_LEFT; - else if (dir1 & UI_RIGHT) dir2 = UI_RIGHT; - dir1 &= (UI_TOP | UI_DOWN); + if (dir1 & (UI_DIR_UP | UI_DIR_DOWN)) { + if (dir1 & UI_DIR_LEFT) dir2 = UI_DIR_LEFT; + else if (dir1 & UI_DIR_RIGHT) dir2 = UI_DIR_RIGHT; + dir1 &= (UI_DIR_UP | UI_DIR_DOWN); } - if ((dir2 == 0) && (dir1 == UI_LEFT || dir1 == UI_RIGHT)) dir2 = UI_DOWN; - if ((dir2 == 0) && (dir1 == UI_TOP || dir1 == UI_DOWN)) dir2 = UI_LEFT; + if ((dir2 == 0) && (dir1 == UI_DIR_LEFT || dir1 == UI_DIR_RIGHT)) dir2 = UI_DIR_DOWN; + if ((dir2 == 0) && (dir1 == UI_DIR_UP || dir1 == UI_DIR_DOWN)) dir2 = UI_DIR_LEFT; /* no space at all? don't change */ if (left || right) { - if (dir1 == UI_LEFT && left == 0) dir1 = UI_RIGHT; - if (dir1 == UI_RIGHT && right == 0) dir1 = UI_LEFT; + if (dir1 == UI_DIR_LEFT && left == 0) dir1 = UI_DIR_RIGHT; + if (dir1 == UI_DIR_RIGHT && right == 0) dir1 = UI_DIR_LEFT; /* this is aligning, not append! */ - if (dir2 == UI_LEFT && right == 0) dir2 = UI_RIGHT; - if (dir2 == UI_RIGHT && left == 0) dir2 = UI_LEFT; + if (dir2 == UI_DIR_LEFT && right == 0) dir2 = UI_DIR_RIGHT; + if (dir2 == UI_DIR_RIGHT && left == 0) dir2 = UI_DIR_LEFT; } if (down || top) { - if (dir1 == UI_TOP && top == 0) dir1 = UI_DOWN; - if (dir1 == UI_DOWN && down == 0) dir1 = UI_TOP; - if (dir2 == UI_TOP && top == 0) dir2 = UI_DOWN; - if (dir2 == UI_DOWN && down == 0) dir2 = UI_TOP; + if (dir1 == UI_DIR_UP && top == 0) dir1 = UI_DIR_DOWN; + if (dir1 == UI_DIR_DOWN && down == 0) dir1 = UI_DIR_UP; + if (dir2 == UI_DIR_UP && top == 0) dir2 = UI_DIR_DOWN; + if (dir2 == UI_DIR_DOWN && down == 0) dir2 = UI_DIR_UP; } - if (dir1 == UI_LEFT) { + if (dir1 == UI_DIR_LEFT) { xof = butrct.xmin - block->rect.xmax; - if (dir2 == UI_TOP) yof = butrct.ymin - block->rect.ymin - center - MENU_PADDING; - else yof = butrct.ymax - block->rect.ymax + center + MENU_PADDING; + if (dir2 == UI_DIR_UP) yof = butrct.ymin - block->rect.ymin - center - MENU_PADDING; + else yof = butrct.ymax - block->rect.ymax + center + MENU_PADDING; } - else if (dir1 == UI_RIGHT) { + else if (dir1 == UI_DIR_RIGHT) { xof = butrct.xmax - block->rect.xmin; - if (dir2 == UI_TOP) yof = butrct.ymin - block->rect.ymin - center - MENU_PADDING; - else yof = butrct.ymax - block->rect.ymax + center + MENU_PADDING; + if (dir2 == UI_DIR_UP) yof = butrct.ymin - block->rect.ymin - center - MENU_PADDING; + else yof = butrct.ymax - block->rect.ymax + center + MENU_PADDING; } - else if (dir1 == UI_TOP) { + else if (dir1 == UI_DIR_UP) { yof = butrct.ymax - block->rect.ymin; - if (dir2 == UI_RIGHT) xof = butrct.xmax - block->rect.xmax; - else xof = butrct.xmin - block->rect.xmin; + if (dir2 == UI_DIR_RIGHT) xof = butrct.xmax - block->rect.xmax; + else xof = butrct.xmin - block->rect.xmin; /* changed direction? */ if ((dir1 & block->direction) == 0) { - uiBlockFlipOrder(block); + UI_block_order_flip(block); } } - else if (dir1 == UI_DOWN) { + else if (dir1 == UI_DIR_DOWN) { yof = butrct.ymin - block->rect.ymax; - if (dir2 == UI_RIGHT) xof = butrct.xmax - block->rect.xmax; - else xof = butrct.xmin - block->rect.xmin; + if (dir2 == UI_DIR_RIGHT) xof = butrct.xmax - block->rect.xmax; + else xof = butrct.xmin - block->rect.xmin; /* changed direction? */ if ((dir1 & block->direction) == 0) { - uiBlockFlipOrder(block); + UI_block_order_flip(block); } } /* and now we handle the exception; no space below or to top */ if (top == 0 && down == 0) { - if (dir1 == UI_LEFT || dir1 == UI_RIGHT) { + if (dir1 == UI_DIR_LEFT || dir1 == UI_DIR_RIGHT) { /* align with bottom of screen */ // yof = ysize; (not with menu scrolls) } @@ -1467,7 +1471,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, /* or no space left or right */ if (left == 0 && right == 0) { - if (dir1 == UI_TOP || dir1 == UI_DOWN) { + if (dir1 == UI_DIR_UP || dir1 == UI_DIR_DOWN) { /* align with left size of screen */ xof = -block->rect.xmin + 5; } @@ -1489,8 +1493,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, BLI_rctf_translate(&bt->rect, xof, yof); - /* ui_check_but recalculates drawstring size in pixels */ - ui_check_but(bt); + /* ui_but_update recalculates drawstring size in pixels */ + ui_but_update(bt); } BLI_rctf_translate(&block->rect, xof, yof); @@ -1518,8 +1522,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, /* exception for switched pulldowns... */ if (dir1 && (dir1 & block->direction) == 0) { - if (dir2 == UI_RIGHT) block->safety.xmax = block->rect.xmax + 3; - if (dir2 == UI_LEFT) block->safety.xmin = block->rect.xmin - 3; + if (dir2 == UI_DIR_RIGHT) block->safety.xmax = block->rect.xmax + 3; + if (dir2 == UI_DIR_LEFT) block->safety.xmin = block->rect.xmin - 3; } block->direction = dir1; } @@ -1547,7 +1551,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar) } for (block = ar->uiblocks.first; block; block = block->next) - uiDrawBlock(C, block); + UI_block_draw(C, block); } static void ui_popup_block_clip(wmWindow *window, uiBlock *block) @@ -1629,7 +1633,7 @@ void ui_popup_block_scrolltest(uiBlock *block) static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle) { - ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region); + ui_region_temp_remove(C, CTX_wm_screen(C), handle->region); if (handle->scrolltimer) WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), handle->scrolltimer); @@ -1663,7 +1667,7 @@ uiBlock *ui_popup_block_refresh( else block = handle_create_func(C, handle, arg); - /* callbacks _must_ leave this for us, otherwise we can't call uiBlockUpdateFromOld */ + /* callbacks _must_ leave this for us, otherwise we can't call UI_block_update_from_old */ BLI_assert(!block->endblock); /* ensure we don't use mouse coords here! */ @@ -1681,9 +1685,9 @@ uiBlock *ui_popup_block_refresh( ar->regiondata = handle; - /* set UI_BLOCK_NUMSELECT before uiEndBlock() so we get alphanumeric keys assigned */ + /* set UI_BLOCK_NUMSELECT before UI_block_end() so we get alphanumeric keys assigned */ if (but) { - if (but->type == PULLDOWN) { + if (but->type == UI_BTYPE_PULLDOWN) { block->flag |= UI_BLOCK_NUMSELECT; } } @@ -1697,7 +1701,7 @@ uiBlock *ui_popup_block_refresh( block->oldblock = NULL; if (!block->endblock) - uiEndBlock_ex(C, block, handle->popup_create_vars.event_xy); + UI_block_end_ex(C, block, handle->popup_create_vars.event_xy); /* if this is being created from a button */ if (but) { @@ -1752,7 +1756,7 @@ uiBlock *ui_popup_block_refresh( ar->winrct.ymin = 0; ar->winrct.ymax = winy; - ui_block_calculate_pie_segment(block, block->pie_data.pie_center_init); + ui_block_calc_pie_segment(block, block->pie_data.pie_center_init); /* lastly set the buttons at the center of the pie menu, ready for animation */ if (U.pie_animation_timeout > 0) { @@ -1779,8 +1783,8 @@ uiBlock *ui_popup_block_refresh( if (block_old) { block->oldblock = block_old; - uiBlockUpdateFromOld(C, block); - uiFreeInactiveBlocks(C, &ar->uiblocks); + UI_block_update_from_old(C, block); + UI_blocklist_free_inactive(C, &ar->uiblocks); } /* checks which buttons are visible, sets flags to prevent draw (do after region init) */ @@ -1831,7 +1835,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut copy_v2_v2_int(handle->popup_create_vars.event_xy, &window->eventstate->x); /* create area region */ - ar = ui_add_temporary_region(CTX_wm_screen(C)); + ar = ui_region_temp_add(CTX_wm_screen(C)); handle->region = ar; memset(&type, 0, sizeof(ARegionType)); @@ -1839,7 +1843,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut type.regionid = RGN_TYPE_TEMPORARY; ar->type = &type; - UI_add_region_handlers(&ar->handlers); + UI_region_handlers_add(&ar->handlers); block = ui_popup_block_refresh(C, handle, butregion, but); handle = block->handle; @@ -1871,7 +1875,7 @@ static void ui_warp_pointer(int x, int y) /********************* Color Button ****************/ /* for picker, while editing hsv */ -void ui_set_but_hsv(uiBut *but) +void ui_but_hsv_set(uiBut *but) { float col[3]; ColorPicker *cpicker = but->custom_data; @@ -1879,7 +1883,7 @@ void ui_set_but_hsv(uiBut *but) ui_color_picker_to_rgb_v(hsv, col); - ui_set_but_vectorf(but, col); + ui_but_v3_set(but, col); } /* Updates all buttons who share the same color picker as the one passed @@ -1900,12 +1904,12 @@ static void ui_update_color_picker_buts_rgb(uiBlock *block, ColorPicker *cpicker float rgb_display[3]; copy_v3_v3(rgb_display, rgb); - ui_block_to_display_space_v3(block, rgb_display); + ui_block_cm_to_display_space_v3(block, rgb_display); ui_rgb_to_color_picker_compat_v(rgb_display, hsv); } if (block->color_profile) - display = ui_block_display_get(block); + display = ui_block_cm_display_get(block); /* this updates button strings, is hackish... but button pointers are on stack of caller function */ for (bt = block->buttons.first; bt; bt = bt->next) { @@ -1914,7 +1918,7 @@ static void ui_update_color_picker_buts_rgb(uiBlock *block, ColorPicker *cpicker if (bt->rnaprop) { - ui_set_but_vectorf(bt, rgb); + ui_but_v3_set(bt, rgb); } else if (strcmp(bt->str, "Hex: ") == 0) { @@ -1943,33 +1947,33 @@ static void ui_update_color_picker_buts_rgb(uiBlock *block, ColorPicker *cpicker } else if (bt->str[1] == ' ') { if (bt->str[0] == 'R') { - ui_set_but_val(bt, rgb[0]); + ui_but_value_set(bt, rgb[0]); } else if (bt->str[0] == 'G') { - ui_set_but_val(bt, rgb[1]); + ui_but_value_set(bt, rgb[1]); } else if (bt->str[0] == 'B') { - ui_set_but_val(bt, rgb[2]); + ui_but_value_set(bt, rgb[2]); } else if (bt->str[0] == 'H') { - ui_set_but_val(bt, hsv[0]); + ui_but_value_set(bt, hsv[0]); } else if (bt->str[0] == 'S') { - ui_set_but_val(bt, hsv[1]); + ui_but_value_set(bt, hsv[1]); } else if (bt->str[0] == 'V') { - ui_set_but_val(bt, hsv[2]); + ui_but_value_set(bt, hsv[2]); } else if (bt->str[0] == 'L') { - ui_set_but_val(bt, hsv[2]); + ui_but_value_set(bt, hsv[2]); } } - ui_check_but(bt); + ui_but_update(bt); } } -static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) +static void ui_colorpicker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but = (uiBut *)bt1; uiPopupBlockHandle *popup = but->block->handle; @@ -1986,20 +1990,20 @@ static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) popup->menuretval = UI_RETURN_UPDATE; } -static void do_color_wheel_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) +static void ui_color_wheel_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but = (uiBut *)bt1; uiPopupBlockHandle *popup = but->block->handle; float rgb[3]; ColorPicker *cpicker = but->custom_data; float *hsv = cpicker->color_data; - bool use_display_colorspace = ui_color_picker_use_display_colorspace(but); + bool use_display_colorspace = ui_but_is_colorpicker_display_space(but); ui_color_picker_to_rgb_v(hsv, rgb); /* hsv is saved in display space so convert back */ if (use_display_colorspace) { - ui_block_to_scene_linear_v3(but->block, rgb); + ui_block_cm_to_scene_linear_v3(but->block, rgb); } ui_update_color_picker_buts_rgb(but->block, cpicker, rgb, !use_display_colorspace); @@ -2008,7 +2012,7 @@ static void do_color_wheel_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(a popup->menuretval = UI_RETURN_UPDATE; } -static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl) +static void ui_colorpicker_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl) { uiBut *but = (uiBut *)bt1; uiPopupBlockHandle *popup = but->block->handle; @@ -2021,7 +2025,7 @@ static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl) /* Hex code is assumed to be in sRGB space (coming from other applications, web, etc) */ if (but->block->color_profile) { /* so we need to linearise it for Blender */ - ui_block_to_scene_linear_v3(but->block, rgb); + ui_block_cm_to_scene_linear_v3(but->block, rgb); } ui_update_color_picker_buts_rgb(but->block, cpicker, rgb, false); @@ -2030,7 +2034,7 @@ static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl) popup->menuretval = UI_RETURN_UPDATE; } -static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) +static void ui_popup_close_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but = (uiBut *)bt1; uiPopupBlockHandle *popup = but->block->handle; @@ -2039,23 +2043,23 @@ static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) popup->menuretval = UI_RETURN_OK; } -static void picker_new_hide_reveal(uiBlock *block, short colormode) +static void ui_colorpicker_hide_reveal(uiBlock *block, short colormode) { uiBut *bt; /* tag buttons */ for (bt = block->buttons.first; bt; bt = bt->next) { - if ((bt->func == do_picker_rna_cb) && bt->type == NUMSLI && bt->rnaindex != 3) { + if ((bt->func == ui_colorpicker_rna_cb) && bt->type == UI_BTYPE_NUM_SLIDER && bt->rnaindex != 3) { /* RGB sliders (color circle and alpha are always shown) */ if (colormode == 0) bt->flag &= ~UI_HIDDEN; else bt->flag |= UI_HIDDEN; } - else if (bt->func == do_color_wheel_rna_cb) { + else if (bt->func == ui_color_wheel_rna_cb) { /* HSV sliders */ if (colormode == 1) bt->flag &= ~UI_HIDDEN; else bt->flag |= UI_HIDDEN; } - else if (bt->func == do_hex_rna_cb || bt->type == LABEL) { + else if (bt->func == ui_colorpicker_hex_rna_cb || bt->type == UI_BTYPE_LABEL) { /* hex input or gamma correction status label */ if (colormode == 2) bt->flag &= ~UI_HIDDEN; else bt->flag |= UI_HIDDEN; @@ -2063,11 +2067,11 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) } } -static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) +static void ui_colorpicker_create_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *bt = bt1; - short colormode = ui_get_but_val(bt); - picker_new_hide_reveal(bt->block, colormode); + short colormode = ui_but_value_get(bt); + ui_colorpicker_hide_reveal(bt->block, colormode); } #define PICKER_H (7.5f * U.widget_unit) @@ -2077,47 +2081,47 @@ static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(a #define PICKER_TOTAL_W (PICKER_W + PICKER_SPACE + PICKER_BAR) -static void circle_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, ColorPicker *cpicker) +static void ui_colorpicker_circle(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, ColorPicker *cpicker) { uiBut *bt; /* HS circle */ - bt = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, PICKER_H, PICKER_W, ptr, prop, -1, 0.0, 0.0, 0.0, 0, TIP_("Color")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, PICKER_H, PICKER_W, ptr, prop, -1, 0.0, 0.0, 0.0, 0, TIP_("Color")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); bt->custom_data = cpicker; /* value */ if (U.color_picker_type == USER_CP_CIRCLE_HSL) { - bt = uiDefButR_prop(block, HSVCUBE, 0, "", PICKER_W + PICKER_SPACE, 0, PICKER_BAR, PICKER_H, ptr, prop, -1, 0.0, 0.0, UI_GRAD_L_ALT, 0, "Lightness"); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", PICKER_W + PICKER_SPACE, 0, PICKER_BAR, PICKER_H, ptr, prop, -1, 0.0, 0.0, UI_GRAD_L_ALT, 0, "Lightness"); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); } else { - bt = uiDefButR_prop(block, HSVCUBE, 0, "", PICKER_W + PICKER_SPACE, 0, PICKER_BAR, PICKER_H, ptr, prop, -1, 0.0, 0.0, UI_GRAD_V_ALT, 0, TIP_("Value")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", PICKER_W + PICKER_SPACE, 0, PICKER_BAR, PICKER_H, ptr, prop, -1, 0.0, 0.0, UI_GRAD_V_ALT, 0, TIP_("Value")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); } bt->custom_data = cpicker; } -static void square_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int type, ColorPicker *cpicker) +static void ui_colorpicker_square(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int type, ColorPicker *cpicker) { uiBut *bt; int bartype = type + 3; /* HS square */ - bt = uiDefButR_prop(block, HSVCUBE, 0, "", 0, PICKER_BAR + PICKER_SPACE, PICKER_TOTAL_W, PICKER_H, ptr, prop, -1, 0.0, 0.0, type, 0, TIP_("Color")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, PICKER_BAR + PICKER_SPACE, PICKER_TOTAL_W, PICKER_H, ptr, prop, -1, 0.0, 0.0, type, 0, TIP_("Color")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); bt->custom_data = cpicker; /* value */ - bt = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, PICKER_TOTAL_W, PICKER_BAR, ptr, prop, -1, 0.0, 0.0, bartype, 0, TIP_("Value")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, PICKER_TOTAL_W, PICKER_BAR, ptr, prop, -1, 0.0, 0.0, bartype, 0, TIP_("Value")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); bt->custom_data = cpicker; } /* a HS circle, V slider, rgb/hsv/hex sliders */ -static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, PropertyRNA *prop, bool show_picker) +static void ui_block_colorpicker(uiBlock *block, float rgba[4], PointerRNA *ptr, PropertyRNA *prop, bool show_picker) { static short colormode = 0; /* temp? 0=rgb, 1=hsv, 2=hex */ uiBut *bt; @@ -2128,7 +2132,7 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper unsigned char rgb_gamma_uchar[3]; float softmin, softmax, hardmin, hardmax, step, precision; int yco; - ColorPicker *cpicker = ui_block_picker_new(block); + ColorPicker *cpicker = ui_block_colorpicker_create(block); float *hsv = cpicker->color_data; width = PICKER_TOTAL_W; @@ -2145,7 +2149,7 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper /* make a display version, for Hex code */ copy_v3_v3(rgb_gamma, rgba); - ui_block_to_display_space_v3(block, rgb_gamma); + ui_block_cm_to_display_space_v3(block, rgb_gamma); } /* sneaky way to check for alpha */ @@ -2157,85 +2161,85 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper switch (U.color_picker_type) { case USER_CP_SQUARE_SV: - square_picker(block, ptr, prop, UI_GRAD_SV, cpicker); + ui_colorpicker_square(block, ptr, prop, UI_GRAD_SV, cpicker); break; case USER_CP_SQUARE_HS: - square_picker(block, ptr, prop, UI_GRAD_HS, cpicker); + ui_colorpicker_square(block, ptr, prop, UI_GRAD_HS, cpicker); break; case USER_CP_SQUARE_HV: - square_picker(block, ptr, prop, UI_GRAD_HV, cpicker); + ui_colorpicker_square(block, ptr, prop, UI_GRAD_HV, cpicker); break; /* user default */ case USER_CP_CIRCLE_HSV: case USER_CP_CIRCLE_HSL: default: - circle_picker(block, ptr, prop, cpicker); + ui_colorpicker_circle(block, ptr, prop, cpicker); break; } /* mode */ yco = -1.5f * UI_UNIT_Y; - uiBlockBeginAlign(block); - bt = uiDefButS(block, ROW, 0, IFACE_("RGB"), 0, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); + UI_block_align_begin(block); + bt = uiDefButS(block, UI_BTYPE_ROW, 0, IFACE_("RGB"), 0, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, ""); + UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL); bt->custom_data = cpicker; if (U.color_picker_type == USER_CP_CIRCLE_HSL) - bt = uiDefButS(block, ROW, 0, IFACE_("HSL"), width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, ""); + bt = uiDefButS(block, UI_BTYPE_ROW, 0, IFACE_("HSL"), width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, ""); else - bt = uiDefButS(block, ROW, 0, IFACE_("HSV"), width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); + bt = uiDefButS(block, UI_BTYPE_ROW, 0, IFACE_("HSV"), width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, ""); + UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL); bt->custom_data = cpicker; - bt = uiDefButS(block, ROW, 0, IFACE_("Hex"), 2 * width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); + bt = uiDefButS(block, UI_BTYPE_ROW, 0, IFACE_("Hex"), 2 * width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, ""); + UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL); bt->custom_data = cpicker; - uiBlockEndAlign(block); + UI_block_align_end(block); yco = -3.0f * UI_UNIT_Y; if (show_picker) { - bt = uiDefIconButO(block, BUT, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth + 10, yco, UI_UNIT_X, UI_UNIT_Y, NULL); - uiButSetFunc(bt, close_popup_cb, bt, NULL); + bt = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth + 10, yco, UI_UNIT_X, UI_UNIT_Y, NULL); + UI_but_func_set(bt, ui_popup_close_cb, bt, NULL); bt->custom_data = cpicker; } /* RGB values */ - uiBlockBeginAlign(block); - bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("R:"), 0, yco, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, TIP_("Red")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + UI_block_align_begin(block); + bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("R:"), 0, yco, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, TIP_("Red")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); bt->custom_data = cpicker; - bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("G:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, TIP_("Green")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("G:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, TIP_("Green")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); bt->custom_data = cpicker; - bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("B:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, TIP_("Blue")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("B:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, TIP_("Blue")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); bt->custom_data = cpicker; /* could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NONE); - * but need to use uiButSetFunc for updating other fake buttons */ + * but need to use UI_but_func_set for updating other fake buttons */ /* HSV values */ yco = -3.0f * UI_UNIT_Y; - uiBlockBeginAlign(block); - bt = uiDefButF(block, NUMSLI, 0, IFACE_("H:"), 0, yco, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue")); - uiButSetFunc(bt, do_color_wheel_rna_cb, bt, hsv); + UI_block_align_begin(block); + bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("H:"), 0, yco, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue")); + UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv); bt->custom_data = cpicker; - bt = uiDefButF(block, NUMSLI, 0, IFACE_("S:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation")); - uiButSetFunc(bt, do_color_wheel_rna_cb, bt, hsv); + bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("S:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation")); + UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv); bt->custom_data = cpicker; if (U.color_picker_type == USER_CP_CIRCLE_HSL) - bt = uiDefButF(block, NUMSLI, 0, IFACE_("L:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, 1.0, 10, 3, TIP_("Lightness")); + bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("L:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, 1.0, 10, 3, TIP_("Lightness")); else - bt = uiDefButF(block, NUMSLI, 0, IFACE_("V:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, softmax, 10, 3, TIP_("Value")); + bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("V:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, softmax, 10, 3, TIP_("Value")); bt->hardmax = hardmax; /* not common but rgb may be over 1.0 */ - uiButSetFunc(bt, do_color_wheel_rna_cb, bt, hsv); + UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv); bt->custom_data = cpicker; - uiBlockEndAlign(block); + UI_block_align_end(block); if (rgba[3] != FLT_MAX) { - bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("A: "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 3, TIP_("Alpha")); - uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); + bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("A: "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 3, TIP_("Alpha")); + UI_but_func_set(bt, ui_colorpicker_rna_cb, bt, NULL); bt->custom_data = cpicker; } else { @@ -2246,18 +2250,18 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", UNPACK3_EX((unsigned int), rgb_gamma_uchar, )); yco = -3.0f * UI_UNIT_Y; - bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)")); - uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); + bt = uiDefBut(block, UI_BTYPE_TEXT, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)")); + UI_but_func_set(bt, ui_colorpicker_hex_rna_cb, bt, hexcol); bt->custom_data = cpicker; - uiDefBut(block, LABEL, 0, IFACE_("(Gamma Corrected)"), 0, yco - UI_UNIT_Y, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("(Gamma Corrected)"), 0, yco - UI_UNIT_Y, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); ui_rgb_to_color_picker_v(rgb_gamma, hsv); - picker_new_hide_reveal(block, colormode); + ui_colorpicker_hide_reveal(block, colormode); } -static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, const wmEvent *event) +static int ui_colorpicker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, const wmEvent *event) { float add = 0.0f; @@ -2270,17 +2274,17 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, c uiBut *but; for (but = block->buttons.first; but; but = but->next) { - if (but->type == HSVCUBE && but->active == NULL) { + if (but->type == UI_BTYPE_HSVCUBE && but->active == NULL) { uiPopupBlockHandle *popup = block->handle; float rgb[3]; ColorPicker *cpicker = but->custom_data; float *hsv = cpicker->color_data; - bool use_display_colorspace = ui_color_picker_use_display_colorspace(but); + bool use_display_colorspace = ui_but_is_colorpicker_display_space(but); - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (use_display_colorspace) - ui_block_to_display_space_v3(block, rgb); + ui_block_cm_to_display_space_v3(block, rgb); ui_rgb_to_color_picker_compat_v(rgb, hsv); @@ -2288,9 +2292,9 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, c ui_color_picker_to_rgb_v(hsv, rgb); if (use_display_colorspace) - ui_block_to_scene_linear_v3(block, rgb); + ui_block_cm_to_scene_linear_v3(block, rgb); - ui_set_but_vectorf(but, rgb); + ui_but_v3_set(but, rgb); ui_update_color_picker_buts_rgb(block, cpicker, rgb, !use_display_colorspace); if (popup) @@ -2309,7 +2313,7 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ uiBlock *block; bool show_picker = true; - block = uiBeginBlock(C, handle->region, __func__, UI_EMBOSS); + block = UI_block_begin(C, handle->region, __func__, UI_EMBOSS); if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { block->color_profile = false; @@ -2325,15 +2329,15 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ copy_v3_v3(handle->retvec, but->editvec); - uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker); + ui_block_colorpicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker); block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1 | UI_BLOCK_MOVEMOUSE_QUIT; - uiBoundsBlock(block, 0.5 * UI_UNIT_X); + UI_block_bounds_set_normal(block, 0.5 * UI_UNIT_X); - block->block_event_func = ui_picker_small_wheel_cb; + block->block_event_func = ui_colorpicker_small_wheel_cb; /* and lets go */ - block->direction = UI_TOP; + block->direction = UI_DIR_UP; return block; } @@ -2469,39 +2473,39 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi /* allow overriding the direction from menu_func */ direction = pup->block->direction; } - else if ((pup->but->type == PULLDOWN) || - (uiButGetMenuType(pup->but) != NULL)) + else if ((pup->but->type == UI_BTYPE_PULLDOWN) || + (UI_but_menutype_get(pup->but) != NULL)) { - direction = UI_DOWN; + direction = UI_DIR_DOWN; } else { - direction = UI_TOP; + direction = UI_DIR_UP; } } else { minwidth = 50; - direction = UI_DOWN; + direction = UI_DIR_DOWN; } - flip = (direction == UI_DOWN); + flip = (direction == UI_DIR_DOWN); block = pup->block; /* in some cases we create the block before the region, * so we set it delayed here if necessary */ if (BLI_findindex(&handle->region->uiblocks, block) == -1) - uiBlockSetRegion(block, handle->region); + UI_block_region_set(block, handle->region); block->direction = direction; - uiBlockLayoutResolve(block, &width, &height); + UI_block_layout_resolve(block, &width, &height); - uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); + UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT); if (pup->popup) { uiBut *but_activate = NULL; - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT); - uiBlockSetDirection(block, direction); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT); + UI_block_direction_set(block, direction); /* offset the mouse position, possibly based on earlier selection */ if ((block->flag & UI_BLOCK_POPUP_MEMORY) && @@ -2539,11 +2543,11 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi * to be within the window bounds may move it away from the mouse, * This ensures we set an item to be active. */ if (but_activate) { - ui_button_activate_over(C, handle->region, but_activate); + ui_but_activate_over(C, handle->region, but_activate); } block->minbounds = minwidth; - uiMenuPopupBoundsBlock(block, 1, offset[0], offset[1]); + UI_block_bounds_set_menu(block, 1, offset[0], offset[1]); } else { /* for a header menu we set the direction automatic */ @@ -2552,19 +2556,19 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi if (sa && sa->headertype == HEADERDOWN) { ARegion *ar = CTX_wm_region(C); if (ar && ar->regiontype == RGN_TYPE_HEADER) { - uiBlockSetDirection(block, UI_TOP); - uiBlockFlipOrder(block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_order_flip(block); } } } block->minbounds = minwidth; - uiTextBoundsBlock(block, 3.0f * UI_UNIT_X); + UI_block_bounds_set_text(block, 3.0f * UI_UNIT_X); } /* if menu slides out of other menu, override direction */ if (pup->slideout) - uiBlockSetDirection(block, UI_RIGHT); + UI_block_direction_set(block, UI_DIR_RIGHT); return pup->block; } @@ -2573,14 +2577,14 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut uiMenuCreateFunc menu_func, void *arg) { wmWindow *window = CTX_wm_window(C); - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); uiPopupBlockHandle *handle; uiPopupMenu *pup; pup = MEM_callocN(sizeof(uiPopupMenu), __func__); - pup->block = uiBeginBlock(C, NULL, __func__, UI_EMBOSSP); + pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS_PULLDOWN); pup->block->flag |= UI_BLOCK_NUMSELECT; /* default menus to numselect */ - pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style); + pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style); pup->slideout = but ? ui_block_is_menu(but->block) : false; pup->but = but; uiLayoutSetOperatorContext(pup->layout, WM_OP_INVOKE_REGION_WIN); @@ -2617,7 +2621,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut if (!but) { handle->popup = true; - UI_add_popup_handlers(C, &window->modalhandlers, handle, false); + UI_popup_handlers_add(C, &window->modalhandlers, handle, false); WM_event_add_mousemove(C); } @@ -2629,16 +2633,16 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut /******************** Popup Menu API with begin and end ***********************/ /* only return handler, and set optional title */ -uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) +uiPopupMenu *UI_popup_menu_begin(bContext *C, const char *title, int icon) { - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); uiPopupMenu *pup = MEM_callocN(sizeof(uiPopupMenu), "popup menu"); uiBut *but; - pup->block = uiBeginBlock(C, NULL, __func__, UI_EMBOSSP); + pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS_PULLDOWN); pup->block->flag |= UI_BLOCK_POPUP_MEMORY; pup->block->puphash = ui_popup_menu_hash(title); - pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style); + pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style); /* note, this intentionally differs from the menu & submenu default because many operators * use popups like this to select one of their options - where having invoke doesn't make sense */ @@ -2653,10 +2657,10 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) if (icon) { BLI_snprintf(titlestr, sizeof(titlestr), " %s", title); - uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(pup->block, UI_BTYPE_LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } else { - but = uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + but = uiDefBut(pup->block, UI_BTYPE_LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->drawflag = UI_BUT_TEXT_LEFT; } @@ -2667,7 +2671,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) } /* set the whole structure to work */ -void uiPupMenuEnd(bContext *C, uiPopupMenu *pup) +void UI_popup_menu_end(bContext *C, uiPopupMenu *pup) { wmWindow *window = CTX_wm_window(C); uiPopupBlockHandle *menu; @@ -2679,13 +2683,13 @@ void uiPupMenuEnd(bContext *C, uiPopupMenu *pup) menu = ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_POPUP, pup); menu->popup = true; - UI_add_popup_handlers(C, &window->modalhandlers, menu, false); + UI_popup_handlers_add(C, &window->modalhandlers, menu, false); WM_event_add_mousemove(C); MEM_freeN(pup); } -uiLayout *uiPupMenuLayout(uiPopupMenu *pup) +uiLayout *UI_popup_menu_layout(uiPopupMenu *pup) { return pup->layout; } @@ -2704,11 +2708,11 @@ static uiBlock *ui_block_func_PIE(bContext *UNUSED(C), uiPopupBlockHandle *handl /* in some cases we create the block before the region, * so we set it delayed here if necessary */ if (BLI_findindex(&handle->region->uiblocks, block) == -1) - uiBlockSetRegion(block, handle->region); + UI_block_region_set(block, handle->region); - uiBlockLayoutResolve(block, &width, &height); + UI_block_layout_resolve(block, &width, &height); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT); block->minbounds = minwidth; block->bounds = 1; @@ -2722,13 +2726,13 @@ static uiBlock *ui_block_func_PIE(bContext *UNUSED(C), uiPopupBlockHandle *handl return pie->block_radial; } -static float uiPieTitleWidth(const char *name, int icon) +static float ui_pie_menu_title_width(const char *name, int icon) { - return (UI_GetStringWidth(name) + + return (UI_fontstyle_string_width(name) + (UI_UNIT_X * (1.50f + (icon ? 0.25f : 0.0f)))); } -uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const wmEvent *event) +uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, const wmEvent *event) { uiStyle *style; uiPieMenu *pie; @@ -2736,10 +2740,10 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const wmWindow *win = CTX_wm_window(C); - style = UI_GetStyleDraw(); + style = UI_style_get_dpi(); pie = MEM_callocN(sizeof(uiPopupMenu), "pie menu"); - pie->block_radial = uiBeginBlock(C, NULL, __func__, UI_EMBOSS); + pie->block_radial = UI_block_begin(C, NULL, __func__, UI_EMBOSS); /* may be useful later to allow spawning pies * from old positions */ /* pie->block_radial->flag |= UI_BLOCK_POPUP_MEMORY; */ @@ -2770,7 +2774,7 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const win->lock_pie_event = event_type; } - pie->layout = uiBlockLayout(pie->block_radial, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style); + pie->layout = UI_block_layout(pie->block_radial, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style); pie->mx = event->x; pie->my = event->y; @@ -2781,12 +2785,12 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const int w; if (icon) { BLI_snprintf(titlestr, sizeof(titlestr), " %s", title); - w = uiPieTitleWidth(titlestr, icon); - but = uiDefIconTextBut(pie->block_radial, LABEL, 0, icon, titlestr, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + w = ui_pie_menu_title_width(titlestr, icon); + but = uiDefIconTextBut(pie->block_radial, UI_BTYPE_LABEL, 0, icon, titlestr, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } else { - w = uiPieTitleWidth(title, 0); - but = uiDefBut(pie->block_radial, LABEL, 0, title, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + w = ui_pie_menu_title_width(title, 0); + but = uiDefBut(pie->block_radial, UI_BTYPE_LABEL, 0, title, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } /* do not align left */ but->drawflag &= ~UI_BUT_TEXT_LEFT; @@ -2795,7 +2799,7 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const return pie; } -void uiPieMenuEnd(bContext *C, uiPieMenu *pie) +void UI_pie_menu_end(bContext *C, uiPieMenu *pie) { wmWindow *window = CTX_wm_window(C); uiPopupBlockHandle *menu; @@ -2804,18 +2808,18 @@ void uiPieMenuEnd(bContext *C, uiPieMenu *pie) menu->popup = true; menu->towardstime = PIL_check_seconds_timer(); - UI_add_popup_handlers(C, &window->modalhandlers, menu, true); + UI_popup_handlers_add(C, &window->modalhandlers, menu, true); WM_event_add_mousemove(C); MEM_freeN(pie); } -uiLayout *uiPieMenuLayout(uiPieMenu *pie) +uiLayout *UI_pie_menu_layout(uiPieMenu *pie) { return pie->layout; } -int uiPieMenuInvoke(struct bContext *C, const char *idname, const wmEvent *event) +int UI_pie_menu_invoke(struct bContext *C, const char *idname, const wmEvent *event) { uiPieMenu *pie; uiLayout *layout; @@ -2830,8 +2834,8 @@ int uiPieMenuInvoke(struct bContext *C, const char *idname, const wmEvent *event if (mt->poll && mt->poll(C, mt) == 0) return OPERATOR_CANCELLED; - pie = uiPieMenuBegin(C, IFACE_(mt->label), ICON_NONE, event); - layout = uiPieMenuLayout(pie); + pie = UI_pie_menu_begin(C, IFACE_(mt->label), ICON_NONE, event); + layout = UI_pie_menu_layout(pie); menu.layout = layout; menu.type = mt; @@ -2842,29 +2846,29 @@ int uiPieMenuInvoke(struct bContext *C, const char *idname, const wmEvent *event mt->draw(C, &menu); - uiPieMenuEnd(C, pie); + UI_pie_menu_end(C, pie); return OPERATOR_INTERFACE; } -int uiPieOperatorEnumInvoke(struct bContext *C, const char *title, const char *opname, +int UI_pie_menu_invoke_from_operator_enum(struct bContext *C, const char *title, const char *opname, const char *propname, const wmEvent *event) { uiPieMenu *pie; uiLayout *layout; - pie = uiPieMenuBegin(C, IFACE_(title), ICON_NONE, event); - layout = uiPieMenuLayout(pie); + pie = UI_pie_menu_begin(C, IFACE_(title), ICON_NONE, event); + layout = UI_pie_menu_layout(pie); layout = uiLayoutRadial(layout); uiItemsEnumO(layout, opname, propname); - uiPieMenuEnd(C, pie); + UI_pie_menu_end(C, pie); return OPERATOR_INTERFACE; } -int uiPieEnumInvoke(struct bContext *C, const char *title, const char *path, +int UI_pie_menu_invoke_from_rna_enum(struct bContext *C, const char *title, const char *path, const wmEvent *event) { PointerRNA ctx_ptr; @@ -2885,14 +2889,14 @@ int uiPieEnumInvoke(struct bContext *C, const char *title, const char *path, return OPERATOR_CANCELLED; } - pie = uiPieMenuBegin(C, IFACE_(title), ICON_NONE, event); + pie = UI_pie_menu_begin(C, IFACE_(title), ICON_NONE, event); - layout = uiPieMenuLayout(pie); + layout = UI_pie_menu_layout(pie); layout = uiLayoutRadial(layout); uiItemFullR(layout, &r_ptr, r_prop, RNA_NO_INDEX, 0, UI_ITEM_R_EXPAND, NULL, 0); - uiPieMenuEnd(C, pie); + UI_pie_menu_end(C, pie); return OPERATOR_INTERFACE; } @@ -2900,7 +2904,7 @@ int uiPieEnumInvoke(struct bContext *C, const char *title, const char *path, /*************************** Standard Popup Menus ****************************/ -void uiPupMenuReports(bContext *C, ReportList *reports) +void UI_popup_menu_reports(bContext *C, ReportList *reports) { Report *report; @@ -2921,8 +2925,8 @@ void uiPupMenuReports(bContext *C, ReportList *reports) if (pup == NULL) { char title[UI_MAX_DRAW_STR]; BLI_snprintf(title, sizeof(title), "%s: %s", IFACE_("Report"), report->typestr); - pup = uiPupMenuBegin(C, title, ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, title, ICON_NONE); + layout = UI_popup_menu_layout(pup); } else { uiItemS(layout); @@ -2930,7 +2934,7 @@ void uiPupMenuReports(bContext *C, ReportList *reports) /* split each newline into a label */ msg = report->message; - icon = uiIconFromReportType(report->type); + icon = UI_icon_from_report_type(report->type); do { char buf[UI_MAX_DRAW_STR]; msg_next = strchr(msg, '\n'); @@ -2945,11 +2949,11 @@ void uiPupMenuReports(bContext *C, ReportList *reports) } if (pup) { - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } } -int uiPupMenuInvoke(bContext *C, const char *idname, ReportList *reports) +int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports) { uiPopupMenu *pup; uiLayout *layout; @@ -2964,8 +2968,8 @@ int uiPupMenuInvoke(bContext *C, const char *idname, ReportList *reports) if (mt->poll && mt->poll(C, mt) == 0) return OPERATOR_CANCELLED; - pup = uiPupMenuBegin(C, IFACE_(mt->label), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_(mt->label), ICON_NONE); + layout = UI_popup_menu_layout(pup); menu.layout = layout; menu.type = mt; @@ -2976,7 +2980,7 @@ int uiPupMenuInvoke(bContext *C, const char *idname, ReportList *reports) mt->draw(C, &menu); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -2984,7 +2988,7 @@ int uiPupMenuInvoke(bContext *C, const char *idname, ReportList *reports) /*************************** Popup Block API **************************/ -void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext) +void UI_popup_block_invoke_ex(bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext) { wmWindow *window = CTX_wm_window(C); uiPopupBlockHandle *handle; @@ -2994,16 +2998,16 @@ void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opn handle->optype = (opname) ? WM_operatortype_find(opname, 0) : NULL; handle->opcontext = opcontext; - UI_add_popup_handlers(C, &window->modalhandlers, handle, false); + UI_popup_handlers_add(C, &window->modalhandlers, handle, false); WM_event_add_mousemove(C); } -void uiPupBlock(bContext *C, uiBlockCreateFunc func, void *arg) +void UI_popup_block_invoke(bContext *C, uiBlockCreateFunc func, void *arg) { - uiPupBlockO(C, func, arg, NULL, WM_OP_INVOKE_DEFAULT); + UI_popup_block_invoke_ex(C, func, arg, NULL, WM_OP_INVOKE_DEFAULT); } -void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg) +void UI_popup_block_ex(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg) { wmWindow *window = CTX_wm_window(C); uiPopupBlockHandle *handle; @@ -3017,7 +3021,7 @@ void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_f handle->cancel_func = cancel_func; // handle->opcontext = opcontext; - UI_add_popup_handlers(C, &window->modalhandlers, handle, false); + UI_popup_handlers_add(C, &window->modalhandlers, handle, false); WM_event_add_mousemove(C); } @@ -3036,25 +3040,25 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int handle->cancel_func = confirm_cancel_operator; handle->opcontext = opcontext; - UI_add_popup_handlers(C, &window->modalhandlers, handle); + UI_popup_handlers_add(C, &window->modalhandlers, handle); WM_event_add_mousemove(C); } #endif -void uiPupBlockClose(bContext *C, uiBlock *block) +void UI_popup_block_close(bContext *C, uiBlock *block) { if (block->handle) { wmWindow *win = CTX_wm_window(C); /* if loading new .blend while popup is open, window will be NULL */ if (win) { - UI_remove_popup_handlers(&win->modalhandlers, block->handle); + UI_popup_handlers_remove(&win->modalhandlers, block->handle); ui_popup_block_free(C, block->handle); } } } -ColorPicker *ui_block_picker_new(struct uiBlock *block) +ColorPicker *ui_block_colorpicker_create(struct uiBlock *block) { ColorPicker *cpicker = MEM_callocN(sizeof(ColorPicker), "color_picker"); BLI_addhead(&block->color_pickers.list, cpicker); |