diff options
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index c2bd6d307d1..e8e9475c338 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -237,7 +237,7 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, bool if (variable) { /* it may seem odd that the icon only adds (UI_UNIT_X / 4) * but taking margins into account its fine */ - return (UI_GetStringWidth(name) + + return (UI_fontstyle_string_width(name) + (UI_UNIT_X * ((compact ? 1.25f : 1.50f) + (icon ? 0.25f : 0.0f)))); } @@ -286,7 +286,7 @@ static void ui_item_position(uiItem *item, int x, int y, int w, int h) bitem->but->rect.xmax = x + w; bitem->but->rect.ymax = y + h; - ui_check_but(bitem->but); /* for strlen */ + ui_but_update(bitem->but); /* for strlen */ } else { uiLayout *litem = (uiLayout *)item; @@ -350,7 +350,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index) RNA_property_update(C, ptr, prop); for (cbut = but->block->buttons.first; cbut; cbut = cbut->next) - ui_check_but(cbut); + ui_but_update(cbut); } } @@ -371,11 +371,11 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in subtype = RNA_property_subtype(prop); sub = ui_item_local_sublayout(layout, layout, 1); - uiBlockSetCurLayout(block, sub); + UI_block_layout_set_current(block, sub); /* create label */ if (name[0]) - uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* create buttons */ if (type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) { @@ -386,7 +386,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in unsigned int layer_used = 0; unsigned int layer_active = 0; - uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, false)); + UI_block_layout_set_current(block, uiLayoutAbsolute(layout, false)); unit = UI_UNIT_X * 0.75; butw = unit; @@ -410,7 +410,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in } for (b = 0; b < cols; b++) { - uiBlockBeginAlign(block); + UI_block_align_begin(block); for (a = 0; a < colbuts; a++) { const int layer_num = a + b * colbuts; @@ -428,7 +428,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y + buth, butw, buth); if (subtype == PROP_LAYER_MEMBER) - uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num)); + UI_but_func_set(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num)); } for (a = 0; a < colbuts; a++) { const int layer_num = a + len / 2 + b * colbuts; @@ -446,9 +446,9 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y, butw, buth); if (subtype == PROP_LAYER_MEMBER) - uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num)); + UI_but_func_set(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num)); } - uiBlockEndAlign(block); + UI_block_align_end(block); x += colbuts * butw + style->buttonspacex; } @@ -457,7 +457,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in int totdim, dim_size[3]; /* 3 == RNA_MAX_ARRAY_DIMENSION */ int row, col; - uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, true)); + UI_block_layout_set_current(block, uiLayoutAbsolute(layout, true)); totdim = RNA_property_array_dimension(ptr, prop, dim_size); if (totdim != 2) return; /* only 2D matrices supported in UI so far */ @@ -470,12 +470,12 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in row = a / dim_size[0]; but = uiDefAutoButR(block, ptr, prop, a, "", ICON_NONE, x + w * col, y + (dim_size[1] * UI_UNIT_Y) - (row * UI_UNIT_Y), w, UI_UNIT_Y); - if (slider && but->type == NUM) - but->type = NUMSLI; + if (slider && but->type == UI_BTYPE_NUM) + but->type = UI_BTYPE_NUM_SLIDER; } } else if (subtype == PROP_DIRECTION && !expand) { - uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X * 3, UI_UNIT_Y * 3, ptr, prop, 0, 0, 0, -1, -1, NULL); + uiDefButR_prop(block, UI_BTYPE_UNITVEC, 0, name, x, y, UI_UNIT_X * 3, UI_UNIT_Y * 3, ptr, prop, 0, 0, 0, -1, -1, NULL); } else { /* note, this block of code is a bit arbitrary and has just been made @@ -500,7 +500,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in } /* show checkboxes for rna on a non-emboss block (menu for eg) */ - if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) { + if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSS_NONE, UI_EMBOSS_PULLDOWN)) { boolarr = MEM_callocN(sizeof(int) * len, "ui_item_array"); RNA_property_boolean_get_array(ptr, prop, boolarr); } @@ -509,12 +509,12 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in if (!icon_only) str[0] = RNA_property_array_item_char(prop, a); if (boolarr) icon = boolarr[a] ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT; but = uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y); - if (slider && but->type == NUM) - but->type = NUMSLI; - if (toggle && but->type == OPTION) - but->type = TOG; + if (slider && but->type == UI_BTYPE_NUM) + but->type = UI_BTYPE_NUM_SLIDER; + if (toggle && but->type == UI_BTYPE_CHECKBOX) + but->type = UI_BTYPE_TOGGLE; if ((a == 0) && (subtype == PROP_AXISANGLE)) - uiButSetUnitType(but, PROP_UNIT_ROTATION); + UI_but_unit_type_set(but, PROP_UNIT_ROTATION); } if (boolarr) { @@ -523,7 +523,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in } } - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); } static void ui_item_enum_expand_handle(bContext *C, void *arg1, void *arg2) @@ -571,13 +571,13 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt /* we dont want nested rows, cols in menus */ if (radial) { layout_radial = uiLayoutRadial(layout); - uiBlockSetCurLayout(block, layout_radial); + UI_block_layout_set_current(block, layout_radial); } else if (layout->root->type != UI_LAYOUT_MENU) { - uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1)); + UI_block_layout_set_current(block, ui_item_local_sublayout(layout, layout, 1)); } else { - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); } for (item = item_array; item->identifier; item++) { @@ -593,20 +593,20 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt itemw = ui_text_icon_width(block->curlayout, icon_only ? "" : name, icon, 0); if (icon && name[0] && !icon_only) - but = uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL); + but = uiDefIconTextButR_prop(block, UI_BTYPE_ROW, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL); else if (icon) - but = uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL); + but = uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL); else - but = uiDefButR_prop(block, ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL); + but = uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL); if (RNA_property_flag(prop) & PROP_ENUM_FLAG) { - uiButSetFunc(but, ui_item_enum_expand_handle, but, SET_INT_IN_POINTER(value)); + UI_but_func_set(but, ui_item_enum_expand_handle, but, SET_INT_IN_POINTER(value)); } if (ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL) but->drawflag |= UI_BUT_TEXT_LEFT; } - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); if (free) { MEM_freeN(item_array); @@ -634,16 +634,16 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n int labelw; sub = uiLayoutRow(layout, layout->align); - uiBlockSetCurLayout(block, sub); + UI_block_layout_set_current(block, sub); if (name[0]) { - /* XXX UI_GetStringWidth is not accurate */ + /* XXX UI_fontstyle_string_width is not accurate */ #if 0 - labelw = UI_GetStringWidth(name); + labelw = UI_fontstyle_string_width(name); CLAMP(labelw, w / 4, 3 * w / 4); #endif labelw = w / 3; - uiDefBut(block, LABEL, 0, name, x, y, labelw, h, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, labelw, h, NULL, 0.0, 0.0, 0, 0, ""); w = w - labelw; } @@ -651,15 +651,15 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n subtype = RNA_property_subtype(prop); if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) { - uiBlockSetCurLayout(block, uiLayoutRow(sub, true)); + UI_block_layout_set_current(block, uiLayoutRow(sub, true)); but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w - UI_UNIT_X, h); - /* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */ - uiDefIconButO(block, BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse", + /* BUTTONS_OT_file_browse calls UI_context_active_but_prop_get_filebrowser */ + uiDefIconButO(block, UI_BTYPE_BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL); } else if (flag & UI_ITEM_R_EVENT) { - uiDefButR_prop(block, KEYEVT, 0, name, x, y, w, h, ptr, prop, index, 0, 0, -1, -1, NULL); + uiDefButR_prop(block, UI_BTYPE_KEY_EVENT, 0, name, x, y, w, h, ptr, prop, index, 0, 0, -1, -1, NULL); } else if (flag & UI_ITEM_R_FULL_EVENT) { if (RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) { @@ -667,20 +667,20 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n WM_keymap_item_to_string(ptr->data, buf, sizeof(buf)); - but = uiDefButR_prop(block, HOTKEYEVT, 0, buf, x, y, w, h, ptr, prop, 0, 0, 0, -1, -1, NULL); - uiButSetFunc(but, ui_keymap_but_cb, but, NULL); + but = uiDefButR_prop(block, UI_BTYPE_HOTKEY_EVENT, 0, buf, x, y, w, h, ptr, prop, 0, 0, 0, -1, -1, NULL); + UI_but_func_set(but, ui_keymap_but_cb, but, NULL); if (flag & UI_ITEM_R_IMMEDIATE) - uiButSetFlag(but, UI_BUT_IMMEDIATE); + UI_but_flag_enable(but, UI_BUT_IMMEDIATE); } } else but = uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY)) ? NULL : "", icon, x, y, w, h); - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); return but; } -void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA **prop) +void UI_context_active_but_prop_get_filebrowser(const bContext *C, PointerRNA *ptr, PropertyRNA **prop) { ARegion *ar = CTX_wm_region(C); uiBlock *block; @@ -729,14 +729,14 @@ static void ui_item_disabled(uiLayout *layout, const char *name) uiBut *but; int w; - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); if (!name) name = ""; w = ui_text_icon_width(layout, name, 0, 0); - but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + 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 = ""; @@ -760,24 +760,24 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam icon = ICON_BLANK1; /* create button */ - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); w = ui_text_icon_width(layout, name, icon, 0); if (flag & UI_ITEM_R_NO_BG) - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* create the button */ if (icon) { if (name[0]) { - but = uiDefIconTextButO_ptr(block, BUT, ot, context, icon, name, 0, 0, w, UI_UNIT_Y, NULL); + but = uiDefIconTextButO_ptr(block, UI_BTYPE_BUT, ot, context, icon, name, 0, 0, w, UI_UNIT_Y, NULL); } else { - but = uiDefIconButO_ptr(block, BUT, ot, context, icon, 0, 0, w, UI_UNIT_Y, NULL); + but = uiDefIconButO_ptr(block, UI_BTYPE_BUT, ot, context, icon, 0, 0, w, UI_UNIT_Y, NULL); } } else { - but = uiDefButO_ptr(block, BUT, ot, context, name, 0, 0, w, UI_UNIT_Y, NULL); + but = uiDefButO_ptr(block, UI_BTYPE_BUT, ot, context, name, 0, 0, w, UI_UNIT_Y, NULL); } assert(but->optype != NULL); @@ -787,14 +787,14 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam but->drawflag |= UI_BUT_TEXT_LEFT; if (flag & UI_ITEM_R_NO_BG) - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); if (layout->redalert) - uiButSetFlag(but, UI_BUT_REDALERT); + UI_but_flag_enable(but, UI_BUT_REDALERT); /* assign properties */ if (properties || (flag & UI_ITEM_O_RETURN_PROPS)) { - PointerRNA *opptr = uiButGetOperatorPtrRNA(but); + PointerRNA *opptr = UI_but_operator_ptr_get(but); if (properties) { opptr->data = properties; @@ -958,7 +958,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname } else { /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */ - but = uiDefBut(block, LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, + but = uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } ui_but_tip_from_enum_item(but, item); @@ -1199,7 +1199,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index int len, w, h, slider, toggle, expand, icon_only, no_bg; bool is_array; - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); /* retrieve info */ type = RNA_property_type(prop); @@ -1258,7 +1258,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index ui_item_rna_size(layout, name, icon, ptr, prop, index, icon_only, &w, &h); if (no_bg) - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* array property */ if (index == RNA_NO_INDEX && is_array) @@ -1266,11 +1266,11 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index /* enum item */ else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) { if (icon && name[0] && !icon_only) - uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); + uiDefIconTextButR_prop(block, UI_BTYPE_ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); else if (icon) - uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); + uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); else - uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); + uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); } /* expanded enum */ else if (type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG)) @@ -1281,29 +1281,29 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index ui_but_add_search(but, ptr, prop, NULL, NULL); if (layout->redalert) - uiButSetFlag(but, UI_BUT_REDALERT); + UI_but_flag_enable(but, UI_BUT_REDALERT); } /* single button */ else { but = uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h); - if (slider && but->type == NUM) - but->type = NUMSLI; + if (slider && but->type == UI_BTYPE_NUM) + but->type = UI_BTYPE_NUM_SLIDER; - if (toggle && but->type == OPTION) - but->type = TOG; + if (toggle && but->type == UI_BTYPE_CHECKBOX) + but->type = UI_BTYPE_TOGGLE; if (layout->redalert) - uiButSetFlag(but, UI_BUT_REDALERT); + UI_but_flag_enable(but, UI_BUT_REDALERT); } /* Mark non-embossed textfields inside a listbox. */ - if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->type == TEX) && (but->dt & UI_EMBOSSN)) { - uiButSetFlag(but, UI_BUT_LIST_ITEM); + if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->type == UI_BTYPE_TEXT) && (but->dt & UI_EMBOSS_NONE)) { + UI_but_flag_enable(but, UI_BUT_LIST_ITEM); } if (no_bg) - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); /* ensure text isn't added to icon_only buttons */ if (but && icon_only) { @@ -1512,7 +1512,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s /* add search items from temporary list */ for (cis = items_list->first; cis; cis = cis->next) { - if (false == uiSearchItemAdd(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) { + if (false == UI_search_item_add(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) { break; } } @@ -1564,7 +1564,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN /* turn button into search button */ if (searchprop) { - but->type = RNA_property_is_unlink(prop) ? SEARCH_MENU_UNLINK : SEARCH_MENU; + but->type = RNA_property_is_unlink(prop) ? UI_BTYPE_SEARCH_MENU_UNLINK : UI_BTYPE_SEARCH_MENU; but->hardmax = MAX2(but->hardmax, 256.0f); but->rnasearchpoin = *searchptr; but->rnasearchprop = searchprop; @@ -1576,7 +1576,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN but->str[0] = 0; } - uiButSetSearchFunc(but, rna_search_cb, but, NULL, NULL); + UI_but_func_search_set(but, rna_search_cb, but, NULL, NULL); } } @@ -1672,10 +1672,10 @@ static uiBut *ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuC uiBut *but; int w, h; - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); if (layout->root->type == UI_LAYOUT_HEADER) - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); if (!name) name = ""; @@ -1709,12 +1709,12 @@ static uiBut *ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuC } if (layout->root->type == UI_LAYOUT_HEADER) { - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR) || (force_menu && layout->root->type != UI_LAYOUT_MENU)) /* We never want a dropdown in menu! */ { - uiButSetMenuFromPulldown(but); + UI_but_type_set_menu_from_pulldown(but); } return but; @@ -1748,7 +1748,7 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon) uiBut *but; int w; - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); if (!name) name = ""; @@ -1758,11 +1758,11 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon) w = ui_text_icon_width(layout, name, icon, 0); if (icon && name[0]) - but = uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + but = uiDefIconTextBut(block, UI_BTYPE_LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); else if (icon) - but = uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); else - but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* to compensate for string size padding in ui_text_icon_width, * make text aligned right if the layout is aligned right. @@ -1791,7 +1791,7 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon) if (ptr && ptr->type) if (RNA_struct_is_ID(ptr->type)) - uiButSetDragID(but, ptr->id.data); + UI_but_drag_set_id(but, ptr->id.data); } @@ -1803,7 +1803,7 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) int *retvalue = (block->handle) ? &block->handle->retvalue : NULL; int w; - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); if (!name) name = ""; @@ -1813,11 +1813,11 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) w = ui_text_icon_width(layout, name, icon, 0); if (icon && name[0]) - uiDefIconTextButI(block, BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, ""); + uiDefIconTextButI(block, UI_BTYPE_BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, ""); else if (icon) - uiDefIconButI(block, BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, ""); + uiDefIconButI(block, UI_BTYPE_BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, ""); else - uiDefButI(block, BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, ""); + uiDefButI(block, UI_BTYPE_BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, ""); } /* separator item */ @@ -1827,8 +1827,8 @@ void uiItemS(uiLayout *layout) bool is_menu = ui_block_is_menu(block); int space = (is_menu) ? 0.45f * UI_UNIT_X : 0.3f * UI_UNIT_X; - uiBlockSetCurLayout(block, layout); - uiDefBut(block, (is_menu) ? SEPRLINE : SEPR, 0, "", 0, 0, space, space, NULL, 0.0, 0.0, 0, 0, ""); + UI_block_layout_set_current(block, layout); + uiDefBut(block, (is_menu) ? UI_BTYPE_SEPR_LINE : UI_BTYPE_SEPR, 0, "", 0, 0, space, space, NULL, 0.0, 0.0, 0, 0, ""); } /* level items */ @@ -1857,7 +1857,7 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo uiItemsEnumO(layout, lvl->opname, lvl->propname); /* override default, needed since this was assumed pre 2.70 */ - uiBlockSetDirection(layout->root->block, UI_DOWN); + UI_block_direction_set(layout->root->block, UI_DIR_DOWN); } void uiItemMenuEnumO(uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name, int icon) @@ -2129,7 +2129,7 @@ static RadialDirection ui_get_radialbut_vec(float vec[2], short itemnum) static bool ui_item_is_radial_displayable(uiItem *item) { - if ((item->type == ITEM_BUTTON) && (((uiButtonItem *)item)->but->type == LABEL)) + if ((item->type == ITEM_BUTTON) && (((uiButtonItem *)item)->but->type == UI_BTYPE_LABEL)) return false; return true; @@ -2138,7 +2138,7 @@ static bool ui_item_is_radial_displayable(uiItem *item) static bool ui_item_is_radial_drawable(uiButtonItem *bitem) { - if (ELEM(bitem->but->type, SEPR, SEPRLINE)) + if (ELEM(bitem->but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) return false; return true; @@ -2194,7 +2194,7 @@ static void ui_litem_layout_radial(uiLayout *litem) bitem->but->rect.xmax += 1.5f * UI_UNIT_X; /* enable drawing as pie item if supported by widget */ if (ui_item_is_radial_drawable(bitem)) - bitem->but->dt = UI_EMBOSSR; + bitem->but->dt = UI_EMBOSS_RADIAL; } ui_item_size(item, &itemw, &itemh); @@ -2587,7 +2587,7 @@ uiLayout *uiLayoutRow(uiLayout *layout, int align) litem->w = layout->w; BLI_addtail(&layout->items, litem); - uiBlockSetCurLayout(layout->root->block, litem); + UI_block_layout_set_current(layout->root->block, litem); return litem; } @@ -2608,7 +2608,7 @@ uiLayout *uiLayoutColumn(uiLayout *layout, int align) litem->w = layout->w; BLI_addtail(&layout->items, litem); - uiBlockSetCurLayout(layout->root->block, litem); + UI_block_layout_set_current(layout->root->block, litem); return litem; } @@ -2630,7 +2630,7 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align) flow->number = number; BLI_addtail(&layout->items, flow); - uiBlockSetCurLayout(layout->root->block, &flow->litem); + UI_block_layout_set_current(layout->root->block, &flow->litem); return &flow->litem; } @@ -2650,7 +2650,7 @@ static uiLayoutItemBx *ui_layout_box(uiLayout *layout, int type) box->litem.w = layout->w; BLI_addtail(&layout->items, box); - uiBlockSetCurLayout(layout->root->block, &box->litem); + UI_block_layout_set_current(layout->root->block, &box->litem); box->roundbox = uiDefBut(layout->root->block, type, 0, "", 0, 0, 0, 0, NULL, 0.0, 0.0, 0, 0, ""); @@ -2670,7 +2670,7 @@ uiLayout *uiLayoutRadial(uiLayout *layout) for (item = layout->root->layout->items.first; item; item = item->next) { litem = (uiLayout *)item; if (litem->item.type == ITEM_LAYOUT_RADIAL) { - uiBlockSetCurLayout(layout->root->block, litem); + UI_block_layout_set_current(layout->root->block, litem); return litem; } } @@ -2685,7 +2685,7 @@ uiLayout *uiLayoutRadial(uiLayout *layout) litem->w = layout->w; BLI_addtail(&layout->root->layout->items, litem); - uiBlockSetCurLayout(layout->root->block, litem); + UI_block_layout_set_current(layout->root->block, litem); return litem; } @@ -2693,7 +2693,7 @@ uiLayout *uiLayoutRadial(uiLayout *layout) uiLayout *uiLayoutBox(uiLayout *layout) { - return (uiLayout *)ui_layout_box(layout, ROUNDBOX); + return (uiLayout *)ui_layout_box(layout, UI_BTYPE_ROUNDBOX); } /* Check all buttons defined in this layout, and set any button flagged as UI_BUT_LIST_ITEM as active/selected. @@ -2707,7 +2707,7 @@ void ui_layout_list_set_labels_active(uiLayout *layout) ui_layout_list_set_labels_active((uiLayout *)(&bitem->item)); } else if (bitem->but->flag & UI_BUT_LIST_ITEM) { - uiButSetFlag(bitem->but, UI_SELECT); + UI_but_flag_enable(bitem->but, UI_SELECT); } } } @@ -2715,7 +2715,7 @@ void ui_layout_list_set_labels_active(uiLayout *layout) uiLayout *uiLayoutListBox(uiLayout *layout, uiList *ui_list, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *actptr, PropertyRNA *actprop) { - uiLayoutItemBx *box = ui_layout_box(layout, LISTBOX); + uiLayoutItemBx *box = ui_layout_box(layout, UI_BTYPE_LISTBOX); uiBut *but = box->roundbox; but->custom_data = ui_list; @@ -2747,7 +2747,7 @@ uiLayout *uiLayoutAbsolute(uiLayout *layout, int align) litem->redalert = layout->redalert; BLI_addtail(&layout->items, litem); - uiBlockSetCurLayout(layout->root->block, litem); + UI_block_layout_set_current(layout->root->block, litem); return litem; } @@ -2775,7 +2775,7 @@ uiLayout *uiLayoutOverlap(uiLayout *layout) litem->redalert = layout->redalert; BLI_addtail(&layout->items, litem); - uiBlockSetCurLayout(layout->root->block, litem); + UI_block_layout_set_current(layout->root->block, litem); return litem; } @@ -2797,7 +2797,7 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align) split->percentage = percentage; BLI_addtail(&layout->items, split); - uiBlockSetCurLayout(layout->root->block, &split->litem); + UI_block_layout_set_current(layout->root->block, &split->litem); return &split->litem; } @@ -3052,7 +3052,7 @@ static void ui_item_layout(uiItem *item) static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y) { if (layout->root->handlefunc) - uiBlockSetHandleFunc(block, layout->root->handlefunc, layout->root->argv); + UI_block_func_handle_set(block, layout->root->handlefunc, layout->root->argv); ui_item_estimate(&layout->item); ui_item_layout(&layout->item); @@ -3085,12 +3085,12 @@ static void ui_layout_add_padding_button(uiLayoutRoot *root) uiLayout *prev_layout = block->curlayout; block->curlayout = root->layout; - uiDefBut(block, SEPR, 0, "", 0, 0, root->padding, root->padding, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_SEPR, 0, "", 0, 0, root->padding, root->padding, NULL, 0.0, 0.0, 0, 0, ""); block->curlayout = prev_layout; } } -uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, uiStyle *style) +uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, uiStyle *style) { uiLayout *layout; uiLayoutRoot *root; @@ -3145,7 +3145,7 @@ int uiLayoutGetOperatorContext(uiLayout *layout) } -void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout) +void UI_block_layout_set_current(uiBlock *block, uiLayout *layout) { block->curlayout = layout; } @@ -3176,7 +3176,7 @@ void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv) layout->root->argv = argv; } -void uiBlockLayoutResolve(uiBlock *block, int *x, int *y) +void UI_block_layout_resolve(uiBlock *block, int *x, int *y) { uiLayoutRoot *root; @@ -3252,7 +3252,7 @@ static void ui_intro_items(DynStr *ds, ListBase *lb) /* could also use the INT but this is nicer*/ switch (item->type) { case ITEM_BUTTON: BLI_dynstr_append(ds, "'type':'BUTTON', "); break; - case ITEM_LAYOUT_ROW: BLI_dynstr_append(ds, "'type':'ROW', "); break; + case ITEM_LAYOUT_ROW: BLI_dynstr_append(ds, "'type':'UI_BTYPE_ROW', "); break; case ITEM_LAYOUT_COLUMN: BLI_dynstr_append(ds, "'type':'COLUMN', "); break; case ITEM_LAYOUT_COLUMN_FLOW: BLI_dynstr_append(ds, "'type':'COLUMN_FLOW', "); break; case ITEM_LAYOUT_ROW_FLOW: BLI_dynstr_append(ds, "'type':'ROW_FLOW', "); break; @@ -3328,7 +3328,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, /* poll() on this operator may still fail, at the moment there is no nice feedback when this happens * just fails silently */ if (!WM_operator_repeat_check(C, op)) { - uiBlockSetButLock(uiLayoutGetBlock(layout), true, "Operator can't' redo"); + UI_block_lock_set(uiLayoutGetBlock(layout), true, "Operator can't' redo"); /* XXX, could give some nicer feedback or not show redo panel at all? */ uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE); @@ -3388,9 +3388,9 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, col = uiLayoutColumn(layout, false); block = uiLayoutGetBlock(col); - but = uiDefIconTextBut(block, BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults")); - uiButSetFunc(but, ui_layout_operator_buts__reset_cb, op, NULL); + UI_but_func_set(but, ui_layout_operator_buts__reset_cb, op, NULL); } #endif @@ -3403,7 +3403,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, for (but = block->buttons.first; but; but = but->next) { /* no undo for buttons for operator redo panels */ - uiButClearFlag(but, UI_BUT_UNDO); + UI_but_flag_disable(but, UI_BUT_UNDO); /* only for popups, see [#36109] */ @@ -3411,8 +3411,8 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, * - this is used for allowing operators with popups to rename stuff with fewer clicks */ if (is_popup) { - if ((but->rnaprop == op->type->prop) && (but->type == TEX)) { - uiButSetFocusOnEnter(CTX_wm_window(C), but); + if ((but->rnaprop == op->type->prop) && (but->type == UI_BTYPE_TEXT)) { + UI_but_focus_on_enter_event(CTX_wm_window(C), but); } } } @@ -3420,7 +3420,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, } /* this is a bit of a hack but best keep it in one place at least */ -MenuType *uiButGetMenuType(uiBut *but) +MenuType *UI_but_menutype_get(uiBut *but) { if (but->menu_create_func == ui_item_menutype_func) { return (MenuType *)but->poin; |