From 5c6e3337801b493926210e96237be2b495fc5d1b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 9 Nov 2014 21:20:40 +0100 Subject: UI Refactor T41640 Make the UI API more consistent and reduce confusion with some naming. mainly: - API function calls - enum values some internal static functions have been left for now --- .../editors/animation/anim_channels_defines.c | 54 +- source/blender/editors/animation/anim_draw.c | 4 +- source/blender/editors/animation/anim_markers.c | 2 +- source/blender/editors/animation/drivers.c | 16 +- source/blender/editors/animation/fmodifier_ui.c | 82 +- source/blender/editors/animation/keyframing.c | 18 +- source/blender/editors/animation/keyingsets.c | 10 +- .../blender/editors/armature/armature_relations.c | 6 +- source/blender/editors/armature/pose_edit.c | 2 +- source/blender/editors/armature/pose_group.c | 6 +- source/blender/editors/armature/pose_lib.c | 6 +- source/blender/editors/curve/editcurve.c | 6 +- source/blender/editors/curve/editfont.c | 4 +- source/blender/editors/gpencil/gpencil_buttons.c | 36 +- source/blender/editors/include/UI_interface.h | 404 ++++----- source/blender/editors/interface/interface.c | 666 +++++++------- source/blender/editors/interface/interface_anim.c | 18 +- source/blender/editors/interface/interface_draw.c | 67 +- .../editors/interface/interface_eyedropper.c | 12 +- .../blender/editors/interface/interface_handlers.c | 952 ++++++++++----------- .../blender/editors/interface/interface_intern.h | 128 +-- .../blender/editors/interface/interface_layout.c | 228 ++--- source/blender/editors/interface/interface_ops.c | 32 +- source/blender/editors/interface/interface_panel.c | 44 +- .../blender/editors/interface/interface_regions.c | 522 +++++------ source/blender/editors/interface/interface_style.c | 32 +- .../editors/interface/interface_templates.c | 598 ++++++------- source/blender/editors/interface/interface_utils.c | 38 +- .../blender/editors/interface/interface_widgets.c | 222 ++--- source/blender/editors/interface/view2d.c | 6 +- source/blender/editors/interface/view2d_ops.c | 2 +- source/blender/editors/object/object_constraint.c | 6 +- source/blender/editors/object/object_relations.c | 14 +- source/blender/editors/object/object_select.c | 6 +- source/blender/editors/render/render_preview.c | 2 +- source/blender/editors/render/render_shading.c | 6 +- source/blender/editors/screen/area.c | 96 ++- source/blender/editors/screen/screen_context.c | 2 +- source/blender/editors/screen/screen_edit.c | 4 +- source/blender/editors/screen/screen_ops.c | 18 +- source/blender/editors/sculpt_paint/sculpt.c | 6 +- source/blender/editors/sound/sound_ops.c | 2 +- source/blender/editors/space_action/action_draw.c | 6 +- source/blender/editors/space_action/action_edit.c | 2 +- source/blender/editors/space_api/spacetypes.c | 2 +- .../editors/space_buttons/buttons_context.c | 8 +- source/blender/editors/space_buttons/buttons_ops.c | 8 +- .../editors/space_buttons/buttons_texture.c | 12 +- source/blender/editors/space_clip/clip_buttons.c | 50 +- .../editors/space_clip/clip_dopesheet_draw.c | 14 +- source/blender/editors/space_clip/clip_ops.c | 2 +- source/blender/editors/space_clip/clip_toolbar.c | 2 +- source/blender/editors/space_file/file_draw.c | 92 +- source/blender/editors/space_file/file_panels.c | 16 +- source/blender/editors/space_file/filesel.c | 24 +- source/blender/editors/space_graph/graph_buttons.c | 68 +- source/blender/editors/space_graph/graph_draw.c | 6 +- source/blender/editors/space_image/image_buttons.c | 70 +- source/blender/editors/space_image/image_ops.c | 14 +- source/blender/editors/space_info/info_ops.c | 12 +- source/blender/editors/space_logic/logic_buttons.c | 4 +- source/blender/editors/space_logic/logic_window.c | 126 +-- source/blender/editors/space_nla/nla_buttons.c | 14 +- source/blender/editors/space_nla/nla_draw.c | 12 +- source/blender/editors/space_nla/nla_edit.c | 6 +- source/blender/editors/space_node/drawnode.c | 34 +- source/blender/editors/space_node/node_add.c | 2 +- source/blender/editors/space_node/node_draw.c | 147 ++-- source/blender/editors/space_node/node_group.c | 6 +- source/blender/editors/space_node/node_select.c | 16 +- source/blender/editors/space_node/node_templates.c | 30 +- .../blender/editors/space_outliner/outliner_draw.c | 170 ++-- .../blender/editors/space_outliner/outliner_edit.c | 6 +- .../editors/space_sequencer/sequencer_add.c | 2 +- .../editors/space_sequencer/sequencer_draw.c | 6 +- source/blender/editors/space_text/text_draw.c | 8 +- source/blender/editors/space_text/text_header.c | 24 +- source/blender/editors/space_text/text_ops.c | 22 +- .../blender/editors/space_view3d/view3d_buttons.c | 92 +- source/blender/editors/space_view3d/view3d_draw.c | 6 +- .../blender/editors/space_view3d/view3d_header.c | 12 +- source/blender/editors/space_view3d/view3d_ruler.c | 13 +- .../blender/editors/space_view3d/view3d_select.c | 2 +- .../blender/editors/space_view3d/view3d_toolbar.c | 18 +- source/blender/editors/transform/transform_ops.c | 6 +- source/blender/editors/util/ed_util.c | 6 +- source/blender/editors/util/numinput.c | 2 +- source/blender/editors/util/undo.c | 6 +- source/blender/editors/uvedit/uvedit_buttons.c | 10 +- source/blender/makesrna/intern/rna_wm.c | 4 +- source/blender/makesrna/intern/rna_wm_api.c | 12 +- source/blender/windowmanager/intern/wm_dragdrop.c | 14 +- .../blender/windowmanager/intern/wm_event_system.c | 10 +- source/blender/windowmanager/intern/wm_operators.c | 146 ++-- 94 files changed, 2913 insertions(+), 2874 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 7d8e278f0cf..f384b2f372c 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -120,8 +120,8 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa glColor3fv(color); /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ - uiSetRoundBox((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); - uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); + UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); + UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); } @@ -420,8 +420,8 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi * - top and bottom * - special hack: make the top a bit higher, since we are first... */ - uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); - uiDrawBox(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); + UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); + UI_draw_roundbox_gl_mode(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); } /* name for summary entries */ @@ -800,8 +800,8 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc glColor3fv(color); /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ - uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); - uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); + UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); + UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8); } /* name for group entries */ @@ -3010,12 +3010,12 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float y /* only on top left corner, to show that this channel sits on top of the preceding ones * while still linking into the action line strip to the right */ - uiSetRoundBox(UI_CNR_TOP_LEFT); + UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT); /* draw slightly shifted up vertically to look like it has more separation from other channels, * but we then need to slightly shorten it so that it doesn't look like it overlaps */ - uiDrawBox(GL_POLYGON, offset, yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8); + UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8); } /* name for nla action entries */ @@ -3449,7 +3449,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float acf->name(ale, name); offset += 3; - UI_DrawString(offset, ytext, name); + UI_draw_string(offset, ytext, name); /* draw red underline if channel is disabled */ if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) { @@ -3788,9 +3788,9 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann /* type of button */ if (negflag) - butType = ICONTOGN; + butType = UI_BTYPE_ICON_TOGGLE_N; else - butType = ICONTOG; + butType = UI_BTYPE_ICON_TOGGLE; /* draw button for setting */ if (ptr && flag) { @@ -3819,18 +3819,18 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann case ACHANNEL_SETTING_PROTECT: /* General - protection flags */ case ACHANNEL_SETTING_MUTE: /* General - muting flags */ case ACHANNEL_SETTING_PINNED: /* NLA Actions - 'map/nomap' */ - uiButSetNFunc(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), SET_INT_IN_POINTER(setting)); + UI_but_funcN_set(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), SET_INT_IN_POINTER(setting)); break; /* settings needing special attention */ case ACHANNEL_SETTING_SOLO: /* NLA Tracks - Solo toggle */ - uiButSetFunc(but, achannel_nlatrack_solo_widget_cb, ale->adt, ale->data); + UI_but_func_set(but, achannel_nlatrack_solo_widget_cb, ale->adt, ale->data); break; /* no flushing */ case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush, otherwise all would open/close at once */ default: - uiButSetFunc(but, achannel_setting_widget_cb, NULL, NULL); + UI_but_func_set(but, achannel_setting_widget_cb, NULL, NULL); break; } } @@ -3861,7 +3861,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale ymid = y - 0.5f * ICON_WIDTH; /* no button backdrop behind icons */ - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* step 1) draw expand widget ....................................... */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) { @@ -3908,14 +3908,14 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale if (acf->name_prop(ale, &ptr, &prop)) { uiBut *but; - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); - but = uiDefButR(block, TEX, 1, "", offset + 3, yminc, RENAME_TEXT_WIDTH, channel_height, + but = uiDefButR(block, UI_BTYPE_TEXT, 1, "", offset + 3, yminc, RENAME_TEXT_WIDTH, channel_height, &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL); - uiButSetFunc(but, achannel_setting_rename_done_cb, ac->ads, NULL); - uiButActiveOnly(C, ac->ar, block, but); + UI_but_func_set(but, achannel_setting_rename_done_cb, ac->ads, NULL); + UI_but_active_only(C, ac->ar, block, but); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); } } } @@ -3972,16 +3972,16 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale uiBut *but; PointerRNA *opptr_b; - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); offset += UI_UNIT_X; - but = uiDefIconButO(block, BUT, "NLA_OT_action_pushdown", WM_OP_INVOKE_DEFAULT, ICON_NLA_PUSHDOWN, + but = uiDefIconButO(block, UI_BTYPE_BUT, "NLA_OT_action_pushdown", WM_OP_INVOKE_DEFAULT, ICON_NLA_PUSHDOWN, (int)v2d->cur.xmax - offset, ymid, UI_UNIT_X, UI_UNIT_X, NULL); - opptr_b = uiButGetOperatorPtrRNA(but); + opptr_b = UI_but_operator_ptr_get(but); RNA_int_set(opptr_b, "channel_index", channel_index); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); } } @@ -3999,7 +3999,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale offset += SLIDER_WIDTH; /* need backdrop behind sliders... */ - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); if (ale->id) { /* Slider using RNA Access -------------------- */ PointerRNA id_ptr, ptr; @@ -4037,9 +4037,9 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale /* assign keyframing function according to slider type */ if (ale->type == ANIMTYPE_SHAPEKEY) - uiButSetFunc(but, achannel_setting_slider_shapekey_cb, ale->id, ale->data); + UI_but_func_set(but, achannel_setting_slider_shapekey_cb, ale->id, ale->data); else - uiButSetFunc(but, achannel_setting_slider_cb, ale->id, ale->data); + UI_but_func_set(but, achannel_setting_slider_cb, ale->id, ale->data); } /* free the path if necessary */ diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 9c3f310a417..9cfe30754c4 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -79,7 +79,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const else { BLI_timecode_string_from_time_simple(&numstr[4], sizeof(numstr) - 4, 1, cfra); } - slen = (short)UI_GetStringWidth(numstr) - 1; + slen = (short)UI_fontstyle_string_width(numstr) - 1; /* get starting coordinates for drawing */ x = cfra * xscale; @@ -91,7 +91,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const /* draw current frame number - black text */ UI_ThemeColor(TH_TEXT); - UI_DrawString(x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr); + UI_draw_string(x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr); /* restore view transform */ glScalef(xscale, 1.0, 1.0); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index acf8bdc6768..b6c7a4aa5a0 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -399,7 +399,7 @@ static void draw_marker( } #endif - UI_DrawString(x, y, marker->name); + UI_draw_string(x, y, marker->name); } } diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 296a52e7f20..7bdc49da54e 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -437,7 +437,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to create driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (all) index = -1; @@ -455,7 +455,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX } @@ -492,7 +492,7 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to find driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (all) index = -1; @@ -506,7 +506,7 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX } @@ -542,7 +542,7 @@ static int copy_driver_button_exec(bContext *C, wmOperator *op) int index; /* try to create driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); @@ -551,7 +551,7 @@ static int copy_driver_button_exec(bContext *C, wmOperator *op) /* only copy the driver for the button that this was involved for */ success = ANIM_copy_driver(op->reports, ptr.id.data, path, index, 0); - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); MEM_freeN(path); } @@ -586,7 +586,7 @@ static int paste_driver_button_exec(bContext *C, wmOperator *op) int index; /* try to create driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); @@ -595,7 +595,7 @@ static int paste_driver_button_exec(bContext *C, wmOperator *op) /* only copy the driver for the button that this was involved for */ success = ANIM_paste_driver(op->reports, ptr.id.data, path, index, 0); - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); MEM_freeN(path); } diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 7ce33e01747..8ede1a0ad76 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -119,12 +119,12 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s /* basic settings (backdrop + mode selector + some padding) */ /* col = uiLayoutColumn(layout, true); */ /* UNUSED */ block = uiLayoutGetBlock(layout); - uiBlockBeginAlign(block); - but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL); - uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL); + UI_block_align_begin(block); + but = uiDefButR(block, UI_BTYPE_MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL); + UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL); - uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL); - uiBlockEndAlign(block); + uiDefButR(block, UI_BTYPE_TOGGLE, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL); + UI_block_align_end(block); /* now add settings for individual modes */ switch (data->mode) { @@ -138,20 +138,20 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s /* draw polynomial order selector */ row = uiLayoutRow(layout, false); block = uiLayoutGetBlock(row); - but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0.5f * UI_UNIT_X, 0, bwidth, UI_UNIT_Y, + but = uiDefButI(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0.5f * UI_UNIT_X, 0, bwidth, UI_UNIT_Y, &data->poly_order, 1, 100, 0, 0, TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)")); - uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL); + UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL); /* calculate maximum width of label for "x^n" labels */ if (data->arraysize > 2) { BLI_snprintf(xval, sizeof(xval), "x^%u", data->arraysize); - maxXWidth = UI_GetStringWidth(xval) + 0.5 * UI_UNIT_X; /* XXX: UI_GetStringWidth is not accurate */ + maxXWidth = UI_fontstyle_string_width(xval) + 0.5 * UI_UNIT_X; /* XXX: UI_fontstyle_string_width is not accurate */ } else { /* basic size (just "x") */ - maxXWidth = UI_GetStringWidth("x") + 0.5 * UI_UNIT_X; + maxXWidth = UI_fontstyle_string_width("x") + 0.5 * UI_UNIT_X; } /* draw controls for each coefficient and a + sign at end of row */ @@ -162,12 +162,12 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s for (i = 0; (i < data->arraysize) && (cp); i++, cp++) { /* To align with first line... */ if (i) - uiDefBut(block, LABEL, 1, " ", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, " ", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); else - uiDefBut(block, LABEL, 1, "y =", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, "y =", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* coefficient */ - uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, bwidth / 2, UI_UNIT_Y, cp, -UI_FLT_MAX, UI_FLT_MAX, + uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, "", 0, 0, bwidth / 2, UI_UNIT_Y, cp, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, TIP_("Coefficient for polynomial")); /* 'x' param (and '+' if necessary) */ @@ -177,10 +177,10 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s BLI_strncpy(xval, "x", sizeof(xval)); else BLI_snprintf(xval, sizeof(xval), "x^%u", i); - uiDefBut(block, LABEL, 1, xval, 0, 0, maxXWidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x")); + uiDefBut(block, UI_BTYPE_LABEL, 1, xval, 0, 0, maxXWidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x")); if ( (i != (data->arraysize - 1)) || ((i == 0) && data->arraysize == 2) ) { - uiDefBut(block, LABEL, 1, "+", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, "+", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* next coefficient on a new row */ row = uiLayoutRow(layout, true); @@ -188,7 +188,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s } else { /* For alignment in UI! */ - uiDefBut(block, LABEL, 1, " ", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, " ", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } } break; @@ -202,10 +202,10 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s /* draw polynomial order selector */ row = uiLayoutRow(layout, false); block = uiLayoutGetBlock(row); - but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width - 1.5 * UI_UNIT_X, UI_UNIT_Y, + but = uiDefButI(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width - 1.5 * UI_UNIT_X, UI_UNIT_Y, &data->poly_order, 1, 100, 0, 0, TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)")); - uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL); + UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL); /* draw controls for each pair of coefficients */ @@ -216,31 +216,31 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) { /* To align with first line */ if (i) - uiDefBut(block, LABEL, 1, " ", 0, 0, 2.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, " ", 0, 0, 2.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); else - uiDefBut(block, LABEL, 1, "y =", 0, 0, 2.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, "y =", 0, 0, 2.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* opening bracket */ - uiDefBut(block, LABEL, 1, "(", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, "(", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* coefficients */ - uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, cp, -UI_FLT_MAX, UI_FLT_MAX, + uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, "", 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, cp, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, TIP_("Coefficient of x")); - uiDefBut(block, LABEL, 1, "x +", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, "x +", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); - uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, cp + 1, -UI_FLT_MAX, UI_FLT_MAX, + uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, "", 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, cp + 1, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, TIP_("Second coefficient")); /* closing bracket and multiplication sign */ if ( (i != (data->poly_order - 1)) || ((i == 0) && data->poly_order == 2) ) { - uiDefBut(block, LABEL, 1, ") \xc3\x97", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, ") \xc3\x97", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* set up new row for the next pair of coefficients */ row = uiLayoutRow(layout, true); block = uiLayoutGetBlock(row); } else - uiDefBut(block, LABEL, 1, ") ", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, ") ", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } break; } @@ -439,11 +439,11 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh row = uiLayoutRow(layout, false); block = uiLayoutGetBlock(row); - uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 1, IFACE_("Control Points:"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); - but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, + but = uiDefBut(block, UI_BTYPE_BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame")); - uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL); + UI_but_func_set(but, fmod_envelope_addpoint_cb, env, NULL); /* control points list */ for (i = 0, fed = env->data; i < env->totvert; i++, fed++) { @@ -451,20 +451,20 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh row = uiLayoutRow(layout, true); block = uiLayoutGetBlock(row); - uiBlockBeginAlign(block); - but = uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 4.5 * UI_UNIT_X, UI_UNIT_Y, + UI_block_align_begin(block); + but = uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 4.5 * UI_UNIT_X, UI_UNIT_Y, &fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs")); - uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL); + UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL); - uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, + uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, &fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point")); - uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, + uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, &fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point")); - but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 0.9 * UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 0.9 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point")); - uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i)); - uiBlockBeginAlign(block); + UI_but_func_set(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i)); + UI_block_align_begin(block); } } @@ -575,7 +575,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier sub = uiLayoutRow(row, true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* expand */ uiItemR(sub, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); @@ -597,14 +597,14 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier /* 'mute' button */ uiItemR(sub, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* delete button */ - but = uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier")); - uiButSetFunc(but, delete_fmodifier_cb, modifiers, fcm); + UI_but_func_set(but, delete_fmodifier_cb, modifiers, fcm); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } /* when modifier is expanded, draw settings */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index c2fabfadc35..9a9c987be14 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1402,10 +1402,10 @@ static int insert_key_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UN uiLayout *layout; /* call the menu, which will call this operator again, hence the canceled */ - pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemsEnumO(layout, "ANIM_OT_keyframe_insert_menu", "type"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -1704,7 +1704,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) flag = ANIM_get_keyframing_flags(scene, 1); /* try to insert keyframe using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -1751,7 +1751,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL); @@ -1792,7 +1792,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -1822,7 +1822,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); @@ -1862,7 +1862,7 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -1892,7 +1892,7 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) if (success) { /* send updates */ - uiContextAnimUpdate(C); + UI_context_update_anim_flag(C); /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 8386eadf962..027c669a01d 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -327,7 +327,7 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) } /* try to add to keyingset using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); /* check if property is able to be added */ if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { @@ -413,7 +413,7 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) } /* try to add to keyingset using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -472,10 +472,10 @@ static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, const wmEve uiLayout *layout; /* call the menu, which will call this operator again, hence the canceled */ - pup = uiPupMenuBegin(C, op->type->name, ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemsEnumO(layout, "ANIM_OT_keying_set_active_set", "type"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 22187682265..3e226c39c8c 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -673,8 +673,8 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { EditBone *actbone = CTX_data_active_bone(C); - uiPopupMenu *pup = uiPupMenuBegin(C, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Make Parent"), ICON_NONE); - uiLayout *layout = uiPupMenuLayout(pup); + uiPopupMenu *pup = UI_popup_menu_begin(C, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Make Parent"), ICON_NONE); + uiLayout *layout = UI_popup_menu_layout(pup); int allchildbones = 0; CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) @@ -691,7 +691,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const if (allchildbones) uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_OFFSET); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 42fd8e3dee1..193ba6397fb 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -503,7 +503,7 @@ static void pose_copy_menu(Scene *scene) /* build the puplist of constraints */ for (con = pchanact->constraints.first, i = 0; con; con = con->next, i++) { const_toggle[i] = 1; -// add_numbut(i, TOG|INT, con->name, 0, 0, &(const_toggle[i]), ""); +// add_numbut(i, UI_BTYPE_TOGGLE|INT, con->name, 0, 0, &(const_toggle[i]), ""); } // if (!do_clever_numbuts("Select Constraints", i, REDRAW)) { diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 4667e09360f..2b605443beb 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -144,8 +144,8 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U /* if there's no active group (or active is invalid), create a new menu to find it */ if (pose->active_group <= 0) { /* create a new menu, and start populating it with group names */ - pup = uiPupMenuBegin(C, op->type->name, ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE); + layout = UI_popup_menu_layout(pup); /* special entry - allow to create new group, then use that * (not to be used for removing though) @@ -160,7 +160,7 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U uiItemIntO(layout, grp->name, ICON_NONE, op->idname, "type", i); /* finish building the menu, and process it (should result in calling self again) */ - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 8bb1c586526..b8373b00368 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -404,8 +404,8 @@ static int poselib_add_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U return OPERATOR_CANCELLED; /* start building */ - pup = uiPupMenuBegin(C, op->type->name, ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE); + layout = UI_popup_menu_layout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); /* add new (adds to the first unoccupied frame) */ @@ -420,7 +420,7 @@ static int poselib_add_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U uiItemMenuF(layout, IFACE_("Replace Existing..."), 0, poselib_add_menu_invoke__replacemenu, NULL); } - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); /* this operator is only for a menu, not used further */ return OPERATOR_INTERFACE; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9c4ee4e09be..f11552d91af 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5382,10 +5382,10 @@ static int toggle_cyclic_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS for (nu = editnurb->first; nu; nu = nu->next) { if (nu->pntsu > 1 || nu->pntsv > 1) { if (nu->type == CU_NURBS) { - pup = uiPupMenuBegin(C, IFACE_("Direction"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Direction"), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemsEnumO(layout, op->type->idname, "direction"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } } diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 4655deec4c4..31c67fbca52 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1744,7 +1744,7 @@ static void font_ui_template_init(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"); - uiIDContextProperty(C, &pprop->ptr, &pprop->prop); + UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop); } static void font_open_cancel(bContext *UNUSED(C), wmOperator *op) @@ -1848,7 +1848,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op) PointerRNA idptr; PropertyPointerRNA pprop; - uiIDContextProperty(C, &pprop.ptr, &pprop.prop); + UI_context_active_but_prop_get_templateID(C, &pprop.ptr, &pprop.prop); if (pprop.prop == NULL) { BKE_report(op->reports, RPT_ERROR, "Incorrect context for running font unlink"); diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index 0acff8fc0a5..a7635c12d56 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -127,7 +127,7 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons /* unless button has own callback, it adds this callback to button */ block = uiLayoutGetBlock(layout); - uiBlockSetFunc(block, gp_ui_activelayer_cb, gpd, gpl); + UI_block_func_set(block, gp_ui_activelayer_cb, gpd, gpl); /* draw header ---------------------------------- */ /* get layout-row + UI-block for header */ @@ -137,7 +137,7 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND); block = uiLayoutGetBlock(row); /* err... */ - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* left-align ............................... */ sub = uiLayoutRow(row, false); @@ -145,9 +145,9 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons /* active */ block = uiLayoutGetBlock(sub); icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; - but = uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, &gpl->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer")); - uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl); + UI_but_func_set(but, gp_ui_activelayer_cb, gpd, gpl); /* locked */ icon = (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED; @@ -175,11 +175,11 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); block = uiLayoutGetBlock(sub); /* XXX... err... */ - but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); - uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); + UI_but_func_set(but, gp_ui_dellayer_cb, gpd, gpl); } - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } else { /* draw rest of header -------------------------------- */ @@ -191,38 +191,38 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons icon = (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION; uiItemR(sub, &ptr, "lock_frame", 0, "", icon); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); /* name */ uiItemR(sub, &ptr, "info", 0, "", ICON_NONE); /* move up/down */ - uiBlockBeginAlign(block); + UI_block_align_begin(block); if (gpl->prev) { - but = uiDefIconBut(block, BUT, 0, ICON_TRIA_UP, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_TRIA_UP, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Move layer up")); - uiButSetFunc(but, gp_ui_layer_up_cb, gpd, gpl); + UI_but_func_set(but, gp_ui_layer_up_cb, gpd, gpl); } if (gpl->next) { - but = uiDefIconBut(block, BUT, 0, ICON_TRIA_DOWN, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_TRIA_DOWN, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Move layer down")); - uiButSetFunc(but, gp_ui_layer_down_cb, gpd, gpl); + UI_but_func_set(but, gp_ui_layer_down_cb, gpd, gpl); } - uiBlockEndAlign(block); + UI_block_align_end(block); /* delete 'button' */ - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* right-align ............................... */ sub = uiLayoutRow(row, true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); block = uiLayoutGetBlock(sub); /* XXX... err... */ - but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); - uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_but_func_set(but, gp_ui_dellayer_cb, gpd, gpl); + UI_block_emboss_set(block, UI_EMBOSS); /* new backdrop ----------------------------------- */ box = uiLayoutBox(layout); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index e8cca243a93..9ba769bcfa0 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -98,19 +98,24 @@ typedef struct uiLayout uiLayout; #define UI_SCREEN_MARGIN 10 /* uiBlock->dt and uiBut->dt */ -#define UI_EMBOSS 0 /* use widget style for drawing */ -#define UI_EMBOSSN 1 /* Nothing, only icon and/or text */ -#define UI_EMBOSSP 2 /* Pulldown menu style */ -#define UI_EMBOSST 3 /* Table */ -#define UI_EMBOSSR 4 /* Pie Menu */ +enum { + UI_EMBOSS = 0, /* use widget style for drawing */ + UI_EMBOSS_NONE = 1, /* Nothing, only icon and/or text */ + UI_EMBOSS_PULLDOWN = 2, /* Pulldown menu style */ + UI_EMBOSS_TABLE = 3, /* Table */ + UI_EMBOSS_RADIAL = 4, /* Pie Menu */ +}; /* uiBlock->direction */ -#define UI_DIRECTION (UI_TOP | UI_DOWN | UI_LEFT | UI_RIGHT) -#define UI_TOP (1 << 0) -#define UI_DOWN (1 << 1) -#define UI_LEFT (1 << 2) -#define UI_RIGHT (1 << 3) -#define UI_CENTER (1 << 4) +enum { + UI_DIR_UP = (1 << 0), + UI_DIR_DOWN = (1 << 1), + UI_DIR_LEFT = (1 << 2), + UI_DIR_RIGHT = (1 << 3), + UI_DIR_CENTER_Y = (1 << 4), + + UI_DIR_ALL = (UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT), +}; #if 0 /* uiBlock->autofill (not yet used) */ @@ -155,8 +160,8 @@ typedef struct uiLayout uiLayout; /* but->flag - general state flags. */ enum { /* warning, the first 6 flags are internal */ - UI_ICON_SUBMENU = (1 << 6), - UI_ICON_PREVIEW = (1 << 7), + UI_BUT_ICON_SUBMENU = (1 << 6), + UI_BUT_ICON_PREVIEW = (1 << 7), UI_BUT_NODE_LINK = (1 << 8), UI_BUT_NODE_ACTIVE = (1 << 9), @@ -233,56 +238,56 @@ typedef enum { /* assigned to but->type, OR'd with the flags above when passing args */ typedef enum { - BUT = (1 << 9), - ROW = (2 << 9), - TOG = (3 << 9), - NUM = (5 << 9), - TEX = (6 << 9), - TOGN = (9 << 9), - LABEL = (10 << 9), - MENU = (11 << 9), /* Dropdown list, actually! */ - ICONTOG = (13 << 9), - NUMSLI = (14 << 9), - COLOR = (15 << 9), - SCROLL = (18 << 9), - BLOCK = (19 << 9), - BUTM = (20 << 9), - SEPR = (21 << 9), - LINK = (22 << 9), - INLINK = (23 << 9), - KEYEVT = (24 << 9), - HSVCUBE = (26 << 9), - PULLDOWN = (27 << 9), /* Menu, actually! */ - ROUNDBOX = (28 << 9), - BUT_COLORBAND = (30 << 9), - BUT_NORMAL = (31 << 9), - BUT_CURVE = (32 << 9), - ICONTOGN = (34 << 9), - LISTBOX = (35 << 9), - LISTROW = (36 << 9), - TOGBUT = (37 << 9), - OPTION = (38 << 9), - OPTIONN = (39 << 9), - TRACKPREVIEW = (40 << 9), - /* buttons with value >= SEARCH_MENU don't get undo pushes */ - SEARCH_MENU = (41 << 9), - BUT_EXTRA = (42 << 9), - HSVCIRCLE = (43 << 9), - HOTKEYEVT = (46 << 9), - BUT_IMAGE = (47 << 9), - HISTOGRAM = (48 << 9), - WAVEFORM = (49 << 9), - VECTORSCOPE = (50 << 9), - PROGRESSBAR = (51 << 9), - SEARCH_MENU_UNLINK = (52 << 9), - NODESOCKET = (53 << 9), - SEPRLINE = (54 << 9), - GRIP = (55 << 9), + UI_BTYPE_BUT = (1 << 9), + UI_BTYPE_ROW = (2 << 9), + UI_BTYPE_TOGGLE = (3 << 9), + UI_BTYPE_NUM = (5 << 9), + UI_BTYPE_TEXT = (6 << 9), + UI_BTYPE_TOGGLE_N = (9 << 9), + UI_BTYPE_LABEL = (10 << 9), + UI_BTYPE_MENU = (11 << 9), /* Dropdown list, actually! */ + UI_BTYPE_ICON_TOGGLE = (13 << 9), + UI_BTYPE_NUM_SLIDER = (14 << 9), + UI_BTYPE_COLOR = (15 << 9), + UI_BTYPE_SCROLL = (18 << 9), + UI_BTYPE_BLOCK = (19 << 9), + UI_BTYPE_BUT_MENU = (20 << 9), + UI_BTYPE_SEPR = (21 << 9), + UI_BTYPE_LINK = (22 << 9), + UI_BTYPE_INLINK = (23 << 9), + UI_BTYPE_KEY_EVENT = (24 << 9), + UI_BTYPE_HSVCUBE = (26 << 9), + UI_BTYPE_PULLDOWN = (27 << 9), /* Menu, actually! */ + UI_BTYPE_ROUNDBOX = (28 << 9), + UI_BTYPE_COLORBAND = (30 << 9), + UI_BTYPE_UNITVEC = (31 << 9), + UI_BTYPE_CURVE = (32 << 9), + UI_BTYPE_ICON_TOGGLE_N = (34 << 9), + UI_BTYPE_LISTBOX = (35 << 9), + UI_BTYPE_LISTROW = (36 << 9), + UI_BTYPE_BUT_TOGGLE = (37 << 9), + UI_BTYPE_CHECKBOX = (38 << 9), + UI_BTYPE_CHECKBOX_N = (39 << 9), + UI_BTYPE_TRACK_PREVIEW = (40 << 9), + /* buttons with value >= UI_BTYPE_SEARCH_MENU don't get undo pushes */ + UI_BTYPE_SEARCH_MENU = (41 << 9), + UI_BTYPE_EXTRA = (42 << 9), + UI_BTYPE_HSVCIRCLE = (43 << 9), + UI_BTYPE_HOTKEY_EVENT = (46 << 9), + UI_BTYPE_IMAGE = (47 << 9), + UI_BTYPE_HISTOGRAM = (48 << 9), + UI_BTYPE_WAVEFORM = (49 << 9), + UI_BTYPE_VECTORSCOPE = (50 << 9), + UI_BTYPE_PROGRESS_BAR = (51 << 9), + UI_BTYPE_SEARCH_MENU_UNLINK = (52 << 9), + UI_BTYPE_NODE_SOCKET = (53 << 9), + UI_BTYPE_SEPR_LINE = (54 << 9), + UI_BTYPE_GRIP = (55 << 9), } eButType; #define BUTTYPE (63 << 9) -/* gradient types, for color picker HSVCUBE etc */ +/* gradient types, for color picker UI_BTYPE_HSVCUBE etc */ #define UI_GRAD_SV 0 #define UI_GRAD_HV 1 #define UI_GRAD_HS 2 @@ -300,35 +305,35 @@ typedef enum { * Functions to draw various shapes, taking theme settings into account. * Used for code that draws its own UI style elements. */ -void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad); -void uiSetRoundBox(int type); -int uiGetRoundBox(void); -void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad); -void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy); -void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float rad); -void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown); -void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight); +void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad); +void UI_draw_roundbox_corner_set(int type); +int UI_draw_roundbox_corner_get(void); +void UI_draw_roundbox_unfilled(float minx, float miny, float maxx, float maxy, float rad); +void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy); +void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, float maxy, float rad); +void UI_draw_roundbox_shade_x(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown); +void UI_draw_roundbox_shade_y(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight); /* state for scrolldrawing */ #define UI_SCROLL_PRESSED (1 << 0) #define UI_SCROLL_ARROWS (1 << 1) #define UI_SCROLL_NO_OUTLINE (1 << 2) -void uiWidgetScrollDraw(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state); +void UI_draw_widget_scroll(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state); /* Callbacks * - * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback. + * UI_block_func_handle_set/ButmFunc are for handling events through a callback. * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is * mostly for compatibility with older code. * - * uiButSetCompleteFunc is for tab completion. + * UI_but_func_complete_set is for tab completion. * * uiButSearchFunc is for name buttons, showing a popup with matches * - * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used, + * UI_block_func_set and UI_but_func_set are callbacks run when a button is used, * in case events, operators or RNA are not sufficient to handle the button. * - * uiButSetNFunc will free the argument with MEM_freeN. */ + * UI_but_funcN_set will free the argument with MEM_freeN. */ typedef struct uiSearchItems uiSearchItems; @@ -347,30 +352,35 @@ typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event); /* Popup Menus * * Functions used to create popup menus. For more extended menus the - * uiPupMenuBegin/End functions can be used to define own items with + * UI_popup_menu_begin/End functions can be used to define own items with * the uiItem functions in between. If it is a simple confirmation menu * or similar, popups can be created with a single function call. */ typedef struct uiPopupMenu uiPopupMenu; -struct uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int icon) ATTR_NONNULL(); -void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu *head); -struct uiLayout *uiPupMenuLayout(uiPopupMenu *head); +struct uiPopupMenu *UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL(); +void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *head); +struct uiLayout *UI_popup_menu_layout(uiPopupMenu *head); -void uiPupMenuReports(struct bContext *C, struct ReportList *reports) ATTR_NONNULL(); -int uiPupMenuInvoke(struct bContext *C, const char *idname, struct ReportList *reports) ATTR_NONNULL(1, 2); +void UI_popup_menu_reports(struct bContext *C, struct ReportList *reports) ATTR_NONNULL(); +int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) ATTR_NONNULL(1, 2); /* Pie menus */ typedef struct uiPieMenu uiPieMenu; -int uiPieMenuInvoke(struct bContext *C, const char *idname, const struct wmEvent *event); -int uiPieOperatorEnumInvoke(struct bContext *C, const char *title, const char *opname, - const char *propname, const struct wmEvent *event); -int uiPieEnumInvoke(struct bContext *C, const char *title, const char *path, const struct wmEvent *event); - -struct uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const struct wmEvent *event) ATTR_NONNULL(); -void uiPieMenuEnd(struct bContext *C, uiPieMenu *pie); -struct uiLayout *uiPieMenuLayout(struct uiPieMenu *pie); +int UI_pie_menu_invoke(struct bContext *C, const char *idname, const struct wmEvent *event); +int UI_pie_menu_invoke_from_operator_enum( + struct bContext *C, const char *title, const char *opname, + const char *propname, const struct wmEvent *event); +int UI_pie_menu_invoke_from_rna_enum( + struct bContext *C, const char *title, + const char *path, const struct wmEvent *event); + +struct uiPieMenu *UI_pie_menu_begin( + struct bContext *C, const char *title, int icon, + const struct wmEvent *event) ATTR_NONNULL(); +void UI_pie_menu_end(struct bContext *C, uiPieMenu *pie); +struct uiLayout *UI_pie_menu_layout(struct uiPieMenu *pie); /* Popup Blocks * * Functions used to create popup blocks. These are like popup menus @@ -379,12 +389,12 @@ struct uiLayout *uiPieMenuLayout(struct uiPieMenu *pie); typedef uiBlock * (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1); typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1); -void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg); -void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); -void uiPupBlockEx(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg); +void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg); +void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); +void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg); /* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */ -void uiPupBlockClose(struct bContext *C, uiBlock *block); +void UI_popup_block_close(struct bContext *C, uiBlock *block); /* Blocks * @@ -397,29 +407,29 @@ void uiPupBlockClose(struct bContext *C, uiBlock *block); * * */ -uiBlock *uiBeginBlock(const struct bContext *C, struct ARegion *region, const char *name, short dt); -void uiEndBlock_ex(const struct bContext *C, uiBlock *block, const int xy[2]); -void uiEndBlock(const struct bContext *C, uiBlock *block); -void uiDrawBlock(const struct bContext *C, struct uiBlock *block); -void uiBlockUpdateFromOld(const struct bContext *C, struct uiBlock *block); +uiBlock *UI_block_begin(const struct bContext *C, struct ARegion *region, const char *name, short dt); +void UI_block_end_ex(const struct bContext *C, uiBlock *block, const int xy[2]); +void UI_block_end(const struct bContext *C, uiBlock *block); +void UI_block_draw(const struct bContext *C, struct uiBlock *block); +void UI_block_update_from_old(const struct bContext *C, struct uiBlock *block); -uiBlock *uiGetBlock(const char *name, struct ARegion *ar); +uiBlock *UI_block_find_in_region(const char *name, struct ARegion *ar); -void uiBlockSetEmboss(uiBlock *block, char dt); +void UI_block_emboss_set(uiBlock *block, char dt); -void uiFreeBlock(const struct bContext *C, uiBlock *block); -void uiFreeBlocks(const struct bContext *C, struct ListBase *lb); -void uiFreeInactiveBlocks(const struct bContext *C, struct ListBase *lb); -void uiFreeActiveButtons(const struct bContext *C, struct bScreen *screen); +void UI_block_free(const struct bContext *C, uiBlock *block); +void UI_blocklist_free(const struct bContext *C, struct ListBase *lb); +void UI_blocklist_free_inactive(const struct bContext *C, struct ListBase *lb); +void UI_screen_free_active_but(const struct bContext *C, struct bScreen *screen); -void uiBlockSetRegion(uiBlock *block, struct ARegion *region); +void UI_block_region_set(uiBlock *block, struct ARegion *region); -void uiBlockSetButLock(uiBlock *block, bool val, const char *lockstr); -void uiBlockClearButLock(uiBlock *block); +void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr); +void UI_block_lock_clear(uiBlock *block); /* automatic aligning, horiz or verical */ -void uiBlockBeginAlign(uiBlock *block); -void uiBlockEndAlign(uiBlock *block); +void UI_block_align_begin(uiBlock *block); +void UI_block_align_end(uiBlock *block); /* block bounds/position calculation */ typedef enum { @@ -432,44 +442,44 @@ typedef enum { UI_BLOCK_BOUNDS_PIE_CENTER, } eBlockBoundsCalc; -void uiBoundsBlock(struct uiBlock *block, int addval); -void uiTextBoundsBlock(uiBlock *block, int addval); -void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my); -void uiMenuPopupBoundsBlock(uiBlock *block, int addvall, int mx, int my); -void uiCenteredBoundsBlock(uiBlock *block, int addval); -void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy); +void UI_block_bounds_set_normal(struct uiBlock *block, int addval); +void UI_block_bounds_set_text(uiBlock *block, int addval); +void UI_block_bounds_set_popup(uiBlock *block, int addval, int mx, int my); +void UI_block_bounds_set_menu(uiBlock *block, int addvall, int mx, int my); +void UI_block_bounds_set_centered(uiBlock *block, int addval); +void UI_block_bounds_set_explicit(uiBlock *block, int minx, int miny, int maxx, int maxy); -int uiBlocksGetYMin(struct ListBase *lb); +int UI_blocklist_min_y_get(struct ListBase *lb); -void uiBlockSetDirection(uiBlock *block, char direction); -void uiBlockFlipOrder(uiBlock *block); -void uiBlockSetFlag(uiBlock *block, int flag); -void uiBlockClearFlag(uiBlock *block, int flag); +void UI_block_direction_set(uiBlock *block, char direction); +void UI_block_order_flip(uiBlock *block); +void UI_block_flag_enable(uiBlock *block, int flag); +void UI_block_flag_disable(uiBlock *block, int flag); -int uiButGetRetVal(uiBut *but); +int UI_but_return_value_get(uiBut *but); -void uiButSetDragID(uiBut *but, struct ID *id); -void uiButSetDragRNA(uiBut *but, struct PointerRNA *ptr); -void uiButSetDragPath(uiBut *but, const char *path); -void uiButSetDragName(uiBut *but, const char *name); -void uiButSetDragValue(uiBut *but); -void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale); +void UI_but_drag_set_id(uiBut *but, struct ID *id); +void UI_but_drag_set_rna(uiBut *but, struct PointerRNA *ptr); +void UI_but_drag_set_path(uiBut *but, const char *path); +void UI_but_drag_set_name(uiBut *but, const char *name); +void UI_but_drag_set_value(uiBut *but); +void UI_but_drag_set_image(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale); bool UI_but_active_drop_name(struct bContext *C); bool UI_but_active_drop_color(struct bContext *C); -void uiButSetFlag(uiBut *but, int flag); -void uiButClearFlag(uiBut *but, int flag); +void UI_but_flag_enable(uiBut *but, int flag); +void UI_but_flag_disable(uiBut *but, int flag); -void uiButSetDrawFlag(uiBut *but, int flag); -void uiButClearDrawFlag(uiBut *but, int flag); +void UI_but_drawflag_enable(uiBut *but, int flag); +void UI_but_drawflag_disable(uiBut *but, int flag); -void uiButSetMenuFromPulldown(uiBut *but); +void UI_but_type_set_menu_from_pulldown(uiBut *but); /* special button case, only draw it when used actively, for outliner etc */ -bool uiButActiveOnly(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but); +bool UI_but_active_only(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but); -void uiButExecute(const struct bContext *C, uiBut *but); +void UI_but_execute(const struct bContext *C, uiBut *but); /* Buttons @@ -543,10 +553,10 @@ uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcon uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip); /* for passing inputs to ButO buttons */ -struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but); +struct PointerRNA *UI_but_operator_ptr_get(uiBut *but); -void uiButSetUnitType(uiBut *but, const int unit_type); -int uiButGetUnitType(const uiBut *but); +void UI_but_unit_type_set(uiBut *but, const int unit_type); +int UI_but_unit_type_get(const uiBut *but); enum { BUT_GET_RNAPROP_IDENTIFIER = 1, @@ -571,7 +581,7 @@ typedef struct uiStringInfo { /* Note: Expects pointers to uiStringInfo structs as parameters. * Will fill them with translated strings, when possible. * Strings in uiStringInfo must be MEM_freeN'ed by caller. */ -void uiButGetStrInfo(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0); +void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0); /* Edit i18n stuff. */ /* Name of the main py op from i18n addon. */ @@ -601,8 +611,8 @@ void uiButGetStrInfo(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0); #define UI_ID_PREVIEWS (1 << 11) #define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL) -int uiIconFromID(struct ID *id); -int uiIconFromReportType(int type); +int UI_icon_from_id(struct ID *id); +int UI_icon_from_report_type(int type); uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip); uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip); @@ -631,41 +641,42 @@ int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, bool (*check_prop * Game engine logic brick links. Non-functional currently in 2.5, * code to handle and draw these is disabled internally. */ -void uiSetButLink(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to); +void UI_but_link_set(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to); -void uiComposeLinks(uiBlock *block); -uiBut *uiFindInlink(uiBlock *block, void *poin); +void UI_block_links_compose(uiBlock *block); +uiBut *UI_block_links_find_inlink(uiBlock *block, void *poin); /* use inside searchfunc to add items */ -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); /* bfunc gets search item *poin as arg2, or if NULL the old string */ -void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc, void *active); +void UI_but_func_search_set(uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc, void *active); /* height in pixels, it's using hardcoded values still */ -int uiSearchBoxHeight(void); -int uiSearchBoxWidth(void); +int UI_searchbox_size_y(void); +int UI_searchbox_size_x(void); /* check if a string is in an existing search box */ -int uiSearchItemFindIndex(uiSearchItems *items, const char *name); +int UI_search_items_find_index(uiSearchItems *items, const char *name); -void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg); -void uiBlockSetButmFunc(uiBlock *block, uiMenuHandleFunc func, void *arg); -void uiBlockSetFunc(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2); -void uiBlockSetNFunc(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2); +void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg); +void UI_block_func_butmenu_set(uiBlock *block, uiMenuHandleFunc func, void *arg); +void UI_block_func_set(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2); +void UI_block_funcN_set(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2); -void uiButSetRenameFunc(uiBut *but, uiButHandleRenameFunc func, void *arg1); -void uiButSetFunc(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2); -void uiButSetNFunc(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2); +void UI_but_func_rename_set(uiBut *but, uiButHandleRenameFunc func, void *arg1); +void UI_but_func_set(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2); +void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2); -void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg); +void UI_but_func_complete_set(uiBut *but, uiButCompleteFunc func, void *arg); -void uiBlockSetDrawExtraFunc(uiBlock *block, - void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), - void *arg1, void *arg2); +void UI_but_func_drawextra_set( + uiBlock *block, + void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), + void *arg1, void *arg2); bool UI_textbutton_activate_rna(const struct bContext *C, struct ARegion *ar, const void *rna_poin_data, const char *rna_prop_id); bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); -void uiButSetFocusOnEnter(struct wmWindow *win, uiBut *but); +void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); /* Autocomplete * @@ -679,9 +690,9 @@ typedef struct AutoComplete AutoComplete; #define AUTOCOMPLETE_FULL_MATCH 1 #define AUTOCOMPLETE_PARTIAL_MATCH 2 -AutoComplete *autocomplete_begin(const char *startname, size_t maxlen); -void autocomplete_do_name(AutoComplete *autocpl, const char *name); -int autocomplete_end(AutoComplete *autocpl, char *autoname); +AutoComplete *UI_autocomplete_begin(const char *startname, size_t maxlen); +void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name); +int UI_autocomplete_end(AutoComplete *autocpl, char *autoname); /* Panels * @@ -689,15 +700,15 @@ int autocomplete_end(AutoComplete *autocpl, char *autoname); * could use a good cleanup, though how they will function in 2.5 is * not clear yet so we postpone that. */ -void uiBeginPanels(const struct bContext *C, struct ARegion *ar); -void uiEndPanels(const struct bContext *C, struct ARegion *ar, int *x, int *y); -void uiDrawPanels(const struct bContext *C, struct ARegion *ar); +void UI_panels_begin(const struct bContext *C, struct ARegion *ar); +void UI_panels_end(const struct bContext *C, struct ARegion *ar, int *x, int *y); +void UI_panels_draw(const struct bContext *C, struct ARegion *ar); -struct Panel *uiPanelFindByType(struct ARegion *ar, struct PanelType *pt); -struct Panel *uiBeginPanel(struct ScrArea *sa, struct ARegion *ar, uiBlock *block, - struct PanelType *pt, struct Panel *pa, bool *r_open); -void uiEndPanel(uiBlock *block, int width, int height); -void uiScalePanels(struct ARegion *ar, float new_width); +struct Panel *UI_panel_find_by_type(struct ARegion *ar, struct PanelType *pt); +struct Panel *UI_panel_begin(struct ScrArea *sa, struct ARegion *ar, uiBlock *block, + struct PanelType *pt, struct Panel *pa, bool *r_open); +void UI_panel_end(uiBlock *block, int width, int height); +void UI_panels_scale(struct ARegion *ar, float new_width); bool UI_panel_category_is_visible(struct ARegion *ar); void UI_panel_category_add(struct ARegion *ar, const char *name); @@ -716,10 +727,10 @@ void UI_panel_category_draw_all(struct ARegion *ar, const * handling WM events. Mostly this is done automatic by modules such * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */ -void UI_add_region_handlers(struct ListBase *handlers); -void UI_add_popup_handlers(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup, const bool accept_dbl_click); -void UI_remove_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *popup); -void UI_remove_popup_handlers_all(struct bContext *C, struct ListBase *handlers); +void UI_region_handlers_add(struct ListBase *handlers); +void UI_popup_handlers_add(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup, const bool accept_dbl_click); +void UI_popup_handlers_remove(struct ListBase *handlers, uiPopupBlockHandle *popup); +void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers); /* Module * @@ -796,9 +807,9 @@ enum { /* not apart of the corner flags but mixed in some functions */ #define UI_RB_ALPHA (UI_CNR_ALL + 1) -uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style); -void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout); -void uiBlockLayoutResolve(uiBlock *block, int *x, int *y); +uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style); +void UI_block_layout_set_current(uiBlock *block, uiLayout *layout); +void UI_block_layout_resolve(uiBlock *block, int *x, int *y); uiBlock *uiLayoutGetBlock(uiLayout *layout); @@ -809,7 +820,7 @@ const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag); -struct MenuType *uiButGetMenuType(uiBut *but); +struct MenuType *UI_but_menutype_get(uiBut *but); void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext); void uiLayoutSetActive(uiLayout *layout, bool active); @@ -876,7 +887,7 @@ void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *pt void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management); void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); -void uiOperatorSearch_But(uiBut *but); +void UI_but_func_operator_search(uiBut *but); void uiTemplateOperatorSearch(uiLayout *layout); void uiTemplateHeader3D(uiLayout *layout, struct bContext *C); void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C); @@ -942,32 +953,33 @@ typedef struct uiDragColorHandle { bool gamma_corrected; } uiDragColorHandle; -void UI_buttons_operatortypes(void); +void ED_button_operatortypes(void); void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop); int UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event); /* Helpers for Operators */ -uiBut *uiContextActiveButton(const struct bContext *C); -void uiContextActiveProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index); -void uiContextActivePropertyHandle(struct bContext *C); -struct wmOperator *uiContextActiveOperator(const struct bContext *C); -void uiContextAnimUpdate(const struct bContext *C); -void uiFileBrowseContextProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); -void uiIDContextProperty(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); +uiBut *UI_context_active_but_get(const struct bContext *C); +void UI_context_active_but_prop_get(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index); +void UI_context_active_but_prop_handle(struct bContext *C); +struct wmOperator *UI_context_active_operator_get(const struct bContext *C); +void UI_context_update_anim_flag(const struct bContext *C); +void UI_context_active_but_prop_get_filebrowser(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); +void UI_context_active_but_prop_get_templateID(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); /* Styled text draw */ -void uiStyleFontSet(struct uiFontStyle *fs); -void uiStyleFontDrawExt(struct uiFontStyle *fs, const struct rcti *rect, const char *str, - size_t len, float *r_xofs, float *r_yofs); -void uiStyleFontDraw(struct uiFontStyle *fs, const struct rcti *rect, const char *str); -void uiStyleFontDrawRotated(struct uiFontStyle *fs, const struct rcti *rect, const char *str); +void UI_fontstyle_set(struct uiFontStyle *fs); +void UI_fontstyle_draw_ex( + struct uiFontStyle *fs, const struct rcti *rect, const char *str, + size_t len, float *r_xofs, float *r_yofs); +void UI_fontstyle_draw(struct uiFontStyle *fs, const struct rcti *rect, const char *str); +void UI_fontstyle_draw_rotated(struct uiFontStyle *fs, const struct rcti *rect, const char *str); -int UI_GetStringWidth(const char *str); // XXX temp -void UI_DrawString(float x, float y, const char *str); // XXX temp -void UI_DrawTriIcon(float x, float y, char dir); +int UI_fontstyle_string_width(const char *str); // XXX temp +void UI_draw_string(float x, float y, const char *str); // XXX temp +void UI_draw_icon_tri(float x, float y, char dir); -uiStyle *UI_GetStyle(void); /* use for fonts etc */ -uiStyle *UI_GetStyleDraw(void); /* DPI scaled settings for drawing */ +uiStyle *UI_style_get(void); /* use for fonts etc */ +uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ /* linker workaround ack! */ void UI_template_fix_linking(void); @@ -993,6 +1005,6 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p); /* Float precision helpers */ #define UI_PRECISION_FLOAT_MAX 7 -int uiFloatPrecisionCalc(int prec, double value); +int UI_calc_float_precision(int prec, double value); #endif /* __UI_INTERFACE_H__ */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index eb12f19cf1d..5a854cae54c 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -76,9 +76,9 @@ #include "interface_intern.h" -/* avoid unneeded calls to ui_get_but_val */ +/* avoid unneeded calls to ui_but_value_get */ #define UI_BUT_VALUE_UNSET DBL_MAX -#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) { (_value) = ui_get_but_val(_but); } (void)0 +#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) { (_value) = ui_but_value_get(_but); } (void)0 #define B_NOP -1 @@ -89,7 +89,7 @@ * ui_blah_blah() internal function */ -static void ui_free_but(const bContext *C, uiBut *but); +static void ui_but_free(const bContext *C, uiBut *but); bool ui_block_is_menu(const uiBlock *block) { @@ -103,17 +103,17 @@ bool ui_block_is_pie_menu(const uiBlock *block) return ((block->flag & UI_BLOCK_RADIAL) != 0); } -static bool ui_is_but_unit_radians_ex(UnitSettings *unit, const int unit_type) +static bool ui_but_is_unit_radians_ex(UnitSettings *unit, const int unit_type) { return (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION); } -static bool ui_is_but_unit_radians(const uiBut *but) +static bool ui_but_is_unit_radians(const uiBut *but) { UnitSettings *unit = but->block->unit; - const int unit_type = uiButGetUnitType(but); + const int unit_type = UI_but_unit_type_get(but); - return ui_is_but_unit_radians_ex(unit, unit_type); + return ui_but_is_unit_radians_ex(unit, unit_type); } /* ************* window matrix ************** */ @@ -222,16 +222,16 @@ void ui_block_translate(uiBlock *block, int x, int y) BLI_rctf_translate(&block->rect, x, y); } -static void ui_text_bounds_block(uiBlock *block, float offset) +static void ui_block_bounds_calc_text(uiBlock *block, float offset) { - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); uiBut *bt, *init_col_bt, *col_bt; int i = 0, j, x1addval = offset; - uiStyleFontSet(&style->widget); + UI_fontstyle_set(&style->widget); for (init_col_bt = bt = block->buttons.first; bt; bt = bt->next) { - if (!ELEM(bt->type, SEPR, SEPRLINE)) { + if (!ELEM(bt->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) { j = BLF_width(style->widget.uifont_id, bt->drawstr, sizeof(bt->drawstr)); if (j > i) @@ -244,7 +244,7 @@ static void ui_text_bounds_block(uiBlock *block, float offset) col_bt->rect.xmin = x1addval; col_bt->rect.xmax = x1addval + i + block->bounds; - ui_check_but(col_bt); /* clips text again */ + ui_but_update(col_bt); /* clips text again */ } /* And we prepare next column. */ @@ -259,11 +259,11 @@ static void ui_text_bounds_block(uiBlock *block, float offset) col_bt->rect.xmin = x1addval; col_bt->rect.xmax = max_ff(x1addval + i + block->bounds, offset + block->minbounds); - ui_check_but(col_bt); /* clips text again */ + ui_but_update(col_bt); /* clips text again */ } } -void ui_bounds_block(uiBlock *block) +void ui_block_bounds_calc(uiBlock *block) { uiBut *bt; int xof; @@ -301,7 +301,7 @@ void ui_bounds_block(uiBlock *block) block->safety.ymax = block->rect.ymax + xof; } -static void ui_centered_bounds_block(wmWindow *window, uiBlock *block) +static void ui_block_bounds_calc_centered(wmWindow *window, uiBlock *block) { int xmax, ymax; int startx, starty; @@ -313,7 +313,7 @@ static void ui_centered_bounds_block(wmWindow *window, uiBlock *block) xmax = WM_window_pixels_x(window); ymax = WM_window_pixels_y(window); - ui_bounds_block(block); + ui_block_bounds_calc(block); width = BLI_rctf_size_x(&block->rect); height = BLI_rctf_size_y(&block->rect); @@ -324,11 +324,11 @@ static void ui_centered_bounds_block(wmWindow *window, uiBlock *block) ui_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin); /* now recompute bounds and safety */ - ui_bounds_block(block); + ui_block_bounds_calc(block); } -static void ui_centered_pie_bounds_block(uiBlock *block) +static void ui_block_bounds_calc_centered_pie(uiBlock *block) { const int xy[2] = { block->pie_data.pie_center_spawned[0], @@ -338,11 +338,12 @@ static void ui_centered_pie_bounds_block(uiBlock *block) ui_block_translate(block, xy[0], xy[1]); /* now recompute bounds and safety */ - ui_bounds_block(block); + ui_block_bounds_calc(block); } -static void ui_popup_bounds_block(wmWindow *window, uiBlock *block, - eBlockBoundsCalc bounds_calc, const int xy[2]) +static void ui_block_bounds_calc_popup( + wmWindow *window, uiBlock *block, + eBlockBoundsCalc bounds_calc, const int xy[2]) { int startx, starty, endx, endy, width, height, oldwidth, oldheight; int oldbounds, xmax, ymax; @@ -351,7 +352,7 @@ static void ui_popup_bounds_block(wmWindow *window, uiBlock *block, oldbounds = block->bounds; /* compute mouse position with user defined offset */ - ui_bounds_block(block); + ui_block_bounds_calc(block); xmax = WM_window_pixels_x(window); ymax = WM_window_pixels_y(window); @@ -363,13 +364,13 @@ static void ui_popup_bounds_block(wmWindow *window, uiBlock *block, if (bounds_calc == UI_BLOCK_BOUNDS_POPUP_MENU) { if (block->flag & UI_BLOCK_LOOP) { block->bounds = 2.5f * UI_UNIT_X; - ui_text_bounds_block(block, block->rect.xmin); + ui_block_bounds_calc_text(block, block->rect.xmin); } } /* next we recompute bounds */ block->bounds = oldbounds; - ui_bounds_block(block); + ui_block_bounds_calc(block); /* and we adjust the position to fit within window */ width = BLI_rctf_size_x(&block->rect); @@ -380,7 +381,7 @@ static void ui_popup_bounds_block(wmWindow *window, uiBlock *block, oldheight = oldheight > 0 ? oldheight : MAX2(1, height); /* offset block based on mouse position, user offset is scaled - * along in case we resized the block in ui_text_bounds_block */ + * along in case we resized the block in ui_block_bounds_calc_text */ startx = xy[0] + block->rect.xmin + (block->mx * width) / oldwidth; starty = xy[1] + block->rect.ymin + (block->my * height) / oldheight; @@ -404,11 +405,11 @@ static void ui_popup_bounds_block(wmWindow *window, uiBlock *block, ui_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin); /* now recompute bounds and safety */ - ui_bounds_block(block); + ui_block_bounds_calc(block); } /* used for various cases */ -void uiBoundsBlock(uiBlock *block, int addval) +void UI_block_bounds_set_normal(uiBlock *block, int addval) { if (block == NULL) return; @@ -418,14 +419,14 @@ void uiBoundsBlock(uiBlock *block, int addval) } /* used for pulldowns */ -void uiTextBoundsBlock(uiBlock *block, int addval) +void UI_block_bounds_set_text(uiBlock *block, int addval) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_TEXT; } /* used for block popups */ -void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my) +void UI_block_bounds_set_popup(uiBlock *block, int addval, int mx, int my) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_POPUP_MOUSE; @@ -434,7 +435,7 @@ void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my) } /* used for menu popups */ -void uiMenuPopupBoundsBlock(uiBlock *block, int addval, int mx, int my) +void UI_block_bounds_set_menu(uiBlock *block, int addval, int mx, int my) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_POPUP_MENU; @@ -443,13 +444,13 @@ void uiMenuPopupBoundsBlock(uiBlock *block, int addval, int mx, int my) } /* used for centered popups, i.e. splash */ -void uiCenteredBoundsBlock(uiBlock *block, int addval) +void UI_block_bounds_set_centered(uiBlock *block, int addval) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_POPUP_CENTER; } -void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy) +void UI_block_bounds_set_explicit(uiBlock *block, int minx, int miny, int maxx, int maxy) { block->rect.xmin = minx; block->rect.ymin = miny; @@ -458,21 +459,21 @@ void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int max block->bounds_type = UI_BLOCK_BOUNDS_NONE; } -static int ui_but_float_precision(uiBut *but, double value) +static int ui_but_calc_float_precision(uiBut *but, double value) { int prec = (int)but->a2; /* first check for various special cases: * * If button is radians, we want additional precision (see T39861). * * If prec is not set, we fallback to a simple default */ - if (ui_is_but_unit_radians(but) && prec < 5) { + if (ui_but_is_unit_radians(but) && prec < 5) { prec = 5; } else if (prec == -1) { prec = (but->hardmax < 10.001f) ? 3 : 2; } - return uiFloatPrecisionCalc(prec, value); + return UI_calc_float_precision(prec, value); } /* ************** LINK LINE DRAWING ************* */ @@ -514,7 +515,7 @@ static void ui_draw_links(uiBlock *block) bool found_activeline = false; for (but = block->buttons.first; but; but = but->next) { - if (but->type == LINK && but->link) { + if (but->type == UI_BTYPE_LINK && but->link) { for (line = but->link->lines.first; line; line = line->next) { if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) { if (line->deactive) @@ -531,7 +532,7 @@ static void ui_draw_links(uiBlock *block) /* Draw the inactive lines (lines with neither button being hovered over) */ for (but = block->buttons.first; but; but = but->next) { - if (but->type == LINK && but->link) { + if (but->type == UI_BTYPE_LINK && but->link) { for (line = but->link->lines.first; line; line = line->next) { if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) { if (!line->deactive) @@ -545,7 +546,7 @@ static void ui_draw_links(uiBlock *block) * Do this last so they appear on top of inactive and grey out lines. */ if (found_activeline) { for (but = block->buttons.first; but; but = but->next) { - if (but->type == LINK && but->link) { + if (but->type == UI_BTYPE_LINK && but->link) { for (line = but->link->lines.first; line; line = line->next) { if ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)) ui_draw_linkline(line, !found_selectline, false); @@ -603,8 +604,8 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut uiLinkLine *line; uiBut *but; - /* if active button is LINK */ - if (newbut->type == LINK && newbut->link) { + /* if active button is UI_BTYPE_LINK */ + if (newbut->type == UI_BTYPE_LINK && newbut->link) { SWAP(uiLink *, oldbut->link, newbut->link); @@ -618,7 +619,7 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut /* check all other button links */ for (but = block->buttons.first; but; but = but->next) { - if (but != newbut && but->type == LINK && but->link) { + if (but != newbut && but->type == UI_BTYPE_LINK && but->link) { for (line = but->link->lines.first; line; line = line->next) { if (line->to == newbut) line->to = oldbut; @@ -717,7 +718,7 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu /* copy hardmin for list rows to prevent 'sticking' highlight to mouse position * when scrolling without moving mouse (see [#28432]) */ - if (ELEM(oldbut->type, ROW, LISTROW)) + if (ELEM(oldbut->type, UI_BTYPE_ROW, UI_BTYPE_LISTROW)) oldbut->hardmax = but->hardmax; ui_but_update_linklines(block, oldbut, but); @@ -742,7 +743,7 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu } BLI_remlink(&block->buttons, but); - ui_free_but(C, but); + ui_but_free(C, but); /* note: if layout hasn't been applied yet, it uses old button pointers... */ } @@ -754,7 +755,7 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu /* ensures one button can get activated, and in case the buttons * draw are the same this gives O(1) lookup for each button */ BLI_remlink(&oldblock->buttons, oldbut); - ui_free_but(C, oldbut); + ui_but_free(C, oldbut); } return found_active; @@ -763,7 +764,7 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu /* needed for temporarily rename buttons, such as in outliner or file-select, * they should keep calling uiDefButs to keep them alive */ /* returns 0 when button removed */ -bool uiButActiveOnly(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) +bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) { uiBlock *oldblock; uiBut *oldbut; @@ -784,11 +785,11 @@ bool uiButActiveOnly(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) } } if ((activate == true) || (found == false)) { - ui_button_activate_do((bContext *)C, ar, but); + ui_but_activate_event((bContext *)C, ar, but); } else if ((found == true) && (isactive == false)) { BLI_remlink(&block->buttons, but); - ui_free_but(C, but); + ui_but_free(C, but); return false; } @@ -796,18 +797,18 @@ bool uiButActiveOnly(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) } /* simulate button click */ -void uiButExecute(const bContext *C, uiBut *but) +void UI_but_execute(const bContext *C, uiBut *but) { ARegion *ar = CTX_wm_region(C); void *active_back; - ui_button_execute_begin((bContext *)C, ar, but, &active_back); + ui_but_execute_begin((bContext *)C, ar, but, &active_back); /* Value is applied in begin. No further action required. */ - ui_button_execute_end((bContext *)C, ar, but, active_back); + ui_but_execute_end((bContext *)C, ar, but, active_back); } /* use to check if we need to disable undo, but don't make any changes * returns false if undo needs to be disabled. */ -static bool ui_is_but_rna_undo(const uiBut *but) +static bool ui_but_is_rna_undo(const uiBut *but) { if (but->rnapoin.id.data) { /* avoid undo push for buttons who's ID are screen or wm level @@ -850,7 +851,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) * fun first pass on all buttons so first word chars always get first priority */ for (but = block->buttons.first; but; but = but->next) { - if (!ELEM(but->type, BUT, BUTM, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) { + if (!ELEM(but->type, UI_BTYPE_BUT, UI_BTYPE_BUT_MENU, UI_BTYPE_MENU, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN) || (but->flag & UI_HIDDEN)) { /* pass */ } else if (but->menu_key == '\0') { @@ -930,7 +931,7 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_str MEM_freeN(butstr_orig); but->str = but->strdata; but->flag |= UI_BUT_HAS_SEP_CHAR; - ui_check_but(but); + ui_but_update(but); } } @@ -948,7 +949,7 @@ static bool ui_but_event_operator_string(const bContext *C, uiBut *but, char *bu found = true; } } - else if ((mt = uiButGetMenuType(but))) { + else if ((mt = UI_but_menutype_get(but))) { IDProperty *prop_menu; IDProperty *prop_menu_name; @@ -1147,7 +1148,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) } } -void uiBlockUpdateFromOld(const bContext *C, uiBlock *block) +void UI_block_update_from_old(const bContext *C, uiBlock *block) { uiBut *but_old; uiBut *but; @@ -1163,7 +1164,7 @@ void uiBlockUpdateFromOld(const bContext *C, uiBlock *block) for (but = block->buttons.first; but; but = but->next) { if (ui_but_update_from_old_block(C, block, &but, &but_old)) { - ui_check_but(but); + ui_but_update(but); } } @@ -1175,7 +1176,7 @@ void uiBlockUpdateFromOld(const bContext *C, uiBlock *block) block->oldblock = NULL; } -void uiEndBlock_ex(const bContext *C, uiBlock *block, const int xy[2]) +void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2]) { wmWindow *window = CTX_wm_window(C); Scene *scene = CTX_data_scene(C); @@ -1183,7 +1184,7 @@ void uiEndBlock_ex(const bContext *C, uiBlock *block, const int xy[2]) BLI_assert(block->active); - uiBlockUpdateFromOld(C, block); + UI_block_update_from_old(C, block); /* inherit flags from 'old' buttons that was drawn here previous, based * on matching buttons, we need this to make button event handling non @@ -1213,9 +1214,9 @@ void uiEndBlock_ex(const bContext *C, uiBlock *block, const int xy[2]) /* handle pending stuff */ if (block->layouts.first) { - uiBlockLayoutResolve(block, NULL, NULL); + UI_block_layout_resolve(block, NULL, NULL); } - ui_block_do_align(block); + ui_block_align_calc(block); if ((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) { ui_menu_block_set_keyaccels(block); /* could use a different flag to check */ } @@ -1229,40 +1230,40 @@ void uiEndBlock_ex(const bContext *C, uiBlock *block, const int xy[2]) case UI_BLOCK_BOUNDS_NONE: break; case UI_BLOCK_BOUNDS: - ui_bounds_block(block); + ui_block_bounds_calc(block); break; case UI_BLOCK_BOUNDS_TEXT: - ui_text_bounds_block(block, 0.0f); + ui_block_bounds_calc_text(block, 0.0f); break; case UI_BLOCK_BOUNDS_POPUP_CENTER: - ui_centered_bounds_block(window, block); + ui_block_bounds_calc_centered(window, block); break; case UI_BLOCK_BOUNDS_PIE_CENTER: - ui_centered_pie_bounds_block(block); + ui_block_bounds_calc_centered_pie(block); break; /* fallback */ case UI_BLOCK_BOUNDS_POPUP_MOUSE: case UI_BLOCK_BOUNDS_POPUP_MENU: - ui_popup_bounds_block(window, block, block->bounds_type, xy); + ui_block_bounds_calc_popup(window, block, block->bounds_type, xy); break; } if (block->rect.xmin == 0.0f && block->rect.xmax == 0.0f) { - uiBoundsBlock(block, 0); + UI_block_bounds_set_normal(block, 0); } if (block->flag & UI_BUT_ALIGN) { - uiBlockEndAlign(block); + UI_block_align_end(block); } block->endblock = 1; } -void uiEndBlock(const bContext *C, uiBlock *block) +void UI_block_end(const bContext *C, uiBlock *block) { wmWindow *window = CTX_wm_window(C); - uiEndBlock_ex(C, block, &window->eventstate->x); + UI_block_end_ex(C, block, &window->eventstate->x); } /* ************** BLOCK DRAWING FUNCTION ************* */ @@ -1303,9 +1304,9 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u } /* uses local copy of style, to scale things down, and allow widgets to change stuff */ -void uiDrawBlock(const bContext *C, uiBlock *block) +void UI_block_draw(const bContext *C, uiBlock *block) { - uiStyle style = *UI_GetStyleDraw(); /* XXX pass on as arg */ + uiStyle style = *UI_style_get_dpi(); /* XXX pass on as arg */ ARegion *ar; uiBut *but; rcti rect; @@ -1317,7 +1318,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) ar = CTX_wm_region(C); if (!block->endblock) - uiEndBlock(C, block); + UI_block_end(C, block); /* disable AA, makes widgets too blurry */ multisample_enabled = glIsEnabled(GL_MULTISAMPLE_ARB); @@ -1384,12 +1385,12 @@ void uiDrawBlock(const bContext *C, uiBlock *block) * * \return (0 == UNSELECT), (1 == SELECT), (-1 == DO-NOTHING) */ -int ui_is_but_push_ex(uiBut *but, double *value) +int ui_but_is_pushed_ex(uiBut *but, double *value) { int is_push = 0; if (but->bit) { - const bool state = ELEM(but->type, TOGN, ICONTOGN, OPTIONN) ? false : true; + const bool state = ELEM(but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N) ? false : true; int lvalue; UI_GET_BUT_VALUE_INIT(but, *value); lvalue = (int)*value; @@ -1402,27 +1403,27 @@ int ui_is_but_push_ex(uiBut *but, double *value) } else { switch (but->type) { - case BUT: - case HOTKEYEVT: - case KEYEVT: - case COLOR: + case UI_BTYPE_BUT: + case UI_BTYPE_HOTKEY_EVENT: + case UI_BTYPE_KEY_EVENT: + case UI_BTYPE_COLOR: is_push = -1; break; - case TOGBUT: - case TOG: - case ICONTOG: - case OPTION: + case UI_BTYPE_BUT_TOGGLE: + case UI_BTYPE_TOGGLE: + case UI_BTYPE_ICON_TOGGLE: + case UI_BTYPE_CHECKBOX: UI_GET_BUT_VALUE_INIT(but, *value); if (*value != (double)but->hardmin) is_push = true; break; - case ICONTOGN: - case TOGN: - case OPTIONN: + case UI_BTYPE_ICON_TOGGLE_N: + case UI_BTYPE_TOGGLE_N: + case UI_BTYPE_CHECKBOX_N: UI_GET_BUT_VALUE_INIT(but, *value); if (*value == 0.0) is_push = true; break; - case ROW: - case LISTROW: + case UI_BTYPE_ROW: + case UI_BTYPE_LISTROW: UI_GET_BUT_VALUE_INIT(but, *value); /* support for rna enum buts */ if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) { @@ -1440,15 +1441,15 @@ int ui_is_but_push_ex(uiBut *but, double *value) return is_push; } -int ui_is_but_push(uiBut *but) +int ui_but_is_pushed(uiBut *but) { double value = UI_BUT_VALUE_UNSET; - return ui_is_but_push_ex(but, &value); + return ui_but_is_pushed_ex(but, &value); } -static void ui_check_but_select(uiBut *but, double *value) +static void ui_but_update_select_flag(uiBut *but, double *value) { - switch (ui_is_but_push_ex(but, value)) { + switch (ui_but_is_pushed_ex(but, value)) { case true: but->flag |= UI_SELECT; break; @@ -1458,13 +1459,13 @@ static void ui_check_but_select(uiBut *but, double *value) } } -static uiBut *ui_find_inlink(uiBlock *block, void *poin) +static uiBut *ui_linkline_find_inlink(uiBlock *block, void *poin) { uiBut *but; but = block->buttons.first; while (but) { - if (but->type == INLINK) { + if (but->type == UI_BTYPE_INLINK) { if (but->poin == poin) return but; } but = but->next; @@ -1472,7 +1473,7 @@ static uiBut *ui_find_inlink(uiBlock *block, void *poin) return NULL; } -static void ui_add_link_line(ListBase *listb, uiBut *but, uiBut *bt, short deactive) +static void ui_linkline_add(ListBase *listb, uiBut *but, uiBut *bt, short deactive) { uiLinkLine *line; @@ -1483,12 +1484,12 @@ static void ui_add_link_line(ListBase *listb, uiBut *but, uiBut *bt, short deact line->deactive = deactive; } -uiBut *uiFindInlink(uiBlock *block, void *poin) +uiBut *UI_block_links_find_inlink(uiBlock *block, void *poin) { - return ui_find_inlink(block, poin); + return ui_linkline_find_inlink(block, poin); } -void uiComposeLinks(uiBlock *block) +void UI_block_links_compose(uiBlock *block) { uiBut *but, *bt; uiLink *link; @@ -1497,7 +1498,7 @@ void uiComposeLinks(uiBlock *block) but = block->buttons.first; while (but) { - if (but->type == LINK) { + if (but->type == UI_BTYPE_LINK) { link = but->link; /* for all pointers in the array */ @@ -1505,26 +1506,26 @@ void uiComposeLinks(uiBlock *block) if (link->ppoin) { ppoin = link->ppoin; for (a = 0; a < *(link->totlink); a++) { - bt = ui_find_inlink(block, (*ppoin)[a]); + bt = ui_linkline_find_inlink(block, (*ppoin)[a]); if (bt) { if ((but->flag & UI_BUT_SCA_LINK_GREY) || (bt->flag & UI_BUT_SCA_LINK_GREY)) { - ui_add_link_line(&link->lines, but, bt, true); + ui_linkline_add(&link->lines, but, bt, true); } else { - ui_add_link_line(&link->lines, but, bt, false); + ui_linkline_add(&link->lines, but, bt, false); } } } } else if (link->poin) { - bt = ui_find_inlink(block, *link->poin); + bt = ui_linkline_find_inlink(block, *link->poin); if (bt) { if ((but->flag & UI_BUT_SCA_LINK_GREY) || (bt->flag & UI_BUT_SCA_LINK_GREY)) { - ui_add_link_line(&link->lines, but, bt, true); + ui_linkline_add(&link->lines, but, bt, true); } else { - ui_add_link_line(&link->lines, but, bt, false); + ui_linkline_add(&link->lines, but, bt, false); } } } @@ -1537,7 +1538,7 @@ void uiComposeLinks(uiBlock *block) /* ************************************************ */ -void uiBlockSetButLock(uiBlock *block, bool val, const char *lockstr) +void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr) { if (val) { block->lock = val; @@ -1545,7 +1546,7 @@ void uiBlockSetButLock(uiBlock *block, bool val, const char *lockstr) } } -void uiBlockClearButLock(uiBlock *block) +void UI_block_lock_clear(uiBlock *block) { block->lock = false; block->lockstr = NULL; @@ -1553,7 +1554,7 @@ void uiBlockClearButLock(uiBlock *block) /* *************************************************************** */ -void ui_delete_linkline(uiLinkLine *line, uiBut *but) +void ui_linkline_remove(uiLinkLine *line, uiBut *but) { uiLink *link; int a, b; @@ -1594,7 +1595,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but) * an edit override pointer while dragging for example */ /* for buttons pointing to color for example */ -void ui_get_but_vectorf(uiBut *but, float vec[3]) +void ui_but_v3_get(uiBut *but, float vec[3]) { PropertyRNA *prop; int a; @@ -1640,13 +1641,13 @@ void ui_get_but_vectorf(uiBut *but, float vec[3]) } } - if (but->type == BUT_NORMAL) { + if (but->type == UI_BTYPE_UNITVEC) { normalize_v3(vec); } } /* for buttons pointing to color for example */ -void ui_set_but_vectorf(uiBut *but, const float vec[3]) +void ui_but_v3_set(uiBut *but, const float vec[3]) { PropertyRNA *prop; @@ -1686,7 +1687,7 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3]) } } -bool ui_is_but_float(const uiBut *but) +bool ui_but_is_float(const uiBut *but) { if (but->pointype == UI_BUT_POIN_FLOAT && but->poin) return true; @@ -1697,9 +1698,9 @@ bool ui_is_but_float(const uiBut *but) return false; } -bool ui_is_but_bool(const uiBut *but) +bool ui_but_is_bool(const uiBut *but) { - if (ELEM(but->type, TOG, TOGN, ICONTOG, ICONTOGN)) + if (ELEM(but->type, UI_BTYPE_TOGGLE, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE, UI_BTYPE_ICON_TOGGLE_N)) return true; if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN) @@ -1709,16 +1710,16 @@ bool ui_is_but_bool(const uiBut *but) } -bool ui_is_but_unit(const uiBut *but) +bool ui_but_is_unit(const uiBut *but) { UnitSettings *unit = but->block->unit; - const int unit_type = uiButGetUnitType(but); + const int unit_type = UI_but_unit_type_get(but); if (unit_type == PROP_UNIT_NONE) return false; #if 1 /* removed so angle buttons get correct snapping */ - if (ui_is_but_unit_radians_ex(unit, unit_type)) + if (ui_but_is_unit_radians_ex(unit, unit_type)) return false; #endif @@ -1738,7 +1739,7 @@ bool ui_is_but_unit(const uiBut *but) /** * Check if this button is similar enough to be grouped with another. */ -bool ui_is_but_compatible(const uiBut *but_a, const uiBut *but_b) +bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b) { if (but_a->type != but_b->type) return false; @@ -1759,7 +1760,7 @@ bool ui_is_but_compatible(const uiBut *but_a, const uiBut *but_b) return true; } -bool ui_is_but_rna_valid(uiBut *but) +bool ui_but_is_rna_valid(uiBut *but) { if (but->rnaprop == NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) { return true; @@ -1770,7 +1771,7 @@ bool ui_is_but_rna_valid(uiBut *but) } } -double ui_get_but_val(uiBut *but) +double ui_but_value_get(uiBut *but) { PropertyRNA *prop; double value = 0.0; @@ -1826,7 +1827,7 @@ double ui_get_but_val(uiBut *but) return value; } -void ui_set_but_val(uiBut *but, double value) +void ui_but_value_set(uiBut *but, double value) { PropertyRNA *prop; @@ -1905,18 +1906,18 @@ void ui_set_but_val(uiBut *but, double value) value = *((float *)but->poin) = (float)value; } - ui_check_but_select(but, &value); + ui_but_update_select_flag(but, &value); } -int ui_get_but_string_max_length(uiBut *but) +int ui_but_string_get_max_length(uiBut *but) { - 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)) return but->hardmax; else return UI_MAX_DRAW_STR; } -uiBut *ui_get_but_drag_multi_edit(uiBut *but) +uiBut *ui_but_drag_multi_edit_get(uiBut *but) { uiBut *but_iter; @@ -1934,7 +1935,7 @@ uiBut *ui_get_but_drag_multi_edit(uiBut *but) static double ui_get_but_scale_unit(uiBut *but, double value) { UnitSettings *unit = but->block->unit; - int unit_type = uiButGetUnitType(but); + int unit_type = UI_but_unit_type_get(but); /* Time unit is a bit special, not handled by BKE_scene_unit_scale() for now. */ if (unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */ @@ -1947,11 +1948,11 @@ static double ui_get_but_scale_unit(uiBut *but, double value) } /* str will be overwritten */ -void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) +void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) { - if (ui_is_but_unit(but)) { + if (ui_but_is_unit(but)) { UnitSettings *unit = but->block->unit; - int unit_type = uiButGetUnitType(but); + int unit_type = UI_but_unit_type_get(but); char *orig_str; orig_str = BLI_strdup(str); @@ -1969,7 +1970,7 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va { UnitSettings *unit = but->block->unit; const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0; - int unit_type = uiButGetUnitType(but); + int unit_type = UI_but_unit_type_get(but); int precision; if (unit->scale_length < 0.0001f) unit->scale_length = 1.0f; // XXX do_versions @@ -1991,7 +1992,7 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va static float ui_get_but_step_unit(uiBut *but, float step_default) { - int unit_type = RNA_SUBTYPE_UNIT_VALUE(uiButGetUnitType(but)); + int unit_type = RNA_SUBTYPE_UNIT_VALUE(UI_but_unit_type_get(but)); double step; step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type); @@ -2009,9 +2010,9 @@ static float ui_get_but_step_unit(uiBut *but, float step_default) /** * \param float_precision For number buttons the precision to use or -1 to fallback to the button default. */ -void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision) +void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision) { - if (but->rnaprop && ELEM(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (but->rnaprop && ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { PropertyType type; const char *buf = NULL; int buf_len; @@ -2048,12 +2049,12 @@ void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int MEM_freeN((void *)buf); } } - else if (but->type == TEX) { + else if (but->type == UI_BTYPE_TEXT) { /* string */ BLI_strncpy(str, but->poin, maxlen); return; } - else if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + else if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { /* string */ BLI_strncpy(str, but->poin, maxlen); return; @@ -2065,14 +2066,14 @@ void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int /* number editing */ double value; - value = ui_get_but_val(but); + value = ui_but_value_get(but); - if (ui_is_but_float(but)) { - if (ui_is_but_unit(but)) { + if (ui_but_is_float(but)) { + if (ui_but_is_unit(but)) { ui_get_but_string_unit(but, str, maxlen, value, false, float_precision); } else { - const int prec = (float_precision == -1) ? ui_but_float_precision(but, value) : float_precision; + const int prec = (float_precision == -1) ? ui_but_calc_float_precision(but, value) : float_precision; BLI_snprintf(str, maxlen, "%.*f", prec, value); } } @@ -2080,9 +2081,9 @@ void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int BLI_snprintf(str, maxlen, "%d", (int)value); } } -void ui_get_but_string(uiBut *but, char *str, const size_t maxlen) +void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) { - ui_get_but_string_ex(but, str, maxlen, -1); + ui_but_string_get_ex(but, str, maxlen, -1); } #ifdef WITH_PYTHON @@ -2090,7 +2091,7 @@ void ui_get_but_string(uiBut *but, char *str, const size_t maxlen) static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *str, double *value) { char str_unit_convert[256]; - const int unit_type = uiButGetUnitType(but); + const int unit_type = UI_but_unit_type_get(but); BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); @@ -2105,14 +2106,14 @@ static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char #endif /* WITH_PYTHON */ -bool ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double *value) +bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double *value) { bool ok = false; #ifdef WITH_PYTHON if (str[0] != '\0') { - bool is_unit_but = (ui_is_but_float(but) && ui_is_but_unit(but)); + bool is_unit_but = (ui_but_is_float(but) && ui_but_is_unit(but)); /* only enable verbose if we won't run again with units */ if (BPY_button_exec(C, str, value, is_unit_but == false) != -1) { /* if the value parsed ok without unit conversion this button may still need a unit multiplier */ @@ -2146,9 +2147,9 @@ bool ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double } -bool ui_set_but_string(bContext *C, uiBut *but, const char *str) +bool ui_but_string_set(bContext *C, uiBut *but, const char *str) { - if (but->rnaprop && ELEM(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (but->rnaprop && ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { if (RNA_property_editable(&but->rnapoin, but->rnaprop)) { PropertyType type; @@ -2193,14 +2194,14 @@ bool ui_set_but_string(bContext *C, uiBut *but, const char *str) } } } - else if (but->type == TEX) { + else if (but->type == UI_BTYPE_TEXT) { /* string */ - if (ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax); + if (ui_but_is_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax); else BLI_strncpy(but->poin, str, but->hardmax); return true; } - else if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + else if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { /* string */ BLI_strncpy(but->poin, str, but->hardmax); return true; @@ -2217,24 +2218,24 @@ bool ui_set_but_string(bContext *C, uiBut *but, const char *str) /* number editing */ double value; - if (ui_set_but_string_eval_num(C, but, str, &value) == false) { + if (ui_but_string_set_eval_num(C, but, str, &value) == false) { return false; } - if (!ui_is_but_float(but)) value = (int)floor(value + 0.5); + if (!ui_but_is_float(but)) value = (int)floor(value + 0.5); /* not that we use hard limits here */ if (value < (double)but->hardmin) value = but->hardmin; if (value > (double)but->hardmax) value = but->hardmax; - ui_set_but_val(but, value); + ui_but_value_set(but, value); return true; } return false; } -void ui_set_but_default(bContext *C, const bool all, const bool use_afterfunc) +void ui_but_default_set(bContext *C, const bool all, const bool use_afterfunc) { const char *opstring = "UI_OT_reset_default_button"; @@ -2364,7 +2365,7 @@ static void ui_set_but_soft_range(uiBut *but) but->softmax = softmax; } else if (but->poin && (but->pointype & UI_BUT_POIN_TYPES)) { - float value = ui_get_but_val(but); + float value = ui_but_value_get(but); CLAMP(value, but->hardmin, but->hardmax); but->softmin = min_ff(but->softmin, value); but->softmax = max_ff(but->softmax, value); @@ -2385,7 +2386,7 @@ static void ui_free_link(uiLink *link) } /* can be called with C==NULL */ -static void ui_free_but(const bContext *C, uiBut *but) +static void ui_but_free(const bContext *C, uiBut *but) { if (but->opptr) { WM_operator_properties_free(but->opptr); @@ -2401,7 +2402,7 @@ static void ui_free_but(const bContext *C, uiBut *but) * however they may have open tooltips or popup windows, which need to * be closed using a context pointer */ if (C) { - ui_button_active_free(C, but); + ui_but_active_free(C, but); } else { if (but->active) { @@ -2414,7 +2415,7 @@ static void ui_free_but(const bContext *C, uiBut *but) } ui_free_link(but->link); - if ((but->type == BUT_IMAGE) && but->poin) { + if ((but->type == UI_BTYPE_IMAGE) && but->poin) { IMB_freeImBuf((struct ImBuf *)but->poin); } @@ -2424,14 +2425,14 @@ static void ui_free_but(const bContext *C, uiBut *but) } /* can be called with C==NULL */ -void uiFreeBlock(const bContext *C, uiBlock *block) +void UI_block_free(const bContext *C, uiBlock *block) { uiBut *but; UI_butstore_clear(block); while ((but = BLI_pophead(&block->buttons))) { - ui_free_but(C, but); + ui_but_free(C, but); } if (block->unit) { @@ -2451,16 +2452,16 @@ void uiFreeBlock(const bContext *C, uiBlock *block) } /* can be called with C==NULL */ -void uiFreeBlocks(const bContext *C, ListBase *lb) +void UI_blocklist_free(const bContext *C, ListBase *lb) { uiBlock *block; while ((block = BLI_pophead(lb))) { - uiFreeBlock(C, block); + UI_block_free(C, block); } } -void uiFreeInactiveBlocks(const bContext *C, ListBase *lb) +void UI_blocklist_free_inactive(const bContext *C, ListBase *lb) { uiBlock *block, *nextblock; @@ -2470,7 +2471,7 @@ void uiFreeInactiveBlocks(const bContext *C, ListBase *lb) if (!block->handle) { if (!block->active) { BLI_remlink(lb, block); - uiFreeBlock(C, block); + UI_block_free(C, block); } else block->active = 0; @@ -2478,7 +2479,7 @@ void uiFreeInactiveBlocks(const bContext *C, ListBase *lb) } } -void uiBlockSetRegion(uiBlock *block, ARegion *region) +void UI_block_region_set(uiBlock *block, ARegion *region) { ListBase *lb = ®ion->uiblocks; uiBlock *oldblock = NULL; @@ -2501,7 +2502,7 @@ void uiBlockSetRegion(uiBlock *block, ARegion *region) block->oldblock = oldblock; } -uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, short dt) +uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, short dt) { uiBlock *block; wmWindow *window; @@ -2534,7 +2535,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor BLI_strncpy(block->name, name, sizeof(block->name)); if (region) - uiBlockSetRegion(block, region); + UI_block_region_set(block, region); /* window matrix and aspect */ if (region && region->swinid) { @@ -2558,23 +2559,23 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor return block; } -uiBlock *uiGetBlock(const char *name, ARegion *ar) +uiBlock *UI_block_find_in_region(const char *name, ARegion *ar) { return BLI_findstring(&ar->uiblocks, name, offsetof(uiBlock, name)); } -void uiBlockSetEmboss(uiBlock *block, char dt) +void UI_block_emboss_set(uiBlock *block, char dt) { block->dt = dt; } -void ui_check_but(uiBut *but) +void ui_but_update(uiBut *but) { /* if something changed in the button */ double value = UI_BUT_VALUE_UNSET; // float okwidth; // UNUSED - ui_check_but_select(but, &value); + ui_but_update_select_flag(but, &value); /* only update soft range while not editing */ if (!(but->editval || but->editstr || but->editvec)) { @@ -2587,16 +2588,16 @@ void ui_check_but(uiBut *but) /* test for min and max, icon sliders, etc */ switch (but->type) { - case NUM: - case SCROLL: - case NUMSLI: + case UI_BTYPE_NUM: + case UI_BTYPE_SCROLL: + case UI_BTYPE_NUM_SLIDER: UI_GET_BUT_VALUE_INIT(but, value); - if (value < (double)but->hardmin) ui_set_but_val(but, but->hardmin); - else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax); + if (value < (double)but->hardmin) ui_but_value_set(but, but->hardmin); + else if (value > (double)but->hardmax) ui_but_value_set(but, but->hardmax); break; - case ICONTOG: - case ICONTOGN: + case UI_BTYPE_ICON_TOGGLE: + case UI_BTYPE_ICON_TOGGLE_N: if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) { if (but->flag & UI_SELECT) but->iconadd = 1; else but->iconadd = 0; @@ -2615,7 +2616,7 @@ void ui_check_but(uiBut *but) /* name: */ switch (but->type) { - case MENU: + case UI_BTYPE_MENU: if (BLI_rctf_size_x(&but->rect) > 24.0f) { /* only needed for menus in popup blocks that don't recreate buttons on redraw */ if (but->block->flag & UI_BLOCK_LOOP) { @@ -2633,8 +2634,8 @@ void ui_check_but(uiBut *but) } break; - case NUM: - case NUMSLI: + case UI_BTYPE_NUM: + case UI_BTYPE_NUM_SLIDER: if (!but->editstr) { const char *drawstr_suffix = NULL; @@ -2644,7 +2645,7 @@ void ui_check_but(uiBut *but) slen = BLI_strncpy_rlen(but->drawstr, but->str, sizeof(but->drawstr)); - if (ui_is_but_float(but)) { + if (ui_but_is_float(but)) { if (value == (double) FLT_MAX) { slen += BLI_strncpy_rlen(but->drawstr + slen, "inf", sizeof(but->drawstr) - slen); } @@ -2652,13 +2653,13 @@ void ui_check_but(uiBut *but) slen += BLI_strncpy_rlen(but->drawstr + slen, "-inf", sizeof(but->drawstr) - slen); } /* support length type buttons */ - else if (ui_is_but_unit(but)) { + else if (ui_but_is_unit(but)) { char new_str[sizeof(but->drawstr)]; ui_get_but_string_unit(but, new_str, sizeof(new_str), value, true, -1); slen += BLI_strncpy_rlen(but->drawstr + slen, new_str, sizeof(but->drawstr) - slen); } else { - const int prec = ui_but_float_precision(but, value); + const int prec = ui_but_calc_float_precision(but, value); slen += BLI_snprintf(but->drawstr + slen, sizeof(but->drawstr) - slen, "%.*f", prec, value); } } @@ -2684,11 +2685,11 @@ void ui_check_but(uiBut *but) } break; - case LABEL: - if (ui_is_but_float(but)) { + case UI_BTYPE_LABEL: + if (ui_but_is_float(but)) { int prec; UI_GET_BUT_VALUE_INIT(but, value); - prec = ui_but_float_precision(but, value); + prec = ui_but_calc_float_precision(but, value); BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); } else { @@ -2697,18 +2698,18 @@ void ui_check_but(uiBut *but) break; - case TEX: - case SEARCH_MENU: - case SEARCH_MENU_UNLINK: + case UI_BTYPE_TEXT: + case UI_BTYPE_SEARCH_MENU: + case UI_BTYPE_SEARCH_MENU_UNLINK: if (!but->editstr) { char str[UI_MAX_DRAW_STR]; - ui_get_but_string(but, str, UI_MAX_DRAW_STR); + ui_but_string_get(but, str, UI_MAX_DRAW_STR); BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str); } break; - case KEYEVT: + case UI_BTYPE_KEY_EVENT: { const char *str; if (but->flag & UI_SELECT) { @@ -2721,7 +2722,7 @@ void ui_check_but(uiBut *but) BLI_snprintf(but->drawstr, UI_MAX_DRAW_STR, "%s%s", but->str, str); break; } - case HOTKEYEVT: + case UI_BTYPE_HOTKEY_EVENT: if (but->flag & UI_SELECT) { if (but->modifier_key) { @@ -2748,8 +2749,8 @@ void ui_check_but(uiBut *but) break; - case HSVCUBE: - case HSVCIRCLE: + case UI_BTYPE_HSVCUBE: + case UI_BTYPE_HSVCIRCLE: break; default: BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); @@ -2765,10 +2766,10 @@ void ui_check_but(uiBut *but) } -void uiBlockBeginAlign(uiBlock *block) +void UI_block_align_begin(uiBlock *block) { /* if other align was active, end it */ - if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block); + if (block->flag & UI_BUT_ALIGN) UI_block_align_end(block); block->flag |= UI_BUT_ALIGN_DOWN; block->alignnr++; @@ -2794,17 +2795,17 @@ static bool buts_are_horiz(uiBut *but1, uiBut *but2) return (dx <= dy); } -void uiBlockEndAlign(uiBlock *block) +void UI_block_align_end(uiBlock *block) { block->flag &= ~UI_BUT_ALIGN; /* all 4 flags */ } bool ui_but_can_align(uiBut *but) { - return !ELEM(but->type, LABEL, OPTION, OPTIONN, SEPR, SEPRLINE); + return !ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_CHECKBOX, UI_BTYPE_CHECKBOX_N, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE); } -static void ui_block_do_align_but(uiBut *first, short nr) +static void ui_block_align_calc_but(uiBut *first, short nr) { uiBut *prev, *but = NULL, *next; int flag = 0, cols = 0, rows = 0; @@ -2944,7 +2945,7 @@ static void ui_block_do_align_but(uiBut *first, short nr) } } -void ui_block_do_align(uiBlock *block) +void ui_block_align_calc(uiBlock *block) { uiBut *but; short nr; @@ -2953,7 +2954,7 @@ void ui_block_do_align(uiBlock *block) for (but = block->buttons.first; but; ) { if (but->alignnr) { nr = but->alignnr; - ui_block_do_align_but(but, nr); + ui_block_align_calc_but(but, nr); /* skip with same number */ for (; but && but->alignnr == nr; but = but->next) { @@ -2970,21 +2971,21 @@ void ui_block_do_align(uiBlock *block) } } -struct ColorManagedDisplay *ui_block_display_get(uiBlock *block) +struct ColorManagedDisplay *ui_block_cm_display_get(uiBlock *block) { return IMB_colormanagement_display_get_named(block->display_device); } -void ui_block_to_display_space_v3(uiBlock *block, float pixel[3]) +void ui_block_cm_to_display_space_v3(uiBlock *block, float pixel[3]) { - struct ColorManagedDisplay *display = ui_block_display_get(block); + struct ColorManagedDisplay *display = ui_block_cm_display_get(block); IMB_colormanagement_scene_linear_to_display_v3(pixel, display); } -void ui_block_to_scene_linear_v3(uiBlock *block, float pixel[3]) +void ui_block_cm_to_scene_linear_v3(uiBlock *block, float pixel[3]) { - struct ColorManagedDisplay *display = ui_block_display_get(block); + struct ColorManagedDisplay *display = ui_block_cm_display_get(block); IMB_colormanagement_display_to_scene_linear_v3(pixel, display); } @@ -3010,7 +3011,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, BLI_assert(width >= 0 && height >= 0); /* we could do some more error checks here */ - if ((type & BUTTYPE) == LABEL) { + if ((type & BUTTYPE) == UI_BTYPE_LABEL) { BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == false); } @@ -3073,7 +3074,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, but->pos = -1; /* cursor invisible */ - if (ELEM(but->type, NUM, NUMSLI)) { /* add a space to name */ + if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { /* add a space to name */ /* slen remains unchanged from previous assignment, ensure this stays true */ if (slen > 0 && slen < UI_MAX_NAME_STR - 2) { if (but->str[slen - 1] != ' ') { @@ -3087,12 +3088,12 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT); } else if ((block->flag & UI_BLOCK_LOOP) || - ELEM(but->type, MENU, TEX, LABEL, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK)) + ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_TEXT, UI_BTYPE_LABEL, UI_BTYPE_BLOCK, UI_BTYPE_BUT_MENU, UI_BTYPE_SEARCH_MENU, UI_BTYPE_PROGRESS_BAR, UI_BTYPE_SEARCH_MENU_UNLINK)) { but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT); } #ifdef USE_NUMBUTS_LR_ALIGN - else if (ELEM(but->type, NUM, NUMSLI)) { + else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { but->drawflag |= UI_BUT_TEXT_LEFT; } #endif @@ -3106,9 +3107,18 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, } /* keep track of UI_interface.h */ - if (ELEM(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM, SCROLL, SEPR, SEPRLINE, GRIP)) {} - else if (but->type >= SEARCH_MENU) {} - else but->flag |= UI_BUT_UNDO; + if (ELEM(but->type, + UI_BTYPE_BLOCK, UI_BTYPE_BUT, UI_BTYPE_LABEL, + UI_BTYPE_PULLDOWN, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, + UI_BTYPE_BUT_MENU, UI_BTYPE_SCROLL, UI_BTYPE_GRIP, + UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE) || + (but->type >= UI_BTYPE_SEARCH_MENU)) + { + /* pass */ + } + else { + but->flag |= UI_BUT_UNDO; + } BLI_addtail(&block->buttons, but); @@ -3149,13 +3159,13 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu int column_start = 0, column_end = 0; int nbr_entries_nosepr = 0; - uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); + UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT); RNA_property_enum_items_gettexted(block->evil_C, &but->rnapoin, but->rnaprop, &item_array, NULL, &free); /* we dont want nested rows, cols in menus */ - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); for (item = item_array; item->identifier; item++, totitems++) { if (!item->identifier[0]) { @@ -3184,7 +3194,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu rows++; /* Title */ - uiDefBut(block, LABEL, 0, RNA_property_ui_name(but->rnaprop), + uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_property_ui_name(but->rnaprop), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiItemS(layout); @@ -3227,7 +3237,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu } else { /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */ - uiDefBut(block, LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } } else { @@ -3236,17 +3246,17 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu } else { if (item->icon) { - uiDefIconTextButI(block, BUTM, B_NOP, item->icon, item->name, 0, 0, + uiDefIconTextButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description); } else { - uiDefButI(block, BUTM, B_NOP, item->name, 0, 0, + uiDefButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description); } } } - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); if (free) { MEM_freeN(item_array); @@ -3271,13 +3281,13 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s int icon = 0; uiMenuCreateFunc func = NULL; - if (ELEM(type, COLOR, HSVCIRCLE, HSVCUBE)) { + if (ELEM(type, UI_BTYPE_COLOR, UI_BTYPE_HSVCIRCLE, UI_BTYPE_HSVCUBE)) { BLI_assert(index == -1); } /* use rna values if parameters are not specified */ - if ((proptype == PROP_ENUM) && ELEM(type, MENU, ROW, LISTROW)) { - /* MENU is handled a little differently here */ + if ((proptype == PROP_ENUM) && ELEM(type, UI_BTYPE_MENU, UI_BTYPE_ROW, UI_BTYPE_LISTROW)) { + /* UI_BTYPE_MENU is handled a little differently here */ EnumPropertyItem *item; int value; bool free; @@ -3285,7 +3295,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s RNA_property_enum_items(block->evil_C, ptr, prop, &item, NULL, &free); - if (type == MENU) { + if (type == UI_BTYPE_MENU) { value = RNA_property_enum_get(ptr, prop); } else { @@ -3306,7 +3316,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s } else { if (!str) { - if (type == MENU) { + if (type == UI_BTYPE_MENU) { str = ""; } else { @@ -3315,7 +3325,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s } } - if (type == MENU) { + if (type == UI_BTYPE_MENU) { func = ui_def_but_rna__menu; } @@ -3340,7 +3350,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s RNA_property_int_range(ptr, prop, &hardmin, &hardmax); RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step); - if (!ELEM(type, ROW, LISTROW) && min == max) { + if (!ELEM(type, UI_BTYPE_ROW, UI_BTYPE_LISTROW) && min == max) { min = hardmin; max = hardmax; } @@ -3355,7 +3365,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s RNA_property_float_range(ptr, prop, &hardmin, &hardmax); RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision); - if (!ELEM(type, ROW, LISTROW) && min == max) { + if (!ELEM(type, UI_BTYPE_ROW, UI_BTYPE_LISTROW) && min == max) { min = hardmin; max = hardmax; } @@ -3391,20 +3401,20 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s } } - if ((type == MENU) && (but->dt == UI_EMBOSSP)) { - but->flag |= UI_ICON_SUBMENU; + if ((type == UI_BTYPE_MENU) && (but->dt == UI_EMBOSS_PULLDOWN)) { + but->flag |= UI_BUT_ICON_SUBMENU; } if (!RNA_property_editable(&but->rnapoin, prop)) { ui_def_but_rna__disable(but); } - if (but->flag & UI_BUT_UNDO && (ui_is_but_rna_undo(but) == false)) { + if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == false)) { but->flag &= ~UI_BUT_UNDO; } /* If this button uses units, calculate the step from this */ - if ((proptype == PROP_FLOAT) && ui_is_but_unit(but)) { + if ((proptype == PROP_FLOAT) && ui_but_is_unit(but)) { but->a1 = ui_get_but_step_unit(but, but->a1); } @@ -3451,7 +3461,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType * but = ui_def_but(block, type, -1, str, x, y, width, height, NULL, 0, 0, 0, 0, tip); but->optype = ot; but->opcontext = opcontext; - but->flag &= ~UI_BUT_UNDO; /* no need for ui_is_but_rna_undo(), we never need undo here */ + but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_rna_undo(), we never need undo here */ if (!ot) { but->flag |= UI_BUT_DISABLED; @@ -3466,7 +3476,7 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, in { uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip); - ui_check_but(but); + ui_but_update(but); return but; } @@ -3506,7 +3516,7 @@ struct AutoComplete { const char *startname; }; -AutoComplete *autocomplete_begin(const char *startname, size_t maxlen) +AutoComplete *UI_autocomplete_begin(const char *startname, size_t maxlen) { AutoComplete *autocpl; @@ -3519,7 +3529,7 @@ AutoComplete *autocomplete_begin(const char *startname, size_t maxlen) return autocpl; } -void autocomplete_do_name(AutoComplete *autocpl, const char *name) +void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name) { char *truncate = autocpl->truncate; const char *startname = autocpl->startname; @@ -3549,7 +3559,7 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name) } } -int autocomplete_end(AutoComplete *autocpl, char *autoname) +int UI_autocomplete_end(AutoComplete *autocpl, char *autoname) { int match = AUTOCOMPLETE_NO_MATCH; if (autocpl->truncate[0]) { @@ -3572,14 +3582,14 @@ int autocomplete_end(AutoComplete *autocpl, char *autoname) return match; } -static void ui_check_but_and_iconize(uiBut *but, int icon) +static void ui_but_update_and_icon_set(uiBut *but, int icon) { if (icon) { but->icon = (BIFIconID) icon; but->flag |= UI_HAS_ICON; } - ui_check_but(but); + ui_but_update(but); } static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip) @@ -3628,14 +3638,14 @@ uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, i { uiBut *but; but = ui_def_but_rna_propname(block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, a1, a2, tip); - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip) { uiBut *but; but = ui_def_but_rna(block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip); - ui_check_but(but); + ui_but_update(but); return but; } @@ -3643,7 +3653,7 @@ uiBut *uiDefButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext { uiBut *but; but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x, y, width, height, tip); - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip) @@ -3657,7 +3667,7 @@ uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, co uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip) { uiBut *but = ui_def_but(block, type, retval, "", x, y, width, height, poin, min, max, a1, a2, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); return but; } static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip) @@ -3707,14 +3717,14 @@ uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x, int { uiBut *but; but = ui_def_but_rna_propname(block, type, retval, "", x, y, width, height, ptr, propname, index, min, max, a1, a2, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); return but; } uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip) { uiBut *but; but = ui_def_but_rna(block, type, retval, "", x, y, width, height, ptr, prop, index, min, max, a1, a2, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); return but; } @@ -3722,7 +3732,7 @@ uiBut *uiDefIconButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcon { uiBut *but; but = ui_def_but_operator_ptr(block, type, ot, opcontext, "", x, y, width, height, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); return but; } uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x, int y, short width, short height, const char *tip) @@ -3735,7 +3745,7 @@ uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip) { uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); but->drawflag |= UI_BUT_ICON_LEFT; return but; } @@ -3786,7 +3796,7 @@ uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const c { uiBut *but; but = ui_def_but_rna_propname(block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, a1, a2, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); but->drawflag |= UI_BUT_ICON_LEFT; return but; } @@ -3794,7 +3804,7 @@ uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, co { uiBut *but; but = ui_def_but_rna(block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); but->drawflag |= UI_BUT_ICON_LEFT; return but; } @@ -3802,7 +3812,7 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int o { uiBut *but; but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x, y, width, height, tip); - ui_check_but_and_iconize(but, icon); + ui_but_update_and_icon_set(but, icon); but->drawflag |= UI_BUT_ICON_LEFT; return but; } @@ -3814,7 +3824,7 @@ uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcon /* END Button containing both string label and icon */ -void uiSetButLink(uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to) +void UI_but_link_set(uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to) { uiLink *link; @@ -3829,7 +3839,7 @@ void uiSetButLink(uiBut *but, void **poin, void ***ppoin, short *tot, int from, /* cruft to make uiBlock and uiBut private */ -int uiBlocksGetYMin(ListBase *lb) +int UI_blocklist_min_y_get(ListBase *lb) { uiBlock *block; int min = 0; @@ -3841,13 +3851,13 @@ int uiBlocksGetYMin(ListBase *lb) return min; } -void uiBlockSetDirection(uiBlock *block, char direction) +void UI_block_direction_set(uiBlock *block, char direction) { block->direction = direction; } /* this call escapes if there's alignment flags */ -void uiBlockFlipOrder(uiBlock *block) +void UI_block_order_flip(uiBlock *block) { uiBut *but; float centy, miny = 10000, maxy = -10000; @@ -3872,80 +3882,80 @@ void uiBlockFlipOrder(uiBlock *block) } -void uiBlockSetFlag(uiBlock *block, int flag) +void UI_block_flag_enable(uiBlock *block, int flag) { block->flag |= flag; } -void uiBlockClearFlag(uiBlock *block, int flag) +void UI_block_flag_disable(uiBlock *block, int flag) { block->flag &= ~flag; } -void uiButSetFlag(uiBut *but, int flag) +void UI_but_flag_enable(uiBut *but, int flag) { but->flag |= flag; } -void uiButClearFlag(uiBut *but, int flag) +void UI_but_flag_disable(uiBut *but, int flag) { but->flag &= ~flag; } -void uiButSetDrawFlag(uiBut *but, int flag) +void UI_but_drawflag_enable(uiBut *but, int flag) { but->drawflag |= flag; } -void uiButClearDrawFlag(uiBut *but, int flag) +void UI_but_drawflag_disable(uiBut *but, int flag) { but->drawflag &= ~flag; } -void uiButSetMenuFromPulldown(uiBut *but) +void UI_but_type_set_menu_from_pulldown(uiBut *but) { - BLI_assert(but->type == PULLDOWN); - but->type = MENU; - uiButClearDrawFlag(but, UI_BUT_TEXT_RIGHT); - uiButSetDrawFlag(but, UI_BUT_TEXT_LEFT); + BLI_assert(but->type == UI_BTYPE_PULLDOWN); + but->type = UI_BTYPE_MENU; + UI_but_drawflag_disable(but, UI_BUT_TEXT_RIGHT); + UI_but_drawflag_enable(but, UI_BUT_TEXT_LEFT); } -int uiButGetRetVal(uiBut *but) +int UI_but_return_value_get(uiBut *but) { return but->retval; } -void uiButSetDragID(uiBut *but, ID *id) +void UI_but_drag_set_id(uiBut *but, ID *id) { but->dragtype = WM_DRAG_ID; but->dragpoin = (void *)id; } -void uiButSetDragRNA(uiBut *but, PointerRNA *ptr) +void UI_but_drag_set_rna(uiBut *but, PointerRNA *ptr) { but->dragtype = WM_DRAG_RNA; but->dragpoin = (void *)ptr; } -void uiButSetDragPath(uiBut *but, const char *path) +void UI_but_drag_set_path(uiBut *but, const char *path) { but->dragtype = WM_DRAG_PATH; but->dragpoin = (void *)path; } -void uiButSetDragName(uiBut *but, const char *name) +void UI_but_drag_set_name(uiBut *but, const char *name) { but->dragtype = WM_DRAG_NAME; but->dragpoin = (void *)name; } /* value from button itself */ -void uiButSetDragValue(uiBut *but) +void UI_but_drag_set_value(uiBut *but) { but->dragtype = WM_DRAG_VALUE; } -void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale) +void UI_but_drag_set_image(uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale) { but->dragtype = WM_DRAG_PATH; but->icon = icon; /* no flag UI_HAS_ICON, so icon doesnt draw in button */ @@ -3954,7 +3964,7 @@ void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *imb but->imb_scale = scale; } -PointerRNA *uiButGetOperatorPtrRNA(uiBut *but) +PointerRNA *UI_but_operator_ptr_get(uiBut *but) { if (but->optype && !but->opptr) { but->opptr = MEM_callocN(sizeof(PointerRNA), "uiButOpPtr"); @@ -3964,12 +3974,12 @@ PointerRNA *uiButGetOperatorPtrRNA(uiBut *but) return but->opptr; } -void uiButSetUnitType(uiBut *but, const int unit_type) +void UI_but_unit_type_set(uiBut *but, const int unit_type) { but->unit_type = (unsigned char)(RNA_SUBTYPE_UNIT_VALUE(unit_type)); } -int uiButGetUnitType(const uiBut *but) +int UI_but_unit_type_get(const uiBut *but) { int ownUnit = (int)but->unit_type; @@ -3985,26 +3995,26 @@ int uiButGetUnitType(const uiBut *but) } } -void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg) +void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg) { block->handle_func = func; block->handle_func_arg = arg; } -void uiBlockSetButmFunc(uiBlock *block, uiMenuHandleFunc func, void *arg) +void UI_block_func_butmenu_set(uiBlock *block, uiMenuHandleFunc func, void *arg) { block->butm_func = func; block->butm_func_arg = arg; } -void uiBlockSetFunc(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2) +void UI_block_func_set(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2) { block->func = func; block->func_arg1 = arg1; block->func_arg2 = arg2; } -void uiBlockSetNFunc(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2) +void UI_block_funcN_set(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2) { if (block->func_argN) { MEM_freeN(block->func_argN); @@ -4015,27 +4025,27 @@ void uiBlockSetNFunc(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *a block->func_arg2 = arg2; } -void uiButSetRenameFunc(uiBut *but, uiButHandleRenameFunc func, void *arg1) +void UI_but_func_rename_set(uiBut *but, uiButHandleRenameFunc func, void *arg1) { but->rename_func = func; but->rename_arg1 = arg1; } -void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(const bContext *C, void *idv, void *arg1, void *arg2, rcti *rect), void *arg1, void *arg2) +void UI_but_func_drawextra_set(uiBlock *block, void (*func)(const bContext *C, void *idv, void *arg1, void *arg2, rcti *rect), void *arg1, void *arg2) { block->drawextra = func; block->drawextra_arg1 = arg1; block->drawextra_arg2 = arg2; } -void uiButSetFunc(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2) +void UI_but_func_set(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2) { but->func = func; but->func_arg1 = arg1; but->func_arg2 = arg2; } -void uiButSetNFunc(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2) +void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2) { if (but->func_argN) { MEM_freeN(but->func_argN); @@ -4046,7 +4056,7 @@ void uiButSetNFunc(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2) but->func_arg2 = arg2; } -void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg) +void UI_but_func_complete_set(uiBut *but, uiButCompleteFunc func, void *arg) { but->autocomplete_func = func; but->autofunc_arg = arg; @@ -4054,67 +4064,67 @@ void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg) uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); but->block_create_func = func; - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, NULL, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, NULL, 0.0, 0.0, 0.0, 0.0, tip); but->block_create_func = func; if (but->func_argN) { MEM_freeN(but->func_argN); } but->func_argN = argN; - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); but->block_create_func = func; - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); but->menu_create_func = func; - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); but->icon = (BIFIconID) icon; but->flag |= UI_HAS_ICON; but->drawflag |= UI_BUT_ICON_LEFT; - but->flag |= UI_ICON_SUBMENU; + but->flag |= UI_BUT_ICON_SUBMENU; but->menu_create_func = func; - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, PULLDOWN, 0, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_PULLDOWN, 0, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); but->icon = (BIFIconID) icon; but->flag |= UI_HAS_ICON; but->drawflag &= ~UI_BUT_ICON_LEFT; but->menu_create_func = func; - ui_check_but(but); + ui_but_update(but); return but; } @@ -4122,18 +4132,18 @@ uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int ic /* Block button containing both string label and icon */ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); - /* XXX temp, old menu calls pass on icon arrow, which is now UI_ICON_SUBMENU flag */ + /* XXX temp, old menu calls pass on icon arrow, which is now UI_BUT_ICON_SUBMENU flag */ if (icon != ICON_RIGHTARROW_THIN) { but->icon = (BIFIconID) icon; but->drawflag |= UI_BUT_ICON_LEFT; } but->flag |= UI_HAS_ICON; - but->flag |= UI_ICON_SUBMENU; + but->flag |= UI_BUT_ICON_SUBMENU; but->block_create_func = func; - ui_check_but(but); + ui_but_update(but); return but; } @@ -4141,7 +4151,7 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, /* Block button containing icon */ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, const char *tip) { - uiBut *but = ui_def_but(block, BLOCK, retval, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, retval, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); but->icon = (BIFIconID) icon; but->flag |= UI_HAS_ICON; @@ -4149,15 +4159,15 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int but->drawflag |= UI_BUT_ICON_LEFT; but->block_create_func = func; - ui_check_but(but); + ui_but_update(but); return but; } uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *spoin, const char *tip) { - uiBut *but = ui_def_but(block, KEYEVT | UI_BUT_POIN_SHORT, retval, str, x, y, width, height, spoin, 0.0, 0.0, 0.0, 0.0, tip); - ui_check_but(but); + uiBut *but = ui_def_but(block, UI_BTYPE_KEY_EVENT | UI_BUT_POIN_SHORT, retval, str, x, y, width, height, spoin, 0.0, 0.0, 0.0, 0.0, tip); + ui_but_update(but); return but; } @@ -4165,25 +4175,25 @@ uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y /* modkeypoin will be set to KM_SHIFT, KM_ALT, KM_CTRL, KM_OSKEY bits */ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *keypoin, short *modkeypoin, const char *tip) { - uiBut *but = ui_def_but(block, HOTKEYEVT | UI_BUT_POIN_SHORT, retval, str, x, y, width, height, keypoin, 0.0, 0.0, 0.0, 0.0, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_HOTKEY_EVENT | UI_BUT_POIN_SHORT, retval, str, x, y, width, height, keypoin, 0.0, 0.0, 0.0, 0.0, tip); but->modifier_key = *modkeypoin; - ui_check_but(but); + ui_but_update(but); return but; } -/* arg is pointer to string/name, use uiButSetSearchFunc() below to make this work */ +/* arg is pointer to string/name, use UI_but_func_search_set() below to make this work */ /* here a1 and a2, if set, control thumbnail preview rows/cols */ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip) { - uiBut *but = ui_def_but(block, SEARCH_MENU, retval, "", x, y, width, height, arg, 0.0, maxlen, a1, a2, tip); + uiBut *but = ui_def_but(block, UI_BTYPE_SEARCH_MENU, retval, "", x, y, width, height, arg, 0.0, maxlen, a1, a2, tip); but->icon = (BIFIconID) icon; but->flag |= UI_HAS_ICON; but->drawflag |= UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT; - ui_check_but(but); + ui_but_update(but); return but; } @@ -4191,18 +4201,18 @@ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxle /* arg is user value, searchfunc and handlefunc both get it as arg */ /* if active set, button opens with this item visible and selected */ -void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg, uiButHandleFunc bfunc, void *active) +void UI_but_func_search_set(uiBut *but, uiButSearchFunc sfunc, void *arg, uiButHandleFunc bfunc, void *active) { but->search_func = sfunc; but->search_arg = arg; - uiButSetFunc(but, bfunc, arg, active); + UI_but_func_set(but, bfunc, arg, active); /* search buttons show red-alert if item doesn't exist, not for menus */ if (0 == (but->block->flag & UI_BLOCK_LOOP)) { /* skip empty buttons, not all buttons need input, we only show invalid */ if (but->drawstr[0]) - ui_but_search_test(but); + ui_but_search_refresh(but); } } @@ -4221,7 +4231,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c __func__, ot->idname, RNA_property_identifier(prop)); } else { - PointerRNA *ptr = uiButGetOperatorPtrRNA(but); /* Will create it if needed! */ + PointerRNA *ptr = UI_but_operator_ptr_get(but); /* Will create it if needed! */ EnumPropertyItem *item, *item_array; bool do_free; @@ -4230,7 +4240,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c for (item = item_array; item->identifier; item++) { /* note: need to give the index rather than the identifier because the enum can be freed */ if (BLI_strcasestr(item->name, str)) { - if (false == uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0)) + if (false == UI_search_item_add(items, item->name, SET_INT_IN_POINTER(item->value), 0)) break; } } @@ -4243,7 +4253,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c static void operator_enum_call_cb(struct bContext *UNUSED(C), void *but, void *arg2) { wmOperatorType *ot = ((uiBut *)but)->optype; - PointerRNA *opptr = uiButGetOperatorPtrRNA(but); /* Will create it if needed! */ + PointerRNA *opptr = UI_but_operator_ptr_get(but); /* Will create it if needed! */ if (ot) { if (ot->prop) { @@ -4268,13 +4278,13 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block, wmOperatorType *ot, IDProperty *prope uiBut *but; but = uiDefSearchBut(block, arg, retval, icon, maxlen, x, y, width, height, a1, a2, tip); - uiButSetSearchFunc(but, operator_enum_search_cb, but, operator_enum_call_cb, NULL); + UI_but_func_search_set(but, operator_enum_search_cb, but, operator_enum_call_cb, NULL); but->optype = ot; but->opcontext = WM_OP_EXEC_DEFAULT; if (properties) { - PointerRNA *ptr = uiButGetOperatorPtrRNA(but); + PointerRNA *ptr = UI_but_operator_ptr_get(but); /* Copy idproperties. */ ptr->data = IDP_CopyProperty(properties); } @@ -4285,7 +4295,7 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block, wmOperatorType *ot, IDProperty *prope /* push a new event onto event queue to activate the given button * (usually a text-field) upon entering a popup */ -void uiButSetFocusOnEnter(wmWindow *win, uiBut *but) +void UI_but_focus_on_enter_event(wmWindow *win, uiBut *but) { wmEvent event; @@ -4299,7 +4309,7 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but) wm_event_add(win, &event); } -void uiButGetStrInfo(bContext *C, uiBut *but, ...) +void UI_but_string_info_get(bContext *C, uiBut *but, ...) { va_list args; uiStringInfo *si; @@ -4337,8 +4347,8 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...) tmp = BLI_strdup(RNA_struct_identifier(but->rnapoin.type)); else if (but->optype) tmp = BLI_strdup(but->optype->idname); - else if (ELEM(but->type, MENU, PULLDOWN)) { - MenuType *mt = uiButGetMenuType(but); + else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) { + MenuType *mt = UI_but_menutype_get(but); if (mt) tmp = BLI_strdup(mt->idname); } @@ -4362,8 +4372,8 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...) tmp = BLI_strdup(t); } } - else if (ELEM(but->type, MENU, PULLDOWN)) { - MenuType *mt = uiButGetMenuType(but); + else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) { + MenuType *mt = UI_but_menutype_get(but); if (mt) { /* not all menus are from python */ if (mt->ext.srna) { @@ -4384,8 +4394,8 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...) _tmp = RNA_property_translation_context(but->rnaprop); else if (but->optype) _tmp = RNA_struct_translation_context(but->optype->srna); - else if (ELEM(but->type, MENU, PULLDOWN)) { - MenuType *mt = uiButGetMenuType(but); + else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) { + MenuType *mt = UI_but_menutype_get(but); if (mt) _tmp = RNA_struct_translation_context(mt->ext.srna); } @@ -4404,10 +4414,10 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...) /* enum property */ ptr = &but->rnapoin; prop = but->rnaprop; - value = (but->type == ROW) ? (int)but->hardmax : (int)ui_get_but_val(but); + value = (but->type == UI_BTYPE_ROW) ? (int)but->hardmax : (int)ui_but_value_get(but); } else if (but->optype) { - PointerRNA *opptr = uiButGetOperatorPtrRNA(but); + PointerRNA *opptr = UI_but_operator_ptr_get(but); wmOperatorType *ot = but->optype; /* if the default property of the operator is enum and it is set, @@ -4492,6 +4502,6 @@ void UI_reinit_font(void) void UI_exit(void) { ui_resources_free(); - ui_button_clipboard_free(); + ui_but_clipboard_free(); } diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 48e54270e95..43899f906ad 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -227,54 +227,54 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) void ui_but_anim_insert_keyframe(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_keyframe_insert_button", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_delete_keyframe(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_keyframe_delete_button", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_clear_keyframe(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_keyframe_clear_button", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_add_driver(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_driver_button_add", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_remove_driver(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_driver_button_remove", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_copy_driver(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_copy_driver_button", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_paste_driver(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_paste_driver_button", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_add_keyingset(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_keyingset_button_add", WM_OP_INVOKE_DEFAULT, NULL); } void ui_but_anim_remove_keyingset(bContext *C) { - /* this operator calls uiContextActiveProperty */ + /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_keyingset_button_remove", WM_OP_INVOKE_DEFAULT, NULL); } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 235d7652539..4dd952f0753 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -62,7 +62,7 @@ static int roundboxtype = UI_CNR_ALL; -void uiSetRoundBox(int type) +void UI_draw_roundbox_corner_set(int type) { /* Not sure the roundbox function is the best place to change this * if this is undone, its not that big a deal, only makes curves edges @@ -71,12 +71,12 @@ void uiSetRoundBox(int type) } -int uiGetRoundBox(void) +int UI_draw_roundbox_corner_get(void) { return roundboxtype; } -void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float rad) +void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, float maxy, float rad) { float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; @@ -152,7 +152,9 @@ static void round_box_shade_col(const float col1[3], float const col2[3], const /* linear horizontal shade within button or in outline */ /* view2d scrollers use it */ -void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown) +void UI_draw_roundbox_shade_x( + int mode, float minx, float miny, float maxx, float maxy, + float rad, float shadetop, float shadedown) { float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; @@ -260,8 +262,9 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* linear vertical shade within button or in outline */ /* view2d scrollers use it */ -void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, - float rad, float shadeLeft, float shadeRight) +void UI_draw_roundbox_shade_y( + int mode, float minx, float miny, float maxx, float maxy, + float rad, float shadeLeft, float shadeRight) { float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; @@ -365,7 +368,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* plain antialiased unfilled rectangle */ -void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad) +void UI_draw_roundbox_unfilled(float minx, float miny, float maxx, float maxy, float rad) { float color[4]; @@ -380,14 +383,14 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); } /* (old, used in outliner) plain antialiased filled box */ -void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad) +void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad) { ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad, roundboxtype & UI_RB_ALPHA); } @@ -450,8 +453,8 @@ static void draw_scope_end(const rctf *rect, GLint *scissor) /* outline */ glColor4f(0.f, 0.f, 0.f, 0.5f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f); } static void histogram_draw_one(float r, float g, float b, float alpha, @@ -535,8 +538,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, histogram can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); @@ -622,8 +625,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, waveform can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); @@ -841,8 +844,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, hvectorscope can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); @@ -1067,7 +1070,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti if (coba == NULL) return; if (but->block->color_profile) - display = ui_block_display_get(but->block); + display = ui_block_cm_display_get(but->block); x1 = rect->xmin; sizex = rect->xmax - x1; @@ -1158,7 +1161,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti } } -void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect) +void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) { static GLuint displist = 0; int a, old[8]; @@ -1171,8 +1174,8 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect) /* backdrop */ glColor3ubv((unsigned char *)wcol->inner); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); /* sphere color */ glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn); @@ -1189,7 +1192,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect) glEnable(GL_LIGHT7); glEnable(GL_LIGHTING); - ui_get_but_vectorf(but, dir); + ui_but_v3_get(but, dir); dir[3] = 0.0f; /* glLightfv needs 4 args, 0.0 is sun */ glLightfv(GL_LIGHT7, GL_POSITION, dir); @@ -1511,8 +1514,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc if (scopes->track_disabled) { glColor4f(0.7f, 0.3f, 0.3f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); ok = 1; } @@ -1559,8 +1562,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc if (scopes->use_track_mask) { glColor4f(0.0f, 0.0f, 0.0f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); } glaDrawPixelsSafe(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, @@ -1600,8 +1603,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc if (!ok) { glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); } /* outline */ @@ -1717,7 +1720,7 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s glShadeModel(GL_FLAT); } -void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) +void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) { /* accumulated outline boxes to make shade not linear, is more pleasant */ ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8); @@ -1727,7 +1730,7 @@ void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, fl } -void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select)) +void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select)) { int i; float rad; @@ -1758,13 +1761,13 @@ void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int glColor4f(0.0f, 0.0f, 0.0f, calpha); calpha += dalpha; - uiDrawBox(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a); + UI_draw_roundbox_gl_mode(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a); } /* outline emphasis */ glEnable(GL_LINE_SMOOTH); glColor4ub(0, 0, 0, 100); - uiDrawBox(GL_LINE_LOOP, rct->xmin - 0.5f, rct->ymin - 0.5f, rct->xmax + 0.5f, rct->ymax + 0.5f, radius + 0.5f); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rct->xmin - 0.5f, rct->ymin - 0.5f, rct->xmax + 0.5f, rct->ymax + 0.5f, radius + 0.5f); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 5b7915e20c5..7fed3772389 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -91,7 +91,7 @@ static bool eyedropper_init(bContext *C, wmOperator *op) op->customdata = eye = MEM_callocN(sizeof(Eyedropper), "Eyedropper"); - uiContextActiveProperty(C, &eye->ptr, &eye->prop, &eye->index); + UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index); if ((eye->ptr.data == NULL) || (eye->prop == NULL) || @@ -381,7 +381,7 @@ static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg return; } - width = UI_GetStringWidth(name); + width = UI_fontstyle_string_width(name); x = x - ar->winrct.xmin; y = y - ar->winrct.ymin; @@ -389,11 +389,11 @@ static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg glColor4ub(0, 0, 0, 50); - uiSetRoundBox(UI_CNR_ALL | UI_RB_ALPHA); - uiRoundBox(x, y, x + width + 8, y + 15, 4); + UI_draw_roundbox_corner_set(UI_CNR_ALL | UI_RB_ALPHA); + UI_draw_roundbox(x, y, x + width + 8, y + 15, 4); glColor4ub(255, 255, 255, 255); - UI_DrawString(x + 4, y + 4, name); + UI_draw_string(x + 4, y + 4, name); } @@ -411,7 +411,7 @@ static int datadropper_init(bContext *C, wmOperator *op) op->customdata = ddr = MEM_callocN(sizeof(DataDropper), "DataDropper"); - uiContextActiveProperty(C, &ddr->ptr, &ddr->prop, &index_dummy); + UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy); if ((ddr->ptr.data == NULL) || (ddr->prop == NULL) || diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 0e3b8e8da63..992c72cacf8 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -104,8 +104,8 @@ #define UI_MAX_PASSWORD_STR 128 /* proto */ -static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to); -static void ui_add_link(bContext *C, uiBut *from, uiBut *to); +static void ui_but_smart_controller_add(bContext *C, uiBut *from, uiBut *to); +static void ui_but_link_add(bContext *C, uiBut *from, uiBut *to); static int ui_do_but_EXIT(bContext *C, uiBut *but, struct uiHandleButtonData *data, const wmEvent *event); #ifdef USE_KEYNAV_LIMIT @@ -252,16 +252,16 @@ typedef struct uiHandleButtonData { CBData *dragcbd; #ifdef USE_CONT_MOUSE_CORRECT - /* when ungrabbing buttons which are #ui_is_a_warp_but(), we may want to position them + /* when ungrabbing buttons which are #ui_but_is_cursor_warp(), we may want to position them * FLT_MAX signifies do-nothing, use #ui_block_to_window_fl() to get this into a usable space */ float ungrab_mval[2]; #endif - /* menu open (watch uiFreeActiveButtons) */ + /* menu open (watch UI_screen_free_active_but) */ uiPopupBlockHandle *menu; int menuretval; - /* search box (watch uiFreeActiveButtons) */ + /* search box (watch UI_screen_free_active_but) */ ARegion *searchbox; #ifdef USE_KEYNAV_LIMIT struct uiKeyNavLock searchbox_keynav_state; @@ -313,9 +313,9 @@ typedef struct uiAfterFunc { -static bool ui_is_but_interactive(const uiBut *but, const bool labeledit); +static bool ui_but_is_interactive(const uiBut *but, const bool labeledit); static bool ui_but_contains_pt(uiBut *but, float mx, float my); -static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y); +static bool ui_but_contains_point_px(ARegion *ar, uiBut *but, int x, int y); static uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bool labeledit); static uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event); static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type); @@ -390,7 +390,7 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val) bool ui_but_is_editable(const uiBut *but) { - return !ELEM(but->type, LABEL, SEPR, SEPRLINE, ROUNDBOX, LISTBOX, PROGRESSBAR); + return !ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR); } static uiBut *ui_but_prev(uiBut *but) @@ -435,10 +435,10 @@ static uiBut *ui_but_last(uiBlock *block) return NULL; } -static bool ui_is_a_warp_but(uiBut *but) +static bool ui_but_is_cursor_warp(uiBut *but) { if (U.uiflag & USER_CONTINUOUS_MOUSE) { - if (ELEM(but->type, NUM, NUMSLI, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) { + if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_HSVCIRCLE, UI_BTYPE_TRACK_PREVIEW, UI_BTYPE_HSVCUBE, UI_BTYPE_CURVE)) { return true; } } @@ -464,7 +464,7 @@ static void ui_mouse_scale_warp(uiHandleButtonData *data, } /* file selectors are exempt from utf-8 checks */ -bool ui_is_but_utf8(const uiBut *but) +bool ui_but_is_utf8(const uiBut *but) { if (but->rnaprop) { const int subtype = RNA_property_subtype(but->rnaprop); @@ -523,7 +523,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but) * with these functions removing the buttons we are working with */ if (but->func || but->funcN || block->handle_func || but->rename_func || - (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) + (but->type == UI_BTYPE_BUT_MENU && block->butm_func) || but->optype || but->rnaprop) { after = ui_afterfunc_new(); @@ -548,7 +548,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but) after->handle_func_arg = block->handle_func_arg; after->retval = but->retval; - if (but->type == BUTM) { + if (but->type == UI_BTYPE_BUT_MENU) { after->butm_func = block->butm_func; after->butm_func_arg = block->butm_func_arg; after->a2 = but->a2; @@ -570,8 +570,8 @@ static void ui_apply_but_func(bContext *C, uiBut *but) } } -/* typically call ui_apply_undo(), ui_apply_autokey() */ -static void ui_apply_undo(uiBut *but) +/* typically call ui_apply_but_undo(), ui_apply_but_autokey() */ +static void ui_apply_but_undo(uiBut *but) { uiAfterFunc *after; @@ -579,8 +579,8 @@ static void ui_apply_undo(uiBut *but) const char *str = NULL; /* define which string to use for undo */ - if (ELEM(but->type, LINK, INLINK)) str = "Add button link"; - else if (but->type == MENU) str = but->drawstr; + if (ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) str = "Add button link"; + else if (but->type == UI_BTYPE_MENU) str = but->drawstr; else if (but->drawstr[0]) str = but->drawstr; else str = but->tip; @@ -595,7 +595,7 @@ static void ui_apply_undo(uiBut *but) } } -static void ui_apply_autokey(bContext *C, uiBut *but) +static void ui_apply_but_autokey(bContext *C, uiBut *but) { Scene *scene = CTX_data_scene(C); @@ -689,7 +689,7 @@ static void ui_apply_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data) { - ui_set_but_val(but, but->hardmin); + ui_but_value_set(but, but->hardmin); ui_apply_but_func(C, but); data->retval = but->retval; @@ -698,10 +698,10 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data) { - if (but->type == MENU) - ui_set_but_val(but, data->value); + if (but->type == UI_BTYPE_MENU) + ui_but_value_set(but, data->value); - ui_check_but(but); + ui_but_update(but); ui_apply_but_func(C, but); data->retval = but->retval; data->applied = true; @@ -712,7 +712,7 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) double value; int w, lvalue, push; - value = ui_get_but_val(but); + value = ui_but_value_get(but); lvalue = (int)value; if (but->bit) { @@ -720,17 +720,17 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) if (w) lvalue = UI_BITBUT_CLR(lvalue, but->bitnr); else lvalue = UI_BITBUT_SET(lvalue, but->bitnr); - ui_set_but_val(but, (double)lvalue); - if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but); + ui_but_value_set(but, (double)lvalue); + if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == UI_BTYPE_ICON_TOGGLE_N) ui_but_update(but); } else { if (value == 0.0) push = 1; else push = 0; - if (ELEM(but->type, TOGN, ICONTOGN, OPTIONN)) push = !push; - ui_set_but_val(but, (double)push); - if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but); + if (ELEM(but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N)) push = !push; + ui_but_value_set(but, (double)push); + if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == UI_BTYPE_ICON_TOGGLE_N) ui_but_update(but); } ui_apply_but_func(C, but); @@ -743,14 +743,14 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleBu { uiBut *bt; - ui_set_but_val(but, but->hardmax); + ui_but_value_set(but, but->hardmax); ui_apply_but_func(C, but); /* states of other row buttons */ for (bt = block->buttons.first; bt; bt = bt->next) - if (bt != but && bt->poin == but->poin && ELEM(bt->type, ROW, LISTROW)) - ui_check_but(bt); + if (bt != but && bt->poin == but->poin && ELEM(bt->type, UI_BTYPE_ROW, UI_BTYPE_LISTROW)) + ui_but_update(bt); data->retval = but->retval; data->applied = true; @@ -761,8 +761,8 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data) if (!data->str) return; - ui_set_but_string(C, but, data->str); - ui_check_but(but); + ui_but_string_set(C, but, data->str); + ui_but_update(but); /* give butfunc the original text too */ /* feature used for bone renaming, channels, etc */ @@ -778,8 +778,8 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data) { if (data->str) { - if (ui_set_but_string(C, but, data->str)) { - data->value = ui_get_but_val(but); + if (ui_but_string_set(C, but, data->str)) { + data->value = ui_but_value_get(but); } else { data->cancel = true; @@ -787,9 +787,9 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data) } } else - ui_set_but_val(but, data->value); + ui_but_value_set(but, data->value); - ui_check_but(but); + ui_but_update(but); ui_apply_but_func(C, but); data->retval = but->retval; @@ -798,8 +798,8 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_apply_but_VEC(bContext *C, uiBut *but, uiHandleButtonData *data) { - ui_set_but_vectorf(but, data->vec); - ui_check_but(but); + ui_but_v3_set(but, data->vec); + ui_but_update(but); ui_apply_but_func(C, but); data->retval = but->retval; @@ -836,7 +836,7 @@ static void ui_multibut_add(uiHandleButtonData *data, uiBut *but) mbut_state = MEM_callocN(sizeof(*mbut_state), __func__); mbut_state->but = but; - mbut_state->origvalue = ui_get_but_val(but); + mbut_state->origvalue = ui_but_value_get(but); BLI_linklist_prepend(&data->multi_data.mbuts, mbut_state); @@ -868,7 +868,7 @@ static void ui_multibut_restore(uiHandleButtonData *data, uiBlock *block) if (but->flag & UI_BUT_DRAG_MULTI) { uiButMultiState *mbut_state = ui_multibut_lookup(data, but); if (mbut_state) { - ui_set_but_val(but, mbut_state->origvalue); + ui_but_value_set(but, mbut_state->origvalue); } } } @@ -915,11 +915,11 @@ static bool ui_multibut_states_tag(uiBut *but_active, uiHandleButtonData *data, drag_prev = true; } - if (ui_is_but_interactive(but, false)) { + if (ui_but_is_interactive(but, false)) { /* drag checks */ if (but_active != but) { - if (ui_is_but_compatible(but_active, but)) { + if (ui_but_is_compatible(but_active, but)) { BLI_assert(but->active == NULL); @@ -981,13 +981,13 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl if (mbut_state) { void *active_back; - ui_button_execute_begin(C, ar, but, &active_back); + ui_but_execute_begin(C, ar, but, &active_back); BLI_assert(active_back == NULL); /* no need to check 'data->state' here */ if (data->str) { /* entering text (set all) */ but->active->value = data->value; - ui_set_but_string(C, but, data->str); + ui_but_string_set(C, but, data->str); } else { /* dragging (use delta) */ @@ -1001,7 +1001,7 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl /* clamp based on soft limits, see: T40154 */ CLAMP(but->active->value, (double)but->softmin, (double)but->softmax); } - ui_button_execute_end(C, ar, but, active_back); + ui_but_execute_end(C, ar, but, active_back); } else { /* highly unlikely */ @@ -1050,18 +1050,18 @@ static bool ui_drag_toggle_set_xy_xy(bContext *C, ARegion *ar, const bool is_set for (but = block->buttons.first; but; but = but->next) { /* Note: ctrl is always true here because (at least for now) we always want to consider text control * in this case, even when not embossed. */ - if (ui_is_but_interactive(but, true)) { + if (ui_but_is_interactive(but, true)) { if (BLI_rctf_isect_segment(&but->rect, xy_a_block, xy_b_block)) { /* execute the button */ - if (ui_is_but_bool(but) && but->type == but_type_start) { + if (ui_but_is_bool(but) && but->type == but_type_start) { /* is it pressed? */ - bool is_set_but = ui_is_but_push(but); - BLI_assert(ui_is_but_bool(but) == true); + bool is_set_but = ui_but_is_pushed(but); + BLI_assert(ui_but_is_bool(but) == true); if (is_set_but != is_set) { - uiButExecute(C, but); + UI_but_execute(C, but); if (do_check) { - ui_check_but(but); + ui_but_update(but); } changed = true; } @@ -1164,7 +1164,7 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void uiBut *but = ui_but_find_mouse_over_ex(ar, drag_info->xy_init[0], drag_info->xy_init[1], true); if (but) { - ui_apply_undo(but); + ui_apply_but_undo(but); } WM_event_remove_ui_handler(&win->modalhandlers, @@ -1181,9 +1181,9 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void } } -static bool ui_is_but_drag_toggle(const uiBut *but) +static bool ui_but_is_drag_toggle(const uiBut *but) { - return ((ui_is_but_bool(but) == true) && + return ((ui_but_is_bool(but) == true) && /* menu check is importnt so the button dragged over isn't removed instantly */ (ui_block_is_menu(but->block) == false)); } @@ -1191,7 +1191,7 @@ static bool ui_is_but_drag_toggle(const uiBut *but) #endif /* USE_DRAG_TOGGLE */ -static bool ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, const wmEvent *event) +static bool ui_but_contains_point_px_icon(uiBut *but, ARegion *ar, const wmEvent *event) { rcti rect; int x = event->x, y = event->y; @@ -1200,7 +1200,7 @@ static bool ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, const wmEvent *eve BLI_rcti_rctf_copy(&rect, &but->rect); - if (but->imb || but->type == COLOR) { + if (but->imb || but->type == UI_BTYPE_COLOR) { /* use button size itself */ } else if (but->drawflag & UI_BUT_ICON_LEFT) { @@ -1215,7 +1215,7 @@ static bool ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, const wmEvent *eve return BLI_rcti_isect_pt(&rect, x, y); } -static bool ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event) +static bool ui_but_drag_init(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { /* prevent other WM gestures to start while we try to drag */ WM_gestures_remove(C); @@ -1225,15 +1225,15 @@ static bool ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, button_activate_state(C, but, BUTTON_STATE_EXIT); data->cancel = true; #ifdef USE_DRAG_TOGGLE - if (ui_is_but_bool(but)) { + if (ui_but_is_bool(but)) { uiDragToggleHandle *drag_info = MEM_callocN(sizeof(*drag_info), __func__); ARegion *ar_prev; /* call here because regular mouse-up event wont run, * typically 'button_activate_exit()' handles this */ - ui_apply_autokey(C, but); + ui_apply_but_autokey(C, but); - drag_info->is_set = ui_is_but_push(but); + drag_info->is_set = ui_but_is_pushed(but); drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect); drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect); drag_info->but_type_start = but->type; @@ -1253,7 +1253,7 @@ static bool ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, } else #endif - if (but->type == COLOR) { + if (but->type == UI_BTYPE_COLOR) { bool valid = false; uiDragColorHandle *drag_info = MEM_callocN(sizeof(*drag_info), __func__); @@ -1288,7 +1288,7 @@ static bool ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, else { wmDrag *drag; - drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but), WM_DRAG_NOP); + drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_but_value_get(but), WM_DRAG_NOP); if (but->imb) WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)); } @@ -1300,7 +1300,7 @@ static bool ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, /* ********************** linklines *********************** */ -static void ui_delete_active_linkline(uiBlock *block) +static void ui_linkline_remove_active(uiBlock *block) { uiBut *but; uiLink *link; @@ -1308,7 +1308,7 @@ static void ui_delete_active_linkline(uiBlock *block) int a, b; for (but = block->buttons.first; but; but = but->next) { - if (but->type == LINK && but->link) { + if (but->type == UI_BTYPE_LINK && but->link) { for (line = but->link->lines.first; line; line = nline) { nline = line->next; @@ -1349,7 +1349,7 @@ static void ui_delete_active_linkline(uiBlock *block) } -static uiLinkLine *ui_is_a_link(uiBut *from, uiBut *to) +static uiLinkLine *ui_but_find_link(uiBut *from, uiBut *to) { uiLinkLine *line; uiLink *link; @@ -1367,7 +1367,7 @@ static uiLinkLine *ui_is_a_link(uiBut *from, uiBut *to) /* XXX BAD BAD HACK, fixme later **************** */ /* Try to add an AND Controller between the sensor and the actuator logic bricks and to connect them all */ -static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to) +static void ui_but_smart_controller_add(bContext *C, uiBut *from, uiBut *to) { Object *ob = NULL; bSensor *sens_iter; @@ -1422,15 +1422,15 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to) /* (4) link the sensor->controller->actuator */ tmp_but = MEM_callocN(sizeof(uiBut), "uiBut"); - uiSetButLink(tmp_but, (void **)&cont, (void ***)&(cont->links), &(cont->totlinks), from->link->tocode, (int)to->hardmin); + UI_but_link_set(tmp_but, (void **)&cont, (void ***)&(cont->links), &(cont->totlinks), from->link->tocode, (int)to->hardmin); tmp_but->hardmin = from->link->tocode; tmp_but->poin = (char *)cont; - tmp_but->type = INLINK; - ui_add_link(C, from, tmp_but); + tmp_but->type = UI_BTYPE_INLINK; + ui_but_link_add(C, from, tmp_but); - tmp_but->type = LINK; - ui_add_link(C, tmp_but, to); + tmp_but->type = UI_BTYPE_LINK; + ui_but_link_add(C, tmp_but, to); /* (5) garbage collection */ MEM_freeN(tmp_but->link); @@ -1439,7 +1439,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to) WM_operator_properties_free(&props_ptr); } -static void ui_add_link(bContext *C, uiBut *from, uiBut *to) +static void ui_but_link_add(bContext *C, uiBut *from, uiBut *to) { /* in 'from' we have to add a link to 'to' */ uiLink *link; @@ -1447,22 +1447,22 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to) void **oldppoin; int a; - if ((line = ui_is_a_link(from, to))) { + if ((line = ui_but_find_link(from, to))) { line->flag |= UI_SELECT; - ui_delete_active_linkline(from->block); + ui_linkline_remove_active(from->block); return; } - if (from->type == INLINK && to->type == INLINK) { + if (from->type == UI_BTYPE_INLINK && to->type == UI_BTYPE_INLINK) { return; } - else if (from->type == LINK && to->type == INLINK) { + else if (from->type == UI_BTYPE_LINK && to->type == UI_BTYPE_INLINK) { if (from->link->tocode != (int)to->hardmin) { - ui_add_smart_controller(C, from, to); + ui_but_smart_controller_add(C, from, to); return; } } - else if (from->type == INLINK && to->type == LINK) { + else if (from->type == UI_BTYPE_INLINK && to->type == UI_BTYPE_LINK) { if (to->link->tocode == (int)from->hardmin) { return; } @@ -1497,15 +1497,15 @@ static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data) uiBut *bt; for (bt = but->block->buttons.first; bt; bt = bt->next) { - if (ui_mouse_inside_button(ar, bt, but->linkto[0] + ar->winrct.xmin, but->linkto[1] + ar->winrct.ymin) ) + if (ui_but_contains_point_px(ar, bt, but->linkto[0] + ar->winrct.xmin, but->linkto[1] + ar->winrct.ymin) ) break; } if (bt && bt != but) { - if (!ELEM(bt->type, LINK, INLINK) || !ELEM(but->type, LINK, INLINK)) + if (!ELEM(bt->type, UI_BTYPE_LINK, UI_BTYPE_INLINK) || !ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) return; - if (but->type == LINK) ui_add_link(C, but, bt); - else ui_add_link(C, bt, but); + if (but->type == UI_BTYPE_LINK) ui_but_link_add(C, but, bt); + else ui_but_link_add(C, bt, but); ui_apply_but_func(C, but); data->retval = but->retval; @@ -1542,7 +1542,7 @@ static void ui_apply_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDat } -static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const bool interactive) +static void ui_apply_but(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const bool interactive) { char *editstr; double *editval; @@ -1591,76 +1591,76 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut /* handle different types */ switch (but->type) { - case BUT: + case UI_BTYPE_BUT: ui_apply_but_BUT(C, but, data); break; - case TEX: - case SEARCH_MENU_UNLINK: - case SEARCH_MENU: + case UI_BTYPE_TEXT: + case UI_BTYPE_SEARCH_MENU_UNLINK: + case UI_BTYPE_SEARCH_MENU: ui_apply_but_TEX(C, but, data); break; - case TOGBUT: - case TOG: - case ICONTOG: - case ICONTOGN: - case TOGN: - case OPTION: - case OPTIONN: + case UI_BTYPE_BUT_TOGGLE: + case UI_BTYPE_TOGGLE: + case UI_BTYPE_TOGGLE_N: + case UI_BTYPE_ICON_TOGGLE: + case UI_BTYPE_ICON_TOGGLE_N: + case UI_BTYPE_CHECKBOX: + case UI_BTYPE_CHECKBOX_N: ui_apply_but_TOG(C, but, data); break; - case ROW: - case LISTROW: + case UI_BTYPE_ROW: + case UI_BTYPE_LISTROW: ui_apply_but_ROW(C, block, but, data); break; - case SCROLL: - case GRIP: - case NUM: - case NUMSLI: + case UI_BTYPE_SCROLL: + case UI_BTYPE_GRIP: + case UI_BTYPE_NUM: + case UI_BTYPE_NUM_SLIDER: ui_apply_but_NUM(C, but, data); break; - case MENU: - case BLOCK: - case PULLDOWN: + case UI_BTYPE_MENU: + case UI_BTYPE_BLOCK: + case UI_BTYPE_PULLDOWN: ui_apply_but_BLOCK(C, but, data); break; - case COLOR: + case UI_BTYPE_COLOR: if (data->cancel) ui_apply_but_VEC(C, but, data); else ui_apply_but_BLOCK(C, but, data); break; - case BUTM: + case UI_BTYPE_BUT_MENU: ui_apply_but_BUTM(C, but, data); break; - case BUT_NORMAL: - case HSVCUBE: - case HSVCIRCLE: + case UI_BTYPE_UNITVEC: + case UI_BTYPE_HSVCUBE: + case UI_BTYPE_HSVCIRCLE: ui_apply_but_VEC(C, but, data); break; - case BUT_COLORBAND: + case UI_BTYPE_COLORBAND: ui_apply_but_COLORBAND(C, but, data); break; - case BUT_CURVE: + case UI_BTYPE_CURVE: ui_apply_but_CURVE(C, but, data); break; - case KEYEVT: - case HOTKEYEVT: + case UI_BTYPE_KEY_EVENT: + case UI_BTYPE_HOTKEY_EVENT: ui_apply_but_BUT(C, but, data); break; - case LINK: - case INLINK: + case UI_BTYPE_LINK: + case UI_BTYPE_INLINK: ui_apply_but_LINK(C, but, data); break; - case BUT_IMAGE: + case UI_BTYPE_IMAGE: ui_apply_but_IMAGE(C, but, data); break; - case HISTOGRAM: + case UI_BTYPE_HISTOGRAM: ui_apply_but_HISTOGRAM(C, but, data); break; - case WAVEFORM: + case UI_BTYPE_WAVEFORM: ui_apply_but_WAVEFORM(C, but, data); break; - case TRACKPREVIEW: + case UI_BTYPE_TRACK_PREVIEW: ui_apply_but_TRACKPREVIEW(C, but, data); break; default: @@ -1698,13 +1698,13 @@ static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleB for (wmd = drags->first; wmd; wmd = wmd->next) { if (wmd->type == WM_DRAG_ID) { /* align these types with UI_but_active_drop_name */ - 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)) { ID *id = (ID *)wmd->poin; button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); BLI_strncpy(data->str, id->name + 2, data->maxlen); - if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { but->changed = true; ui_searchbox_update(C, data->searchbox, but, true); } @@ -1751,7 +1751,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, /* numeric value */ - if (ELEM(but->type, NUM, NUMSLI)) { + if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { if (but->poin == NULL && but->rnapoin.data == NULL) { /* pass */ @@ -1760,7 +1760,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, /* Get many decimal places, then strip trailing zeros. * note: too high values start to give strange results (6 or so is ok) */ char buf_copy[UI_MAX_DRAW_STR]; - ui_get_but_string_ex(but, buf_copy, sizeof(buf_copy), 6); + ui_but_string_get_ex(but, buf_copy, sizeof(buf_copy), 6); BLI_str_rstrip_float_zero(buf_copy, '\0'); WM_clipboard_text_set(buf_copy, 0); @@ -1768,17 +1768,17 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, else { double val; - if (ui_set_but_string_eval_num(C, but, buf_paste, &val)) { + if (ui_but_string_set_eval_num(C, but, buf_paste, &val)) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); data->value = val; - ui_set_but_string(C, but, buf_paste); + ui_but_string_set(C, but, buf_paste); button_activate_state(C, but, BUTTON_STATE_EXIT); } } } /* NORMAL button */ - else if (but->type == BUT_NORMAL) { + else if (but->type == UI_BTYPE_UNITVEC) { float xyz[3]; if (but->poin == NULL && but->rnapoin.data == NULL) { @@ -1786,7 +1786,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } else if (mode == 'c') { char buf_copy[UI_MAX_DRAW_STR]; - ui_get_but_vectorf(but, xyz); + ui_but_v3_get(but, xyz); BLI_snprintf(buf_copy, sizeof(buf_copy), "[%f, %f, %f]", xyz[0], xyz[1], xyz[2]); WM_clipboard_text_set(buf_copy, 0); } @@ -1797,7 +1797,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, xyz[2] = 1.0; } button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); - ui_set_but_vectorf(but, xyz); + ui_but_v3_set(but, xyz); button_activate_state(C, but, BUTTON_STATE_EXIT); } } @@ -1805,7 +1805,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, /* RGB triple */ - else if (but->type == COLOR) { + else if (but->type == UI_BTYPE_COLOR) { float rgba[4]; if (but->poin == NULL && but->rnapoin.data == NULL) { @@ -1819,7 +1819,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, else rgba[3] = 1.0f; - ui_get_but_vectorf(but, rgba); + ui_but_v3_get(but, rgba); /* convert to linear color to do compatible copy between gamma and non-gamma */ if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) srgb_to_linearrgb_v3_v3(rgba, rgba); @@ -1835,7 +1835,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, linearrgb_to_srgb_v3_v3(rgba, rgba); button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); - ui_set_but_vectorf(but, rgba); + ui_but_v3_set(but, rgba); if (but->rnaprop && RNA_property_array_length(&but->rnapoin, but->rnaprop) == 4) RNA_property_float_set_index(&but->rnapoin, but->rnaprop, 3, rgba[3]); @@ -1845,7 +1845,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } /* text/string and ID data */ - else if (ELEM(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + else if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { uiHandleButtonData *active_data = but->active; if (but->poin == NULL && but->rnapoin.data == NULL) { @@ -1860,12 +1860,12 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, else { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); - if (ui_is_but_utf8(but)) + if (ui_but_is_utf8(but)) BLI_strncpy_utf8(active_data->str, buf_paste, active_data->maxlen); else BLI_strncpy(active_data->str, buf_paste, active_data->maxlen); - if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { /* else uiSearchboxData.active member is not updated [#26856] */ but->changed = true; ui_searchbox_update(C, data->searchbox, but, true); @@ -1874,7 +1874,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } } /* colorband (not supported by system clipboard) */ - else if (but->type == BUT_COLORBAND) { + else if (but->type == UI_BTYPE_COLORBAND) { if (mode == 'c') { if (but->poin != NULL) { memcpy(&but_copypaste_coba, but->poin, sizeof(ColorBand)); @@ -1891,7 +1891,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } } } - else if (but->type == BUT_CURVE) { + else if (but->type == UI_BTYPE_CURVE) { if (mode == 'c') { if (but->poin != NULL) { but_copypaste_curve_alive = true; @@ -1916,7 +1916,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, if (mode == 'c') { 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 */ str = WM_operator_pystring_ex(C, NULL, false, true, but->optype, opptr); @@ -1926,8 +1926,8 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } } /* menu (any type) */ - else if (ELEM(but->type, MENU, PULLDOWN)) { - MenuType *mt = uiButGetMenuType(but); + else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) { + MenuType *mt = UI_but_menutype_get(but); if (mt) { char str[32 + sizeof(mt->idname)]; BLI_snprintf(str, sizeof(str), "bpy.ops.wm.call_menu(name=\"%s\")", mt->idname); @@ -1971,7 +1971,7 @@ static int ui_text_position_to_hidden(uiBut *but, int pos) return BLI_strnlen_utf8(butstr, pos); } -void ui_button_text_password_hide(char password_str[UI_MAX_PASSWORD_STR], uiBut *but, const bool restore) +void ui_but_text_password_hide(char password_str[UI_MAX_PASSWORD_STR], uiBut *but, const bool restore) { char *butstr; @@ -2034,7 +2034,7 @@ static bool ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data) */ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, const float x) { - uiStyle *style = UI_GetStyle(); // XXX pass on as arg + uiStyle *style = UI_style_get(); // XXX pass on as arg uiFontStyle *fstyle = &style->widget; const float aspect = but->block->aspect; const short fstyle_points_prev = fstyle->points; @@ -2047,18 +2047,18 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con ui_fontscale(&fstyle->points, aspect); - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); - ui_button_text_password_hide(password_str, but, false); + ui_but_text_password_hide(password_str, but, false); origstr = MEM_mallocN(sizeof(char) * data->maxlen, "ui_textedit origstr"); BLI_strncpy(origstr, but->editstr, data->maxlen); - 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)) { if (but->flag & UI_HAS_ICON) { startx += UI_DPI_ICON_SIZE / aspect; } @@ -2128,7 +2128,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con if (fstyle->kerning == 1) BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT); - ui_button_text_password_hide(password_str, but, true); + ui_but_text_password_hide(password_str, but, true); MEM_freeN(origstr); @@ -2145,7 +2145,7 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, if (data->selextend == EXTEND_RIGHT) but->selend = but->pos; else if (data->selextend == EXTEND_LEFT) but->selsta = but->pos; - ui_check_but(but); + ui_but_update(but); } /* this is used for both utf8 and ascii, its meant to be used for single keys, @@ -2185,7 +2185,7 @@ static bool ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char as { char buf[2] = {ascii, '\0'}; - if (ui_is_but_utf8(but) && (BLI_str_utf8_size(buf) == -1)) { + if (ui_but_is_utf8(but) && (BLI_str_utf8_size(buf) == -1)) { printf("%s: entering invalid ascii char into an ascii key (%d)\n", __func__, (int)(unsigned char)ascii); @@ -2204,7 +2204,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJump const int pos_prev = but->pos; const bool has_sel = (but->selend - but->selsta) > 0; - ui_check_but(but); + ui_but_update(but); /* special case, quit selection and set cursor */ if (has_sel && !select) { @@ -2356,7 +2356,7 @@ static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const in /* paste */ if (mode == UI_TEXTEDIT_PASTE) { - /* TODO, ensure UTF8 ui_is_but_utf8() - campbell */ + /* TODO, ensure UTF8 ui_but_is_utf8() - campbell */ /* extract the first line from the clipboard */ pbuf = WM_clipboard_text_get_firstline(false, &buf_len); @@ -2426,7 +2426,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) if (data->applied_interactive) { /* remove any small changes so canceling edit doesn't restore invalid value: T40538 */ data->cancel = true; - ui_apply_button(C, but->block, but, data, true); + ui_apply_but(C, but->block, but, data, true); data->cancel = false; data->applied_interactive = false; @@ -2434,16 +2434,16 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) #endif /* retrieve string */ - data->maxlen = ui_get_but_string_max_length(but); + data->maxlen = ui_but_string_get_max_length(but); data->str = MEM_callocN(sizeof(char) * data->maxlen + 1, "textedit str"); - ui_get_but_string(but, data->str, data->maxlen); + ui_but_string_get(but, data->str, data->maxlen); - if (ui_is_but_float(but) && !ui_is_but_unit(but)) { + if (ui_but_is_float(but) && !ui_but_is_unit(but)) { BLI_str_rstrip_float_zero(data->str, '\0'); } - if (ELEM(but->type, NUM, NUMSLI)) { - ui_convert_to_unit_alt_name(but, data->str, data->maxlen); + if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { + ui_but_convert_to_unit_alt_name(but, data->str, data->maxlen); } /* won't change from now on */ @@ -2460,7 +2460,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) but->selend = len; /* optional searchbox */ - if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { data->searchbox = ui_searchbox_create(C, data->region, but); ui_searchbox_update(C, data->searchbox, but, true); /* true = reset */ } @@ -2468,7 +2468,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) /* reset alert flag (avoid confusion, will refresh on exit) */ but->flag &= ~UI_BUT_REDALERT; - ui_check_but(but); + ui_but_update(but); WM_cursor_modal_set(CTX_wm_window(C), BC_TEXTEDITCURSOR); } @@ -2476,7 +2476,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if (but) { - if (ui_is_but_utf8(but)) { + if (ui_but_is_utf8(but)) { int strip = BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); /* not a file?, strip non utf-8 chars */ if (strip) { @@ -2513,11 +2513,11 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa uiBut *but; /* label and roundbox can overlap real buttons (backdrops...) */ - if (ELEM(actbut->type, LABEL, SEPR, SEPRLINE, ROUNDBOX, LISTBOX)) + if (ELEM(actbut->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX)) return; for (but = actbut->next; but; but = but->next) { - if (ELEM(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2526,7 +2526,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa } } for (but = block->buttons.first; but != actbut; but = but->next) { - if (ELEM(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2541,11 +2541,11 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa uiBut *but; /* label and roundbox can overlap real buttons (backdrops...) */ - if (ELEM(actbut->type, LABEL, SEPR, SEPRLINE, ROUNDBOX, LISTBOX)) + if (ELEM(actbut->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX)) return; for (but = actbut->prev; but; but = but->prev) { - if (ELEM(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2554,7 +2554,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa } } for (but = block->buttons.last; but != actbut; but = but->prev) { - if (ELEM(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2769,7 +2769,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle /* exception that's useful for number buttons, some keyboard * numpads have a comma instead of a period */ - if (ELEM(but->type, NUM, NUMSLI)) { /* could use data->min*/ + if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { /* could use data->min*/ if (event->type == PADPERIOD && ascii == ',') { ascii = '.'; utf8_buf = NULL; /* force ascii fallback */ @@ -2801,10 +2801,10 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if (changed) { /* only update when typing for TAB key */ if (update && data->interactive) { - ui_apply_button(C, block, but, data, true); + ui_apply_but(C, block, but, data, true); } else { - ui_check_but(but); + ui_but_update(but); } but->changed = true; @@ -2839,7 +2839,7 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u } if (retval == WM_UI_HANDLER_BREAK) { - ui_check_but(but); + ui_but_update(but); ED_region_tag_redraw(data->region); } } @@ -2848,22 +2848,22 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) { - if (but->type == BUT_CURVE) { + if (but->type == UI_BTYPE_CURVE) { but->editcumap = (CurveMapping *)but->poin; } - else if (but->type == BUT_COLORBAND) { + else if (but->type == UI_BTYPE_COLORBAND) { data->coba = (ColorBand *)but->poin; but->editcoba = data->coba; } - else if (ELEM(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE, COLOR)) { - ui_get_but_vectorf(but, data->origvec); + else if (ELEM(but->type, UI_BTYPE_UNITVEC, UI_BTYPE_HSVCUBE, UI_BTYPE_HSVCIRCLE, UI_BTYPE_COLOR)) { + ui_but_v3_get(but, data->origvec); copy_v3_v3(data->vec, data->origvec); but->editvec = data->vec; } else { float softrange, softmin, softmax; - data->startvalue = ui_get_but_val(but); + data->startvalue = ui_but_value_get(but); data->origvalue = data->startvalue; data->value = data->origvalue; but->editval = &data->value; @@ -2897,10 +2897,10 @@ static void ui_numedit_end(uiBut *but, uiHandleButtonData *data) static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data) { if (data->interactive) { - ui_apply_button(C, block, but, data, true); + ui_apply_but(C, block, but, data, true); } else { - ui_check_but(but); + ui_but_update(but); } ED_region_tag_redraw(data->region); @@ -2908,7 +2908,7 @@ static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleBu /* ****************** menu opening for various types **************** */ -static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data) +static void ui_block_open_begin(bContext *C, uiBut *but, uiHandleButtonData *data) { uiBlockCreateFunc func = NULL; uiBlockHandleCreateFunc handlefunc = NULL; @@ -2916,8 +2916,8 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data void *arg = NULL; switch (but->type) { - case BLOCK: - case PULLDOWN: + case UI_BTYPE_BLOCK: + case UI_BTYPE_PULLDOWN: if (but->menu_create_func) { menufunc = but->menu_create_func; arg = but->poin; @@ -2927,13 +2927,13 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data arg = but->poin ? but->poin : but->func_argN; } break; - case MENU: + case UI_BTYPE_MENU: BLI_assert(but->menu_create_func); menufunc = but->menu_create_func; arg = but->poin; break; - case COLOR: - ui_get_but_vectorf(but, data->origvec); + case UI_BTYPE_COLOR: + ui_but_v3_get(but, data->origvec); copy_v3_v3(data->vec, data->origvec); but->editvec = data->vec; @@ -2961,7 +2961,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data //if (but->block->auto_open == 0) but->block->auto_open = 1; } -static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data) +static void ui_block_open_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if (but) { but->editval = NULL; @@ -2976,7 +2976,7 @@ static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data) } } -int ui_button_open_menu_direction(uiBut *but) +int ui_but_menu_direction(uiBut *but) { uiHandleButtonData *data = but->active; @@ -2986,14 +2986,14 @@ int ui_button_open_menu_direction(uiBut *but) return 0; } -/* Hack for uiList LISTROW buttons to "give" events to overlaying TEX buttons (cltr-clic rename feature & co). */ +/* Hack for uiList UI_BTYPE_LISTROW buttons to "give" events to overlaying UI_BTYPE_TEXT buttons (cltr-clic rename feature & co). */ static uiBut *ui_but_list_row_text_activate(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event, uiButtonActivateType activate_type) { ARegion *ar = CTX_wm_region(C); uiBut *labelbut = ui_but_find_mouse_over_ex(ar, event->x, event->y, true); - if (labelbut && labelbut->type == TEX && !(labelbut->flag & UI_BUT_DISABLED)) { + if (labelbut && labelbut->type == UI_BTYPE_TEXT && !(labelbut->flag & UI_BUT_DISABLED)) { /* exit listrow */ data->cancel = true; button_activate_exit(C, but, data, false, false); @@ -3056,10 +3056,10 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data if (event->type == LEFTMOUSE && event->val == KM_PRESS) { /* only cancel if click outside the button */ - if (ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) { + if (ui_but_contains_point_px(but->active->region, but, event->x, event->y) == 0) { /* data->cancel doesnt work, this button opens immediate */ if (but->flag & UI_BUT_IMMEDIATE) - ui_set_but_val(but, 0); + ui_but_value_set(but, 0); else data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -3074,14 +3074,14 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data if (event->ctrl) but->modifier_key |= KM_CTRL; if (event->oskey) but->modifier_key |= KM_OSKEY; - ui_check_but(but); + ui_but_update(but); ED_region_tag_redraw(data->region); if (event->val == KM_PRESS) { if (ISHOTKEY(event->type)) { if (WM_key_event_string(event->type)[0]) - ui_set_but_val(but, event->type); + ui_but_value_set(but, event->type); else data->cancel = true; @@ -3117,7 +3117,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, c if (event->val == KM_PRESS) { if (WM_key_event_string(event->type)[0]) - ui_set_but_val(but, event->type); + ui_but_value_set(but, event->type); else data->cancel = true; @@ -3132,10 +3132,10 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton { if (data->state == BUTTON_STATE_HIGHLIGHT) { if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && event->val == KM_PRESS) { - if (ELEM(event->type, PADENTER, RETKEY) && (!ui_is_but_utf8(but))) { + if (ELEM(event->type, PADENTER, RETKEY) && (!ui_but_is_utf8(but))) { /* pass - allow filesel, enter to execute */ } - else if (but->dt == UI_EMBOSSN && !event->ctrl) { + else if (but->dt == UI_EMBOSS_NONE && !event->ctrl) { /* pass */ } else { @@ -3160,7 +3160,7 @@ static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHa { /* unlink icon is on right */ if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && event->val == KM_PRESS && - ui_is_but_search_unlink_visible(but)) + ui_but_is_search_unlink_visible(but)) { ARegion *ar = data->region; rcti rect; @@ -3190,12 +3190,12 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons { #ifdef USE_DRAG_TOGGLE if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS && ui_is_but_drag_toggle(but)) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS && ui_but_is_drag_toggle(but)) { #if 0 /* UNUSED */ data->togdual = event->ctrl; data->togonly = !event->shift; #endif - ui_apply_button(C, but->block, but, data, true); + ui_apply_but(C, but->block, but, data, true); button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; data->dragstarty = event->y; @@ -3228,7 +3228,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con /* first handle click on icondrag type button */ if (event->type == LEFTMOUSE && but->dragpoin) { - if (ui_but_mouse_inside_icon(but, data->region, event)) { + if (ui_but_contains_point_px_icon(but, data->region, event)) { /* tell the button to wait and keep checking further events to * see if it should start dragging */ @@ -3239,7 +3239,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con } } #ifdef USE_DRAG_TOGGLE - if (event->type == LEFTMOUSE && ui_is_but_drag_toggle(but)) { + if (event->type == LEFTMOUSE && ui_but_is_drag_toggle(but)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; data->dragstarty = event->y; @@ -3250,7 +3250,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { int ret = WM_UI_HANDLER_BREAK; /* XXX (a bit ugly) Special case handling for filebrowser drag button */ - if (but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) { + if (but->dragpoin && but->imb && ui_but_contains_point_px_icon(but, data->region, event)) { ret = WM_UI_HANDLER_CONTINUE; } button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -3260,7 +3260,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con else if (data->state == BUTTON_STATE_WAIT_DRAG) { /* this function also ends state */ - if (ui_but_start_drag(C, but, data, event)) { + if (ui_but_drag_init(C, but, data, event)) { return WM_UI_HANDLER_BREAK; } @@ -3290,9 +3290,9 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa else { float fac = 1.0f; - if (ui_is_but_unit(but)) { + if (ui_but_is_unit(but)) { UnitSettings *unit = but->block->unit; - int unit_type = RNA_SUBTYPE_UNIT_VALUE(uiButGetUnitType(but)); + int unit_type = RNA_SUBTYPE_UNIT_VALUE(UI_but_unit_type_get(but)); if (bUnit_IsValid(unit->system, unit_type)) { fac = (float)bUnit_BaseScalar(unit->system, unit_type); @@ -3358,7 +3358,7 @@ static bool ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float deler, tempf, softmin, softmax, softrange; int lvalue, temp; bool changed = false; - const bool is_float = ui_is_but_float(but); + const bool is_float = ui_but_is_float(but); if (mx == data->draglastx) return changed; @@ -3382,7 +3382,7 @@ static bool ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, softmax = but->softmax; softrange = softmax - softmin; - if (ui_is_a_warp_but(but)) { + if (ui_but_is_cursor_warp(but)) { /* Mouse location isn't screen clamped to the screen so use a linear mapping * 2px == 1-int, or 1px == 1-ClickStep */ if (is_float) { @@ -3536,7 +3536,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton retval = WM_UI_HANDLER_BREAK; } else if (event->type == LEFTMOUSE) { - data->dragstartx = data->draglastx = ui_is_a_warp_but(but) ? screen_mx : mx; + data->dragstartx = data->draglastx = ui_but_is_cursor_warp(but) ? screen_mx : mx; button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); retval = WM_UI_HANDLER_BREAK; } @@ -3594,7 +3594,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton if (event->shift) fac /= 10.0f; if (event->alt) fac /= 20.0f; - if (ui_numedit_but_NUM(but, data, (ui_is_a_warp_but(but) ? screen_mx : mx), snap, fac)) + if (ui_numedit_but_NUM(but, data, (ui_but_is_cursor_warp(but) ? screen_mx : mx), snap, fac)) ui_numedit_apply(C, block, but, data); #ifdef USE_DRAG_MULTINUM else if (data->multi_data.has_mbuts) { @@ -3627,7 +3627,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton handlewidth = min_ff(BLI_rctf_size_x(&but->rect) / 3, BLI_rctf_size_y(&but->rect)); - if (!ui_is_but_float(but)) { + if (!ui_but_is_float(but)) { if (mx < (but->rect.xmin + handlewidth)) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); @@ -3705,11 +3705,11 @@ static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, /* yes, 'mx' as both x/y is intentional */ ui_mouse_scale_warp(data, mx, mx, &mx_fl, &my_fl, shift); - if (but->type == NUMSLI) { + if (but->type == UI_BTYPE_NUM_SLIDER) { offs = (BLI_rctf_size_y(&but->rect) / 2.0f); deler = BLI_rctf_size_x(&but->rect) - offs; } - else if (but->type == SCROLL) { + else if (but->type == UI_BTYPE_SCROLL) { const float size = (is_horizontal) ? BLI_rctf_size_x(&but->rect) : -BLI_rctf_size_y(&but->rect); deler = size * (but->softmax - but->softmin) / (but->softmax - but->softmin + but->a1); offs = 0.0; @@ -3725,7 +3725,7 @@ static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, /* deal with mouse correction */ #ifdef USE_CONT_MOUSE_CORRECT - if (ui_is_a_warp_but(but)) { + if (ui_but_is_cursor_warp(but)) { /* OK but can go outside bounds */ if (is_horizontal) { data->ungrab_mval[0] = (but->rect.xmin + offs) + (f * deler); @@ -3748,7 +3748,7 @@ static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, if (tempf == softmin || tempf == softmax) { /* pass */ } - else if (ui_is_but_float(but)) { + else if (ui_but_is_float(but)) { if (shift) { if (tempf == softmin || tempf == softmax) {} @@ -3768,7 +3768,7 @@ static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, } } - if (!ui_is_but_float(but)) { + if (!ui_but_is_float(but)) { lvalue = floor(data->value + 0.5); CLAMP(temp, softmin, softmax); @@ -3824,7 +3824,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } - /* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */ + /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons, and match wheel usage above */ else if (event->type == LEFTMOUSE && event->alt) { int halfpos = BLI_rctf_cent_x(&but->rect); click = 2; @@ -3932,7 +3932,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton f = softmin + f * softrange; - if (!ui_is_but_float(but)) { + if (!ui_but_is_float(but)) { if (f < temp) temp--; else temp++; @@ -4098,7 +4098,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co /* first handle click on icondrag type button */ if (event->type == LEFTMOUSE && but->dragpoin && event->val == KM_PRESS) { - if (ui_but_mouse_inside_icon(but, data->region, event)) { + if (ui_but_contains_point_px_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; data->dragstarty = event->y; @@ -4106,7 +4106,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co } } #ifdef USE_DRAG_TOGGLE - if (event->type == LEFTMOUSE && event->val == KM_PRESS && (ui_is_but_drag_toggle(but))) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS && (ui_but_is_drag_toggle(but))) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; data->dragstarty = event->y; @@ -4118,14 +4118,14 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } - else if (but->type == MENU) { + else if (but->type == UI_BTYPE_MENU) { if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) { const int direction = (event->type == WHEELDOWNMOUSE) ? -1 : 1; - data->value = ui_step_name_menu(but, direction); + data->value = ui_but_menu_step(but, direction); button_activate_state(C, but, BUTTON_STATE_EXIT); - ui_apply_button(C, but->block, but, data, true); + ui_apply_but(C, but->block, but, data, true); /* button's state need to be changed to EXIT so moving mouse away from this mouse wouldn't lead * to cancel changes made to this button, but changing state to EXIT also makes no button active for @@ -4154,12 +4154,12 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co else if (data->state == BUTTON_STATE_WAIT_DRAG) { /* this function also ends state */ - if (ui_but_start_drag(C, but, data, event)) { + if (ui_but_drag_init(C, but, data, event)) { return WM_UI_HANDLER_BREAK; } /* outside icon quit, not needed if drag activated */ - if (0 == ui_but_mouse_inside_icon(but, data->region, event)) { + if (0 == ui_but_contains_point_px_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_EXIT); data->cancel = true; return WM_UI_HANDLER_BREAK; @@ -4175,7 +4175,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co return WM_UI_HANDLER_CONTINUE; } -static bool ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, +static bool ui_numedit_but_UNITVEC(uiBut *but, uiHandleButtonData *data, int mx, int my, const enum eSnapType snap) { @@ -4271,7 +4271,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co /* first handle click on icondrag type button */ if (event->type == LEFTMOUSE && but->dragpoin && event->val == KM_PRESS) { ui_palette_set_active(but); - if (ui_but_mouse_inside_icon(but, data->region, event)) { + if (ui_but_contains_point_px_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; data->dragstarty = event->y; @@ -4299,7 +4299,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co float *hsv = cpicker ? cpicker->color_data : hsv_static; float col[3]; - ui_get_but_vectorf(but, col); + ui_but_v3_get(but, col); rgb_to_hsv_compat_v(col, hsv); if (event->type == WHEELDOWNMOUSE) @@ -4312,10 +4312,10 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } hsv_to_rgb_v(hsv, data->vec); - ui_set_but_vectorf(but, data->vec); + ui_but_v3_set(but, data->vec); button_activate_state(C, but, BUTTON_STATE_EXIT); - ui_apply_button(C, but->block, but, data, true); + ui_apply_but(C, but->block, but, data, true); return WM_UI_HANDLER_BREAK; } else if ((int)(but->a1) == UI_PALETTE_COLOR && @@ -4333,12 +4333,12 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co else if (data->state == BUTTON_STATE_WAIT_DRAG) { /* this function also ends state */ - if (ui_but_start_drag(C, but, data, event)) { + if (ui_but_drag_init(C, but, data, event)) { return WM_UI_HANDLER_BREAK; } /* outside icon quit, not needed if drag activated */ - if (0 == ui_but_mouse_inside_icon(but, data->region, event)) { + if (0 == ui_but_contains_point_px_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_EXIT); data->cancel = true; return WM_UI_HANDLER_BREAK; @@ -4357,7 +4357,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { RNA_property_float_get_array(&but->rnapoin, but->rnaprop, target); - ui_block_to_scene_linear_v3(but->block, target); + ui_block_cm_to_scene_linear_v3(but->block, target); } else if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR) { RNA_property_float_get_array(&but->rnapoin, but->rnaprop, target); @@ -4370,7 +4370,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } else if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR) { RNA_property_float_get_array(&but->rnapoin, but->rnaprop, color); - ui_block_to_display_space_v3(but->block, color); + ui_block_cm_to_display_space_v3(but->block, color); BKE_brush_color_set(scene, brush, color); } } @@ -4392,7 +4392,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co return WM_UI_HANDLER_CONTINUE; } -static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) +static int ui_do_but_UNITVEC(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { int mx, my; @@ -4410,7 +4410,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); /* also do drag the first time */ - if (ui_numedit_but_NORMAL(but, data, mx, my, snap)) + if (ui_numedit_but_UNITVEC(but, data, mx, my, snap)) ui_numedit_apply(C, block, but, data); return WM_UI_HANDLER_BREAK; @@ -4420,7 +4420,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut if (event->type == MOUSEMOVE) { if (mx != data->draglastx || my != data->draglasty) { const enum eSnapType snap = ui_event_to_snap(event); - if (ui_numedit_but_NORMAL(but, data, mx, my, snap)) + if (ui_numedit_but_UNITVEC(but, data, mx, my, snap)) ui_numedit_apply(C, block, but, data); } } @@ -4481,12 +4481,12 @@ static bool ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, float x, y; float mx_fl, my_fl; bool changed = true; - bool use_display_colorspace = ui_color_picker_use_display_colorspace(but); + bool use_display_colorspace = ui_but_is_colorpicker_display_space(but); ui_mouse_scale_warp(data, mx, my, &mx_fl, &my_fl, shift); #ifdef USE_CONT_MOUSE_CORRECT - if (ui_is_a_warp_but(but)) { + if (ui_but_is_cursor_warp(but)) { /* OK but can go outside bounds */ data->ungrab_mval[0] = mx_fl; data->ungrab_mval[1] = my_fl; @@ -4494,10 +4494,10 @@ static bool ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, } #endif - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (use_display_colorspace) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); ui_rgb_to_color_picker_HSVCUBE_compat_v(but, rgb, hsv); @@ -4511,7 +4511,7 @@ static bool ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, /* calculate original hsv again */ copy_v3_v3(rgb, data->origvec); if (use_display_colorspace) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); copy_v3_v3(hsvo, hsv); @@ -4575,7 +4575,7 @@ static bool ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, ui_color_picker_to_rgb_HSVCUBE_v(but, hsv, rgb); if (use_display_colorspace) - ui_block_to_scene_linear_v3(but->block, rgb); + ui_block_cm_to_scene_linear_v3(but->block, rgb); /* clamp because with color conversion we can exceed range [#34295] */ if (but->a1 == UI_GRAD_V_ALT) { @@ -4599,12 +4599,12 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, const float hsv_v_max = max_ff(hsv[2], but->softmax); float rgb[3]; float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt; - 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(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); ui_rgb_to_color_picker_HSVCUBE_compat_v(but, rgb, hsv); @@ -4656,10 +4656,10 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, ui_color_picker_to_rgb_HSVCUBE_v(but, hsv, rgb); if (use_display_colorspace) - ui_block_to_scene_linear_v3(but->block, rgb); + ui_block_cm_to_scene_linear_v3(but->block, rgb); copy_v3_v3(data->vec, rgb); - ui_set_but_vectorf(but, data->vec); + ui_but_v3_set(but, data->vec); } static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) @@ -4693,7 +4693,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu ui_ndofedit_but_HSVCUBE(but, data, ndof, snap, event->shift != 0); button_activate_state(C, but, BUTTON_STATE_EXIT); - ui_apply_button(C, but->block, but, data, true); + ui_apply_but(C, but->block, but, data, true); return WM_UI_HANDLER_BREAK; } @@ -4714,14 +4714,14 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); ui_rgb_to_color_picker_HSVCUBE_v(but, def, def_hsv); - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); ui_rgb_to_color_picker_HSVCUBE_compat_v(but, rgb, hsv); def_hsv[0] = hsv[0]; def_hsv[1] = hsv[1]; ui_color_picker_to_rgb_HSVCUBE_v(but, def_hsv, rgb); - ui_set_but_vectorf(but, rgb); + ui_but_v3_set(but, rgb); RNA_property_update(C, &but->rnapoin, but->rnaprop); return WM_UI_HANDLER_BREAK; @@ -4765,12 +4765,12 @@ static bool ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, 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_mouse_scale_warp(data, mx, my, &mx_fl, &my_fl, shift); #ifdef USE_CONT_MOUSE_CORRECT - if (ui_is_a_warp_but(but)) { + if (ui_but_is_cursor_warp(but)) { /* OK but can go outside bounds */ data->ungrab_mval[0] = mx_fl; data->ungrab_mval[1] = my_fl; @@ -4787,9 +4787,9 @@ static bool ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, BLI_rcti_rctf_copy(&rect, &but->rect); - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (use_display_colorspace) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); ui_rgb_to_color_picker_compat_v(rgb, hsv); @@ -4813,7 +4813,7 @@ static bool ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, copy_v3_v3(hsvo, hsv); copy_v3_v3(rgbo, data->origvec); if (use_display_colorspace) - ui_block_to_display_space_v3(but->block, rgbo); + ui_block_cm_to_display_space_v3(but->block, rgbo); ui_rgb_to_color_picker_compat_v(rgbo, hsvo); @@ -4842,9 +4842,9 @@ static bool ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, } if (use_display_colorspace) - ui_block_to_scene_linear_v3(but->block, rgb); + ui_block_cm_to_scene_linear_v3(but->block, rgb); - ui_set_but_vectorf(but, rgb); + ui_but_v3_set(but, rgb); data->draglastx = mx; data->draglasty = my; @@ -4858,14 +4858,14 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, { 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); float rgb[3]; float phi, r /*, sqr */ /* UNUSED */, v[2]; float sensitivity = (shift ? 0.06f : 0.3f) * ndof->dt; - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (use_display_colorspace) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); ui_rgb_to_color_picker_compat_v(rgb, hsv); /* Convert current color on hue/sat disc to circular coordinates phi, r */ @@ -4918,9 +4918,9 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, } if (use_display_colorspace) - ui_block_to_scene_linear_v3(but->block, data->vec); + ui_block_cm_to_scene_linear_v3(but->block, data->vec); - ui_set_but_vectorf(but, data->vec); + ui_but_v3_set(but, data->vec); } @@ -4955,7 +4955,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_ndofedit_but_HSVCIRCLE(but, data, ndof, snap, event->shift != 0); button_activate_state(C, but, BUTTON_STATE_EXIT); - ui_apply_button(C, but->block, but, data, true); + ui_apply_but(C, but->block, but, data, true); return WM_UI_HANDLER_BREAK; } @@ -4974,14 +4974,14 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); ui_color_picker_to_rgb_v(def, def_hsv); - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); ui_rgb_to_color_picker_compat_v(rgb, hsv); def_hsv[0] = hsv[0]; def_hsv[2] = hsv[2]; hsv_to_rgb_v(def_hsv, rgb); - ui_set_but_vectorf(but, rgb); + ui_but_v3_set(but, rgb); RNA_property_update(C, &but->rnapoin, but->rnaprop); @@ -5001,12 +5001,12 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle /* XXX hardcoded keymap check.... */ else if (event->type == WHEELDOWNMOUSE) { hsv[2] = CLAMPIS(hsv[2] - 0.05f, 0.0f, 1.0f); - ui_set_but_hsv(but); /* converts to rgb */ + ui_but_hsv_set(but); /* converts to rgb */ ui_numedit_apply(C, block, but, data); } else if (event->type == WHEELUPMOUSE) { hsv[2] = CLAMPIS(hsv[2] + 0.05f, 0.0f, 1.0f); - ui_set_but_hsv(but); /* converts to rgb */ + ui_but_hsv_set(but); /* converts to rgb */ ui_numedit_apply(C, block, but, data); } else if (event->type == MOUSEMOVE) { @@ -5183,7 +5183,7 @@ static bool ui_numedit_but_CURVE(uiBlock *block, uiBut *but, uiHandleButtonData #ifdef USE_CONT_MOUSE_CORRECT /* note: using 'cmp_last' is weak since there may be multiple points selected, * but in practice this isnt really an issue */ - if (ui_is_a_warp_but(but)) { + if (ui_but_is_cursor_warp(but)) { /* OK but can go outside bounds */ data->ungrab_mval[0] = but->rect.xmin + ((cmp_last->x - cumap->curr.xmin) * zoomx); data->ungrab_mval[1] = but->rect.ymin + ((cmp_last->y - cumap->curr.ymin) * zoomy); @@ -5659,7 +5659,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) wmKeyMapItem *kmi; PointerRNA ptr; uiLayout *layout; - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); IDProperty *prop = (but->opptr) ? but->opptr->data : NULL; int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km); @@ -5667,16 +5667,16 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr); - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetHandleFunc(block, but_shortcut_name_func, but); - uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); - uiBlockSetDirection(block, UI_CENTER); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_func_handle_set(block, but_shortcut_name_func, but); + UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT); + UI_block_direction_set(block, UI_DIR_CENTER_Y); - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style); + layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE); - uiPopupBoundsBlock(block, 6, -50, 26); + UI_block_bounds_set_popup(block, 6, -50, 26); return block; } @@ -5690,7 +5690,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) wmKeyMapItem *kmi; PointerRNA ptr; uiLayout *layout; - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); IDProperty *prop = (but->opptr) ? but->opptr->data : NULL; int kmi_id; @@ -5712,15 +5712,15 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr); - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetHandleFunc(block, but_shortcut_name_func, but); - uiBlockSetDirection(block, UI_CENTER); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_func_handle_set(block, but_shortcut_name_func, but); + UI_block_direction_set(block, UI_DIR_CENTER_Y); - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style); + layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE); - uiPopupBoundsBlock(block, 6, -50, 26); + UI_block_bounds_set_popup(block, 6, -50, 26); return block; } @@ -5741,7 +5741,7 @@ static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); - uiPupBlock(C, menu_change_shortcut, but); + UI_popup_block_invoke(C, menu_change_shortcut, but); } static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) @@ -5762,7 +5762,7 @@ static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); - uiPupBlockEx(C, menu_add_shortcut, NULL, menu_add_shortcut_cancel, but); + UI_popup_block_ex(C, menu_add_shortcut, NULL, menu_add_shortcut_cancel, but); } /** @@ -5777,8 +5777,8 @@ void ui_panel_menu(bContext *C, ARegion *ar, Panel *pa) RNA_pointer_create(&sc->id, &RNA_Panel, pa, &ptr); - pup = uiPupMenuBegin(C, IFACE_("Panel"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Panel"), ICON_NONE); + layout = UI_popup_menu_layout(pup); if (UI_panel_category_is_visible(ar)) { char tmpstr[80]; BLI_snprintf(tmpstr, sizeof(tmpstr), "%s" UI_SEP_CHAR_S "%s", IFACE_("Pin"), IFACE_("Shift+Left Mouse")); @@ -5792,7 +5792,7 @@ void ui_panel_menu(bContext *C, ARegion *ar, Panel *pa) } } - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } static bool ui_but_menu(bContext *C, uiBut *but) @@ -5806,17 +5806,17 @@ static bool ui_but_menu(bContext *C, uiBut *but) /* return 0;*/ /* having this menu for some buttons makes no sense */ - if (but->type == BUT_IMAGE) { + if (but->type == UI_BTYPE_IMAGE) { return false; } button_timers_tooltip_remove(C, but); /* highly unlikely getting the label ever fails */ - uiButGetStrInfo(C, but, &label, NULL); + UI_but_string_info_get(C, but, &label, NULL); - pup = uiPupMenuBegin(C, label.strinfo ? label.strinfo : "", ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, label.strinfo ? label.strinfo : "", ICON_NONE); + layout = UI_popup_menu_layout(pup); if (label.strinfo) MEM_freeN(label.strinfo); @@ -6007,19 +6007,19 @@ static bool ui_but_menu(bContext *C, uiBut *but) /* would rather use a block but, but gets weirdly positioned... */ //uiDefBlockBut(block, menu_change_shortcut, but, "Change Shortcut", 0, 0, uiLayoutGetWidth(layout), UI_UNIT_Y, ""); - but2 = uiDefIconTextBut(block, BUT, 0, 0, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"), + but2 = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, 0, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(but2, popup_change_shortcut_func, but, NULL); + UI_but_func_set(but2, popup_change_shortcut_func, but, NULL); - but2 = uiDefIconTextBut(block, BUT, 0, 0, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Shortcut"), + but2 = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, 0, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Shortcut"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(but2, remove_shortcut_func, but, NULL); + UI_but_func_set(but2, remove_shortcut_func, but, NULL); } /* only show 'add' if there's a suitable key map for it to go in */ else if (WM_keymap_guess_opname(C, but->optype->idname)) { - but2 = uiDefIconTextBut(block, BUT, 0, 0, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add Shortcut"), + but2 = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, 0, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add Shortcut"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(but2, popup_add_shortcut_func, but, NULL); + UI_but_func_set(but2, popup_add_shortcut_func, but, NULL); } uiItemS(layout); @@ -6093,7 +6093,7 @@ static bool ui_but_menu(bContext *C, uiBut *but) } uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return true; } @@ -6113,7 +6113,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && (event->ctrl || event->oskey)) { /* Specific handling for listrows, we try to find their overlapping tex button. */ - if (but->type == LISTROW) { + if (but->type == UI_BTYPE_LISTROW) { uiBut *labelbut = ui_but_list_row_text_activate(C, but, data, event, BUTTON_ACTIVATE_OVER); if (labelbut) { but = labelbut; @@ -6134,11 +6134,11 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* pass */ } else { - if (but->type == COLOR) { + if (but->type == UI_BTYPE_COLOR) { WM_operator_name_call(C, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, NULL); return WM_UI_HANDLER_BREAK; } - else if (but->type == SEARCH_MENU_UNLINK) { + else if (but->type == UI_BTYPE_SEARCH_MENU_UNLINK) { if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_POINTER) { StructRNA *type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop); const short idcode = RNA_type_to_ID_code(type); @@ -6227,107 +6227,107 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * } switch (but->type) { - case BUT: + case UI_BTYPE_BUT: retval = ui_do_but_BUT(C, but, data, event); break; - case KEYEVT: + case UI_BTYPE_KEY_EVENT: retval = ui_do_but_KEYEVT(C, but, data, event); break; - case HOTKEYEVT: + case UI_BTYPE_HOTKEY_EVENT: retval = ui_do_but_HOTKEYEVT(C, but, data, event); break; - case TOGBUT: - case TOG: - case ICONTOG: - case ICONTOGN: - case TOGN: - case OPTION: - case OPTIONN: + case UI_BTYPE_BUT_TOGGLE: + case UI_BTYPE_TOGGLE: + case UI_BTYPE_ICON_TOGGLE: + case UI_BTYPE_ICON_TOGGLE_N: + case UI_BTYPE_TOGGLE_N: + case UI_BTYPE_CHECKBOX: + case UI_BTYPE_CHECKBOX_N: retval = ui_do_but_TOG(C, but, data, event); break; - case SCROLL: + case UI_BTYPE_SCROLL: retval = ui_do_but_SCROLL(C, block, but, data, event); break; - case GRIP: + case UI_BTYPE_GRIP: retval = ui_do_but_GRIP(C, block, but, data, event); break; - case NUM: + case UI_BTYPE_NUM: retval = ui_do_but_NUM(C, block, but, data, event); break; - case NUMSLI: + case UI_BTYPE_NUM_SLIDER: retval = ui_do_but_SLI(C, block, but, data, event); break; - case LISTBOX: + case UI_BTYPE_LISTBOX: /* Nothing to do! */ break; - case LISTROW: + case UI_BTYPE_LISTROW: retval = ui_do_but_LISTROW(C, but, data, event); break; - case ROUNDBOX: - case LABEL: - case ROW: - case BUT_IMAGE: - case PROGRESSBAR: - case NODESOCKET: + case UI_BTYPE_ROUNDBOX: + case UI_BTYPE_LABEL: + case UI_BTYPE_ROW: + case UI_BTYPE_IMAGE: + case UI_BTYPE_PROGRESS_BAR: + case UI_BTYPE_NODE_SOCKET: retval = ui_do_but_EXIT(C, but, data, event); break; - case HISTOGRAM: + case UI_BTYPE_HISTOGRAM: retval = ui_do_but_HISTOGRAM(C, block, but, data, event); break; - case WAVEFORM: + case UI_BTYPE_WAVEFORM: retval = ui_do_but_WAVEFORM(C, block, but, data, event); break; - case VECTORSCOPE: + case UI_BTYPE_VECTORSCOPE: /* Nothing to do! */ break; - case TEX: - case SEARCH_MENU: + case UI_BTYPE_TEXT: + case UI_BTYPE_SEARCH_MENU: retval = ui_do_but_TEX(C, block, but, data, event); break; - case SEARCH_MENU_UNLINK: + case UI_BTYPE_SEARCH_MENU_UNLINK: retval = ui_do_but_SEARCH_UNLINK(C, block, but, data, event); break; - case MENU: - case BLOCK: - case PULLDOWN: + case UI_BTYPE_MENU: + case UI_BTYPE_BLOCK: + case UI_BTYPE_PULLDOWN: retval = ui_do_but_BLOCK(C, but, data, event); break; - case BUTM: + case UI_BTYPE_BUT_MENU: retval = ui_do_but_BUT(C, but, data, event); break; - case COLOR: + case UI_BTYPE_COLOR: if (but->a1 == -1) /* signal to prevent calling up color picker */ retval = ui_do_but_EXIT(C, but, data, event); else retval = ui_do_but_COLOR(C, but, data, event); break; - case BUT_NORMAL: - retval = ui_do_but_NORMAL(C, block, but, data, event); + case UI_BTYPE_UNITVEC: + retval = ui_do_but_UNITVEC(C, block, but, data, event); break; - case BUT_COLORBAND: + case UI_BTYPE_COLORBAND: retval = ui_do_but_COLORBAND(C, block, but, data, event); break; - case BUT_CURVE: + case UI_BTYPE_CURVE: retval = ui_do_but_CURVE(C, block, but, data, event); break; - case HSVCUBE: + case UI_BTYPE_HSVCUBE: retval = ui_do_but_HSVCUBE(C, block, but, data, event); break; - case HSVCIRCLE: + case UI_BTYPE_HSVCIRCLE: retval = ui_do_but_HSVCIRCLE(C, block, but, data, event); break; - case LINK: - case INLINK: + case UI_BTYPE_LINK: + case UI_BTYPE_INLINK: retval = ui_do_but_LINK(C, but, data, event); break; - case TRACKPREVIEW: + case UI_BTYPE_TRACK_PREVIEW: retval = ui_do_but_TRACKPREVIEW(C, block, but, data, event); break; /* quiet warnings for unhandled types */ - case SEPR: - case SEPRLINE: - case BUT_EXTRA: + case UI_BTYPE_SEPR: + case UI_BTYPE_SEPR_LINE: + case UI_BTYPE_EXTRA: break; } @@ -6340,7 +6340,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * (event->type == BACKSPACEKEY && event->val == KM_PRESS)) { /* ctrl+backspace = reset active button; backspace = reset a whole array*/ - ui_set_but_default(C, !event->ctrl, true); + ui_but_default_set(C, !event->ctrl, true); ED_region_tag_redraw(data->region); retval = WM_UI_HANDLER_BREAK; } @@ -6352,7 +6352,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* if we started dragging, progress on any event */ (data->multi_data.init == BUTTON_MULTI_INIT_SETUP)) { - if (ELEM(but->type, NUM, NUMSLI) && + if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) && ELEM(data->state, BUTTON_STATE_TEXT_EDITING, BUTTON_STATE_NUM_EDITING)) { /* initialize! */ @@ -6438,7 +6438,7 @@ static bool ui_but_isect_pie_seg(uiBlock *block, uiBut *but) return false; } -uiBut *ui_but_find_activated(ARegion *ar) +uiBut *ui_but_find_active_in_region(ARegion *ar) { uiBlock *block; uiBut *but; @@ -6451,26 +6451,26 @@ uiBut *ui_but_find_activated(ARegion *ar) return NULL; } -bool ui_button_is_active(ARegion *ar) +bool ui_but_is_active(ARegion *ar) { - return (ui_but_find_activated(ar) != NULL); + return (ui_but_find_active_in_region(ar) != NULL); } /* is called by notifier */ -void uiFreeActiveButtons(const bContext *C, bScreen *screen) +void UI_screen_free_active_but(const bContext *C, bScreen *screen) { ScrArea *sa = screen->areabase.first; for (; sa; sa = sa->next) { ARegion *ar = sa->regionbase.first; for (; ar; ar = ar->next) { - uiBut *but = ui_but_find_activated(ar); + uiBut *but = ui_but_find_active_in_region(ar); if (but) { uiHandleButtonData *data = but->active; if (data->menu == NULL && data->searchbox == NULL) if (data->state == BUTTON_STATE_HIGHLIGHT) - ui_button_active_free(C, but); + ui_but_active_free(C, but); } } } @@ -6483,10 +6483,10 @@ void uiFreeActiveButtons(const bContext *C, bScreen *screen) bool UI_but_active_drop_name(bContext *C) { ARegion *ar = CTX_wm_region(C); - uiBut *but = ui_but_find_activated(ar); + uiBut *but = ui_but_find_active_in_region(ar); if (but) { - 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)) return 1; } @@ -6498,9 +6498,9 @@ bool UI_but_active_drop_color(bContext *C) ARegion *ar = CTX_wm_region(C); if (ar) { - uiBut *but = ui_but_find_activated(ar); + uiBut *but = ui_but_find_active_in_region(ar); - if (but && but->type == COLOR) + if (but && but->type == UI_BTYPE_COLOR) return true; } @@ -6520,7 +6520,7 @@ static void ui_blocks_set_tooltips(ARegion *ar, const bool enable) block->tooltipdisabled = !enable; } -static bool ui_mouse_inside_region(ARegion *ar, int x, int y) +static bool ui_region_contains_point_px(ARegion *ar, int x, int y) { uiBlock *block; @@ -6554,11 +6554,11 @@ static bool ui_mouse_inside_region(ARegion *ar, int x, int y) return true; } -static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) +static bool ui_but_contains_point_px(ARegion *ar, uiBut *but, int x, int y) { uiBlock *block = but->block; float mx, my; - if (!ui_mouse_inside_region(ar, x, y)) + if (!ui_region_contains_point_px(ar, x, y)) return false; mx = x; @@ -6580,30 +6580,30 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) /** * Can we mouse over the button or is it hidden/disabled/layout. - * Note: ctrl is kind of a hack currently, so that non-embossed TEX button behaves as a label when ctrl is not pressed. + * Note: ctrl is kind of a hack currently, so that non-embossed UI_BTYPE_TEXT button behaves as a label when ctrl is not pressed. */ -static bool ui_is_but_interactive(const uiBut *but, const bool labeledit) +static bool ui_but_is_interactive(const uiBut *but, const bool labeledit) { - /* note, LABEL is included for highlights, this allows drags */ - if ((but->type == LABEL) && but->dragpoin == NULL) + /* note, UI_BTYPE_LABEL is included for highlights, this allows drags */ + if ((but->type == UI_BTYPE_LABEL) && but->dragpoin == NULL) return false; - if (ELEM(but->type, ROUNDBOX, SEPR, SEPRLINE, LISTBOX)) + if (ELEM(but->type, UI_BTYPE_ROUNDBOX, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_LISTBOX)) return false; if (but->flag & UI_HIDDEN) return false; if (but->flag & UI_SCROLLED) return false; - if ((but->type == TEX) && (but->dt == UI_EMBOSSN) && !labeledit) + if ((but->type == UI_BTYPE_TEXT) && (but->dt == UI_EMBOSS_NONE) && !labeledit) return false; - if ((but->type == LISTROW) && labeledit) + if ((but->type == UI_BTYPE_LISTROW) && labeledit) return false; return true; } -bool ui_is_but_search_unlink_visible(const uiBut *but) +bool ui_but_is_search_unlink_visible(const uiBut *but) { - BLI_assert(but->type == SEARCH_MENU_UNLINK); + BLI_assert(but->type == UI_BTYPE_SEARCH_MENU_UNLINK); return ((but->editstr == NULL) && (but->drawstr[0] != '\0')); } @@ -6617,7 +6617,7 @@ static uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, c // if (!win->active) // return NULL; - if (!ui_mouse_inside_region(ar, x, y)) + if (!ui_region_contains_point_px(ar, x, y)) return NULL; for (block = ar->uiblocks.first; block; block = block->next) { @@ -6626,7 +6626,7 @@ static uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, c ui_window_to_block_fl(ar, block, &mx, &my); for (but = block->buttons.last; but; but = but->prev) { - if (ui_is_but_interactive(but, labeledit)) { + if (ui_but_is_interactive(but, labeledit)) { if (but->pie_dir != UI_RADIAL_NONE) { if (ui_but_isect_pie_seg(block, but)) { butover = but; @@ -6664,7 +6664,7 @@ static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y) uiBut *but; float mx, my; - if (!ui_mouse_inside_region(ar, x, y)) + if (!ui_region_contains_point_px(ar, x, y)) return NULL; for (block = ar->uiblocks.first; block; block = block->next) { @@ -6673,7 +6673,7 @@ static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y) ui_window_to_block_fl(ar, block, &mx, &my); for (but = block->buttons.last; but; but = but->prev) { - if (but->type == LISTBOX && ui_but_contains_pt(but, mx, my)) { + if (but->type == UI_BTYPE_LISTBOX && ui_but_contains_pt(but, mx, my)) { return but; } } @@ -6754,14 +6754,14 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s button_tooltip_timer_reset(C, but); /* automatic open pulldown block timer */ - if (ELEM(but->type, BLOCK, PULLDOWN)) { + if (ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) { if (data->used_mouse && !data->autoopentimer) { int time; if (but->block->auto_open == true) { /* test for toolbox */ time = 1; } - else if ((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open == true) { + else if ((but->block->flag & UI_BLOCK_LOOP && but->type != UI_BTYPE_BLOCK) || but->block->auto_open == true) { time = 5 * U.menuthreshold2; } else if (U.uiflag & USER_MENUOPENAUTO) { @@ -6792,7 +6792,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s /* number editing */ if (state == BUTTON_STATE_NUM_EDITING) { - if (ui_is_a_warp_but(but)) + if (ui_but_is_cursor_warp(but)) WM_cursor_grab_enable(CTX_wm_window(C), true, true, NULL); ui_numedit_begin(but, data); } @@ -6802,7 +6802,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s if (but->flag & UI_BUT_DRIVEN) WM_report(C, RPT_INFO, "Can't edit driven number value, see graph editor for the driver setup."); - if (ui_is_a_warp_but(but)) { + if (ui_but_is_cursor_warp(but)) { #ifdef USE_CONT_MOUSE_CORRECT if (data->ungrab_mval[0] != FLT_MAX) { @@ -6823,9 +6823,9 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s } /* menu open */ if (state == BUTTON_STATE_MENU_OPEN) - ui_blockopen_begin(C, but, data); + ui_block_open_begin(C, but, data); else if (data->state == BUTTON_STATE_MENU_OPEN) - ui_blockopen_end(C, but, data); + ui_block_open_end(C, but, data); /* add a short delay before exiting, to ensure there is some feedback */ if (state == BUTTON_STATE_WAIT_FLASH) { @@ -6859,13 +6859,13 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s data->state = state; if (state != BUTTON_STATE_EXIT) { - /* When objects for eg. are removed, running ui_check_but() can access + /* When objects for eg. are removed, running ui_but_update() can access * the removed data - so disable update on exit. Also in case of * highlight when not in a popup menu, we remove because data used in * button below popup might have been removed by action of popup. Needs * a more reliable solution... */ if (state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP)) - ui_check_but(but); + ui_but_update(but); } /* redraw */ @@ -6886,7 +6886,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA copy_v2_fl(data->ungrab_mval, FLT_MAX); #endif - if (ELEM(but->type, BUT_CURVE, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM(but->type, UI_BTYPE_CURVE, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) { /* XXX curve is temp */ } else { @@ -6913,7 +6913,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA /* activate right away */ if (but->flag & UI_BUT_IMMEDIATE) { - if (but->type == HOTKEYEVT) + if (but->type == UI_BTYPE_HOTKEY_EVENT) button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); /* .. more to be added here */ } @@ -6940,7 +6940,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA else if (type == BUTTON_ACTIVATE_APPLY) button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH); - if (but->type == GRIP) { + if (but->type == UI_BTYPE_GRIP) { const bool horizontal = (BLI_rctf_size_x(&but->rect) < BLI_rctf_size_y(&but->rect)); WM_cursor_modal_set(data->window, horizontal ? CURSOR_X_MOVE : CURSOR_Y_MOVE); } @@ -6952,7 +6952,7 @@ static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *da uiBlock *block = but->block; uiBut *bt; - if (but->type == GRIP) { + if (but->type == UI_BTYPE_GRIP) { WM_cursor_modal_restore(data->window); } @@ -6962,7 +6962,7 @@ static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *da /* apply the button action or value */ if (!onfree) - ui_apply_button(C, block, but, data, false); + ui_apply_but(C, block, but, data, false); #ifdef USE_DRAG_MULTINUM if (data->multi_data.has_mbuts) { @@ -6971,7 +6971,7 @@ static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *da bt->flag &= ~UI_BUT_DRAG_MULTI; if (!data->cancel) { - ui_apply_autokey(C, bt); + ui_apply_but_autokey(C, bt); } } } @@ -6995,8 +6995,8 @@ static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *da if (!onfree && !data->cancel) { /* autokey & undo push */ - ui_apply_undo(but); - ui_apply_autokey(C, but); + ui_apply_but_undo(but); + ui_apply_but_autokey(C, but); /* popup menu memory */ if (block->flag & UI_BLOCK_POPUP_MEMORY) @@ -7031,7 +7031,7 @@ static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *da but->flag &= ~(UI_ACTIVE | UI_SELECT); but->flag |= UI_BUT_LAST_ACTIVE; if (!onfree) - ui_check_but(but); + ui_but_update(but); /* adds empty mousemove in queue for re-init handler, in case mouse is * still over a button. we cannot just check for this ourselfs because @@ -7040,7 +7040,7 @@ static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *da WM_event_add_mousemove(C); } -void ui_button_active_free(const bContext *C, uiBut *but) +void ui_but_active_free(const bContext *C, uiBut *but) { uiHandleButtonData *data; @@ -7106,13 +7106,13 @@ static uiBut *ui_context_rna_button_active(const bContext *C) return ui_context_button_active(C, ui_context_rna_button_active_test); } -uiBut *uiContextActiveButton(const struct bContext *C) +uiBut *UI_context_active_but_get(const struct bContext *C) { return ui_context_button_active(C, NULL); } /* helper function for insert keyframe, reset to default, etc operators */ -void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index) +void UI_context_active_but_prop_get(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index) { uiBut *activebut = ui_context_rna_button_active(C); @@ -7129,7 +7129,7 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P } } -void uiContextActivePropertyHandle(bContext *C) +void UI_context_active_but_prop_handle(bContext *C) { uiBut *activebut = ui_context_rna_button_active(C); if (activebut) { @@ -7143,7 +7143,7 @@ void uiContextActivePropertyHandle(bContext *C) } } -wmOperator *uiContextActiveOperator(const struct bContext *C) +wmOperator *UI_context_active_operator_get(const struct bContext *C) { ARegion *ar_ctx = CTX_wm_region(C); uiBlock *block; @@ -7181,7 +7181,7 @@ wmOperator *uiContextActiveOperator(const struct bContext *C) } /* helper function for insert keyframe, reset to default, etc operators */ -void uiContextAnimUpdate(const bContext *C) +void UI_context_update_anim_flag(const bContext *C) { Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); @@ -7266,8 +7266,8 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar) return WM_UI_HANDLER_CONTINUE; } -/* exported to interface.c: uiButActiveOnly() */ -void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but) +/* exported to interface.c: UI_but_active_only() */ +void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but) { wmWindow *win = CTX_wm_window(C); wmEvent event; @@ -7289,12 +7289,12 @@ void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but) * exported so menus can start with a highlighted button, * even if the mouse isnt over it */ -void ui_button_activate_over(bContext *C, ARegion *ar, uiBut *but) +void ui_but_activate_over(bContext *C, ARegion *ar, uiBut *but) { button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); } -void ui_button_execute_begin(struct bContext *UNUSED(C), struct ARegion *ar, uiBut *but, void **active_back) +void ui_but_execute_begin(struct bContext *UNUSED(C), struct ARegion *ar, uiBut *but, void **active_back) { /* note: ideally we would not have to change 'but->active' however * some functions we call don't use data (as they should be doing) */ @@ -7305,12 +7305,12 @@ void ui_button_execute_begin(struct bContext *UNUSED(C), struct ARegion *ar, uiB data->region = ar; } -void ui_button_execute_end(struct bContext *C, struct ARegion *UNUSED(ar), uiBut *but, void *active_back) +void ui_but_execute_end(struct bContext *C, struct ARegion *UNUSED(ar), uiBut *but, void *active_back) { - ui_apply_button(C, but->block, but, but->active, true); + ui_apply_but(C, but->block, but, but->active, true); if ((but->flag & UI_BUT_DRAG_MULTI) == 0) { - ui_apply_autokey(C, but); + ui_apply_but_autokey(C, but); } /* use onfree event so undo is handled by caller and apply is already done above */ button_activate_exit((bContext *)C, but, but->active, false, true); @@ -7322,7 +7322,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu uiBut *oldbut; uiHandleButtonData *data; - oldbut = ui_but_find_activated(ar); + oldbut = ui_but_find_active_in_region(ar); if (oldbut) { data = oldbut->active; data->cancel = true; @@ -7361,7 +7361,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) bool exit = false; if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(but->block)) && - !ui_mouse_inside_button(ar, but, event->x, event->y)) + !ui_but_contains_point_px(ar, but, event->x, event->y)) { exit = true; } @@ -7396,7 +7396,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) WM_event_remove_timer(data->wm, data->window, data->autoopentimer); data->autoopentimer = NULL; - if (ui_mouse_inside_button(ar, but, event->x, event->y)) + if (ui_but_contains_point_px(ar, but, event->x, event->y)) button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); } @@ -7424,7 +7424,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) break; case MOUSEMOVE: - if (ELEM(but->type, LINK, INLINK)) { + if (ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) { ARegion *ar = data->region; but->flag |= UI_SELECT; ui_do_button(C, block, but, event); @@ -7433,7 +7433,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) else { /* deselect the button when moving the mouse away */ /* also de-activate for buttons that only show higlights */ - if (ui_mouse_inside_button(ar, but, event->x, event->y)) { + if (ui_but_contains_point_px(ar, but, event->x, event->y)) { if (!(but->flag & UI_SELECT)) { but->flag |= (UI_SELECT | UI_ACTIVE); data->cancel = false; @@ -7478,7 +7478,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) uiBut *bt; if (data->menu && data->menu->region) { - if (ui_mouse_inside_region(data->menu->region, event->x, event->y)) { + if (ui_region_contains_point_px(data->menu->region, event->x, event->y)) { break; } } @@ -7486,7 +7486,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) bt = ui_but_find_mouse_over(ar, event); if (bt && bt->active != data) { - if (but->type != COLOR) { /* exception */ + if (but->type != UI_BTYPE_COLOR) { /* exception */ data->cancel = true; } button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -7631,7 +7631,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar) RNA_property_int_set(&but->rnapoin, but->rnaprop, value); RNA_property_update(C, &but->rnapoin, but->rnaprop); - ui_apply_undo(but); + ui_apply_but_undo(but); ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM; ED_region_tag_redraw(ar); @@ -7675,18 +7675,18 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u /* copy over return values from the closing menu */ if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) { - if (but->type == COLOR) + if (but->type == UI_BTYPE_COLOR) copy_v3_v3(data->vec, menu->retvec); - else if (but->type == MENU) + else if (but->type == UI_BTYPE_MENU) data->value = menu->retvalue; } if (menu->menuretval & UI_RETURN_UPDATE) { if (data->interactive) { - ui_apply_button(C, but->block, but, data, true); + ui_apply_but(C, but->block, but, data, true); } else { - ui_check_but(but); + ui_but_update(but); } menu->menuretval = 0; @@ -7700,7 +7700,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u button_activate_exit(C, but, data, true, false); } else if (menu->menuretval & UI_RETURN_OUT) { - if (event->type == MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) { + if (event->type == MOUSEMOVE && ui_but_contains_point_px(data->region, but, event->x, event->y)) { button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT); } else { @@ -7960,7 +7960,7 @@ static bool ui_menu_pass_event_to_parent_if_nonactive(uiPopupBlockHandle *menu, static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu) { ARegion *ar = menu->region; - uiBut *but = ui_but_find_activated(ar); + uiBut *but = ui_but_find_active_in_region(ar); int retval; if (but) { @@ -7972,11 +7972,11 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock else if (!ui_block_is_menu(but->block) || ui_block_is_pie_menu(but->block)) { /* pass, skip for dialogs */ } - else if (!ui_mouse_inside_region(but->active->region, event->x, event->y)) { + else if (!ui_region_contains_point_px(but->active->region, event->x, event->y)) { /* pass, needed to click-exit outside of non-flaoting menus */ } else if ((!ELEM(event->type, MOUSEMOVE, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN)) && ISMOUSE(event->type)) { - if (!ui_mouse_inside_button(but->active->region, but, event->x, event->y)) { + if (!ui_but_contains_point_px(but->active->region, but, event->x, event->y)) { but = NULL; } } @@ -8001,7 +8001,7 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock return retval; } -float ui_block_calculate_pie_segment(uiBlock *block, const float event_xy[2]) +float ui_block_calc_pie_segment(uiBlock *block, const float event_xy[2]) { float seg1[2]; float seg2[2]; @@ -8052,7 +8052,7 @@ static int ui_handle_menu_event( inside_title = inside && ((my + (UI_UNIT_Y * 1.5f)) > block->rect.ymax); /* if there's an active modal button, don't check events or outside, except for search menu */ - but = ui_but_find_activated(ar); + but = ui_but_find_active_in_region(ar); #ifdef USE_DRAG_POPUP if (menu->is_grab) { @@ -8128,15 +8128,15 @@ static int ui_handle_menu_event( if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) break; - but = ui_but_find_activated(ar); + but = ui_but_find_active_in_region(ar); if (!but) { /* no item active, we make first active */ - if (block->direction & UI_TOP) but = ui_but_last(block); + if (block->direction & UI_DIR_UP) but = ui_but_last(block); else but = ui_but_first(block); } - if (but && ELEM(but->type, BLOCK, PULLDOWN)) + if (but && ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN); } @@ -8161,7 +8161,7 @@ static int ui_handle_menu_event( ui_pan_to_scroll(event, &type, &val); if (val == KM_PRESS) { - const eButType type_flip = BUT | ROW; + const eButType type_flip = UI_BTYPE_BUT | UI_BTYPE_ROW; if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) break; @@ -8170,14 +8170,14 @@ static int ui_handle_menu_event( ui_mouse_motion_keynav_init(&menu->keynav_state, event); #endif - but = ui_but_find_activated(ar); + but = ui_but_find_active_in_region(ar); if (but) { - /* is there a situation where UI_LEFT or UI_RIGHT would also change navigation direction? */ - if (((ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) || - ((ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_RIGHT)) || - ((ELEM(type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_TOP))) + /* is there a situation where UI_DIR_LEFT or UI_DIR_RIGHT would also change navigation direction? */ + if (((ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DIR_DOWN)) || + ((ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DIR_RIGHT)) || + ((ELEM(type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DIR_UP))) { - /* the following is just a hack - uiBut->type set to BUT and BUTM have there menus built + /* the following is just a hack - uiBut->type set to UI_BTYPE_BUT and UI_BTYPE_BUT_MENU have there menus built * opposite ways - this should be changed so that all popup-menus use the same uiBlock->direction */ if (but->type & type_flip) but = ui_but_next(but); @@ -8198,9 +8198,9 @@ static int ui_handle_menu_event( } if (!but) { - if (((ELEM(type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) || - ((ELEM(type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) || - ((ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))) + if (((ELEM(type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DIR_DOWN)) || + ((ELEM(type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DIR_RIGHT)) || + ((ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DIR_UP))) { if ((bt = ui_but_first(block)) && (bt->type & type_flip)) { bt = ui_but_last(block); @@ -8263,7 +8263,7 @@ static int ui_handle_menu_event( for (but = block->buttons.first; but; but = but->next) { bool doit = false; - if (!ELEM(but->type, LABEL, SEPR, SEPRLINE)) + if (!ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) count++; /* exception for rna layer buts */ @@ -8281,7 +8281,7 @@ static int ui_handle_menu_event( if (doit) { /* activate buttons but open menu's */ uiButtonActivateType activate; - if (but->type == PULLDOWN) { + if (but->type == UI_BTYPE_PULLDOWN) { activate = BUTTON_ACTIVATE_OPEN; } else { @@ -8336,15 +8336,15 @@ static int ui_handle_menu_event( for (but = block->buttons.first; but; but = but->next) { if (but->menu_key == event->type) { - if (ELEM(but->type, BUT, BUTM)) { + if (ELEM(but->type, UI_BTYPE_BUT, UI_BTYPE_BUT_MENU)) { /* mainly for operator buttons */ ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY); } - else if (ELEM(but->type, BLOCK, PULLDOWN)) { + else if (ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) { /* open submenus (like right arrow key) */ ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN); } - else if (but->type == MENU) { + else if (but->type == UI_BTYPE_MENU) { /* activate menu items */ ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE); } @@ -8409,14 +8409,14 @@ static int ui_handle_menu_event( else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) { /* enter will always close this block, we let the event * get handled by the button if it is activated, otherwise we cancel */ - if (!ui_but_find_activated(ar)) + if (!ui_but_find_active_in_region(ar)) menu->menuretval = UI_RETURN_CANCEL | UI_RETURN_POPUP_OK; } #ifdef USE_DRAG_POPUP else if ((event->type == LEFTMOUSE) && (event->val == KM_PRESS) && (inside && is_floating && inside_title)) { - if (!but || !ui_mouse_inside_button(ar, but, event->x, event->y)) { + if (!but || !ui_but_contains_point_px(ar, but, event->x, event->y)) { if (but) { button_timers_tooltip_remove(C, but); } @@ -8496,7 +8496,7 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo ar = menu->region; block = ar->uiblocks.first; - but = ui_but_find_activated(ar); + but = ui_but_find_active_in_region(ar); data = but->active; submenu = data->menu; @@ -8538,7 +8538,7 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo static bool ui_but_pie_menu_supported_apply(uiBut *but) { - return (!ELEM(but->type, NUMSLI, NUM)); + return (!ELEM(but->type, UI_BTYPE_NUM_SLIDER, UI_BTYPE_NUM)); } static int ui_but_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu, uiBut *but, bool force_close) @@ -8546,10 +8546,10 @@ static int ui_but_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu, uiBut *b int retval = WM_UI_HANDLER_BREAK; if (but && ui_but_pie_menu_supported_apply(but)) { - if (but->type == MENU) { + if (but->type == UI_BTYPE_MENU) { /* forcing the pie menu to close will not handle menus */ if (!force_close) { - uiBut *active_but = ui_but_find_activated(menu->region); + uiBut *active_but = ui_but_find_active_in_region(menu->region); if (active_but) { button_activate_exit(C, active_but, active_but->active, false, false); @@ -8563,7 +8563,7 @@ static int ui_but_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu, uiBut *b } } else { - ui_apply_button(C, but->block, but, but->active, false); + ui_apply_but(C, but->block, but, but->active, false); button_activate_exit((bContext *)C, but, but->active, false, true); menu->menuretval = UI_RETURN_OK; @@ -8584,7 +8584,7 @@ static uiBut *ui_block_pie_dir_activate(uiBlock *block, const wmEvent *event, Ra if ((block->flag & UI_BLOCK_NUMSELECT) && event->val == KM_PRESS) { for (but = block->buttons.first; but; but = but->next) { - if (but->pie_dir == dir && !ELEM(but->type, SEPR, SEPRLINE)) { + if (but->pie_dir == dir && !ELEM(but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) { return but; } } @@ -8600,7 +8600,7 @@ static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandl if (but == NULL) return WM_UI_HANDLER_BREAK; - active_but = ui_but_find_activated(menu->region); + active_but = ui_but_find_active_in_region(menu->region); if (active_but) button_activate_exit(C, active_but, active_but->active, false, false); @@ -8609,7 +8609,7 @@ static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandl return ui_but_pie_menu_apply(C, menu, but, false); } -static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu) +static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu) { ARegion *ar; uiBlock *block; @@ -8646,7 +8646,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle ui_window_to_block_fl(ar, block, &event_xy[0], &event_xy[1]); - dist = ui_block_calculate_pie_segment(block, event_xy); + dist = ui_block_calc_pie_segment(block, event_xy); if (event->type == TIMER) { if (event->customdata == menu->scrolltimer) { @@ -8706,7 +8706,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle } if (len_sq < 1.0) { - uiBut *but = ui_but_find_activated(menu->region); + uiBut *but = ui_but_find_active_in_region(menu->region); if (but) { return ui_but_pie_menu_apply(C, menu, but, true); @@ -8732,7 +8732,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle block->pie_data.flags |= UI_PIE_CLICK_STYLE; } else { - uiBut *but = ui_but_find_activated(menu->region); + uiBut *but = ui_but_find_active_in_region(menu->region); if (but && (U.pie_menu_confirm > 0) && (dist >= U.pie_menu_threshold + U.pie_menu_confirm)) @@ -8871,7 +8871,7 @@ static int ui_handle_menus_recursive( bool do_towards_reinit = false; /* check if we have a submenu, and handle events for it first */ - but = ui_but_find_activated(menu->region); + but = ui_but_find_active_in_region(menu->region); data = (but) ? but->active : NULL; submenu = (data) ? data->menu : NULL; @@ -8898,7 +8898,7 @@ static int ui_handle_menus_recursive( /* now handle events for our own menu */ if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) { - const bool do_but_search = (but && ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)); + const bool do_but_search = (but && ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)); if (submenu && submenu->menuretval) { const bool do_ret_out_parent = (submenu->menuretval & UI_RETURN_OUT_PARENT) != 0; retval = ui_handle_menu_return_submenu(C, event, menu); @@ -8920,7 +8920,7 @@ static int ui_handle_menus_recursive( if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) { /* when there is a active search button and we close it, * we need to reinit the mouse coords [#35346] */ - if (ui_but_find_activated(menu->region) != but) { + if (ui_but_find_active_in_region(menu->region) != but) { do_towards_reinit = true; } } @@ -8929,7 +8929,7 @@ static int ui_handle_menus_recursive( uiBlock *block = menu->region->uiblocks.first; if (block->flag & UI_BLOCK_RADIAL) - retval = ui_handler_pie(C, event, menu); + retval = ui_pie_handler(C, event, menu); else if (event->type == LEFTMOUSE || event->val != KM_DBL_CLICK) retval = ui_handle_menu_event(C, event, menu, level, is_parent_inside, is_parent_menu, is_floating); } @@ -8944,7 +8944,7 @@ static int ui_handle_menus_recursive( /* *************** UI event handlers **************** */ -static int ui_handler_region(bContext *C, const wmEvent *event, void *UNUSED(userdata)) +static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(userdata)) { ARegion *ar; uiBut *but; @@ -8959,7 +8959,7 @@ static int ui_handler_region(bContext *C, const wmEvent *event, void *UNUSED(use } /* either handle events for already activated button or try to activate */ - but = ui_but_find_activated(ar); + but = ui_but_find_active_in_region(ar); retval = ui_handler_panel_region(C, event, ar); @@ -8983,7 +8983,7 @@ static int ui_handler_region(bContext *C, const wmEvent *event, void *UNUSED(use return retval; } -static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata)) +static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata)) { bScreen *sc; ARegion *ar; @@ -8991,14 +8991,14 @@ static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata)) ar = CTX_wm_region(C); if (ar == NULL) return; - uiFreeBlocks(C, &ar->uiblocks); + UI_blocklist_free(C, &ar->uiblocks); sc = CTX_wm_screen(C); if (sc == NULL) return; /* delayed apply callbacks, but not for screen level regions, those * we rather do at the very end after closing them all, which will - * be done in ui_handler_region/window */ + * be done in ui_region_handler/window */ if (BLI_findindex(&sc->regionbase, ar) == -1) ui_apply_but_funcs_after(C); } @@ -9014,7 +9014,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE if (!ar) ar = CTX_wm_region(C); - but = ui_but_find_activated(ar); + but = ui_but_find_active_in_region(ar); if (but) { uiBut *but_other; @@ -9024,7 +9024,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE data = but->active; if ((data->state == BUTTON_STATE_MENU_OPEN) && - (but->type == PULLDOWN) && + (but->type == UI_BTYPE_PULLDOWN) && (but_other = ui_but_find_mouse_over(ar, event)) && (but != but_other) && (but->type == but_other->type)) @@ -9070,7 +9070,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE } /* two types of popups, one with operator + enum, other with regular callbacks */ -static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata) +static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata) { uiPopupBlockHandle *menu = userdata; struct ARegion *menu_region; @@ -9106,7 +9106,7 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata) } ui_popup_block_free(C, menu); - UI_remove_popup_handlers(&win->modalhandlers, menu); + UI_popup_handlers_remove(&win->modalhandlers, menu); #ifdef USE_DRAG_TOGGLE { @@ -9148,7 +9148,7 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata) return retval; } -static void ui_handler_remove_popup(bContext *C, void *userdata) +static void ui_popup_handler_remove(bContext *C, void *userdata) { uiPopupBlockHandle *menu = userdata; @@ -9159,25 +9159,25 @@ static void ui_handler_remove_popup(bContext *C, void *userdata) ui_apply_but_funcs_after(C); } -void UI_add_region_handlers(ListBase *handlers) +void UI_region_handlers_add(ListBase *handlers) { - WM_event_remove_ui_handler(handlers, ui_handler_region, ui_handler_remove_region, NULL, false); - WM_event_add_ui_handler(NULL, handlers, ui_handler_region, ui_handler_remove_region, NULL, false); + WM_event_remove_ui_handler(handlers, ui_region_handler, ui_region_handler_remove, NULL, false); + WM_event_add_ui_handler(NULL, handlers, ui_region_handler, ui_region_handler_remove, NULL, false); } -void UI_add_popup_handlers(bContext *C, ListBase *handlers, uiPopupBlockHandle *popup, const bool accept_dbl_click) +void UI_popup_handlers_add(bContext *C, ListBase *handlers, uiPopupBlockHandle *popup, const bool accept_dbl_click) { - WM_event_add_ui_handler(C, handlers, ui_handler_popup, ui_handler_remove_popup, popup, accept_dbl_click); + WM_event_add_ui_handler(C, handlers, ui_popup_handler, ui_popup_handler_remove, popup, accept_dbl_click); } -void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup) +void UI_popup_handlers_remove(ListBase *handlers, uiPopupBlockHandle *popup) { - WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, false); + WM_event_remove_ui_handler(handlers, ui_popup_handler, ui_popup_handler_remove, popup, false); } -void UI_remove_popup_handlers_all(bContext *C, ListBase *handlers) +void UI_popup_handlers_remove_all(bContext *C, ListBase *handlers) { - WM_event_free_ui_handler_all(C, handlers, ui_handler_popup, ui_handler_remove_popup); + WM_event_free_ui_handler_all(C, handlers, ui_popup_handler, ui_popup_handler_remove); } bool UI_textbutton_activate_rna(const bContext *C, ARegion *ar, @@ -9188,7 +9188,7 @@ bool UI_textbutton_activate_rna(const bContext *C, ARegion *ar, for (block = ar->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) { - if (but->type == TEX) { + if (but->type == UI_BTYPE_TEXT) { if (but->rnaprop && but->rnapoin.data == rna_poin_data) { if (STREQ(RNA_property_identifier(but->rnaprop), rna_prop_id)) { break; @@ -9201,7 +9201,7 @@ bool UI_textbutton_activate_rna(const bContext *C, ARegion *ar, } if (but) { - uiButActiveOnly(C, ar, block, but); + UI_but_active_only(C, ar, block, but); return true; } else { @@ -9217,7 +9217,7 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut) for (block = ar->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) - if (but == actbut && but->type == TEX) + if (but == actbut && but->type == UI_BTYPE_TEXT) break; if (but) @@ -9225,7 +9225,7 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut) } if (but) { - uiButActiveOnly(C, ar, block, but); + UI_but_active_only(C, ar, block, but); return true; } else { @@ -9234,7 +9234,7 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut) } -void ui_button_clipboard_free(void) +void ui_but_clipboard_free(void) { curvemapping_free_data(&but_copypaste_curve); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 3048a49b3a6..6c80d3f1856 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -68,7 +68,7 @@ typedef enum { /* standard set */ UI_WTYPE_LABEL, UI_WTYPE_TOGGLE, - UI_WTYPE_OPTION, + UI_WTYPE_CHECKBOX, UI_WTYPE_RADIO, UI_WTYPE_NUMBER, UI_WTYPE_SLIDER, @@ -96,7 +96,7 @@ typedef enum { UI_WTYPE_ICON, UI_WTYPE_SWATCH, UI_WTYPE_RGB_PICKER, - UI_WTYPE_NORMAL, + UI_WTYPE_UNITVEC, UI_WTYPE_BOX, UI_WTYPE_SCROLL, UI_WTYPE_LISTITEM, @@ -213,20 +213,20 @@ struct uiBut { /* both these values use depends on the button type * (polymorphic struct or union would be nicer for this stuff) */ - /* (type == HSVCUBE), Use UI_GRAD_* values. - * (type == NUM), Use to store RNA 'step' value, for dragging and click-step. - * (type == LABEL), Use (a1 == 1.0f) to use a2 as a blending factor (wow, this is imaginative!). - * (type == SCROLL) Use as scroll size. - * (type == SEARCH_MENU) Use as number or rows. - * (type == COLOR) Use as indication of color palette + /* (type == UI_BTYPE_HSVCUBE), Use UI_GRAD_* values. + * (type == UI_BTYPE_NUM), Use to store RNA 'step' value, for dragging and click-step. + * (type == UI_BTYPE_LABEL), Use (a1 == 1.0f) to use a2 as a blending factor (wow, this is imaginative!). + * (type == UI_BTYPE_SCROLL) Use as scroll size. + * (type == UI_BTYPE_SEARCH_MENU) Use as number or rows. + * (type == UI_BTYPE_COLOR) Use as indication of color palette */ float a1; - /* (type == HSVCIRCLE ), Use to store the luminosity. - * (type == NUM), Use to store RNA 'precision' value, for dragging and click-step. - * (type == LABEL), If (a1 == 1.0f) use a2 as a blending factor. - * (type == SEARCH_MENU) Use as number or columns. - * (type == COLOR) Use as index in palette (not so good, needs refactor) + /* (type == UI_BTYPE_HSVCIRCLE ), Use to store the luminosity. + * (type == UI_BTYPE_NUM), Use to store RNA 'precision' value, for dragging and click-step. + * (type == UI_BTYPE_LABEL), If (a1 == 1.0f) use a2 as a blending factor. + * (type == UI_BTYPE_SEARCH_MENU) Use as number or columns. + * (type == UI_BTYPE_COLOR) Use as index in palette (not so good, needs refactor) */ float a2; @@ -258,17 +258,17 @@ struct uiBut { BIFIconID icon; bool lock; - char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */ + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */ signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */ char changed; /* could be made into a single flag */ unsigned char unit_type; /* so buttons can support unit systems which are not RNA */ short modifier_key; short iconadd; - /* BLOCK data */ + /* UI_BTYPE_BLOCK data */ uiBlockCreateFunc block_create_func; - /* PULLDOWN/MENU data */ + /* UI_BTYPE_PULLDOWN/UI_BTYPE_MENU data */ uiMenuCreateFunc menu_create_func; /* RNA data */ @@ -376,7 +376,7 @@ struct uiBlock { short alignnr; char direction; - char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */ bool auto_open; char _pad[7]; double auto_open_last; @@ -386,7 +386,7 @@ struct uiBlock { char lock; char active; /* to keep blocks while drawing and free them afterwards */ char tooltipdisabled; /* to avoid tooltip after click */ - char endblock; /* uiEndBlock done? */ + char endblock; /* UI_block_end done? */ eBlockBoundsCalc bounds_type; /* for doing delayed */ int mx, my; @@ -421,7 +421,7 @@ typedef struct uiSafetyRct { /* interface.c */ -extern void ui_delete_linkline(uiLinkLine *line, uiBut *but); +extern void ui_linkline_remove(uiLinkLine *line, uiBut *but); void ui_fontscale(short *points, float aspect); @@ -434,48 +434,48 @@ extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, floa extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y); extern void ui_window_to_region(const ARegion *ar, int *x, int *y); -extern double ui_get_but_val(uiBut *but); -extern void ui_set_but_val(uiBut *but, double value); -extern void ui_set_but_hsv(uiBut *but); -extern void ui_get_but_vectorf(uiBut *but, float vec[3]); -extern void ui_set_but_vectorf(uiBut *but, const float vec[3]); +extern double ui_but_value_get(uiBut *but); +extern void ui_but_value_set(uiBut *but, double value); +extern void ui_but_hsv_set(uiBut *but); +extern void ui_but_v3_get(uiBut *but, float vec[3]); +extern void ui_but_v3_set(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect, const float mx, const float my); extern void ui_hsvcircle_pos_from_vals(struct uiBut *but, const rcti *rect, float *hsv, float *xpos, float *ypos); extern void ui_hsvcube_pos_from_vals(struct uiBut *but, const rcti *rect, float *hsv, float *xp, float *yp); -bool ui_color_picker_use_display_colorspace(struct uiBut *but); +bool ui_but_is_colorpicker_display_space(struct uiBut *but); -extern void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision) ATTR_NONNULL(); -extern void ui_get_but_string(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); -extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) ATTR_NONNULL(); -extern bool ui_set_but_string(struct bContext *C, uiBut *but, const char *str) ATTR_NONNULL(); -extern bool ui_set_but_string_eval_num(struct bContext *C, uiBut *but, const char *str, double *value) ATTR_NONNULL(); -extern int ui_get_but_string_max_length(uiBut *but); -extern uiBut *ui_get_but_drag_multi_edit(uiBut *but); +extern void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision) ATTR_NONNULL(); +extern void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); +extern void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) ATTR_NONNULL(); +extern bool ui_but_string_set(struct bContext *C, uiBut *but, const char *str) ATTR_NONNULL(); +extern bool ui_but_string_set_eval_num(struct bContext *C, uiBut *but, const char *str, double *value) ATTR_NONNULL(); +extern int ui_but_string_get_max_length(uiBut *but); +extern uiBut *ui_but_drag_multi_edit_get(uiBut *but); -extern void ui_set_but_default(struct bContext *C, const bool all, const bool use_afterfunc); +extern void ui_but_default_set(struct bContext *C, const bool all, const bool use_afterfunc); -extern void ui_check_but(uiBut *but); -extern bool ui_is_but_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_bool(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_unit(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_compatible(const uiBut *but_a, const uiBut *but_b) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_rna_valid(uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_utf8(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_search_unlink_visible(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern void ui_but_update(uiBut *but); +extern bool ui_but_is_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_bool(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_unit(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_rna_valid(uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_utf8(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_search_unlink_visible(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern int ui_is_but_push_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT; -extern int ui_is_but_push(uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern int ui_but_is_pushed_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT; +extern int ui_but_is_pushed(uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern void ui_bounds_block(uiBlock *block); +extern void ui_block_bounds_calc(uiBlock *block); extern void ui_block_translate(uiBlock *block, int x, int y); -extern void ui_block_do_align(uiBlock *block); +extern void ui_block_align_calc(uiBlock *block); -extern struct ColorManagedDisplay *ui_block_display_get(uiBlock *block); -void ui_block_to_display_space_v3(uiBlock *block, float pixel[3]); -void ui_block_to_scene_linear_v3(uiBlock *block, float pixel[3]); +extern struct ColorManagedDisplay *ui_block_cm_display_get(uiBlock *block); +void ui_block_cm_to_display_space_v3(uiBlock *block, float pixel[3]); +void ui_block_cm_to_scene_linear_v3(uiBlock *block, float pixel[3]); /* interface_regions.c */ @@ -551,7 +551,7 @@ void ui_popup_menu_memory_set(uiBlock *block, struct uiBut *but); void ui_popup_translate(struct bContext *C, struct ARegion *ar, const int mdiff[2]); -ColorPicker *ui_block_picker_new(struct uiBlock *block); +ColorPicker *ui_block_colorpicker_create(struct uiBlock *block); void ui_popup_block_scrolltest(struct uiBlock *block); void ui_rgb_to_color_picker_compat_v(const float rgb[3], float r_cp[3]); @@ -568,7 +568,7 @@ int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, const struct wmEvent *event); bool ui_searchbox_apply(uiBut *but, struct ARegion *ar); void ui_searchbox_free(struct bContext *C, struct ARegion *ar); -void ui_but_search_test(uiBut *but); +void ui_but_search_refresh(uiBut *but); uiBlock *ui_popup_block_refresh(struct bContext *C, uiPopupBlockHandle *handle, ARegion *butregion, uiBut *but); @@ -581,7 +581,7 @@ uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, struct ARegion *but void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle); -int ui_step_name_menu(uiBut *but, int step); +int ui_but_menu_step(uiBut *but, int step); struct AutoComplete; @@ -590,7 +590,7 @@ extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *eve extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, const rcti *rect, const bool show_pin); /* interface_draw.c */ -extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); +extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, const float alpha); @@ -598,7 +598,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_COLORBAND(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_NORMAL(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); +void ui_draw_but_UNITVEC(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_CURVE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); @@ -607,21 +607,21 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol /* interface_handlers.c */ PointerRNA *ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, int opcontext, bool create_props); extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); -extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but); -extern void ui_button_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but); -extern void ui_button_execute_begin(struct bContext *C, struct ARegion *ar, uiBut *but, void **active_back); -extern void ui_button_execute_end(struct bContext *C, struct ARegion *ar, uiBut *but, void *active_back); -extern void ui_button_active_free(const struct bContext *C, uiBut *but); -extern bool ui_button_is_active(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT; -extern int ui_button_open_menu_direction(uiBut *but); -extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore); -extern uiBut *ui_but_find_activated(struct ARegion *ar); +extern void ui_but_activate_event(struct bContext *C, struct ARegion *ar, uiBut *but); +extern void ui_but_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but); +extern void ui_but_execute_begin(struct bContext *C, struct ARegion *ar, uiBut *but, void **active_back); +extern void ui_but_execute_end(struct bContext *C, struct ARegion *ar, uiBut *but, void *active_back); +extern void ui_but_active_free(const struct bContext *C, uiBut *but); +extern bool ui_but_is_active(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT; +extern int ui_but_menu_direction(uiBut *but); +extern void ui_but_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore); +extern uiBut *ui_but_find_active_in_region(struct ARegion *ar); bool ui_but_is_editable(const uiBut *but); void ui_but_pie_dir_visual(RadialDirection dir, float vec[2]); void ui_but_pie_dir(RadialDirection dir, float vec[2]); -float ui_block_calculate_pie_segment(struct uiBlock *block, const float event_xy[2]); +float ui_block_calc_pie_segment(struct uiBlock *block, const float event_xy[2]); -void ui_button_clipboard_free(void); +void ui_but_clipboard_free(void); void ui_panel_menu(struct bContext *C, ARegion *ar, Panel *pa); uiBut *ui_but_find_old(uiBlock *block_old, const uiBut *but_new); uiBut *ui_but_find_new(uiBlock *block_old, const uiBut *but_new); 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; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 817445cc14e..4cb587bc1be 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -98,7 +98,7 @@ static int copy_data_path_button_poll(bContext *C) char *path; int index; - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -120,7 +120,7 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) int index; /* try to create driver using property retrieved from UI */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -160,7 +160,7 @@ static int operator_button_property_finish(bContext *C, PointerRNA *ptr, Propert RNA_property_update(C, ptr, prop); /* as if we pressed the button */ - uiContextActivePropertyHandle(C); + UI_context_active_but_prop_handle(C); /* Since we don't want to undo _all_ edits to settings, eg window * edits on the screen or on operator settings. @@ -180,7 +180,7 @@ static int reset_default_button_poll(bContext *C) PropertyRNA *prop; int index; - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); return (ptr.data && prop && RNA_property_editable(&ptr, prop)); } @@ -193,7 +193,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to reset the nominated setting to its default value */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); /* if there is a valid property that is editable... */ if (ptr.data && prop && RNA_property_editable(&ptr, prop)) { @@ -231,7 +231,7 @@ static int unset_property_button_exec(bContext *C, wmOperator *UNUSED(op)) int index; /* try to unset the nominated property */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); /* if there is a valid property that is editable... */ if (ptr.data && prop && RNA_property_editable(&ptr, prop) && @@ -317,7 +317,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll) int index; /* try to reset the nominated setting to its default value */ - uiContextActiveProperty(C, &ptr, &prop, &index); + UI_context_active_but_prop_get(C, &ptr, &prop, &index); /* if there is a valid property that is editable... */ if (ptr.data && prop) { @@ -595,7 +595,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, static int editsource_exec(bContext *C, wmOperator *op) { - uiBut *but = uiContextActiveButton(C); + uiBut *but = UI_context_active_but_get(C); if (but) { GHashIterator ghi; @@ -605,7 +605,7 @@ static int editsource_exec(bContext *C, wmOperator *op) int ret; /* needed else the active button does not get tested */ - uiFreeActiveButtons(C, CTX_wm_screen(C)); + UI_screen_free_active_but(C, CTX_wm_screen(C)); // printf("%s: begin\n", __func__); @@ -715,7 +715,7 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch static int edittranslation_exec(bContext *C, wmOperator *op) { - uiBut *but = uiContextActiveButton(C); + uiBut *but = UI_context_active_but_get(C); int ret = OPERATOR_CANCELLED; if (but) { @@ -755,7 +755,7 @@ static int edittranslation_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - uiButGetStrInfo(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip, + UI_but_string_info_get(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip, &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL); WM_operator_properties_create_ptr(&ptr, ot); @@ -877,9 +877,9 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( /* find button under mouse, check if it has RNA color property and * if it does copy the data */ - but = ui_but_find_activated(ar); + but = ui_but_find_active_in_region(ar); - if (but && but->type == COLOR && but->rnaprop) { + if (but && but->type == UI_BTYPE_COLOR && but->rnaprop) { const int color_len = RNA_property_array_length(&but->rnapoin, but->rnaprop); BLI_assert(color_len <= 4); @@ -890,13 +890,13 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { if (!gamma) - ui_block_to_display_space_v3(but->block, color); + ui_block_cm_to_display_space_v3(but->block, color); RNA_property_float_set_array(&but->rnapoin, but->rnaprop, color); RNA_property_update(C, &but->rnapoin, but->rnaprop); } else if (RNA_property_subtype(but->rnaprop) == PROP_COLOR) { if (gamma) - ui_block_to_scene_linear_v3(but->block, color); + ui_block_cm_to_scene_linear_v3(but->block, color); RNA_property_float_set_array(&but->rnapoin, but->rnaprop, color); RNA_property_update(C, &but->rnapoin, but->rnaprop); } @@ -932,7 +932,7 @@ static void UI_OT_drop_color(wmOperatorType *ot) /* ********************************************************* */ /* Registration */ -void UI_buttons_operatortypes(void) +void ED_button_operatortypes(void) { WM_operatortype_append(UI_OT_reset_default_theme); WM_operatortype_append(UI_OT_copy_data_path_button); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 9265ca0d4b9..fc39b63a71d 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -207,7 +207,7 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar) */ /* #define UI_USE_PANELTAB */ -Panel *uiPanelFindByType(ARegion *ar, PanelType *pt) +Panel *UI_panel_find_by_type(ARegion *ar, PanelType *pt) { Panel *pa; const char *idname = pt->idname; @@ -233,9 +233,9 @@ Panel *uiPanelFindByType(ARegion *ar, PanelType *pt) } /** - * \note \a pa should be return value from #uiPanelFindByType and can be NULL. + * \note \a pa should be return value from #UI_panel_find_by_type and can be NULL. */ -Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, Panel *pa, bool *r_open) +Panel *UI_panel_begin(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, Panel *pa, bool *r_open) { Panel *palast, *panext; const char *drawname = CTX_IFACE_(pt->translation_context, pt->label); @@ -336,7 +336,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, Pan return pa; } -void uiEndPanel(uiBlock *block, int width, int height) +void UI_panel_end(uiBlock *block, int width, int height) { Panel *pa = block->panel; @@ -363,12 +363,12 @@ void uiEndPanel(uiBlock *block, int width, int height) static void ui_offset_panel_block(uiBlock *block) { - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); uiBut *but; int ofsy; /* compute bounds and offset */ - ui_bounds_block(block); + ui_block_bounds_calc(block); ofsy = block->panel->sizey - style->panelspace; @@ -401,7 +401,7 @@ static void uiPanelPop(uiBlock *UNUSED(block)) #endif /* triangle 'icon' for panel header */ -void UI_DrawTriIcon(float x, float y, char dir) +void UI_draw_icon_tri(float x, float y, char dir) { float f3 = 0.15 * U.widget_unit; float f5 = 0.25 * U.widget_unit; @@ -542,14 +542,14 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, const r if (dir == 'h') { hrect.xmin = rect->xmin + pnl_icons; hrect.ymin += 2.0f / block->aspect; - uiStyleFontDraw(&style->paneltitle, &hrect, activename); + UI_fontstyle_draw(&style->paneltitle, &hrect, activename); } else { /* ignore 'pnl_icons', otherwise the text gets offset horizontally * + 0.001f to avoid flirting with float inaccuracy */ hrect.xmin = rect->xmin + (PNL_ICON + 5) / block->aspect + 0.001f; - uiStyleFontDrawRotated(&style->paneltitle, &hrect, activename); + UI_fontstyle_draw_rotated(&style->paneltitle, &hrect, activename); } } @@ -641,11 +641,11 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con else { /* in some occasions, draw a border */ if (panel->flag & PNL_SELECT) { - if (panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL); - else uiSetRoundBox(UI_CNR_NONE); + if (panel->control & UI_PNL_SOLID) UI_draw_roundbox_corner_set(UI_CNR_ALL); + else UI_draw_roundbox_corner_set(UI_CNR_NONE); UI_ThemeColorShade(TH_BACK, -120); - uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax + 1, 8); + UI_draw_roundbox_unfilled(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax + 1, 8); } /* panel backdrop */ @@ -938,7 +938,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) } } -void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar) +void UI_panels_begin(const bContext *UNUSED(C), ARegion *ar) { Panel *pa; @@ -953,7 +953,7 @@ void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar) } /* only draws blocks with panels */ -void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y) +void UI_panels_end(const bContext *C, ARegion *ar, int *x, int *y) { ScrArea *sa = CTX_wm_area(C); uiBlock *block; @@ -1012,7 +1012,7 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y) ui_panels_size(sa, ar, x, y); } -void uiDrawPanels(const bContext *C, ARegion *ar) +void UI_panels_draw(const bContext *C, ARegion *ar) { uiBlock *block; @@ -1021,18 +1021,18 @@ void uiDrawPanels(const bContext *C, ARegion *ar) /* draw panels, selected on top */ for (block = ar->uiblocks.first; block; block = block->next) { if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) { - uiDrawBlock(C, block); + UI_block_draw(C, block); } } for (block = ar->uiblocks.first; block; block = block->next) { if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) { - uiDrawBlock(C, block); + UI_block_draw(C, block); } } } -void uiScalePanels(ARegion *ar, float new_width) +void UI_panels_scale(ARegion *ar, float new_width) { uiBlock *block; uiBut *but; @@ -1327,7 +1327,7 @@ void UI_panel_category_clear_all(ARegion *ar) BLI_freelistN(&ar->panels_category); } -/* based on uiDrawBox, check on making a version which allows us to skip some sides */ +/* based on UI_draw_roundbox_gl_mode, check on making a version which allows us to skip some sides */ static void ui_panel_category_draw_tab(int mode, float minx, float miny, float maxx, float maxy, float rad, int roundboxtype, const bool use_highlight, const bool use_shadow, @@ -1420,7 +1420,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* no tab outlines for */ // #define USE_FLAT_INACTIVE View2D *v2d = &ar->v2d; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); const uiFontStyle *fstyle = &style->widget; const int fontid = fstyle->uifont_id; short fstyle_points = fstyle->points; @@ -1487,7 +1487,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) BLF_enable(fontid, BLF_ROTATION); BLF_rotation(fontid, M_PI / 2); - //uiStyleFontSet(&style->widget); + //UI_fontstyle_set(&style->widget); ui_fontscale(&fstyle_points, aspect / (U.pixelsize * 1.1f)); BLF_size(fontid, fstyle_points, U.dpi); @@ -1768,7 +1768,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar) } /* on active button, do not handle panels */ - if (ui_button_is_active(ar)) + if (ui_but_is_active(ar)) continue; if (inside || inside_header) { 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); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index c27789c0fc9..d2aa463e3ff 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -145,13 +145,13 @@ static uiFont *uifont_to_blfont(int id) /* *************** draw ************************ */ -void uiStyleFontDrawExt(uiFontStyle *fs, const rcti *rect, const char *str, +void UI_fontstyle_draw_ex(uiFontStyle *fs, const rcti *rect, const char *str, size_t len, float *r_xofs, float *r_yofs) { float height; int xofs = 0, yofs; - uiStyleFontSet(fs); + UI_fontstyle_set(fs); height = BLF_ascender(fs->uifont_id); yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height)); @@ -192,22 +192,22 @@ void uiStyleFontDrawExt(uiFontStyle *fs, const rcti *rect, const char *str, *r_yofs = yofs; } -void uiStyleFontDraw(uiFontStyle *fs, const rcti *rect, const char *str) +void UI_fontstyle_draw(uiFontStyle *fs, const rcti *rect, const char *str) { float xofs, yofs; - uiStyleFontDrawExt(fs, rect, str, + UI_fontstyle_draw_ex(fs, rect, str, BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs); } /* drawn same as above, but at 90 degree angle */ -void uiStyleFontDrawRotated(uiFontStyle *fs, const rcti *rect, const char *str) +void UI_fontstyle_draw_rotated(uiFontStyle *fs, const rcti *rect, const char *str) { float height; int xofs, yofs; float angle; rcti txtrect; - uiStyleFontSet(fs); + UI_fontstyle_set(fs); height = BLF_ascender(fs->uifont_id); /* becomes x-offset when rotated */ @@ -255,7 +255,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, const rcti *rect, const char *str) /* ************** helpers ************************ */ /* XXX: read a style configure */ -uiStyle *UI_GetStyle(void) +uiStyle *UI_style_get(void) { uiStyle *style = NULL; /* offset is two struct uiStyle pointers */ @@ -264,9 +264,9 @@ uiStyle *UI_GetStyle(void) } /* for drawing, scaled with DPI setting */ -uiStyle *UI_GetStyleDraw(void) +uiStyle *UI_style_get_dpi(void) { - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); static uiStyle _style; _style = *style; @@ -290,16 +290,16 @@ uiStyle *UI_GetStyleDraw(void) } /* temporarily, does widget font */ -int UI_GetStringWidth(const char *str) +int UI_fontstyle_string_width(const char *str) { - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); uiFontStyle *fstyle = &style->widget; int width; if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); width = BLF_width(fstyle->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); if (fstyle->kerning == 1) @@ -309,14 +309,14 @@ int UI_GetStringWidth(const char *str) } /* temporarily, does widget font */ -void UI_DrawString(float x, float y, const char *str) +void UI_draw_string(float x, float y, const char *str) { - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); if (style->widget.kerning == 1) BLF_enable(style->widget.uifont_id, BLF_KERNING_DEFAULT); - uiStyleFontSet(&style->widget); + UI_fontstyle_set(&style->widget); BLF_position(style->widget.uifont_id, x, y, 0.0f); BLF_draw(style->widget.uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); @@ -451,7 +451,7 @@ void uiStyleInit(void) BLF_size(blf_mono_font_render, 12 * U.pixelsize, 72); } -void uiStyleFontSet(uiFontStyle *fs) +void UI_fontstyle_set(uiFontStyle *fs) { uiFont *font = uifont_to_blfont(fs->uifont_id); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 5feb7029f5d..b3ba4fa3cb6 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -158,7 +158,7 @@ static void id_search_cb(const bContext *C, void *arg_template, const char *str, iconid = ui_id_icon_get((bContext *)C, id, template->preview); - if (false == uiSearchItemAdd(items, name_ui, id, iconid)) + if (false == UI_search_item_add(items, name_ui, id, iconid)) break; } } @@ -183,8 +183,8 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) /* get active id for showing first item */ idptr = RNA_property_pointer_get(&template.ptr, template.prop); - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU); /* preview thumbnails */ if (template.prv_rows > 0 && template.prv_cols > 0) { @@ -192,29 +192,29 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) int h = 4 * U.widget_unit * template.prv_rows + U.widget_unit; /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, UI_UNIT_Y, template.prv_rows, template.prv_cols, ""); - uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data); + UI_but_func_search_set(but, id_search_cb, &template, id_search_call_cb, idptr.data); } /* list view */ else { - const int searchbox_width = uiSearchBoxWidth(); - const int searchbox_height = uiSearchBoxHeight(); + const int searchbox_width = UI_searchbox_size_x(); + const int searchbox_height = UI_searchbox_size_y(); /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 15, searchbox_width, searchbox_height, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, searchbox_width, searchbox_height, NULL, 0, 0, 0, 0, NULL); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, searchbox_width, UI_UNIT_Y - 1, 0, 0, ""); - uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data); + UI_but_func_search_set(but, id_search_cb, &template, id_search_call_cb, idptr.data); } - uiBoundsBlock(block, 0.3f * U.widget_unit); - uiBlockSetDirection(block, UI_DOWN); + UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); + UI_block_direction_set(block, UI_DIR_DOWN); /* give search-field focus */ - uiButSetFocusOnEnter(win, but); + UI_but_focus_on_enter_event(win, but); /* this type of search menu requires undo */ but->flag |= UI_BUT_UNDO; @@ -225,7 +225,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) /* This is for browsing and editing the ID-blocks used */ /* for new/open operators */ -void uiIDContextProperty(bContext *C, PointerRNA *ptr, PropertyRNA **prop) +void UI_context_active_but_prop_get_templateID(bContext *C, PointerRNA *ptr, PropertyRNA **prop) { TemplateID *template; ARegion *ar = CTX_wm_region(C); @@ -268,7 +268,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) break; case UI_ID_OPEN: case UI_ID_ADD_NEW: - /* these call uiIDContextProperty */ + /* these call UI_context_active_but_prop_get_templateID */ break; case UI_ID_DELETE: memset(&idptr, 0, sizeof(idptr)); @@ -412,7 +412,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str // lb = template->idlb; block = uiLayoutGetBlock(layout); - uiBlockBeginAlign(block); + UI_block_align_begin(block); if (idptr.type) type = idptr.type; @@ -423,10 +423,10 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, TIP_(template_id_browse_tip(type))); but->icon = id ? ui_id_icon_get(C, id, true) : RNA_struct_ui_icon(type); - uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW); + UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); if ((idfrom && idfrom->lib) || !editable) - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); uiLayoutRow(layout, true); } @@ -435,12 +435,12 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str TIP_(template_id_browse_tip(type))); but->icon = RNA_struct_ui_icon(type); /* default dragging of icon for id browse buttons */ - uiButSetDragID(but, id); - uiButSetFlag(but, UI_HAS_ICON); - uiButSetDrawFlag(but, UI_BUT_ICON_LEFT); + UI_but_drag_set_id(but, id); + UI_but_flag_enable(but, UI_HAS_ICON); + UI_but_drawflag_enable(but, UI_BUT_ICON_LEFT); if ((idfrom && idfrom->lib) || !editable) - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } /* text button with name */ @@ -450,25 +450,25 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str //text_idbutton(id, name); name[0] = '\0'; - but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_TEXT, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type)); - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME)); - if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME)); + if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT); if (id->lib) { if (id->flag & LIB_INDIRECT) { - but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Indirect library datablock, cannot change")); - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } else { - but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Direct linked library datablock, click to make local")); if (!id_make_local(id, true /* test */) || (idfrom && idfrom->lib)) - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_LOCAL)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_LOCAL)); } if (id->us > 1) { @@ -476,12 +476,12 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str BLI_snprintf(numstr, sizeof(numstr), "%d", id->us); - but = uiDefBut(block, BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y, + but = uiDefBut(block, UI_BTYPE_BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Display number of users of this data (click to make a single-user copy)")); but->flag |= UI_BUT_UNDO; - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE)); if (/* test only */ (id_copy(id, NULL, true) == false) || (idfrom && idfrom->lib) || @@ -489,14 +489,14 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str /* object in editmode - don't change data */ (idfrom && GS(idfrom->name) == ID_OB && (((Object *)idfrom)->mode & OB_MODE_EDIT))) { - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } } - if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT); + if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT); if (id->lib == NULL && !(ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) { - uiDefButR(block, TOG, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL); + uiDefButR(block, UI_BTYPE_TOGGLE, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL); } } @@ -532,26 +532,26 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str ); if (newop) { - but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, + but = uiDefIconTextButO(block, UI_BTYPE_BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, UI_UNIT_Y, NULL); - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } else { - but = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), + but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } if ((idfrom && idfrom->lib) || !editable) - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack. * Only for images, sound and fonts */ if (id && BKE_pack_check(id)) { - but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, + but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack")); - uiButGetOperatorPtrRNA(but); + UI_but_operator_ptr_get(but); RNA_string_set(but->opptr, "id_name", id->name + 2); RNA_int_set(but->opptr, "id_type", GS(id->name)); @@ -561,18 +561,18 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6; if (openop) { - but = uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"), + but = uiDefIconTextButO(block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL); - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); } else { - but = uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, + but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); } if ((idfrom && idfrom->lib) || !editable) - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } /* delete button */ @@ -582,26 +582,26 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str but = NULL; if (unlinkop) { - but = uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); + but = uiDefIconButO(block, UI_BTYPE_BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); /* so we can access the template from operators, font unlinking needs this */ - uiButSetNFunc(but, NULL, MEM_dupallocN(template), NULL); + UI_but_funcN_set(but, NULL, MEM_dupallocN(template), NULL); } else { if ((RNA_property_flag(template->prop) & PROP_NEVER_UNLINK) == 0) { - but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Unlink datablock " "(Shift + Click to set users to zero, data will then not be saved)")); - uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); + UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); if (RNA_property_flag(template->prop) & PROP_NEVER_NULL) { - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } } } if (but) { if ((idfrom && idfrom->lib) || !editable) { - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } } } @@ -609,7 +609,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if (idcode == ID_TE) uiTemplateTextureShow(layout, C, &template->ptr, template->prop); - uiBlockEndAlign(block); + UI_block_align_end(block); } static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, @@ -843,24 +843,24 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, /* VIRTUAL MODIFIER */ /* XXX this is not used now, since these cannot be accessed via RNA */ BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name); - uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name")); + uiDefBut(block, UI_BTYPE_LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name")); - but = uiDefBut(block, BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, + but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Convert virtual modifier to a real modifier")); - uiButSetFunc(but, modifiers_convertToReal, ob, md); + UI_but_func_set(but, modifiers_convertToReal, ob, md); } else { /* REAL MODIFIER */ row = uiLayoutRow(box, false); block = uiLayoutGetBlock(row); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* Open/Close ................................. */ uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE); /* modifier-type icon */ uiItemL(row, "", RNA_struct_ui_icon(ptr.type)); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); /* modifier name */ md->scene = scene; @@ -871,7 +871,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, uiLayoutSetRedAlert(row, false); /* mode enabling buttons */ - uiBlockBeginAlign(block); + UI_block_align_begin(block); /* Softbody not allowed in this situation, enforce! */ if (((md->type != eModifierType_Softbody && md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type != eModifierType_Surface) ) @@ -902,10 +902,10 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { /* add disabled pre-tessellated button, so users could have * message for this modifiers */ - but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, + but = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, TIP_("This modifier can only be applied on splines' points")); - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } else if (mti->type != eModifierTypeType_Constructive) { /* constructive modifiers tessellates curve before applying */ @@ -913,15 +913,15 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, } } - uiBlockEndAlign(block); + UI_block_align_end(block); /* Up/Down + Delete ........................... */ - uiBlockBeginAlign(block); + UI_block_align_begin(block); uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_modifier_move_up"); uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_modifier_move_down"); - uiBlockEndAlign(block); + UI_block_align_end(block); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* When Modifier is a simulation, show button to switch to context rather than the delete button. */ if (modifier_can_delete(md) && (!modifier_is_simulation(md) || @@ -935,7 +935,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, else if (modifier_is_simulation(md) == 2) { uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PARTICLES"); } - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } @@ -947,7 +947,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) { /* only here obdata, the rest of modifiers is ob level */ - uiBlockSetButLock(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE); + UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE); if (md->type == eModifierType_ParticleSystem) { ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; @@ -973,8 +973,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, } } - uiBlockClearButLock(block); - uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE); + UI_block_lock_clear(block); + UI_block_lock_set(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE); if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke)) @@ -1021,7 +1021,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) return NULL; } - uiBlockSetButLock(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE); + UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE); /* find modifier and draw it */ cageIndex = modifiers_getCageIndex(scene, ob, &lastCageIndex, 0); @@ -1115,8 +1115,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* unless button has own callback, it adds this callback to button */ block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_constraint_panels, ob); - uiBlockSetFunc(block, constraint_active_func, ob, con); + UI_block_func_handle_set(block, do_constraint_panels, ob); + UI_block_func_set(block, constraint_active_func, ob, con); RNA_pointer_create(&ob->id, &RNA_Constraint, con, &ptr); @@ -1130,12 +1130,12 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* Draw constraint header */ /* open/close */ - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); uiItemR(row, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); /* name */ - uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, + uiDefBut(block, UI_BTYPE_LABEL, B_CONSTRAINT_TEST, typestr, xco + 0.5f * UI_UNIT_X, yco, 5 * UI_UNIT_X, 0.9f * UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, ""); if (con->flag & CONSTRAINT_DISABLE) @@ -1151,15 +1151,15 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* proxy-protected constraints cannot be edited, so hide up/down + close buttons */ if (proxy_protected) { - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); /* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */ - uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 12.2f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y, + uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 12.2f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected")); - uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 13.1f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y, + uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 13.1f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected")); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } else { short prev_proxylock, show_upbut, show_downbut; @@ -1185,33 +1185,33 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) show_downbut = (con->next) ? 1 : 0; /* enabled */ - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); /* up/down */ if (show_upbut || show_downbut) { - uiBlockBeginAlign(block); + UI_block_align_begin(block); if (show_upbut) uiItemO(row, "", ICON_TRIA_UP, "CONSTRAINT_OT_move_up"); if (show_downbut) uiItemO(row, "", ICON_TRIA_DOWN, "CONSTRAINT_OT_move_down"); - uiBlockEndAlign(block); + UI_block_align_end(block); } /* Close 'button' - emboss calls here disable drawing of 'button' behind X */ - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); uiItemO(row, "", ICON_X, "CONSTRAINT_OT_delete"); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } /* Set but-locks for protected settings (magic numbers are used here!) */ if (proxy_protected) - uiBlockSetButLock(block, true, IFACE_("Cannot edit Proxy-Protected Constraint")); + UI_block_lock_set(block, true, IFACE_("Cannot edit Proxy-Protected Constraint")); /* Draw constraint data */ if ((con->flag & CONSTRAINT_EXPAND) == 0) { @@ -1224,7 +1224,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) } /* clear any locks set up for proxies/lib-linking */ - uiBlockClearButLock(block); + UI_block_lock_clear(block); return result; } @@ -1248,7 +1248,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr) return NULL; } - uiBlockSetButLock(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE); + UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE); /* hrms, the temporal constraint should not draw! */ if (con->type == CONSTRAINT_TYPE_KINEMATIC) { @@ -1353,11 +1353,11 @@ void uiTemplatePreview(uiLayout *layout, bContext *C, ID *id, int show_buttons, uiLayoutSetKeepAspect(col, true); /* add preview */ - uiDefBut(block, BUT_EXTRA, 0, "", 0, 0, UI_UNIT_X * 10, ui_preview->height, pid, 0.0, 0.0, 0, 0, ""); - uiBlockSetDrawExtraFunc(block, ED_preview_draw, pparent, slot); - uiBlockSetHandleFunc(block, do_preview_buttons, NULL); + uiDefBut(block, UI_BTYPE_EXTRA, 0, "", 0, 0, UI_UNIT_X * 10, ui_preview->height, pid, 0.0, 0.0, 0, 0, ""); + UI_but_func_drawextra_set(block, ED_preview_draw, pparent, slot); + UI_block_func_handle_set(block, do_preview_buttons, NULL); - uiDefIconButS(block, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height, + uiDefIconButS(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height, UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, ""); /* add buttons */ @@ -1379,25 +1379,25 @@ void uiTemplatePreview(uiLayout *layout, bContext *C, ID *id, int show_buttons, RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr); uiLayoutRow(layout, true); - uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Texture"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, ""); if (GS(parent->name) == ID_MA) { - uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Material"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); } else if (GS(parent->name) == ID_LA) { - uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Lamp"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); } else if (GS(parent->name) == ID_WO) { - uiDefButS(block, ROW, B_MATPRV, IFACE_("World"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("World"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); } else if (GS(parent->name) == ID_LS) { - uiDefButS(block, ROW, B_MATPRV, IFACE_("Line Style"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Line Style"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); } - uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Both"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, ""); /* Alpha button for texture preview */ @@ -1501,28 +1501,28 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand split = uiLayoutSplit(layout, 0.4f, false); - uiBlockSetEmboss(block, UI_EMBOSSN); - uiBlockBeginAlign(block); + UI_block_emboss_set(block, UI_EMBOSS_NONE); + UI_block_align_begin(block); row = uiLayoutRow(split, false); - bt = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL, + bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Add a new color stop to the colorband")); - uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba); + UI_but_funcN_set(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, + bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Delete the active position")); - uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba); + UI_but_funcN_set(bt, colorband_del_cb, MEM_dupallocN(cb), coba); - bt = uiDefIconTextBut(block, BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, + bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip the color ramp")); - uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); - uiBlockEndAlign(block); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_but_funcN_set(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); + UI_block_align_end(block); + UI_block_emboss_set(block, UI_EMBOSS); row = uiLayoutRow(split, false); - uiBlockBeginAlign(block); + UI_block_align_begin(block); uiItemR(row, &ptr, "color_mode", 0, "", ICON_NONE); if (ELEM(coba->color_mode, COLBAND_BLEND_HSV, COLBAND_BLEND_HSL)) { uiItemR(row, &ptr, "hue_interpolation", 0, "", ICON_NONE); @@ -1530,12 +1530,12 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand else { /* COLBAND_BLEND_RGB */ uiItemR(row, &ptr, "interpolation", 0, "", ICON_NONE); } - uiBlockEndAlign(block); + UI_block_align_end(block); row = uiLayoutRow(layout, false); - bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, ys, BLI_rctf_size_x(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, ""); - uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); + bt = uiDefBut(block, UI_BTYPE_COLORBAND, 0, "", xs, ys, BLI_rctf_size_x(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, ""); + UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); row = uiLayoutRow(layout, false); @@ -1548,34 +1548,34 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand split = uiLayoutSplit(layout, 0.3f, false); row = uiLayoutRow(split, false); - uiDefButS(block, NUM, 0, "", 0, 0, 5.0f * UI_UNIT_X, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), + uiDefButS(block, UI_BTYPE_NUM, 0, "", 0, 0, 5.0f * UI_UNIT_X, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), 0, 0, TIP_("Choose active color stop")); row = uiLayoutRow(split, false); uiItemR(row, &ptr, "position", 0, IFACE_("Pos"), ICON_NONE); bt = block->buttons.last; - uiButSetFunc(bt, colorband_update_cb, bt, coba); + UI_but_func_set(bt, colorband_update_cb, bt, coba); row = uiLayoutRow(layout, false); uiItemR(row, &ptr, "color", 0, "", ICON_NONE); bt = block->buttons.last; - uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); + UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); } else { split = uiLayoutSplit(layout, 0.5f, false); subsplit = uiLayoutSplit(split, 0.35f, false); row = uiLayoutRow(subsplit, false); - uiDefButS(block, NUM, 0, "", 0, 0, 5.0f * UI_UNIT_X, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), + uiDefButS(block, UI_BTYPE_NUM, 0, "", 0, 0, 5.0f * UI_UNIT_X, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), 0, 0, TIP_("Choose active color stop")); row = uiLayoutRow(subsplit, false); uiItemR(row, &ptr, "position", UI_ITEM_R_SLIDER, IFACE_("Pos"), ICON_NONE); bt = block->buttons.last; - uiButSetFunc(bt, colorband_update_cb, bt, coba); + UI_but_func_set(bt, colorband_update_cb, bt, coba); row = uiLayoutRow(split, false); uiItemR(row, &ptr, "color", 0, "", ICON_NONE); bt = block->buttons.last; - uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); + UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); } } } @@ -1606,11 +1606,11 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname block = uiLayoutAbsoluteBlock(layout); id = cptr.id.data; - uiBlockSetButLock(block, (id && id->lib), ERROR_LIBDATA_MESSAGE); + UI_block_lock_set(block, (id && id->lib), ERROR_LIBDATA_MESSAGE); colorband_buttons_layout(layout, block, cptr.data, &rect, cb, expand); - uiBlockClearButLock(block); + UI_block_lock_clear(block); MEM_freeN(cb); } @@ -1619,7 +1619,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname /********************* Icon viewer Template ************************/ /* ID Search browse menu, open */ -static uiBlock *icon_view_menu(bContext *C, ARegion *ar, void *arg_litem) +static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) { static RNAUpdateCb cb; uiBlock *block; @@ -1635,8 +1635,8 @@ static uiBlock *icon_view_menu(bContext *C, ARegion *ar, void *arg_litem) /* unused */ // icon = RNA_property_enum_get(&cb.ptr, cb.prop); - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW); RNA_property_enum_items(C, &cb.ptr, cb.prop, &item, NULL, &free); @@ -1649,12 +1649,12 @@ static uiBlock *icon_view_menu(bContext *C, ARegion *ar, void *arg_litem) y = (a / 8) * UI_UNIT_X * 5; icon = item[a].icon; - but = uiDefIconButR_prop(block, ROW, 0, icon, x, y, UI_UNIT_X * 5, UI_UNIT_Y * 5, &cb.ptr, cb.prop, -1, 0, icon, -1, -1, NULL); - uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW); + but = uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, x, y, UI_UNIT_X * 5, UI_UNIT_Y * 5, &cb.ptr, cb.prop, -1, 0, icon, -1, -1, NULL); + UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); } - uiBoundsBlock(block, 0.3f * U.widget_unit); - uiBlockSetDirection(block, UI_TOP); + UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); + UI_block_direction_set(block, UI_DIR_UP); if (free) { MEM_freeN(item); @@ -1686,15 +1686,15 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname) block = uiLayoutAbsoluteBlock(layout); - but = uiDefBlockButN(block, icon_view_menu, MEM_dupallocN(cb), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, ""); + but = uiDefBlockButN(block, ui_icon_view_menu_cb, MEM_dupallocN(cb), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, ""); -// but = uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect), ptr, prop, -1, 0, icon, -1, -1, NULL); +// but = uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, 0, 0, BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect), ptr, prop, -1, 0, icon, -1, -1, NULL); but->icon = icon; - uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW); + UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); - uiButSetNFunc(but, rna_update_cb, MEM_dupallocN(cb), NULL); + UI_but_funcN_set(but, rna_update_cb, MEM_dupallocN(cb), NULL); MEM_freeN(cb); } @@ -1727,10 +1727,10 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname col = uiLayoutColumn(layout, true); block = uiLayoutGetBlock(col); - uiDefBut(block, HISTOGRAM, 0, "", 0, 0, UI_UNIT_X * 10, hist->height, hist, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_HISTOGRAM, 0, "", 0, 0, UI_UNIT_X * 10, hist->height, hist, 0, 0, 0, 0, ""); /* Resize grip. */ - uiDefIconButI(block, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &hist->height, + uiDefIconButI(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &hist->height, UI_UNIT_Y, UI_UNIT_Y * 20.0f, 0.0f, 0.0f, ""); } @@ -1762,10 +1762,10 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname) scopes->wavefrm_height = UI_UNIT_Y * 20; } - uiDefBut(block, WAVEFORM, 0, "", 0, 0, UI_UNIT_X * 10, scopes->wavefrm_height, scopes, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_WAVEFORM, 0, "", 0, 0, UI_UNIT_X * 10, scopes->wavefrm_height, scopes, 0, 0, 0, 0, ""); /* Resize grip. */ - uiDefIconButI(block, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &scopes->wavefrm_height, + uiDefIconButI(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &scopes->wavefrm_height, UI_UNIT_Y, UI_UNIT_Y * 20.0f, 0.0f, 0.0f, ""); } @@ -1797,10 +1797,10 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna col = uiLayoutColumn(layout, true); block = uiLayoutGetBlock(col); - uiDefBut(block, VECTORSCOPE, 0, "", 0, 0, UI_UNIT_X * 10, scopes->vecscope_height, scopes, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_VECTORSCOPE, 0, "", 0, 0, UI_UNIT_X * 10, scopes->vecscope_height, scopes, 0, 0, 0, 0, ""); /* Resize grip. */ - uiDefIconButI(block, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &scopes->vecscope_height, + uiDefIconButI(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &scopes->vecscope_height, UI_UNIT_Y, UI_UNIT_Y * 20.0f, 0.0f, 0.0f, ""); } @@ -1887,26 +1887,26 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v) uiBut *bt; float width = 8 * UI_UNIT_X; - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - bt = uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"), + bt = uiDefButBitI(block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"), 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, ""); - uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL); + UI_but_func_set(bt, curvemap_buttons_setclip, cumap, NULL); - uiBlockBeginAlign(block); - uiDefButF(block, NUM, 0, IFACE_("Min X "), 0, 4 * UI_UNIT_Y, width, UI_UNIT_Y, + UI_block_align_begin(block); + uiDefButF(block, UI_BTYPE_NUM, 0, IFACE_("Min X "), 0, 4 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 2, ""); - uiDefButF(block, NUM, 0, IFACE_("Min Y "), 0, 3 * UI_UNIT_Y, width, UI_UNIT_Y, + uiDefButF(block, UI_BTYPE_NUM, 0, IFACE_("Min Y "), 0, 3 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 2, ""); - uiDefButF(block, NUM, 0, IFACE_("Max X "), 0, 2 * UI_UNIT_Y, width, UI_UNIT_Y, + uiDefButF(block, UI_BTYPE_NUM, 0, IFACE_("Max X "), 0, 2 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 2, ""); - uiDefButF(block, NUM, 0, IFACE_("Max Y "), 0, UI_UNIT_Y, width, UI_UNIT_Y, + uiDefButF(block, UI_BTYPE_NUM, 0, IFACE_("Max Y "), 0, UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 2, ""); - uiBlockSetDirection(block, UI_RIGHT); + UI_block_direction_set(block, UI_DIR_RIGHT); return block; } @@ -1963,24 +1963,24 @@ static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *ar, void *cum uiBlock *block; short yco = 0, menuwidth = 10 * UI_UNIT_X; - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); - uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + UI_block_func_butmenu_set(block, curvemap_tools_dofunc, cumap_v); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_VIEW, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_VECTOR, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_AUTO, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_HOZ, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_EXP, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_POS, ""); - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 50); + UI_block_direction_set(block, UI_DIR_RIGHT); + UI_block_bounds_set_text(block, 50); return block; } @@ -1990,24 +1990,24 @@ static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *ar, void *cum uiBlock *block; short yco = 0, menuwidth = 10 * UI_UNIT_X; - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); - uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + UI_block_func_butmenu_set(block, curvemap_tools_dofunc, cumap_v); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_VIEW, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_VECTOR, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_AUTO, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_HOZ, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_EXP, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_NEG, ""); - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 50); + UI_block_direction_set(block, UI_DIR_RIGHT); + UI_block_bounds_set_text(block, 50); return block; } @@ -2017,20 +2017,20 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_ uiBlock *block; short yco = 0, menuwidth = 10 * UI_UNIT_X; - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); - uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + UI_block_func_butmenu_set(block, curvemap_tools_dofunc, cumap_v); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_VIEW, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_VECTOR, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_AUTO, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_NEG, ""); - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 50); + UI_block_direction_set(block, UI_DIR_RIGHT); + UI_block_bounds_set_text(block, 50); return block; } @@ -2090,16 +2090,16 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); if (cumap->cm[0].curve) { - bt = uiDefButI(block, ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } if (cumap->cm[1].curve) { - bt = uiDefButI(block, ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } if (cumap->cm[2].curve) { - bt = uiDefButI(block, ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } } else if (labeltype == 'c') { @@ -2108,20 +2108,20 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); if (cumap->cm[3].curve) { - bt = uiDefButI(block, ROW, 0, "C", 0, 0, dx, dx, &cumap->cur, 0.0, 3.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "C", 0, 0, dx, dx, &cumap->cur, 0.0, 3.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } if (cumap->cm[0].curve) { - bt = uiDefButI(block, ROW, 0, "R", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "R", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } if (cumap->cm[1].curve) { - bt = uiDefButI(block, ROW, 0, "G", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "G", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } if (cumap->cm[2].curve) { - bt = uiDefButI(block, ROW, 0, "B", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "B", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } } else if (labeltype == 'h') { @@ -2130,16 +2130,16 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); if (cumap->cm[0].curve) { - bt = uiDefButI(block, ROW, 0, "H", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "H", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } if (cumap->cm[1].curve) { - bt = uiDefButI(block, ROW, 0, "S", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "S", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } if (cumap->cm[2].curve) { - bt = uiDefButI(block, ROW, 0, "V", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, ""); - uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL); + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "V", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL); } } else @@ -2151,13 +2151,13 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe /* operation buttons */ sub = uiLayoutRow(row, true); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); - bt = uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom in")); - uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL); + bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom in")); + UI_but_func_set(bt, curvemap_buttons_zoom_in, cumap, NULL); - bt = uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out")); - uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL); + bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out")); + UI_but_func_set(bt, curvemap_buttons_zoom_out, cumap, NULL); if (brush) bt = uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools")); @@ -2168,23 +2168,23 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe bt = uiDefIconBlockBut(block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools")); - uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); + UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); icon = (cumap->flag & CUMA_DO_CLIP) ? ICON_CLIPUV_HLT : ICON_CLIPUV_DEHLT; bt = uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options")); - uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); + UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); - bt = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete points")); - uiButSetNFunc(bt, curvemap_buttons_delete, MEM_dupallocN(cb), cumap); + bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete points")); + UI_but_funcN_set(bt, curvemap_buttons_delete, MEM_dupallocN(cb), cumap); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); - uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL); + UI_block_funcN_set(block, rna_update_cb, MEM_dupallocN(cb), NULL); /* curve itself */ size = uiLayoutGetWidth(layout); row = uiLayoutRow(layout, false); - uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, 8.0f * UI_UNIT_X, cumap, 0.0f, 1.0f, bg, 0, ""); + uiDefBut(block, UI_BTYPE_CURVE, 0, "", 0, 0, size, 8.0f * UI_UNIT_X, cumap, 0.0f, 1.0f, bg, 0, ""); /* sliders for selected point */ for (i = 0; i < cm->totpoint; i++) { @@ -2206,10 +2206,10 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe } uiLayoutRow(layout, true); - uiBlockSetNFunc(block, curvemap_buttons_update, MEM_dupallocN(cb), cumap); - uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, + UI_block_funcN_set(block, curvemap_buttons_update, MEM_dupallocN(cb), cumap); + uiDefButF(block, UI_BTYPE_NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, bounds.xmin, bounds.xmax, 1, 5, ""); - uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButF(block, UI_BTYPE_NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, bounds.ymin, bounds.ymax, 1, 5, ""); } @@ -2220,12 +2220,12 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiItemR(uiLayoutColumn(split, false), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiLayoutRow(layout, false); - bt = uiDefBut(block, BUT, 0, IFACE_("Reset"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + bt = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Reset"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, TIP_("Reset Black/White point and curves")); - uiButSetNFunc(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap); + UI_but_funcN_set(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap); } - uiBlockSetNFunc(block, NULL, NULL, NULL); + UI_block_funcN_set(block, NULL, NULL, NULL); } void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propname, int type, @@ -2258,11 +2258,11 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn cb->prop = prop; id = cptr.id.data; - uiBlockSetButLock(block, (id && id->lib), ERROR_LIBDATA_MESSAGE); + UI_block_lock_set(block, (id && id->lib), ERROR_LIBDATA_MESSAGE); curvemap_buttons_layout(layout, &cptr, type, levels, brush, neg_slope, cb); - uiBlockClearButLock(block); + UI_block_lock_clear(block); MEM_freeN(cb); } @@ -2279,7 +2279,7 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna uiBlock *block = uiLayoutGetBlock(layout); uiLayout *col, *row; uiBut *but = NULL; - ColorPicker *cpicker = ui_block_picker_new(block); + ColorPicker *cpicker = ui_block_colorpicker_create(block); float softmin, softmax, step, precision; if (!prop) { @@ -2294,15 +2294,15 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna switch (U.color_picker_type) { case USER_CP_SQUARE_SV: - but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_SV, 0, ""); break; case USER_CP_SQUARE_HS: - but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_HS, 0, ""); break; case USER_CP_SQUARE_HV: - but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_HV, 0, ""); break; @@ -2310,7 +2310,7 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna case USER_CP_CIRCLE_HSV: case USER_CP_CIRCLE_HSL: default: - but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, ""); break; @@ -2337,22 +2337,22 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna switch (U.color_picker_type) { case USER_CP_CIRCLE_HSL: uiItemS(row); - but = uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, -1, softmin, softmax, UI_GRAD_L_ALT, 0, ""); break; case USER_CP_SQUARE_SV: uiItemS(col); - but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_SV + 3, 0, ""); break; case USER_CP_SQUARE_HS: uiItemS(col); - but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_HS + 3, 0, ""); break; case USER_CP_SQUARE_HV: uiItemS(col); - but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_HV + 3, 0, ""); break; @@ -2360,7 +2360,7 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna case USER_CP_CIRCLE_HSV: default: uiItemS(row); - but = uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, + but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, -1, softmin, softmax, UI_GRAD_V_ALT, 0, ""); break; } @@ -2400,8 +2400,8 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, col = uiLayoutColumn(layout, true); uiLayoutRow(col, true); - uiDefIconButO(block, BUT, "PALETTE_OT_color_add", WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); - uiDefIconButO(block, BUT, "PALETTE_OT_color_delete", WM_OP_INVOKE_DEFAULT, ICON_ZOOMOUT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); + uiDefIconButO(block, UI_BTYPE_BUT, "PALETTE_OT_color_add", WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); + uiDefIconButO(block, UI_BTYPE_BUT, "PALETTE_OT_color_delete", WM_OP_INVOKE_DEFAULT, ICON_ZOOMOUT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); col = uiLayoutColumn(layout, true); uiLayoutRow(col, true); @@ -2415,7 +2415,7 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, } RNA_pointer_create(&palette->id, &RNA_PaletteColor, color, &ptr); - uiDefButR(block, COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &ptr, "color", -1, 0.0, 1.0, + uiDefButR(block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &ptr, "color", -1, 0.0, 1.0, UI_PALETTE_COLOR, col_id, ""); row_cols++; col_id++; @@ -2511,8 +2511,8 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, icon = ICON_LAYER_USED; but = uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2); - uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer)); - but->type = TOG; + UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer)); + but->type = UI_BTYPE_TOGGLE; } } } @@ -2578,10 +2578,10 @@ void uiTemplateGameStates(uiLayout *layout, PointerRNA *ptr, const char *propnam else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, state)) icon = ICON_LAYER_USED; - but = uiDefIconButR_prop(block, ICONTOG, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop, + but = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop, state, 0, 0, -1, -1, sca_state_name_get(ob, state)); - uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state)); - but->type = TOG; + UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state)); + but->type = UI_BTYPE_TOGGLE; } } } @@ -2767,7 +2767,7 @@ typedef struct { int end_idx; /* Index of last item to display + 1. */ } uiListLayoutdata; -static void prepare_list(uiList *ui_list, int len, int activei, int rows, int maxrows, int columns, +static void uilist_prepare(uiList *ui_list, int len, int activei, int rows, int maxrows, int columns, uiListLayoutdata *layoutdata) { uiListDyn *dyn_data = ui_list->dyn_data; @@ -2821,7 +2821,7 @@ static void prepare_list(uiList *ui_list, int len, int activei, int rows, int ma layoutdata->end_idx = min_ii(layoutdata->start_idx + rows * columns, len); } -static void ui_list_resize_update_cb(bContext *UNUSED(C), void *arg1, void *UNUSED(arg2)) +static void uilist_resize_update_cb(bContext *UNUSED(C), void *arg1, void *UNUSED(arg2)) { uiList *ui_list = arg1; uiListDyn *dyn_data = ui_list->dyn_data; @@ -3046,7 +3046,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co col = uiLayoutColumn(row, true); /* init numbers */ - prepare_list(ui_list, len, activei, rows, maxrows, 1, &layoutdata); + uilist_prepare(ui_list, len, activei, rows, maxrows, 1, &layoutdata); if (dataptr->data && prop) { /* create list items */ @@ -3058,12 +3058,12 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co overlap = uiLayoutOverlap(col); - uiBlockSetFlag(subblock, UI_BLOCK_LIST_ITEM); + UI_block_flag_enable(subblock, UI_BLOCK_LIST_ITEM); /* list item behind label & other buttons */ sub = uiLayoutRow(overlap, false); - but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + but = uiDefButR_prop(subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, active_dataptr, activeprop, 0, 0, org_i, 0, 0, TIP_("Double click to rename")); sub = uiLayoutRow(overlap, false); @@ -3079,7 +3079,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co ui_layout_list_set_labels_active(sub); } - uiBlockClearFlag(subblock, UI_BLOCK_LIST_ITEM); + UI_block_flag_disable(subblock, UI_BLOCK_LIST_ITEM); } } @@ -3091,7 +3091,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* add scrollbar */ if (len > layoutdata.visual_items) { col = uiLayoutColumn(row, false); - uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height, + uiDefButI(block, UI_BTYPE_SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height, &ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height, dyn_data->visual_height, 0, ""); } @@ -3117,10 +3117,10 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* next/prev button */ BLI_snprintf(numstr, sizeof(numstr), "%d :", dyn_data->items_shown); - but = uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, + but = uiDefIconTextButR_prop(block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, active_dataptr, activeprop, 0, 0, 0, 0, 0, ""); if (dyn_data->items_shown == 0) - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); break; case UILST_LAYOUT_GRID: box = uiLayoutListBox(layout, ui_list, dataptr, prop, active_dataptr, activeprop); @@ -3129,7 +3129,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co col = uiLayoutColumn(row, true); subrow = NULL; /* Quite gcc warning! */ - prepare_list(ui_list, len, activei, rows, maxrows, columns, &layoutdata); + uilist_prepare(ui_list, len, activei, rows, maxrows, columns, &layoutdata); if (dataptr->data && prop) { /* create list items */ @@ -3145,14 +3145,14 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co subblock = uiLayoutGetBlock(subrow); overlap = uiLayoutOverlap(subrow); - uiBlockSetFlag(subblock, UI_BLOCK_LIST_ITEM); + UI_block_flag_enable(subblock, UI_BLOCK_LIST_ITEM); /* list item behind label & other buttons */ sub = uiLayoutRow(overlap, false); - but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + but = uiDefButR_prop(subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, active_dataptr, activeprop, 0, 0, org_i, 0, 0, NULL); - uiButSetDrawFlag(but, UI_BUT_NO_TOOLTIP); + UI_but_drawflag_enable(but, UI_BUT_NO_TOOLTIP); sub = uiLayoutRow(overlap, false); @@ -3165,7 +3165,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co ui_layout_list_set_labels_active(sub); } - uiBlockClearFlag(subblock, UI_BLOCK_LIST_ITEM); + UI_block_flag_disable(subblock, UI_BLOCK_LIST_ITEM); } } @@ -3180,7 +3180,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* add scrollbar */ if (len > layoutdata.visual_items) { col = uiLayoutColumn(row, false); - uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height, + uiDefButI(block, UI_BTYPE_SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height, &ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height, dyn_data->visual_height, 0, ""); } @@ -3188,8 +3188,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co } if (glob) { - /* About GRIP drag-resize: - * We can't directly use results from GRIP button, since we have a rather complex behavior here + /* About UI_BTYPE_GRIP drag-resize: + * We can't directly use results from a grip button, since we have a rather complex behavior here * (sizing by discrete steps and, overall, autosize feature). * Since we *never* know whether we are grip-resizing or not (because there is no callback for when a * button enters/leaves its "edit mode"), we use the fact that grip-controlled value (dyn_data->resize) @@ -3202,37 +3202,37 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co row = uiLayoutRow(glob, true); subblock = uiLayoutGetBlock(row); - uiBlockSetEmboss(subblock, UI_EMBOSSN); + UI_block_emboss_set(subblock, UI_EMBOSS_NONE); if (ui_list->filter_flag & UILST_FLT_SHOW) { - but = uiDefIconButBitI(subblock, TOG, UILST_FLT_SHOW, 0, ICON_DISCLOSURE_TRI_DOWN, 0, 0, + but = uiDefIconButBitI(subblock, UI_BTYPE_TOGGLE, UILST_FLT_SHOW, 0, ICON_DISCLOSURE_TRI_DOWN, 0, 0, UI_UNIT_X, UI_UNIT_Y * 0.5f, &(ui_list->filter_flag), 0, 0, 0, 0, TIP_("Hide filtering options")); - uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but = uiDefIconButI(subblock, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10.0f, UI_UNIT_Y * 0.5f, + but = uiDefIconButI(subblock, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10.0f, UI_UNIT_Y * 0.5f, &dyn_data->resize, 0.0, 0.0, 0, 0, ""); - uiButSetFunc(but, ui_list_resize_update_cb, ui_list, NULL); + UI_but_func_set(but, uilist_resize_update_cb, ui_list, NULL); - uiBlockSetEmboss(subblock, UI_EMBOSS); + UI_block_emboss_set(subblock, UI_EMBOSS); col = uiLayoutColumn(glob, false); subblock = uiLayoutGetBlock(col); - uiDefBut(subblock, SEPR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y * 0.05f, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(subblock, UI_BTYPE_SEPR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y * 0.05f, NULL, 0.0, 0.0, 0, 0, ""); draw_filter(ui_list, C, col); } else { - but = uiDefIconButBitI(subblock, TOG, UILST_FLT_SHOW, 0, ICON_DISCLOSURE_TRI_RIGHT, 0, 0, + but = uiDefIconButBitI(subblock, UI_BTYPE_TOGGLE, UILST_FLT_SHOW, 0, ICON_DISCLOSURE_TRI_RIGHT, 0, 0, UI_UNIT_X, UI_UNIT_Y * 0.5f, &(ui_list->filter_flag), 0, 0, 0, 0, TIP_("Show filtering options")); - uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but = uiDefIconButI(subblock, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10.0f, UI_UNIT_Y * 0.5f, + but = uiDefIconButI(subblock, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10.0f, UI_UNIT_Y * 0.5f, &dyn_data->resize, 0.0, 0.0, 0, 0, ""); - uiButSetFunc(but, ui_list_resize_update_cb, ui_list, NULL); + UI_but_func_set(but, uilist_resize_update_cb, ui_list, NULL); - uiBlockSetEmboss(subblock, UI_EMBOSS); + UI_block_emboss_set(subblock, UI_EMBOSS); } } @@ -3278,16 +3278,16 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char } } - if (false == uiSearchItemAdd(items, name, ot, 0)) + if (false == UI_search_item_add(items, name, ot, 0)) break; } } } } -void uiOperatorSearch_But(uiBut *but) +void UI_but_func_operator_search(uiBut *but) { - uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL); + UI_but_func_search_set(but, operator_search_cb, NULL, operator_call_cb, NULL); } void uiTemplateOperatorSearch(uiLayout *layout) @@ -3297,10 +3297,10 @@ void uiTemplateOperatorSearch(uiLayout *layout) static char search[256] = ""; block = uiLayoutGetBlock(layout); - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, 0, ""); - uiOperatorSearch_But(but); + UI_but_func_operator_search(but); } /************************* Running Jobs Template **************************/ @@ -3350,9 +3350,9 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) int handle_event; block = uiLayoutGetBlock(layout); - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); - uiBlockSetHandleFunc(block, do_running_jobs, NULL); + UI_block_func_handle_set(block, do_running_jobs, NULL); if (sa->spacetype == SPACE_SEQ) { if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY)) @@ -3402,18 +3402,18 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) ui_abs = uiLayoutAbsolute(layout, false); (void)ui_abs; /* UNUSED */ - uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, 0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8, + uiDefIconBut(block, UI_BTYPE_BUT, handle_event, ICON_PANEL_CLOSE, 0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job")); - uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner), + uiDefBut(block, UI_BTYPE_PROGRESS_BAR, 0, WM_jobs_name(wm, owner), UI_UNIT_X, 0, UI_UNIT_X * 5.0f, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress")); uiLayoutRow(layout, false); } if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST)) - uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, UI_UNIT_X * 4.25f, UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, UI_UNIT_X * 4.25f, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop screencast")); if (screen->animtimer) - uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, IFACE_("Anim Player"), 0, 0, UI_UNIT_X * 5.0f, UI_UNIT_Y, + uiDefIconTextBut(block, UI_BTYPE_BUT, B_STOPANIM, ICON_CANCEL, IFACE_("Anim Player"), 0, 0, UI_UNIT_X * 5.0f, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop animation playback")); } @@ -3428,7 +3428,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiLayout *ui_abs; uiBlock *block; uiBut *but; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); int width; int icon; @@ -3447,37 +3447,37 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) width = max_ii(width, 10); /* make a box around the report to make it stand out */ - uiBlockBeginAlign(block); - but = uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - /* set the report's bg color in but->col - ROUNDBOX feature */ + UI_block_align_begin(block); + but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); + /* set the report's bg color in but->col - UI_BTYPE_ROUNDBOX feature */ rgb_float_to_uchar(but->col, rti->col); but->col[3] = 255; - but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, + but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->grayscale); but->col[3] = 255; - uiBlockEndAlign(block); + UI_block_align_end(block); /* icon and report message on top */ - icon = uiIconFromReportType(report->type); + icon = UI_icon_from_report_type(report->type); /* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report * to be shown instead of icon when appropriate... */ - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); if (reports->list.first != reports->list.last) - uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, + uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'")); else - uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); + uiDefIconBut(block, UI_BTYPE_LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); - uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, + uiDefBut(block, UI_BTYPE_LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); } @@ -3526,11 +3526,11 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title, if (is_set) { /* unset operator */ uiBlock *block = uiLayoutGetBlock(row); - uiBlockSetEmboss(block, UI_EMBOSSN); - but = uiDefIconButO(block, BUT, "UI_OT_unset_property_button", WM_OP_EXEC_DEFAULT, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); + UI_block_emboss_set(block, UI_EMBOSS_NONE); + but = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_unset_property_button", WM_OP_EXEC_DEFAULT, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL); but->rnapoin = *ptr; but->rnaprop = prop; - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } } RNA_STRUCT_END; @@ -3550,7 +3550,7 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr) for (; but; but = but->next) { /* operator buttons may store props for use (file selector, [#36492]) */ if (but->rnaprop) { - uiButSetFunc(but, keymap_item_modified, ptr->data, NULL); + UI_but_func_set(but, keymap_item_modified, ptr->data, NULL); } } } @@ -3625,15 +3625,15 @@ static uiBlock *component_menu(bContext *C, ARegion *ar, void *args_v) uiBlock *block; uiLayout *layout; - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN); - layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, UI_GetStyle()), 0); + layout = uiLayoutColumn(UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, UI_style_get()), 0); uiItemR(layout, &args->ptr, args->propname, UI_ITEM_R_EXPAND, "", ICON_NONE); - uiBoundsBlock(block, 6); - uiBlockSetDirection(block, UI_DOWN); + UI_block_bounds_set_normal(block, 6); + UI_block_direction_set(block, UI_DIR_DOWN); return block; } @@ -3647,7 +3647,7 @@ void uiTemplateComponentMenu(uiLayout *layout, PointerRNA *ptr, const char *prop BLI_strncpy(args->propname, propname, sizeof(args->propname)); block = uiLayoutGetBlock(layout); - uiBlockBeginAlign(block); + UI_block_align_begin(block); but = uiDefBlockButN(block, component_menu, args, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, ""); /* set rna directly, uiDefBlockButN doesn't do this */ @@ -3655,7 +3655,7 @@ void uiTemplateComponentMenu(uiLayout *layout, PointerRNA *ptr, const char *prop but->rnaprop = RNA_struct_find_property(ptr, propname); but->rnaindex = 0; - uiBlockEndAlign(block); + UI_block_align_end(block); } /************************* Node Socket Icon **************************/ @@ -3666,14 +3666,14 @@ void uiTemplateNodeSocket(uiLayout *layout, bContext *UNUSED(C), float *color) uiBut *but; block = uiLayoutGetBlock(layout); - uiBlockBeginAlign(block); + UI_block_align_begin(block); /* XXX using explicit socket colors is not quite ideal. * Eventually it should be possible to use theme colors for this purpose, * but this requires a better design for extendable color palettes in user prefs. */ - but = uiDefBut(block, NODESOCKET, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + but = uiDefBut(block, UI_BTYPE_NODE_SOCKET, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); rgba_float_to_uchar(but->col, color); - uiBlockEndAlign(block); + UI_block_align_end(block); } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 008ea84b607..854f1763370 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -70,11 +70,11 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind return NULL; if (icon && name && name[0] == '\0') - but = uiDefIconButR_prop(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); else if (icon) - but = uiDefIconTextButR_prop(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconTextButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); else - but = uiDefButR_prop(block, OPTION, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefButR_prop(block, UI_BTYPE_CHECKBOX, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); break; } case PROP_INT: @@ -84,29 +84,29 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind if (arraylen && index == -1) { if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA)) - but = uiDefButR_prop(block, COLOR, 0, name, x1, y1, x2, y2, ptr, prop, -1, 0, 0, -1, -1, NULL); + but = uiDefButR_prop(block, UI_BTYPE_COLOR, 0, name, x1, y1, x2, y2, ptr, prop, -1, 0, 0, -1, -1, NULL); } else if (RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR) - but = uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); else - but = uiDefButR_prop(block, NUM, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefButR_prop(block, UI_BTYPE_NUM, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); break; } case PROP_ENUM: if (icon && name && name[0] == '\0') - but = uiDefIconButR_prop(block, MENU, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconButR_prop(block, UI_BTYPE_MENU, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); else if (icon) - but = uiDefIconTextButR_prop(block, MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconTextButR_prop(block, UI_BTYPE_MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); else - but = uiDefButR_prop(block, MENU, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefButR_prop(block, UI_BTYPE_MENU, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); break; case PROP_STRING: if (icon && name && name[0] == '\0') - but = uiDefIconButR_prop(block, TEX, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconButR_prop(block, UI_BTYPE_TEXT, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); else if (icon) - but = uiDefIconTextButR_prop(block, TEX, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconTextButR_prop(block, UI_BTYPE_TEXT, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); else - but = uiDefButR_prop(block, TEX, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefButR_prop(block, UI_BTYPE_TEXT, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); break; case PROP_POINTER: { @@ -119,15 +119,15 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind if (icon == ICON_DOT) icon = 0; - but = uiDefIconTextButR_prop(block, SEARCH_MENU, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconTextButR_prop(block, UI_BTYPE_SEARCH_MENU, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); break; } case PROP_COLLECTION: { char text[256]; BLI_snprintf(text, sizeof(text), IFACE_("%d items"), RNA_property_collection_length(ptr, prop)); - but = uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL); - uiButSetFlag(but, UI_BUT_DISABLED); + but = uiDefBut(block, UI_BTYPE_LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL); + UI_but_flag_enable(but, UI_BUT_DISABLED); break; } default: @@ -201,7 +201,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, /***************************** ID Utilities *******************************/ -int uiIconFromID(ID *id) +int UI_icon_from_id(ID *id) { Object *ob; PointerRNA ptr; @@ -219,7 +219,7 @@ int uiIconFromID(ID *id) if (ob->type == OB_EMPTY) return ICON_EMPTY_DATA; else - return uiIconFromID(ob->data); + return UI_icon_from_id(ob->data); } /* otherwise get it through RNA, creating the pointer @@ -230,7 +230,7 @@ int uiIconFromID(ID *id) } /* see: report_type_str */ -int uiIconFromReportType(int type) +int UI_icon_from_report_type(int type) { if (type & RPT_ERROR_ALL) return ICON_ERROR; @@ -247,7 +247,7 @@ int uiIconFromReportType(int type) /** * Returns the best "UI" precision for given floating value, so that e.g. 10.000001 rather gets drawn as '10'... */ -int uiFloatPrecisionCalc(int prec, double value) +int UI_calc_float_precision(int prec, double value) { static const double pow10_neg[UI_PRECISION_FLOAT_MAX + 1] = {1e0, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7}; static const double max_pow = 10000000.0; /* pow(10, UI_PRECISION_FLOAT_MAX) */ diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c496bae741c..97f560df7be 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -222,7 +222,7 @@ void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float m for (j = 0; j < WIDGET_AA_JITTER; j++) { glTranslatef(jit[j][0], jit[j][1], 0.0f); - uiDrawBox(mode, minx, miny, maxx, maxy, rad); + UI_draw_roundbox_gl_mode(mode, minx, miny, maxx, maxy, rad); glTranslatef(-jit[j][0], -jit[j][1], 0.0f); } @@ -830,7 +830,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), const rcti static int ui_but_draw_menu_icon(const uiBut *but) { - return (but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP); + return (but->flag & UI_BUT_ICON_SUBMENU) && (but->dt == UI_EMBOSS_PULLDOWN); } /* icons have been standardized... and this call draws in untransformed coordinates */ @@ -841,7 +841,7 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons float xs = 0.0f, ys = 0.0f; float aspect, height; - if (but->flag & UI_ICON_PREVIEW) { + if (but->flag & UI_BUT_ICON_PREVIEW) { glEnable(GL_BLEND); widget_draw_preview(icon, alpha, rect); glDisable(GL_BLEND); @@ -849,20 +849,20 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons } /* this icon doesn't need draw... */ - if (icon == ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU) == 0) return; + if (icon == ICON_BLANK1 && (but->flag & UI_BUT_ICON_SUBMENU) == 0) return; aspect = but->block->aspect / UI_DPI_FAC; height = ICON_DEFAULT_HEIGHT / aspect; /* calculate blend color */ - if (ELEM(but->type, TOG, ROW, TOGN, LISTROW)) { + if (ELEM(but->type, UI_BTYPE_TOGGLE, UI_BTYPE_ROW, UI_BTYPE_TOGGLE_N, UI_BTYPE_LISTROW)) { if (but->flag & UI_SELECT) {} else if (but->flag & UI_ACTIVE) {} else alpha = 0.5f; } /* extra feature allows more alpha blending */ - if ((but->type == LABEL) && but->a1 == 1.0f) + if ((but->type == UI_BTYPE_LABEL) && but->a1 == 1.0f) alpha *= but->a2; glEnable(GL_BLEND); @@ -872,7 +872,7 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons if (but->drawflag & UI_BUT_ICON_LEFT) { if (but->block->flag & UI_BLOCK_LOOP) { - if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) + if (ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEARCH_MENU_UNLINK)) xs = rect->xmin + 4.0f * ofs; else xs = rect->xmin + ofs; @@ -973,7 +973,7 @@ static float ui_text_clip_middle_ex(uiFontStyle *fstyle, char *str, float okwidt BLI_assert(str[0]); /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) { /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -1071,7 +1071,7 @@ static float ui_text_clip_middle_ex(uiFontStyle *fstyle, char *str, float okwidt static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rect) { /* No margin for labels! */ - const int border = ELEM(but->type, LABEL, MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); + const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); const float okwidth = (float)max_ii(BLI_rcti_size_x(rect) - border, 0); const size_t max_len = sizeof(but->drawstr); const float minwidth = (float)(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f; @@ -1087,7 +1087,7 @@ static void ui_text_clip_middle(uiFontStyle *fstyle, uiBut *but, const rcti *rec static void ui_text_clip_middle_protect_right(uiFontStyle *fstyle, uiBut *but, const rcti *rect, const char *rsep) { /* No margin for labels! */ - const int border = ELEM(but->type, LABEL, MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); + const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU) ? 0 : (int)(UI_TEXT_CLIP_MARGIN + 0.5f); const float okwidth = (float)max_ii(BLI_rcti_size_x(rect) - border, 0); const size_t max_len = sizeof(but->drawstr); const float minwidth = (float)(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f; @@ -1107,7 +1107,7 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rec BLI_assert(but->editstr && but->pos >= 0); /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -1170,7 +1170,7 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti const char *cpend = but->drawstr + drawstr_len; /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -1239,7 +1239,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b const char *drawstr_right = NULL; bool use_right_only = false; - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT)) fstyle->align = UI_STYLE_TEXT_LEFT; @@ -1255,7 +1255,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* Special case: when we're entering text for multiple buttons, * don't draw the text for any of the multi-editing buttons */ if (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI)) { - uiBut *but_edit = ui_get_but_drag_multi_edit(but); + uiBut *but_edit = ui_but_drag_multi_edit_get(but); if (but_edit) { drawstr = but_edit->editstr; fstyle->align = UI_STYLE_TEXT_LEFT; @@ -1334,7 +1334,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b } #ifdef USE_NUMBUTS_LR_ALIGN - if (!drawstr_right && ELEM(but->type, NUM, NUMSLI) && + if (!drawstr_right && ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) && /* if we're editing or multi-drag (fake editing), then use left alignment */ (but->editstr == NULL) && (drawstr == but->drawstr)) { @@ -1361,7 +1361,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* for underline drawing */ float font_xofs, font_yofs; - uiStyleFontDrawExt(fstyle, rect, drawstr + but->ofs, + UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, drawstr_left_len - but->ofs, &font_xofs, &font_yofs); if (but->menu_key != '\0') { @@ -1401,7 +1401,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b if (drawstr_right) { fstyle->align = UI_STYLE_TEXT_RIGHT; rect->xmax -= UI_TEXT_CLIP_MARGIN; - uiStyleFontDraw(fstyle, rect, drawstr_right); + UI_fontstyle_draw(fstyle, rect, drawstr_right); } } @@ -1412,10 +1412,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB float alpha = (float)wcol->text[3] / 255.0f; char password_str[UI_MAX_DRAW_STR]; - ui_button_text_password_hide(password_str, but, false); + ui_but_text_password_hide(password_str, but, false); /* check for button text label */ - if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) { + if (but->type == UI_BTYPE_MENU && (but->flag & UI_BUT_NODE_LINK)) { rcti temp = *rect; temp.xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp, false); @@ -1450,7 +1450,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB } /* unlink icon for this button type */ - if ((but->type == SEARCH_MENU_UNLINK) && ui_is_but_search_unlink_visible(but)) { + if ((but->type == UI_BTYPE_SEARCH_MENU_UNLINK) && ui_but_is_search_unlink_visible(but)) { rcti temp = *rect; temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); @@ -1467,10 +1467,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB but->ofs = 0; but->strwidth = 0; } - else if (ELEM(but->type, NUM, NUMSLI)) { + else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { ui_text_clip_right_label(fstyle, but, rect); } - else if ((but->block->flag & UI_BLOCK_LOOP) && (but->type == BUT)) { + else if ((but->block->flag & UI_BLOCK_LOOP) && (but->type == UI_BTYPE_BUT)) { /* Clip middle, but protect in all case right part containing the shortcut, if any. */ ui_text_clip_middle_protect_right(fstyle, but, rect, "|"); } @@ -1481,7 +1481,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB /* always draw text for textbutton cursor */ widget_draw_text(fstyle, wcol, but, rect); - ui_button_text_password_hide(password_str, but, true); + ui_but_text_password_hide(password_str, but, true); } #undef UI_TEXT_CLIP_MARGIN @@ -2053,11 +2053,11 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir //rect->ymin -= 4.0; //rect->ymax += 4.0; } - else if (direction == UI_DOWN) { + else if (direction == UI_DIR_DOWN) { roundboxalign = (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); rect->ymin -= 0.1f * U.widget_unit; } - else if (direction == UI_TOP) { + else if (direction == UI_DIR_UP) { roundboxalign = UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT; rect->ymax += 0.1f * U.widget_unit; } @@ -2142,10 +2142,10 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * float xpos, ypos, ang = 0.0f; float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; int a; - bool color_profile = ui_color_picker_use_display_colorspace(but); + bool color_profile = ui_but_is_colorpicker_display_space(but); /* color */ - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); /* since we use compat functions on both 'hsv' and 'hsvo', they need to be initialized */ hsvo[0] = hsv[0] = hsv_ptr[0]; @@ -2153,7 +2153,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * hsvo[2] = hsv[2] = hsv_ptr[2]; if (color_profile) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); ui_rgb_to_color_picker_compat_v(rgb, hsv); copy_v3_v3(hsvo, hsv); @@ -2354,7 +2354,7 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons } -bool ui_color_picker_use_display_colorspace(uiBut *but) +bool ui_but_is_colorpicker_display_space(uiBut *but) { bool color_profile = but->block->color_profile; @@ -2408,14 +2408,14 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) ColorPicker *cpicker = but->custom_data; float *hsv = cpicker->color_data; float hsv_n[3]; - bool use_display_colorspace = ui_color_picker_use_display_colorspace(but); + bool use_display_colorspace = ui_but_is_colorpicker_display_space(but); copy_v3_v3(hsv_n, hsv); - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (use_display_colorspace) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); rgb_to_hsv_compat_v(rgb, hsv_n); @@ -2444,10 +2444,10 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect) if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) color_profile = false; - ui_get_but_vectorf(but, rgb); + ui_but_v3_get(but, rgb); if (color_profile) - ui_block_to_display_space_v3(but->block, rgb); + ui_block_cm_to_display_space_v3(but->block, rgb); if (but->a1 == UI_GRAD_L_ALT) rgb_to_hsl_v(rgb, hsv); @@ -2593,7 +2593,7 @@ void ui_draw_link_bezier(const rcti *rect) } /* function in use for buttons and for view2d sliders */ -void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state) +void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state) { uiWidgetBase wtb; int horizontal; @@ -2679,7 +2679,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat int horizontal; /* calculate slider part */ - value = ui_get_but_val(but); + value = ui_but_value_get(but); size = (but->softmax + but->a1 - but->softmin); size = max_ff(size, 2.0f); @@ -2729,7 +2729,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat state = UI_SCROLL_PRESSED; else state = 0; - uiWidgetScrollDraw(wcol, rect, &rect1, state); + UI_draw_widget_scroll(wcol, rect, &rect1, state); } static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) @@ -2751,7 +2751,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int rect_bar.xmax = rect_bar.xmin + w; - uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); + UI_draw_widget_scroll(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); /* raise text a bit */ rect->ymin += 6 * UI_DPI_FAC; @@ -2810,7 +2810,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s rect1 = *rect; - value = ui_get_but_val(but); + value = ui_but_value_get(but); fac = ((float)value - but->softmin) * (BLI_rcti_size_x(&rect1) - offs) / (but->softmax - but->softmin); /* left part of slider, always rounded */ @@ -2881,7 +2881,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat rad = 0.25f * U.widget_unit; round_box_edges(&wtb, roundboxalign, rect, rad); - ui_get_but_vectorf(but, col); + ui_but_v3_get(but, col); if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) { /* draw based on state - color for keyed etc */ @@ -2897,7 +2897,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat } if (color_profile) - ui_block_to_display_space_v3(but->block, col); + ui_block_cm_to_display_space_v3(but->block, col); rgba_float_to_uchar((unsigned char *)wcol->inner, col); @@ -2926,9 +2926,9 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat } } -static void widget_normal(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) +static void widget_unitvec(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { - ui_draw_but_NORMAL(but, wcol, rect); + ui_draw_but_UNITVEC(but, wcol, rect); } static void widget_icon_has_anim(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) @@ -2945,7 +2945,7 @@ static void widget_icon_has_anim(uiBut *but, uiWidgetColors *wcol, rcti *rect, i round_box_edges(&wtb, UI_CNR_ALL, rect, rad); widgetbase_draw(&wtb, wcol); } - else if (but->type == NUM) { + else if (but->type == UI_BTYPE_NUM) { /* Draw number buttons still with left/right * triangles when field is not embossed */ widget_numbut_embossn(but, wcol, rect, state, roundboxalign); @@ -3278,7 +3278,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) wt.wcol_theme = &btheme->tui.wcol_toggle; break; - case UI_WTYPE_OPTION: + case UI_WTYPE_CHECKBOX: wt.wcol_theme = &btheme->tui.wcol_option; wt.draw = widget_optionbut; break; @@ -3382,8 +3382,8 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) case UI_WTYPE_RGB_PICKER: break; - case UI_WTYPE_NORMAL: - wt.custom = widget_normal; + case UI_WTYPE_UNITVEC: + wt.custom = widget_unitvec; break; case UI_WTYPE_SCROLL: @@ -3418,7 +3418,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) int roundbox = UI_CNR_ALL; /* alignment */ - if ((but->drawflag & UI_BUT_ALIGN) && but->type != PULLDOWN) { + if ((but->drawflag & UI_BUT_ALIGN) && but->type != UI_BTYPE_PULLDOWN) { /* ui_block_position has this correction too, keep in sync */ if (but->drawflag & UI_BUT_ALIGN_TOP) @@ -3459,12 +3459,12 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) /* align with open menu */ if (but->active) { - int direction = ui_button_open_menu_direction(but); + int direction = ui_but_menu_direction(but); - if (direction == UI_TOP) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_TOP_LEFT); - else if (direction == UI_DOWN) roundbox &= ~(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); - else if (direction == UI_LEFT) roundbox &= ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); - else if (direction == UI_RIGHT) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); + if (direction == UI_DIR_UP) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_TOP_LEFT); + else if (direction == UI_DIR_DOWN) roundbox &= ~(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); + else if (direction == UI_DIR_LEFT) roundbox &= ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); + else if (direction == UI_DIR_RIGHT) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); } return roundbox; @@ -3496,12 +3496,12 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct uiWidgetType *wt = NULL; /* handle menus separately */ - if (but->dt == UI_EMBOSSP) { + if (but->dt == UI_EMBOSS_PULLDOWN) { switch (but->type) { - case LABEL: + case UI_BTYPE_LABEL: widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); break; - case SEPRLINE: + case UI_BTYPE_SEPR_LINE: ui_draw_separator(rect, &tui->wcol_menu_item); break; default: @@ -3509,17 +3509,17 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct break; } } - else if (but->dt == UI_EMBOSSN) { + else if (but->dt == UI_EMBOSS_NONE) { /* "nothing" */ wt = widget_type(UI_WTYPE_ICON); } - else if (but->dt == UI_EMBOSSR) { + else if (but->dt == UI_EMBOSS_RADIAL) { wt = widget_type(UI_WTYPE_MENU_ITEM_RADIAL); } else { switch (but->type) { - case LABEL: + case UI_BTYPE_LABEL: if (but->block->flag & UI_BLOCK_LOOP) widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); else { @@ -3528,51 +3528,51 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } break; - case SEPR: - case SEPRLINE: + case UI_BTYPE_SEPR: + case UI_BTYPE_SEPR_LINE: break; - case BUT: + case UI_BTYPE_BUT: wt = widget_type(UI_WTYPE_EXEC); break; - case NUM: + case UI_BTYPE_NUM: wt = widget_type(UI_WTYPE_NUMBER); break; - case NUMSLI: + case UI_BTYPE_NUM_SLIDER: wt = widget_type(UI_WTYPE_SLIDER); break; - case ROW: + case UI_BTYPE_ROW: wt = widget_type(UI_WTYPE_RADIO); break; - case LISTROW: + case UI_BTYPE_LISTROW: wt = widget_type(UI_WTYPE_LISTITEM); break; - case TEX: + case UI_BTYPE_TEXT: wt = widget_type(UI_WTYPE_NAME); break; - case SEARCH_MENU_UNLINK: - case SEARCH_MENU: + case UI_BTYPE_SEARCH_MENU_UNLINK: + case UI_BTYPE_SEARCH_MENU: wt = widget_type(UI_WTYPE_NAME); if (but->block->flag & UI_BLOCK_LOOP) wt->wcol_theme = &btheme->tui.wcol_menu_back; break; - case TOGBUT: - case TOG: - case TOGN: + case UI_BTYPE_BUT_TOGGLE: + case UI_BTYPE_TOGGLE: + case UI_BTYPE_TOGGLE_N: wt = widget_type(UI_WTYPE_TOGGLE); break; - case OPTION: - case OPTIONN: + case UI_BTYPE_CHECKBOX: + case UI_BTYPE_CHECKBOX_N: if (!(but->flag & UI_HAS_ICON)) { - wt = widget_type(UI_WTYPE_OPTION); + wt = widget_type(UI_WTYPE_CHECKBOX); but->drawflag |= UI_BUT_TEXT_LEFT; } else @@ -3584,8 +3584,8 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct break; - case MENU: - case BLOCK: + case UI_BTYPE_MENU: + case UI_BTYPE_BLOCK: if (but->flag & UI_BUT_NODE_LINK) { /* new node-link button, not active yet XXX */ wt = widget_type(UI_WTYPE_MENU_NODE_LINK); @@ -3597,7 +3597,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct * add updown arrows if there is room. */ if ((!but->str[0] && but->icon && (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect) + 2)) || /* disable for brushes also */ - (but->flag & UI_ICON_PREVIEW)) + (but->flag & UI_BUT_ICON_PREVIEW)) { /* no arrows */ wt = widget_type(UI_WTYPE_MENU_ICON_RADIO); @@ -3608,35 +3608,35 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } break; - case PULLDOWN: + case UI_BTYPE_PULLDOWN: wt = widget_type(UI_WTYPE_PULLDOWN); break; - case BUTM: + case UI_BTYPE_BUT_MENU: wt = widget_type(UI_WTYPE_MENU_ITEM); break; - case COLOR: + case UI_BTYPE_COLOR: wt = widget_type(UI_WTYPE_SWATCH); break; - case ROUNDBOX: - case LISTBOX: + case UI_BTYPE_ROUNDBOX: + case UI_BTYPE_LISTBOX: wt = widget_type(UI_WTYPE_BOX); break; - case LINK: - case INLINK: + case UI_BTYPE_LINK: + case UI_BTYPE_INLINK: wt = widget_type(UI_WTYPE_ICON); wt->custom = widget_link; break; - case BUT_EXTRA: + case UI_BTYPE_EXTRA: widget_draw_extra_mask(C, but, widget_type(UI_WTYPE_BOX), rect); break; - case HSVCUBE: + case UI_BTYPE_HSVCUBE: if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { /* vertical V slider, uses new widget draw now */ ui_draw_but_HSV_v(but, rect); } @@ -3645,56 +3645,56 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } break; - case HSVCIRCLE: + case UI_BTYPE_HSVCIRCLE: ui_draw_but_HSVCIRCLE(but, &tui->wcol_regular, rect); break; - case BUT_COLORBAND: + case UI_BTYPE_COLORBAND: ui_draw_but_COLORBAND(but, &tui->wcol_regular, rect); break; - case BUT_NORMAL: - wt = widget_type(UI_WTYPE_NORMAL); + case UI_BTYPE_UNITVEC: + wt = widget_type(UI_WTYPE_UNITVEC); break; - case BUT_IMAGE: + case UI_BTYPE_IMAGE: ui_draw_but_IMAGE(ar, but, &tui->wcol_regular, rect); break; - case HISTOGRAM: + case UI_BTYPE_HISTOGRAM: ui_draw_but_HISTOGRAM(ar, but, &tui->wcol_regular, rect); break; - case WAVEFORM: + case UI_BTYPE_WAVEFORM: ui_draw_but_WAVEFORM(ar, but, &tui->wcol_regular, rect); break; - case VECTORSCOPE: + case UI_BTYPE_VECTORSCOPE: ui_draw_but_VECTORSCOPE(ar, but, &tui->wcol_regular, rect); break; - case BUT_CURVE: + case UI_BTYPE_CURVE: ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect); break; - case PROGRESSBAR: + case UI_BTYPE_PROGRESS_BAR: wt = widget_type(UI_WTYPE_PROGRESSBAR); fstyle = &style->widgetlabel; break; - case SCROLL: + case UI_BTYPE_SCROLL: wt = widget_type(UI_WTYPE_SCROLL); break; - case GRIP: + case UI_BTYPE_GRIP: wt = widget_type(UI_WTYPE_ICON); break; - case TRACKPREVIEW: + case UI_BTYPE_TRACK_PREVIEW: ui_draw_but_TRACKPREVIEW(ar, but, &tui->wcol_regular, rect); break; - case NODESOCKET: + case UI_BTYPE_NODE_SOCKET: ui_draw_but_NODESOCKET(ar, but, &tui->wcol_regular, rect); break; @@ -3714,13 +3714,13 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct state = but->flag; if ((but->editstr) || - (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && ui_get_but_drag_multi_edit(but))) + (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && ui_but_drag_multi_edit_get(but))) { state |= UI_TEXTINPUT; } if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) - if (but->dt != UI_EMBOSSP) + if (but->dt != UI_EMBOSS_PULLDOWN) disabled = true; if (disabled) @@ -3739,7 +3739,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct glDisable(GL_BLEND); // if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) -// if (but->dt != UI_EMBOSSP) +// if (but->dt != UI_EMBOSS_PULLDOWN) // widget_disabled(&disablerect); } } @@ -3758,12 +3758,12 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) if (block->flag & UI_BLOCK_CLIPTOP) { /* XXX no scaling for UI here yet */ glColor3ubv((unsigned char *)wt->wcol.text); - UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymax - 8, 't'); + UI_draw_icon_tri(BLI_rcti_cent_x(rect), rect->ymax - 8, 't'); } if (block->flag & UI_BLOCK_CLIPBOTTOM) { /* XXX no scaling for UI here yet */ glColor3ubv((unsigned char *)wt->wcol.text); - UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v'); + UI_draw_icon_tri(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v'); } } } @@ -3937,7 +3937,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic wt->state(wt, state); wt->draw(&wt->wcol, rect, 0, 0); - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); fstyle->align = UI_STYLE_TEXT_LEFT; /* text location offset */ @@ -3951,7 +3951,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic *cpoin = 0; /* need to set this first */ - uiStyleFontSet(fstyle); + UI_fontstyle_set(fstyle); if (fstyle->kerning == 1) { /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -3975,7 +3975,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic ui_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, NULL); glColor4ubv((unsigned char *)wt->wcol.text); - uiStyleFontDraw(fstyle, rect, drawstr); + UI_fontstyle_draw(fstyle, rect, drawstr); } /* part text right aligned */ @@ -3983,7 +3983,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic if (cpoin) { fstyle->align = UI_STYLE_TEXT_RIGHT; rect->xmax = _rect.xmax - 5; - uiStyleFontDraw(fstyle, rect, cpoin + 1); + UI_fontstyle_draw(fstyle, rect, cpoin + 1); *cpoin = UI_SEP_CHAR; } } @@ -4050,6 +4050,6 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ui_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, NULL); glColor4ubv((unsigned char *)wt->wcol.text); - uiStyleFontDraw(fstyle, &trect, drawstr); + UI_fontstyle_draw(fstyle, &trect, drawstr); } } diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 6cc265d06ad..f42e35945d7 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -206,7 +206,7 @@ static void view2d_masks(View2D *v2d, int check_scrollers) void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) { bool tot_changed = false, do_init; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); do_init = (v2d->flag & V2D_IS_INITIALISED) == 0; @@ -1719,7 +1719,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v glRecti(v2d->hor.xmin, v2d->hor.ymin, v2d->hor.xmax, v2d->hor.ymax); } - uiWidgetScrollDraw(&wcol, &hor, &slider, state); + UI_draw_widget_scroll(&wcol, &hor, &slider, state); /* scale indicators */ if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) { @@ -1820,7 +1820,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v glRecti(v2d->vert.xmin, v2d->vert.ymin, v2d->vert.xmax, v2d->vert.ymax); } - uiWidgetScrollDraw(&wcol, &vert, &slider, state); + UI_draw_widget_scroll(&wcol, &vert, &slider, state); /* scale indiators */ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 2b84c0678ae..297d8d0f258 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1951,7 +1951,7 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot) static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); ARegion *ar = CTX_wm_region(C); View2D *v2d = &ar->v2d; int winx, winy; diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 80d63ccb446..674fb176a8f 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1897,8 +1897,8 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED } /* prepare popup menu to choose targetting options */ - pup = uiPupMenuBegin(C, IFACE_("Add IK"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Add IK"), ICON_NONE); + layout = UI_popup_menu_layout(pup); /* the type of targets we'll set determines the menu entries to show... */ if (get_new_constraint_target(C, CONSTRAINT_TYPE_KINEMATIC, &tar_ob, &tar_pchan, 0)) { @@ -1917,7 +1917,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED } /* finish building the menu, and process it (should result in calling self again) */ - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 798334ba2a7..48e617eda11 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -300,15 +300,15 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED; } else if (ob->id.lib) { - uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("OK?"), ICON_QUESTION); - uiLayout *layout = uiPupMenuLayout(pup); + uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("OK?"), ICON_QUESTION); + uiLayout *layout = UI_popup_menu_layout(pup); /* create operator menu item with relevant properties filled in */ uiItemFullO_ptr(layout, op->type, op->type->name, ICON_NONE, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); /* present the menu and be done... */ - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); /* this invoke just calls another instance of this operator... */ return OPERATOR_INTERFACE; @@ -881,8 +881,8 @@ static int parent_set_exec(bContext *C, wmOperator *op) static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { Object *ob = ED_object_active_context(C); - uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE); - uiLayout *layout = uiPupMenuLayout(pup); + uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), ICON_NONE); + uiLayout *layout = UI_popup_menu_layout(pup); wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", true); PointerRNA opptr; @@ -923,7 +923,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI); } - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -2477,7 +2477,7 @@ static int object_unlink_data_exec(bContext *C, wmOperator *op) ID *id; PropertyPointerRNA pprop; - uiIDContextProperty(C, &pprop.ptr, &pprop.prop); + UI_context_active_but_prop_get_templateID(C, &pprop.ptr, &pprop.prop); if (pprop.prop == NULL) { BKE_report(op->reports, RPT_ERROR, "Incorrect context for running object data unlink"); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index e295a63848a..65ce0c8d520 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -618,15 +618,15 @@ static bool select_grouped_group(bContext *C, Object *ob) /* Select objects in } /* build the menu. */ - pup = uiPupMenuBegin(C, IFACE_("Select Group"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Select Group"), ICON_NONE); + layout = UI_popup_menu_layout(pup); for (i = 0; i < group_count; i++) { group = ob_groups[i]; uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name + 2); } - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return changed; /* The operator already handle this! */ } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index fb7653282b8..2a0ec853079 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -525,7 +525,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre } /* new UI convention: draw is in pixel space already. */ -/* uses ROUNDBOX button in block to get the rect */ +/* uses UI_BTYPE_ROUNDBOX button in block to get the rect */ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect) { Render *re; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 6c996bcbd67..b4114126b8a 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -408,7 +408,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) } /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { /* when creating new ID blocks, use is already 1, but RNA @@ -457,7 +457,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) } /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { /* when creating new ID blocks, use is already 1, but RNA @@ -520,7 +520,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) } /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { /* when creating new ID blocks, use is already 1, but RNA diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index ed224b2d5c2..630ff8fecf6 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -271,21 +271,21 @@ static void region_draw_azone_tab_plus(AZone *az) /* add code to draw region hidden as 'too small' */ switch (az->edge) { case AE_TOP_TO_BOTTOMRIGHT: - uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); + UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); break; case AE_BOTTOM_TO_TOPLEFT: - uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); + UI_draw_roundbox_corner_set(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); break; case AE_LEFT_TO_TOPRIGHT: - uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); + UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); break; case AE_RIGHT_TO_TOPLEFT: - uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); + UI_draw_roundbox_corner_set(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); break; } glColor4f(0.05f, 0.05f, 0.05f, 0.4f); - uiRoundBox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); + UI_draw_roundbox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); glEnable(GL_BLEND); @@ -306,32 +306,32 @@ static void region_draw_azone_tab(AZone *az) /* add code to draw region hidden as 'too small' */ switch (az->edge) { case AE_TOP_TO_BOTTOMRIGHT: - uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA); + UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA); - uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); + UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); - uiRoundRect((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f); + UI_draw_roundbox_unfilled((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f); break; case AE_BOTTOM_TO_TOPLEFT: - uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); + UI_draw_roundbox_corner_set(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); - uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); + UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); - uiRoundRect((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f); + UI_draw_roundbox_unfilled((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f); break; case AE_LEFT_TO_TOPRIGHT: - uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); + UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); - uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); + UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); - uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); + UI_draw_roundbox_unfilled((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); break; case AE_RIGHT_TO_TOPLEFT: - uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_RB_ALPHA); + UI_draw_roundbox_corner_set(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_RB_ALPHA); - uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); + UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); - uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); + UI_draw_roundbox_unfilled((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); break; } @@ -497,7 +497,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) ar->do_draw = 0; memset(&ar->drawrct, 0, sizeof(ar->drawrct)); - uiFreeInactiveBlocks(C, &ar->uiblocks); + UI_blocklist_free_inactive(C, &ar->uiblocks); if (sa && (win->screen->state != SCREENFULL)) { region_draw_emboss(ar, &ar->winrct); @@ -1315,7 +1315,7 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand /* XXX it would be good to have boundbox checks for some of these... */ if (flag & ED_KEYMAP_UI) { /* user interface widgets */ - UI_add_region_handlers(handlers); + UI_region_handlers_add(handlers); } if (flag & ED_KEYMAP_VIEW2D) { /* 2d-viewport handling+manipulation */ @@ -1409,7 +1409,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) } else { /* prevent uiblocks to run */ - uiFreeBlocks(NULL, &ar->uiblocks); + UI_blocklist_free(NULL, &ar->uiblocks); } } } @@ -1652,7 +1652,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) RNA_pointer_create(&(scr->id), &RNA_Area, sa, &areaptr); - uiDefButR(block, MENU, 0, "", xco, yco, 1.5 * U.widget_unit, U.widget_unit, + uiDefButR(block, UI_BTYPE_MENU, 0, "", xco, yco, 1.5 * U.widget_unit, U.widget_unit, &areaptr, "type", 0, 0.0f, 0.0f, 0.0f, 0.0f, ""); return xco + 1.7 * U.widget_unit; @@ -1663,7 +1663,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *context, int contextnr) { ScrArea *sa = CTX_wm_area(C); - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); uiBlock *block; PanelType *pt; Panel *panel; @@ -1761,16 +1761,16 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * w -= margin_x; /* create panels */ - uiBeginPanels(C, ar); + UI_panels_begin(C, ar); - /* set view2d view matrix - uiBeginBlock() stores it */ + /* set view2d view matrix - UI_block_begin() stores it */ UI_view2d_view_ortho(v2d); BLI_SMALLSTACK_ITER_BEGIN(pt_stack, pt) { bool open; - panel = uiPanelFindByType(ar, pt); + panel = UI_panel_find_by_type(ar, pt); if (use_category_tabs && pt->category[0] && !STREQ(category, pt->category)) { if ((panel == NULL) || ((panel->flag & PNL_PIN) == 0)) { @@ -1779,20 +1779,21 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * } /* draw panel */ - block = uiBeginBlock(C, ar, pt->idname, UI_EMBOSS); - panel = uiBeginPanel(sa, ar, block, pt, panel, &open); + block = UI_block_begin(C, ar, pt->idname, UI_EMBOSS); + panel = UI_panel_begin(sa, ar, block, pt, panel, &open); /* bad fixed values */ triangle = (int)(UI_UNIT_Y * 1.1f); if (pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) { /* for enabled buttons */ - panel->layout = uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, - triangle, (UI_UNIT_Y * 1.1f) + style->panelspace, UI_UNIT_Y, 1, 0, style); + panel->layout = UI_block_layout( + block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, + triangle, (UI_UNIT_Y * 1.1f) + style->panelspace, UI_UNIT_Y, 1, 0, style); pt->draw_header(C, panel); - uiBlockLayoutResolve(block, &xco, &yco); + UI_block_layout_resolve(block, &xco, &yco); panel->labelofs = xco - triangle; panel->layout = NULL; } @@ -1809,28 +1810,29 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * else panelContext = UI_LAYOUT_PANEL; - panel->layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, panelContext, - style->panelspace, 0, w - 2 * style->panelspace, em, 0, style); + panel->layout = UI_block_layout( + block, UI_LAYOUT_VERTICAL, panelContext, + style->panelspace, 0, w - 2 * style->panelspace, em, 0, style); pt->draw(C, panel); - uiBlockLayoutResolve(block, &xco, &yco); + UI_block_layout_resolve(block, &xco, &yco); panel->layout = NULL; yco -= 2 * style->panelspace; - uiEndPanel(block, w, -yco); + UI_panel_end(block, w, -yco); } else { yco = 0; - uiEndPanel(block, w, 0); + UI_panel_end(block, w, 0); } - uiEndBlock(C, block); + UI_block_end(C, block); } BLI_SMALLSTACK_ITER_END; /* align panels and return size */ - uiEndPanels(C, ar, &x, &y); + UI_panels_end(C, ar, &x, &y); /* before setting the view */ if (vertical) { @@ -1855,7 +1857,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * * flip +1 or -1 pixel compared to redoing the entire layout again. * Leaving in commented code for future tests */ #if 0 - uiScalePanels(ar, BLI_rctf_size_x(&v2d->cur)); + UI_panels_scale(ar, BLI_rctf_size_x(&v2d->cur)); break; #endif } @@ -1883,7 +1885,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * UI_view2d_view_ortho(v2d); /* draw panels */ - uiDrawPanels(C, ar); + UI_panels_draw(C, ar); /* restore view matrix */ UI_view2d_view_restore(C); @@ -1910,7 +1912,7 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar) void ED_region_header(const bContext *C, ARegion *ar) { - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); uiBlock *block; uiLayout *layout; HeaderType *ht; @@ -1930,8 +1932,8 @@ void ED_region_header(const bContext *C, ARegion *ar) /* draw all headers types */ for (ht = ar->type->headertypes.first; ht; ht = ht->next) { - block = uiBeginBlock(C, ar, ht->idname, UI_EMBOSS); - layout = uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, 0, style); + block = UI_block_begin(C, ar, ht->idname, UI_EMBOSS); + layout = UI_block_layout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, 0, style); if (ht->draw) { header.type = ht; @@ -1944,14 +1946,14 @@ void ED_region_header(const bContext *C, ARegion *ar) maxco = xco; } - uiBlockLayoutResolve(block, &xco, &yco); + UI_block_layout_resolve(block, &xco, &yco); /* for view2d */ if (xco > maxco) maxco = xco; - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); } /* always as last */ @@ -1975,7 +1977,7 @@ int ED_area_headersize(void) void ED_region_info_draw(ARegion *ar, const char *text, int block, float fill_color[4]) { const int header_height = UI_UNIT_Y; - uiStyle *style = UI_GetStyleDraw(); + uiStyle *style = UI_style_get_dpi(); int fontid = style->widget.uifont_id; GLint scissor[4]; rcti rect; @@ -2115,7 +2117,7 @@ void ED_region_cache_draw_background(const ARegion *ar) void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y) { - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); int fontid = style->widget.uifont_id; char numstr[32]; float font_dims[2] = {0.0f, 0.0f}; diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 7c8987ae778..18c9a94e46f 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -399,7 +399,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if (sfile) { op = sfile->op; } - else if ((op = uiContextActiveOperator(C))) { + else if ((op = UI_context_active_operator_get(C))) { /* do nothign */ } else { diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 9463a702b76..c179cfc464c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1439,7 +1439,7 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event) /* this used to be a notifier, but needs to be done immediate * because it can undo setting the right button as active due * to delayed notifier handling */ - uiFreeActiveButtons(C, win->screen); + UI_screen_free_active_but(C, win->screen); } else region_cursor_set(win, scr->subwinactive, false); @@ -1813,7 +1813,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s * switching screens with tooltip open because region and tooltip * are no longer in the same screen */ for (ar = sa->regionbase.first; ar; ar = ar->next) - uiFreeBlocks(C, &ar->uiblocks); + UI_blocklist_free(C, &ar->uiblocks); /* prevent hanging header prints */ ED_area_headerprint(sa, NULL); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index ac061752575..35d9b764043 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2737,8 +2737,8 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent if (actedge == NULL) return OPERATOR_CANCELLED; - pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); + layout = UI_popup_menu_layout(pup); WM_operator_properties_create(&ptr1, "SCREEN_OT_area_join"); @@ -2757,7 +2757,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent uiItemFullO(layout, "SCREEN_OT_area_split", NULL, ICON_NONE, ptr2.data, WM_OP_INVOKE_DEFAULT, 0); uiItemFullO(layout, "SCREEN_OT_area_join", NULL, ICON_NONE, ptr1.data, WM_OP_INVOKE_DEFAULT, 0); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -2857,14 +2857,14 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNU if (items == 0) return OPERATOR_CANCELLED; - pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); + layout = UI_popup_menu_layout(pup); for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--) if (WM_operator_repeat_check(C, lastop)) uiItemIntO(layout, RNA_struct_ui_name(lastop->type->srna), ICON_NONE, op->type->idname, "index", i); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -3255,12 +3255,12 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv uiPopupMenu *pup; uiLayout *layout; - pup = uiPupMenuBegin(C, IFACE_("Header"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Header"), ICON_NONE); + layout = UI_popup_menu_layout(pup); ED_screens_header_tools_menu_create(C, layout, NULL); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 2e4c9a32607..e0e68fc0d34 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4714,8 +4714,8 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o static int dyntopo_warning_popup(bContext *C, wmOperatorType *ot, bool vdata, bool modifiers) { - uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("Warning!"), ICON_ERROR); - uiLayout *layout = uiPupMenuLayout(pup); + uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Warning!"), ICON_ERROR); + uiLayout *layout = UI_popup_menu_layout(pup); if (vdata) { const char *msg_error = TIP_("Vertex Data Detected!"); @@ -4736,7 +4736,7 @@ static int dyntopo_warning_popup(bContext *C, wmOperatorType *ot, bool vdata, bo uiItemFullO_ptr(layout, ot, IFACE_("OK"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 619fbd7f4c8..7ede6c95b9d 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -87,7 +87,7 @@ static void sound_open_init(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"); - uiIDContextProperty(C, &pprop->ptr, &pprop->prop); + UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop); } #ifdef WITH_AUDASPACE diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 335949e8495..a17cfa4d87c 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -112,7 +112,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) } } { /* second pass: widgets */ - uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS); size_t channel_index = 0; y = (float)ACHANNEL_FIRST; @@ -134,8 +134,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) channel_index++; } - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); } /* free tempolary channels */ diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 091d3fe56b4..e55ce3ea8eb 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -85,7 +85,7 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) PropertyRNA *prop; /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { bAction *action = NULL, *oldact = NULL; diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index c8431d58bf5..77c6cce6cda 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -122,7 +122,7 @@ void ED_spacetypes_init(void) ED_operatortypes_io(); ED_operatortypes_view2d(); - UI_buttons_operatortypes(); + ED_button_operatortypes(); /* register operators */ spacetypes = BKE_spacetypes_list(); diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 524a42ba388..73091e7f261 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1103,11 +1103,11 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); block = uiLayoutGetBlock(row); - uiBlockSetEmboss(block, UI_EMBOSSN); - but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, + UI_block_emboss_set(block, UI_EMBOSS_NONE); + but = uiDefIconButBitC(block, UI_BTYPE_ICON_TOGGLE, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, TIP_("Follow context or keep fixed datablock displayed")); - uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - uiButSetFunc(but, pin_cb, NULL, NULL); + UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + UI_but_func_set(but, pin_cb, NULL, NULL); for (a = 0; a < path->len; a++) { ptr = &path->ptr[a]; diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index a62ec1b31e1..c73dc04538e 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -72,10 +72,10 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UN RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr); - pup = uiPupMenuBegin(C, IFACE_("Align"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Align"), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemsEnumR(layout, &ptr, "align"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -176,7 +176,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED; } - uiFileBrowseContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_filebrowser(C, &ptr, &prop); if (!prop) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 020d477fc39..cfdb5b0f8ba 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -576,9 +576,9 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS else BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name); - but = uiDefIconTextBut(block, BUT, 0, user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, + but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiButSetNFunc(but, template_texture_select, MEM_dupallocN(user), NULL); + UI_but_funcN_set(but, template_texture_select, MEM_dupallocN(user), NULL); last_category = user->category; } @@ -620,9 +620,9 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C) } /* some cosmetic tweaks */ - uiButSetMenuFromPulldown(but); + UI_but_type_set_menu_from_pulldown(but); - but->flag &= ~UI_ICON_SUBMENU; + but->flag &= ~UI_BUT_ICON_SUBMENU; } /************************* Texture Show **************************/ @@ -675,9 +675,9 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope uiBlock *block = uiLayoutGetBlock(layout); uiBut *but; - but = uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab"); - uiButSetFunc(but, template_texture_show, user->ptr.data, user->prop); + UI_but_func_set(but, template_texture_show, user->ptr.data, user->prop); } } diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 889613b5d13..fe36d9a9685 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -130,7 +130,7 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c row = uiLayoutRow(layout, false); block = uiLayoutGetBlock(row); - uiDefBut(block, LABEL, 0, IFACE_("File Path:"), 0, 19, 145, 19, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("File Path:"), 0, 19, 145, 19, NULL, 0, 0, 0, 0, ""); row = uiLayoutRow(layout, false); split = uiLayoutSplit(row, 0.0f, false); @@ -183,10 +183,10 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) col = uiLayoutColumn(layout, true); block = uiLayoutGetBlock(col); - uiDefBut(block, TRACKPREVIEW, 0, "", 0, 0, UI_UNIT_X * 10, scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_TRACK_PREVIEW, 0, "", 0, 0, UI_UNIT_X * 10, scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); /* Resize grip. */ - uiDefIconButI(block, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.8f), + uiDefIconButI(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.8f), &scopes->track_preview_height, UI_UNIT_Y, UI_UNIT_Y * 20.0f, 0.0f, 0.0f, ""); } @@ -403,9 +403,9 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P else tip = TIP_("Marker is enabled at current frame"); - bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y, + bt = uiDefIconButBitI(block, UI_BTYPE_TOGGLE_N, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y, &cb->marker_flag, 0, 0, 1, 0, tip); - uiButSetNFunc(bt, marker_update_cb, cb, NULL); + UI_but_funcN_set(bt, marker_update_cb, cb, NULL); } else { int width, height, step, digits; @@ -417,7 +417,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P if (track->flag & TRACK_LOCKED) { uiLayoutSetActive(layout, false); block = uiLayoutAbsoluteBlock(layout); - uiDefBut(block, LABEL, 0, IFACE_("Track is locked"), 0, 0, UI_UNIT_X * 15.0f, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Track is locked"), 0, 0, UI_UNIT_X * 15.0f, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); return; } @@ -442,53 +442,53 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P cb->marker_flag = marker->flag; block = uiLayoutAbsoluteBlock(layout); - uiBlockSetHandleFunc(block, marker_block_handler, cb); - uiBlockSetNFunc(block, marker_update_cb, cb, NULL); + UI_block_func_handle_set(block, marker_block_handler, cb); + UI_block_funcN_set(block, marker_update_cb, cb, NULL); if (cb->marker_flag & MARKER_DISABLED) tip = TIP_("Marker is disabled at current frame"); else tip = TIP_("Marker is enabled at current frame"); - uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, IFACE_("Enabled"), 0.5 * UI_UNIT_X, 9.5 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, + uiDefButBitI(block, UI_BTYPE_CHECKBOX_N, MARKER_DISABLED, B_MARKER_FLAG, IFACE_("Enabled"), 0.5 * UI_UNIT_X, 9.5 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_flag, 0, 0, 0, 0, tip); col = uiLayoutColumn(layout, true); uiLayoutSetActive(col, (cb->marker_flag & MARKER_DISABLED) == 0); block = uiLayoutAbsoluteBlock(col); - uiBlockBeginAlign(block); + UI_block_align_begin(block); - uiDefBut(block, LABEL, 0, IFACE_("Position:"), 0, 10 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_POS, IFACE_("X:"), 0.5 * UI_UNIT_X, 9 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pos[0], + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Position:"), 0, 10 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_POS, IFACE_("X:"), 0.5 * UI_UNIT_X, 9 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pos[0], -10 * width, 10.0 * width, step, digits, TIP_("X-position of marker at frame in screen coordinates")); - uiDefButF(block, NUM, B_MARKER_POS, IFACE_("Y:"), 8.25 * UI_UNIT_X, 9 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pos[1], + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_POS, IFACE_("Y:"), 8.25 * UI_UNIT_X, 9 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pos[1], -10 * height, 10.0 * height, step, digits, TIP_("Y-position of marker at frame in screen coordinates")); - uiDefBut(block, LABEL, 0, IFACE_("Offset:"), 0, 8 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_OFFSET, IFACE_("X:"), 0.5 * UI_UNIT_X, 7 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->track_offset[0], + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Offset:"), 0, 8 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_OFFSET, IFACE_("X:"), 0.5 * UI_UNIT_X, 7 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->track_offset[0], -10 * width, 10.0 * width, step, digits, TIP_("X-offset to parenting point")); - uiDefButF(block, NUM, B_MARKER_OFFSET, IFACE_("Y:"), 8.25 * UI_UNIT_X, 7 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->track_offset[1], + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_OFFSET, IFACE_("Y:"), 8.25 * UI_UNIT_X, 7 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->track_offset[1], -10 * height, 10.0 * height, step, digits, TIP_("Y-offset to parenting point")); - uiDefBut(block, LABEL, 0, IFACE_("Pattern Area:"), 0, 6 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_PAT_DIM, IFACE_("Width:"), 0.5 * UI_UNIT_X, 5 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pat[0], 3.0f, + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Pattern Area:"), 0, 6 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_PAT_DIM, IFACE_("Width:"), 0.5 * UI_UNIT_X, 5 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pat[0], 3.0f, 10.0 * width, step, digits, TIP_("Width of marker's pattern in screen coordinates")); - uiDefButF(block, NUM, B_MARKER_PAT_DIM, IFACE_("Height:"), 0.5 * UI_UNIT_X, 4 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pat[1], 3.0f, + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_PAT_DIM, IFACE_("Height:"), 0.5 * UI_UNIT_X, 4 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_pat[1], 3.0f, 10.0 * height, step, digits, TIP_("Height of marker's pattern in screen coordinates")); - uiDefBut(block, LABEL, 0, IFACE_("Search Area:"), 0, 3 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_MARKER_SEARCH_POS, IFACE_("X:"), 0.5 * UI_UNIT_X, 2 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search_pos[0], + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Search Area:"), 0, 3 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_SEARCH_POS, IFACE_("X:"), 0.5 * UI_UNIT_X, 2 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search_pos[0], -width, width, step, digits, TIP_("X-position of search at frame relative to marker's position")); - uiDefButF(block, NUM, B_MARKER_SEARCH_POS, IFACE_("Y:"), 8.25 * UI_UNIT_X, 2 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search_pos[1], + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_SEARCH_POS, IFACE_("Y:"), 8.25 * UI_UNIT_X, 2 * UI_UNIT_Y, 7.25 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search_pos[1], -height, height, step, digits, TIP_("Y-position of search at frame relative to marker's position")); - uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, IFACE_("Width:"), 0.5 * UI_UNIT_X, 1 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search[0], 3.0f, + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_SEARCH_DIM, IFACE_("Width:"), 0.5 * UI_UNIT_X, 1 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search[0], 3.0f, 10.0 * width, step, digits, TIP_("Width of marker's search in screen coordinates")); - uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, IFACE_("Height:"), 0.5 * UI_UNIT_X, 0 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search[1], 3.0f, + uiDefButF(block, UI_BTYPE_NUM, B_MARKER_SEARCH_DIM, IFACE_("Height:"), 0.5 * UI_UNIT_X, 0 * UI_UNIT_Y, 15 * UI_UNIT_X, UI_UNIT_Y, &cb->marker_search[1], 3.0f, 10.0 * height, step, digits, TIP_("Height of marker's search in screen coordinates")); - uiBlockEndAlign(block); + UI_block_align_end(block); } } diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 2a457bf503f..fe5b332aeb1 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -283,7 +283,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) MovieTracking *tracking; MovieTrackingDopesheet *dopesheet; MovieTrackingDopesheetChannel *channel; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); uiBlock *block; int fontid = style->widget.uifont_id; int height; @@ -348,7 +348,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) } /* second pass: widgets */ - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); y = (float) CHANNEL_FIRST; /* get RNA properties (once) */ @@ -370,11 +370,11 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) RNA_pointer_create(&clip->id, &RNA_MovieTrackingTrack, track, &ptr); - uiBlockSetEmboss(block, UI_EMBOSSN); - uiDefIconButR_prop(block, ICONTOG, 1, icon, + UI_block_emboss_set(block, UI_EMBOSS_NONE); + uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 1, icon, v2d->cur.xmax - UI_UNIT_X - CHANNEL_PAD, y - UI_UNIT_Y / 2.0f, UI_UNIT_X, UI_UNIT_Y, &ptr, chan_prop_lock, 0, 0, 0, 0, 0, NULL); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } /* adjust y-position for next one */ @@ -382,6 +382,6 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) } glDisable(GL_BLEND); - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 9f7bcae800a..787a7fca273 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -168,7 +168,7 @@ static void open_init(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"); - uiIDContextProperty(C, &pprop->ptr, &pprop->prop); + UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop); } static void open_cancel(bContext *UNUSED(C), wmOperator *op) diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c index 55b78219770..608c1136070 100644 --- a/source/blender/editors/space_clip/clip_toolbar.c +++ b/source/blender/editors/space_clip/clip_toolbar.c @@ -242,7 +242,7 @@ static void clip_panel_operator_redo(const bContext *C, Panel *pa) uiLayoutSetEnabled(pa->layout, false); /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */ - uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op); + UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op); clip_panel_operator_redo_operator(C, pa, op); } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 20dccc208d4..81476a8ad76 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -116,7 +116,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) /* Initialize UI block. */ BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar); - block = uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS); + block = UI_block_begin(C, ar, uiblockstr, UI_EMBOSS); /* exception to make space for collapsed region icon */ for (artmp = CTX_wm_area(C)->regionbase.first; artmp; artmp = artmp->next) { @@ -128,10 +128,10 @@ void file_draw_buttons(const bContext *C, ARegion *ar) } /* Is there enough space for the execute / cancel buttons? */ - loadbutton = UI_GetStringWidth(sfile->params->title) + btn_margin; + loadbutton = UI_fontstyle_string_width(sfile->params->title) + btn_margin; if (loadbutton < btn_minw) { loadbutton = MAX2(btn_minw, - btn_margin + UI_GetStringWidth(params->title)); + btn_margin + UI_fontstyle_string_width(params->title)); } if (available_w <= loadbutton + separator + input_minw || params->title[0] == 0) { @@ -155,80 +155,80 @@ void file_draw_buttons(const bContext *C, ARegion *ar) if (available_w > 0) { int overwrite_alert = file_draw_check_exists(sfile); /* callbacks for operator check functions */ - uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL); + UI_block_func_set(block, file_draw_check_cb, NULL, NULL); - but = uiDefBut(block, TEX, -1, "", + but = uiDefBut(block, UI_BTYPE_TEXT, -1, "", min_x, line1_y, line1_w - chan_offs, btn_h, params->dir, 0.0, (float)FILE_MAX, 0, 0, TIP_("File path")); - uiButSetCompleteFunc(but, autocomplete_directory, NULL); - uiButSetFlag(but, UI_BUT_NO_UTF8); - uiButClearFlag(but, UI_BUT_UNDO); - uiButSetNFunc(but, file_directory_enter_handle, NULL, but); + UI_but_func_complete_set(but, autocomplete_directory, NULL); + UI_but_flag_enable(but, UI_BUT_NO_UTF8); + UI_but_flag_disable(but, UI_BUT_UNDO); + UI_but_funcN_set(but, file_directory_enter_handle, NULL, but); /* TODO, directory editing is non-functional while a library is loaded * until this is properly supported just disable it. */ if (sfile->files && filelist_lib(sfile->files)) - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); if ((params->flag & FILE_DIRSEL_ONLY) == 0) { - but = uiDefBut(block, TEX, -1, "", + but = uiDefBut(block, UI_BTYPE_TEXT, -1, "", min_x, line2_y, line2_w - chan_offs, btn_h, params->file, 0.0, (float)FILE_MAXFILE, 0, 0, TIP_(overwrite_alert ? N_("File name, overwrite existing") : N_("File name"))); - uiButSetCompleteFunc(but, autocomplete_file, NULL); - uiButSetFlag(but, UI_BUT_NO_UTF8); - uiButClearFlag(but, UI_BUT_UNDO); + UI_but_func_complete_set(but, autocomplete_file, NULL); + UI_but_flag_enable(but, UI_BUT_NO_UTF8); + UI_but_flag_disable(but, UI_BUT_UNDO); /* silly workaround calling NFunc to ensure this does not get called * immediate ui_apply_but_func but only after button deactivates */ - uiButSetNFunc(but, file_filename_enter_handle, NULL, but); + UI_but_funcN_set(but, file_filename_enter_handle, NULL, but); /* check if this overrides a file and if the operator option is used */ if (overwrite_alert) { - uiButSetFlag(but, UI_BUT_REDALERT); + UI_but_flag_enable(but, UI_BUT_REDALERT); } } /* clear func */ - uiBlockSetFunc(block, NULL, NULL, NULL); + UI_block_func_set(block, NULL, NULL, NULL); } /* Filename number increment / decrement buttons. */ if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) { - uiBlockBeginAlign(block); - but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT, + UI_block_align_begin(block); + but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT, min_x + line2_w + separator - chan_offs, line2_y, btn_fn_w, btn_h, TIP_("Decrement the filename number")); - RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1); + RNA_int_set(UI_but_operator_ptr_get(but), "increment", -1); - but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN, + but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN, min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y, btn_fn_w, btn_h, TIP_("Increment the filename number")); - RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1); - uiBlockEndAlign(block); + RNA_int_set(UI_but_operator_ptr_get(but), "increment", 1); + UI_block_align_end(block); } /* Execute / cancel buttons. */ if (loadbutton) { /* params->title is already translated! */ - uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title, + uiDefButO(block, UI_BTYPE_BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title, max_x - loadbutton, line1_y, loadbutton, btn_h, ""); - uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"), + uiDefButO(block, UI_BTYPE_BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"), max_x - loadbutton, line2_y, loadbutton, btn_h, ""); } - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); } static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade) { UI_ThemeColorShade(colorid, shade); - uiSetRoundBox(UI_CNR_ALL); - uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f); } @@ -281,16 +281,16 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, /*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/ - but = uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, ""); + but = uiDefIconBut(block, UI_BTYPE_LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, ""); if (drag) - uiButSetDragPath(but, path); + UI_but_drag_set_path(but, path); } static void file_draw_string(int sx, int sy, const char *string, float width, int height, short align) { - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); uiFontStyle fs = style->widgetlabel; rcti rect; char fname[FILE_MAXFILE]; @@ -300,13 +300,13 @@ static void file_draw_string(int sx, int sy, const char *string, float width, in BLI_strncpy(fname, string, FILE_MAXFILE); file_shorten_string(fname, width + 1.0f, 0); - /* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */ + /* no text clipping needed, UI_fontstyle_draw does it but is a bit too strict (for buttons it works) */ rect.xmin = sx; rect.xmax = (int)(sx + ceil(width + 4.0f)); rect.ymin = sy - height; rect.ymax = sy; - uiStyleFontDraw(&fs, &rect, fname); + UI_fontstyle_draw(&fs, &rect, fname); } void file_calc_previews(const bContext *C, ARegion *ar) @@ -362,7 +362,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int /* shadow */ if (dropshadow) - uiDrawBoxShadow(220, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey)); + UI_draw_box_shadow(220, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey)); glEnable(GL_BLEND); @@ -378,8 +378,8 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int /* dragregion */ if (drag) { - but = uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, ""); - uiButSetDragImage(but, file->path, get_file_icon(file), imb, scale); + but = uiDefBut(block, UI_BTYPE_LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, ""); + UI_but_drag_set_image(but, file->path, get_file_icon(file), imb, scale); } glDisable(GL_BLEND); @@ -470,7 +470,7 @@ void file_draw_list(const bContext *C, ARegion *ar) struct FileList *files = sfile->files; struct direntry *file; ImBuf *imb; - uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS); int numfiles; int numfiles_layout; int sx, sy; @@ -526,7 +526,7 @@ void file_draw_list(const bContext *C, ARegion *ar) draw_tile(sx, sy - 1, layout->tile_w + 4, sfile->layout->tile_h + layout->tile_border_y, colorid, shade); } } - uiSetRoundBox(UI_CNR_NONE); + UI_draw_roundbox_corner_set(UI_CNR_NONE); /* don't drag parent or refresh items */ do_drag = !(STREQ(file->relname, "..") || STREQ(file->relname, ".")); @@ -565,12 +565,12 @@ void file_draw_list(const bContext *C, ARegion *ar) width = textwidth; } - but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X, + but = uiDefBut(block, UI_BTYPE_TEXT, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X, width, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, ""); - uiButSetRenameFunc(but, renamebutton_cb, file); - uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ - uiButClearFlag(but, UI_BUT_UNDO); - if (false == uiButActiveOnly(C, ar, block, but)) { + UI_but_func_rename_set(but, renamebutton_cb, file); + UI_but_flag_enable(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ + UI_but_flag_disable(but, UI_BUT_UNDO); + if (false == UI_but_active_only(C, ar, block, but)) { file->selflag &= ~EDITING_FILE; } } @@ -618,7 +618,7 @@ void file_draw_list(const bContext *C, ARegion *ar) } } - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); } diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 8fad17e1210..c224da721fa 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -114,16 +114,16 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat BLI_strncpy(dir, entry, FILE_MAX); /* create list item */ - but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nr, 0, i, 0, 0, entry); - uiButSetFunc(but, file_panel_cb, entry, NULL); - uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - uiButSetDrawFlag(but, UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT); + but = uiDefIconTextButS(block, UI_BTYPE_LISTROW, 0, icon, dir, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nr, 0, i, 0, 0, entry); + UI_but_func_set(but, file_panel_cb, entry, NULL); + UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + UI_but_drawflag_enable(but, UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT); /* create delete button */ if (allow_delete && fsmenu_can_save(fsmenu, category, i)) { - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); uiItemIntO(layout, "", ICON_X, "FILE_OT_bookmark_delete", "index", i); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } } } @@ -218,11 +218,11 @@ static void file_panel_operator(const bContext *C, Panel *pa) wmOperator *op = sfile->op; // int empty = 1, flag; - uiBlockSetFunc(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL); + UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL); uiLayoutOperatorButs(C, pa->layout, op, file_panel_check_prop, '\0', UI_LAYOUT_OP_SHOW_EMPTY); - uiBlockSetFunc(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL); + UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL); } void file_panels_register(ARegionType *art) diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index afe3f29e9bc..8b90cf6cc29 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -444,8 +444,8 @@ float file_shorten_string(char *string, float w, int front) float file_string_width(const char *str) { - uiStyle *style = UI_GetStyle(); - uiStyleFontSet(&style->widget); + uiStyle *style = UI_style_get(); + UI_fontstyle_set(&style->widget); return BLF_width(style->widget.uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); } @@ -454,13 +454,13 @@ float file_font_pointsize(void) #if 0 float s; char tmp[2] = "X"; - uiStyle *style = UI_GetStyle(); - uiStyleFontSet(&style->widget); + uiStyle *style = UI_style_get(); + UI_fontstyle_set(&style->widget); s = BLF_height(style->widget.uifont_id, tmp); return style->widget.points; #else - uiStyle *style = UI_GetStyle(); - uiStyleFontSet(&style->widget); + uiStyle *style = UI_style_get(); + UI_fontstyle_set(&style->widget); return style->widget.points * UI_DPI_FAC; #endif } @@ -662,7 +662,7 @@ int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) dir = opendir(dirname); if (dir) { - AutoComplete *autocpl = autocomplete_begin(str, FILE_MAX); + AutoComplete *autocpl = UI_autocomplete_begin(str, FILE_MAX); while ((de = readdir(dir)) != NULL) { if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0) { @@ -676,14 +676,14 @@ int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) if (BLI_stat(path, &status) == 0) { if (S_ISDIR(status.st_mode)) { /* is subdir */ - autocomplete_do_name(autocpl, path); + UI_autocomplete_update_name(autocpl, path); } } } } closedir(dir); - match = autocomplete_end(autocpl, str); + match = UI_autocomplete_end(autocpl, str); if (match) { if (match == AUTOCOMPLETE_FULL_MATCH) { BLI_add_slash(str); @@ -705,17 +705,17 @@ int autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) /* search if str matches the beginning of name */ if (str[0] && sfile->files) { - AutoComplete *autocpl = autocomplete_begin(str, FILE_MAX); + AutoComplete *autocpl = UI_autocomplete_begin(str, FILE_MAX); int nentries = filelist_numfiles(sfile->files); int i; for (i = 0; i < nentries; ++i) { struct direntry *file = filelist_file(sfile->files, i); if (file && (S_ISREG(file->type) || S_ISDIR(file->type))) { - autocomplete_do_name(autocpl, file->relname); + UI_autocomplete_update_name(autocpl, file->relname); } } - match = autocomplete_end(autocpl, str); + match = UI_autocomplete_end(autocpl, str); } return match; diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index b59030d3c12..a2b64afdb15 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -159,7 +159,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa) // UNUSED // block = uiLayoutGetBlock(layout); - // uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); + // UI_block_func_handle_set(block, do_graph_region_buttons, NULL); /* F-Curve pointer */ RNA_pointer_create(ale->id, &RNA_FCurve, fcu, &fcu_ptr); @@ -315,7 +315,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) return; block = uiLayoutGetBlock(layout); - /* uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); */ + /* UI_block_func_handle_set(block, do_graph_region_buttons, NULL); */ /* only show this info if there are keyframes to edit */ if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) { @@ -366,33 +366,33 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) { uiItemL(col, IFACE_("Key:"), ICON_NONE); - but = uiDefButR(block, NUM, B_REDR, IFACE_("Frame:"), 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, IFACE_("Frame:"), 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL); - uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt); + UI_but_func_set(but, graphedit_activekey_update_cb, fcu, bezt); - but = uiDefButR(block, NUM, B_REDR, IFACE_("Value:"), 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, IFACE_("Value:"), 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL); - uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt); - uiButSetUnitType(but, unit); + UI_but_func_set(but, graphedit_activekey_update_cb, fcu, bezt); + UI_but_unit_type_set(but, unit); } /* previous handle - only if previous was Bezier interpolation */ if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) { uiItemL(col, IFACE_("Left Handle:"), ICON_NONE); - but = uiDefButR(block, NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL); - uiButSetFunc(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt); + UI_but_func_set(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt); - but = uiDefButR(block, NUM, B_REDR, "Y:", 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "Y:", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL); - uiButSetFunc(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt); - uiButSetUnitType(but, unit); + UI_but_func_set(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt); + UI_but_unit_type_set(but, unit); /* XXX: with label? */ - but = uiDefButR(block, MENU, B_REDR, NULL, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_MENU, B_REDR, NULL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left_type", 0, 0, 0, -1, -1, "Type of left handle"); - uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + UI_but_func_set(but, graphedit_activekey_handles_cb, fcu, bezt); } /* next handle - only if current is Bezier interpolation */ @@ -400,19 +400,19 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) /* NOTE: special update callbacks are needed on the coords here due to T39911 */ uiItemL(col, IFACE_("Right Handle:"), ICON_NONE); - but = uiDefButR(block, NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL); - uiButSetFunc(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt); + UI_but_func_set(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt); - but = uiDefButR(block, NUM, B_REDR, "Y:", 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "Y:", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL); - uiButSetFunc(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt); - uiButSetUnitType(but, unit); + UI_but_func_set(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt); + UI_but_unit_type_set(but, unit); /* XXX: with label? */ - but = uiDefButR(block, MENU, B_REDR, NULL, 0, 0, UI_UNIT_X, UI_UNIT_Y, + but = uiDefButR(block, UI_BTYPE_MENU, B_REDR, NULL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right_type", 0, 0, 0, -1, -1, "Type of right handle"); - uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + UI_but_func_set(but, graphedit_activekey_handles_cb, fcu, bezt); } } else { @@ -671,22 +671,22 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* set event handler for panel */ block = uiLayoutGetBlock(pa->layout); // xxx? - uiBlockSetHandleFunc(block, do_graph_region_driver_buttons, NULL); + UI_block_func_handle_set(block, do_graph_region_driver_buttons, NULL); /* general actions - management */ col = uiLayoutColumn(pa->layout, false); block = uiLayoutGetBlock(col); - but = uiDefIconTextBut(block, BUT, B_IPO_DEPCHANGE, ICON_FILE_REFRESH, IFACE_("Update Dependencies"), + but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_FILE_REFRESH, IFACE_("Update Dependencies"), 0, 0, 10 * UI_UNIT_X, 22, NULL, 0.0, 0.0, 0, 0, TIP_("Force updates of dependencies")); - uiButSetFunc(but, driver_update_flags_cb, fcu, NULL); + UI_but_func_set(but, driver_update_flags_cb, fcu, NULL); - but = uiDefIconTextBut(block, BUT, B_IPO_DEPCHANGE, ICON_ZOOMOUT, IFACE_("Remove Driver"), + but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_ZOOMOUT, IFACE_("Remove Driver"), 0, 0, 10 * UI_UNIT_X, 18, NULL, 0.0, 0.0, 0, 0, TIP_("Remove this driver")); - uiButSetNFunc(but, driver_remove_cb, MEM_dupallocN(ale), NULL); + UI_but_funcN_set(but, driver_remove_cb, MEM_dupallocN(ale), NULL); /* driver-level settings - type, expressions, and errors */ RNA_pointer_create(ale->id, &RNA_Driver, driver, &driver_ptr); @@ -763,11 +763,11 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* add driver variables */ col = uiLayoutColumn(pa->layout, false); block = uiLayoutGetBlock(col); - but = uiDefIconTextBut(block, BUT, B_IPO_DEPCHANGE, ICON_ZOOMIN, IFACE_("Add Variable"), + but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_ZOOMIN, IFACE_("Add Variable"), 0, 0, 10 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, TIP_("Driver variables ensure that all dependencies will be accounted for and that drivers will update correctly")); - uiButSetFunc(but, driver_add_var_cb, driver, NULL); + UI_but_func_set(but, driver_add_var_cb, driver, NULL); /* loop over targets, drawing them */ for (dvar = driver->variables.first; dvar; dvar = dvar->next) { @@ -788,11 +788,11 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) uiItemR(row, &dvar_ptr, "name", 0, "", ICON_NONE); /* remove button */ - uiBlockSetEmboss(block, UI_EMBOSSN); - but = uiDefIconBut(block, BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y, + UI_block_emboss_set(block, UI_EMBOSS_NONE); + but = uiDefIconBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, IFACE_("Delete target variable")); - uiButSetFunc(but, driver_delete_var_cb, driver, dvar); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_but_func_set(but, driver_delete_var_cb, driver, dvar); + UI_block_emboss_set(block, UI_EMBOSS); /* variable type */ row = uiLayoutRow(box, false); @@ -869,7 +869,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa) return; block = uiLayoutGetBlock(pa->layout); - uiBlockSetHandleFunc(block, do_graph_region_modifier_buttons, NULL); + UI_block_func_handle_set(block, do_graph_region_modifier_buttons, NULL); /* 'add modifier' button at top of panel */ { @@ -879,7 +879,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa) /* this is an operator button which calls a 'add modifier' operator... * a menu might be nicer but would be tricky as we need some custom filtering */ - uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), + uiDefButO(block, UI_BTYPE_BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 0.5 * UI_UNIT_X, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, TIP_("Adds a new F-Curve Modifier for the active F-Curve")); /* copy/paste (as sub-row)*/ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index ed7cfe7da99..1536809ef9b 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -1109,7 +1109,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) } } { /* second pass: widgets */ - uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS); size_t channel_index = 0; y = (float)ACHANNEL_FIRST; @@ -1135,8 +1135,8 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) channel_index++; } - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); glDisable(GL_BLEND); } diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 154437ab53a..c6fcf746220 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -268,7 +268,7 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PRE return; } - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl); uiSetPanelHandler(IMAGE_HANDLER_PREVIEW); // for close and esc @@ -276,7 +276,7 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PRE ofsy = -100 + (sa->winy / 2) / sima->blockscale; if (uiNewPanel(C, ar, block, "Preview", "Image", ofsx, ofsy, 300, 200) == 0) return; - uiBlockSetDrawExtraFunc(block, preview_cb); + UI_but_func_drawextra_set(block, preview_cb); } #endif @@ -290,7 +290,7 @@ static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void * Image *image = image_p; int slot; - uiDefBut(block, LABEL, 0, IFACE_("Slot"), + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Slot"), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiItemS(layout); @@ -303,7 +303,7 @@ static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void * else { BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot + 1); } - uiDefButS(block, BUTM, B_NOP, str, 0, 0, + uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, str, 0, 0, UI_UNIT_X * 5, UI_UNIT_X, &image->render_slot, (float) slot, 0.0, 0, -1, ""); } } @@ -340,10 +340,10 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void return; } - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); uiLayoutColumn(layout, false); - uiDefBut(block, LABEL, 0, IFACE_("Layer"), + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Layer"), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiItemS(layout); @@ -357,7 +357,7 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void for (rl = rr->layers.last; rl; rl = rl->prev, nr--) { final: - uiDefButS(block, BUTM, B_NOP, IFACE_(rl->name), 0, 0, + uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rl->name), 0, 0, UI_UNIT_X * 5, UI_UNIT_X, &iuser->layer, (float) nr, 0.0, 0, -1, ""); } @@ -406,10 +406,10 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * rl = BLI_findlink(&rr->layers, rpass_index); - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); uiLayoutColumn(layout, false); - uiDefBut(block, LABEL, 0, IFACE_("Pass"), + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Pass"), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiItemS(layout); @@ -425,7 +425,7 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * /* rendered results don't have a Combined pass */ for (rpass = rl ? rl->passes.last : NULL; rpass; rpass = rpass->prev, nr--) { final: - uiDefButS(block, BUTM, B_NOP, IFACE_(rpass->name), 0, 0, + uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rpass->name), 0, 0, UI_UNIT_X * 5, UI_UNIT_X, &iuser->pass, (float) nr, 0.0, 0, -1, ""); } @@ -551,8 +551,8 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderRes BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), *render_slot + 1); } but = uiDefMenuBut(block, ui_imageuser_slot_menu, image, str, 0, 0, wmenu1, UI_UNIT_Y, TIP_("Select Slot")); - uiButSetFunc(but, image_multi_cb, rr, iuser); - uiButSetMenuFromPulldown(but); + UI_but_func_set(but, image_multi_cb, rr, iuser); + UI_but_type_set_menu_from_pulldown(but); } if (rr) { @@ -567,8 +567,8 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderRes display_name = rl ? rl->name : (fake_name ? fake_name : ""); but = uiDefMenuBut(block, ui_imageuser_layer_menu, rnd_pt, display_name, 0, 0, wmenu2, UI_UNIT_Y, TIP_("Select Layer")); - uiButSetFunc(but, image_multi_cb, rr, iuser); - uiButSetMenuFromPulldown(but); + UI_but_func_set(but, image_multi_cb, rr, iuser); + UI_but_type_set_menu_from_pulldown(but); /* pass */ @@ -577,8 +577,8 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderRes display_name = rpass ? rpass->name : (fake_name ? fake_name : ""); but = uiDefMenuBut(block, ui_imageuser_pass_menu, rnd_pt, display_name, 0, 0, wmenu3, UI_UNIT_Y, TIP_("Select Pass")); - uiButSetFunc(but, image_multi_cb, rr, iuser); - uiButSetMenuFromPulldown(but); + UI_but_func_set(but, image_multi_cb, rr, iuser); + UI_but_type_set_menu_from_pulldown(but); } } @@ -599,20 +599,20 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, Image *image, Ren } /* decrease, increase arrows */ - but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Layer")); - uiButSetFunc(but, image_multi_declay_cb, rr, iuser); - but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Layer")); - uiButSetFunc(but, image_multi_inclay_cb, rr, iuser); + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Layer")); + UI_but_func_set(but, image_multi_declay_cb, rr, iuser); + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Layer")); + UI_but_func_set(but, image_multi_inclay_cb, rr, iuser); uiblock_layer_pass_buttons(row, image, rr, iuser, 230 * dpi_fac, render_slot); /* decrease, increase arrows */ - but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Pass")); - uiButSetFunc(but, image_multi_decpass_cb, rr, iuser); - but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Pass")); - uiButSetFunc(but, image_multi_incpass_cb, rr, iuser); + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Pass")); + UI_but_func_set(but, image_multi_decpass_cb, rr, iuser); + but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Pass")); + UI_but_func_set(but, image_multi_incpass_cb, rr, iuser); - uiBlockEndAlign(block); + UI_block_align_end(block); } // XXX HACK! @@ -690,7 +690,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL); if (ima) { - uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL); + UI_block_funcN_set(block, rna_update_cb, MEM_dupallocN(cb), NULL); if (ima->source == IMA_SRC_VIEWER) { ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock); @@ -705,18 +705,18 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char #if 0 iuser = ntree_get_active_iuser(scene->nodetree); if (iuser) { - uiBlockBeginAlign(block); - uiDefIconTextBut(block, BUT, B_SIMA_RECORD, ICON_REC, "Record", 10, 120, 100, 20, 0, 0, 0, 0, 0, ""); - uiDefIconTextBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, "Play", 110, 120, 100, 20, 0, 0, 0, 0, 0, ""); - but = uiDefBut(block, BUT, B_NOP, "Free Cache", 210, 120, 100, 20, 0, 0, 0, 0, 0, ""); - uiButSetFunc(but, image_freecache_cb, ima, NULL); + UI_block_align_begin(block); + uiDefIconTextBut(block, UI_BTYPE_BUT, B_SIMA_RECORD, ICON_REC, "Record", 10, 120, 100, 20, 0, 0, 0, 0, 0, ""); + uiDefIconTextBut(block, UI_BTYPE_BUT, B_SIMA_PLAY, ICON_PLAY, "Play", 110, 120, 100, 20, 0, 0, 0, 0, 0, ""); + but = uiDefBut(block, UI_BTYPE_BUT, B_NOP, "Free Cache", 210, 120, 100, 20, 0, 0, 0, 0, 0, ""); + UI_but_func_set(but, image_freecache_cb, ima, NULL); if (iuser->frames) BLI_snprintf(str, sizeof(str), "(%d) Frames:", iuser->framenr); else strcpy(str, "Frames:"); - uiBlockBeginAlign(block); - uiDefButI(block, NUM, imagechanged, str, 10, 90, 150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use"); - uiDefButI(block, NUM, imagechanged, "StartFr:", 160, 90, 150, 20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie"); + UI_block_align_begin(block); + uiDefButI(block, UI_BTYPE_NUM, imagechanged, str, 10, 90, 150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use"); + uiDefButI(block, UI_BTYPE_NUM, imagechanged, "StartFr:", 160, 90, 150, 20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie"); } #endif } @@ -852,7 +852,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char } - uiBlockSetNFunc(block, NULL, NULL, NULL); + UI_block_funcN_set(block, NULL, NULL, NULL); } MEM_freeN(cb); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index b51897d1c5d..1b86b608a7c 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -947,7 +947,7 @@ static void image_open_init(bContext *C, wmOperator *op) op->customdata = iod = MEM_callocN(sizeof(ImageOpenData), __func__); iod->iuser = CTX_data_pointer_get_type(C, "image_user", &RNA_ImageUser).data; - uiIDContextProperty(C, &iod->pprop.ptr, &iod->pprop.prop); + UI_context_active_but_prop_get_templateID(C, &iod->pprop.ptr, &iod->pprop.prop); } static void image_open_cancel(bContext *UNUSED(C), wmOperator *op) @@ -1158,7 +1158,7 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( PropertyRNA *prop; /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { PointerRNA oldptr; @@ -1958,7 +1958,7 @@ static int image_new_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { /* when creating new ID blocks, use is already 1, but RNA @@ -2024,7 +2024,7 @@ static int image_new_exec(bContext *C, wmOperator *op) } /* XXX, Ton is not a fan of OK buttons but using this function to avoid undo/redo bug while in mesh-editmode, - campbell */ -/* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */ +/* XXX Note: the WM_operator_props_dialog_popup() doesn't work for UI_context_active_but_prop_get_templateID(), image is not being that way */ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { /* Better for user feedback. */ @@ -2248,11 +2248,11 @@ static int image_pack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL); if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) { - pup = uiPupMenuBegin(C, IFACE_("OK"), ICON_QUESTION); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("OK"), ICON_QUESTION); + layout = UI_popup_menu_layout(pup); uiItemBooleanO(layout, IFACE_("Can't pack edited image from disk, pack as internal PNG?"), ICON_NONE, op->idname, "as_png", 1); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); BKE_image_release_ibuf(ima, ibuf, NULL); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 405c1f0a961..240d8baa6f2 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -253,13 +253,13 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( else BLI_snprintf(title, sizeof(title), IFACE_("Unpack %d Files"), count); - pup = uiPupMenuBegin(C, title, ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, title, ICON_NONE); + layout = UI_popup_menu_layout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); uiItemsEnumO(layout, "FILE_OT_unpack_all", "method"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -322,13 +322,13 @@ static int unpack_item_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED uiPopupMenu *pup; uiLayout *layout; - pup = uiPupMenuBegin(C, IFACE_("Unpack"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Unpack"), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); uiItemsFullEnumO(layout, op->type->idname, "method", op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index 2c521532484..085fe68df92 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -124,12 +124,12 @@ static int cut_links_exec(bContext *C, wmOperator *op) for (block = ar->uiblocks.first; block; block = block->next) { but = block->buttons.first; while (but) { - if (but->type==LINK && but->link) { + if (but->type==UI_BTYPE_LINK && but->link) { for (line = but->link->lines.first; line; line = nline) { nline = line->next; if (cut_links_intersect(line, mcoords, i)) { - ui_delete_linkline(line, but); + ui_linkline_remove(line, but); } } } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index dd152022762..504256179c8 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -761,17 +761,17 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) uiBlock *block; int yco=0; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); - uiBlockSetButmFunc(block, do_sensor_menu, NULL); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); + UI_block_func_butmenu_set(block, do_sensor_menu, NULL); - uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, SEPRLINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Show Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -810,17 +810,17 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) uiBlock *block; int yco=0; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); - uiBlockSetButmFunc(block, do_controller_menu, NULL); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); + UI_block_func_butmenu_set(block, do_controller_menu, NULL); - uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, SEPRLINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Show Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, ""); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -859,17 +859,17 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) uiBlock *block; int xco=0; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); - uiBlockSetButmFunc(block, do_actuator_menu, NULL); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); + UI_block_func_butmenu_set(block, do_actuator_menu, NULL); - uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, SEPRLINE, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Show Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -892,26 +892,26 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c short yco = 12, xco = 0, stbit, offset; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSS); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS); /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, ""); for (offset=0; offset<15; offset += 5) { - uiBlockBeginAlign(block); + UI_block_align_begin(block); for (stbit=0; stbit<5; stbit++) { - but = uiDefButBitI(block, TOG, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); - uiButSetFunc(but, check_controller_state_mask, but, &(cont->state_mask)); + but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); + UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask)); } for (stbit=0; stbit<5; stbit++) { - but = uiDefButBitI(block, TOG, (1<<(stbit+offset+15)), (stbit+offset+15), "", (short)(xco+12*stbit+13*offset), yco-12, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); - uiButSetFunc(but, check_controller_state_mask, but, &(cont->state_mask)); + but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset+15)), (stbit+offset+15), "", (short)(xco+12*stbit+13*offset), yco-12, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); + UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask)); } } - uiBlockEndAlign(block); + UI_block_align_end(block); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -923,7 +923,7 @@ static bool is_sensor_linked(uiBlock *block, bSensor *sens) for (i=0; itotlinks; i++) { cont = sens->links[i]; - if (uiFindInlink(block, cont) != NULL) + if (UI_block_links_find_inlink(block, cont) != NULL) return 1; } return 0; @@ -2353,9 +2353,9 @@ void logic_buttons(bContext *C, ARegion *ar) idar= get_selected_and_linked_obs(C, &count, slogic->scaflag); BLI_snprintf(uiblockstr, sizeof(uiblockstr), "buttonswin %p", (void *)ar); - block= uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS); - uiBlockSetHandleFunc(block, do_logic_buts, NULL); - uiBoundsBlock(block, U.widget_unit/2); + block= UI_block_begin(C, ar, uiblockstr, UI_EMBOSS); + UI_block_func_handle_set(block, do_logic_buts, NULL); + UI_block_bounds_set_normal(block, U.widget_unit/2); /* loop over all objects and set visible/linked flags for the logic bricks */ for (a=0; aid.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers")); + uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWCONT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); @@ -2479,9 +2479,9 @@ void logic_buttons(bContext *C, ARegion *ar) col = uiLayoutColumn(split, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT); - but = uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } //col = uiLayoutColumn(split, true); @@ -2502,22 +2502,22 @@ void logic_buttons(bContext *C, ARegion *ar) col = uiLayoutColumn(subsplit, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT); - but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } - uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR); + UI_but_link_set(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR); } } - uiBlockLayoutResolve(block, NULL, &yco); /* stores final height in yco */ + UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ height = yco; /* ****************** Sensors ****************** */ xco= U.widget_unit / 2; yco= -U.widget_unit / 2; width= 17 * U.widget_unit; - layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_GetStyle()); + layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); row = uiLayoutRow(layout, true); uiDefBlockBut(block, sensor_menu, NULL, IFACE_("Sensors"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ @@ -2537,7 +2537,7 @@ void logic_buttons(bContext *C, ARegion *ar) if ((ob->scavisflag & OB_VIS_SENS) == 0) continue; row = uiLayoutRow(layout, true); - uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors")); + uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWSENS, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); @@ -2575,23 +2575,23 @@ void logic_buttons(bContext *C, ARegion *ar) /* put link button to the right */ col = uiLayoutColumn(split, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } /* use old-school uiButtons for links for now */ - uiSetButLink(but, NULL, (void ***)&sens->links, &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER); + UI_but_link_set(but, NULL, (void ***)&sens->links, &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER); } } } - uiBlockLayoutResolve(block, NULL, &yco); /* stores final height in yco */ + UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ height = MIN2(height, yco); /* ****************** Actuators ****************** */ xco= 40 * U.widget_unit; yco= -U.widget_unit / 2; width= 17 * U.widget_unit; - layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_GetStyle()); + layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); row = uiLayoutRow(layout, true); uiDefBlockBut(block, actuator_menu, NULL, IFACE_("Actuators"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ @@ -2613,7 +2613,7 @@ void logic_buttons(bContext *C, ARegion *ar) } row = uiLayoutRow(layout, true); - uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators")); + uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWACT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); @@ -2644,9 +2644,9 @@ void logic_buttons(bContext *C, ARegion *ar) /* put inlink button to the left */ col = uiLayoutColumn(split, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - but = uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } col = uiLayoutColumn(split, true); @@ -2661,7 +2661,7 @@ void logic_buttons(bContext *C, ARegion *ar) } } } - uiBlockLayoutResolve(block, NULL, &yco); /* stores final height in yco */ + UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ height = MIN2(height, yco); UI_view2d_totRect_set(&ar->v2d, 57.5f * U.widget_unit, height - U.widget_unit); @@ -2669,10 +2669,10 @@ void logic_buttons(bContext *C, ARegion *ar) /* set the view */ UI_view2d_view_ortho(&ar->v2d); - uiComposeLinks(block); + UI_block_links_compose(block); - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); /* restore view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 1090106d79f..89cfd389a9d 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -254,7 +254,7 @@ static void nla_panel_animdata(const bContext *C, Panel *pa) /* adt = adt_ptr.data; */ block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); + UI_block_func_handle_set(block, do_nla_region_buttons, NULL); /* AnimData Source Properties ----------------------------------- */ @@ -309,7 +309,7 @@ static void nla_panel_track(const bContext *C, Panel *pa) return; block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); + UI_block_func_handle_set(block, do_nla_region_buttons, NULL); /* Info - Active NLA-Context:Track ---------------------- */ row = uiLayoutRow(layout, true); @@ -329,7 +329,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa) return; block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); + UI_block_func_handle_set(block, do_nla_region_buttons, NULL); /* Strip Properties ------------------------------------- */ /* strip type */ @@ -394,7 +394,7 @@ static void nla_panel_actclip(const bContext *C, Panel *pa) return; block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); + UI_block_func_handle_set(block, do_nla_region_buttons, NULL); /* Strip Properties ------------------------------------- */ /* action pointer */ @@ -434,7 +434,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) return; block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); + UI_block_func_handle_set(block, do_nla_region_buttons, NULL); col = uiLayoutColumn(layout, true); uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE); @@ -468,7 +468,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa) strip = strip_ptr.data; block = uiLayoutGetBlock(pa->layout); - uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); + UI_block_func_handle_set(block, do_nla_region_buttons, NULL); /* 'add modifier' button at top of panel */ { @@ -477,7 +477,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa) // XXX for now, this will be a operator button which calls a temporary 'add modifier' operator // FIXME: we need to set the only-active property so that this will only add modifiers for the active strip (not all selected) - uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20, + uiDefButO(block, UI_BTYPE_BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20, TIP_("Adds a new F-Modifier for the active NLA Strip")); /* copy/paste (as sub-row)*/ diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index ac8dca6e83a..4cae820de89 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -341,9 +341,9 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri if (nonSolo == 0) { /* strip is in normal track */ glColor3fv(color); - uiSetRoundBox(UI_CNR_ALL); /* all corners rounded */ + UI_draw_roundbox_corner_set(UI_CNR_ALL); /* all corners rounded */ - uiDrawBoxShade(GL_POLYGON, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1); + UI_draw_roundbox_shade_x(GL_POLYGON, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1); } else { /* strip is in disabled track - make less visible */ @@ -379,7 +379,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri setlinestyle(4); /* draw outline */ - uiDrawBoxShade(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1); + UI_draw_roundbox_shade_x(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1); /* if action-clip strip, draw lines delimiting repeats too (in the same color as outline) */ if ((strip->type == NLASTRIP_TYPE_CLIP) && IS_EQF(strip->repeat, 1.0f) == 0) { @@ -670,7 +670,7 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar) } } { /* second pass: UI widgets */ - uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS); size_t channel_index = 0; y = (float)(-NLACHANNEL_HEIGHT(snla)); @@ -697,8 +697,8 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar) channel_index++; } - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); glDisable(GL_BLEND); } diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index fe0431b9618..1085bcfc20b 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -2174,8 +2174,8 @@ static int nla_fmodifier_add_invoke(bContext *C, wmOperator *UNUSED(op), const w uiLayout *layout; int i; - pup = uiPupMenuBegin(C, IFACE_("Add F-Modifier"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Add F-Modifier"), ICON_NONE); + layout = UI_popup_menu_layout(pup); /* start from 1 to skip the 'Invalid' modifier type */ for (i = 1; i < FMODIFIER_NUM_TYPES; i++) { @@ -2192,7 +2192,7 @@ static int nla_fmodifier_add_invoke(bContext *C, wmOperator *UNUSED(op), const w } uiItemS(layout); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index ffc82128181..e0fe622d98d 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -382,7 +382,7 @@ static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree, static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float aspect) { /* XXX font id is crap design */ - const int fontid = UI_GetStyle()->widgetlabel.uifont_id; + const int fontid = UI_style_get()->widgetlabel.uifont_id; NodeFrame *data = (NodeFrame *)node->storage; rctf *rct = &node->totr; int color_id = node_get_colorid(node); @@ -424,7 +424,7 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, /* skip if out of view */ if (BLI_rctf_isect(&node->totr, &ar->v2d.cur, NULL) == false) { - uiEndBlock(C, node->block); + UI_block_end(C, node->block); node->block = NULL; return; } @@ -441,8 +441,8 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, else UI_ThemeColor4(TH_NODE_FRAME); glEnable(GL_BLEND); - uiSetRoundBox(UI_CNR_ALL); - uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); glDisable(GL_BLEND); /* outline active and selected emphasis */ @@ -454,8 +454,8 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, UI_ThemeColorShadeAlpha(TH_ACTIVE, 0, -40); else UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_LINE_LOOP, + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); @@ -468,8 +468,8 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, UI_ThemeClearColor(color_id); - uiEndBlock(C, node->block); - uiDrawBlock(C, node->block); + UI_block_end(C, node->block); + UI_block_draw(C, node->block); node->block = NULL; } @@ -546,7 +546,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax || node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) { - uiEndBlock(C, node->block); + UI_block_end(C, node->block); node->block = NULL; return; } @@ -556,10 +556,10 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( */ #if 0 /* body */ - uiSetRoundBox(UI_CNR_ALL); + UI_draw_roundbox_corner_set(UI_CNR_ALL); UI_ThemeColor4(TH_NODE); glEnable(GL_BLEND); - uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, size); + UI_draw_roundbox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, size); glDisable(GL_BLEND); /* outline active and selected emphasis */ @@ -571,7 +571,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40); else UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120); - uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -581,7 +581,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( if (node->label[0] != '\0') { /* draw title (node label) */ BLI_strncpy(showname, node->label, sizeof(showname)); - uiDefBut(node->block, LABEL, 0, showname, + uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname, (int)(rct->xmin - NODE_DYS), (int)(rct->ymax), (short)512, (short)NODE_DY, NULL, 0, 0, 0, 0, NULL); @@ -594,8 +594,8 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( node_socket_circle_draw(C, ntree, node, sock, socket_size, (sock->flag & SELECT) || (node->flag & SELECT)); } - uiEndBlock(C, node->block); - uiDrawBlock(C, node->block); + UI_block_end(C, node->block); + UI_block_draw(C, node->block); node->block = NULL; } @@ -2899,9 +2899,9 @@ static void node_file_output_socket_draw(bContext *C, uiLayout *layout, PointerR RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name); block = uiLayoutGetBlock(row); - uiBlockSetEmboss(block, UI_EMBOSSP); + UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN); uiItemL(row, imtype_name, ICON_NONE); - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); } } diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 02e6f9b69f3..5805c11a438 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -498,7 +498,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) ntree = ntreeAddTree(bmain, treename, idname); /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { /* RNA_property_pointer_set increases the user count, diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 7b5ec38f4c6..b64dc0eb03f 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -69,7 +69,7 @@ #include "COM_compositor.h" /* XXX interface.h */ -extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); +extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); float ED_node_grid_size(void) { @@ -283,11 +283,11 @@ static void node_uiblocks_init(const bContext *C, bNodeTree *ntree) for (node = ntree->nodes.first; node; node = node->next) { /* ui block */ BLI_snprintf(uiblockstr, sizeof(uiblockstr), "node buttons %p", (void *)node); - node->block = uiBeginBlock(C, CTX_wm_region(C), uiblockstr, UI_EMBOSS); - uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node); + node->block = UI_block_begin(C, CTX_wm_region(C), uiblockstr, UI_EMBOSS); + UI_block_func_handle_set(node->block, do_node_internal_buttons, node); /* this cancels events for background nodes */ - uiBlockSetFlag(node->block, UI_BLOCK_CLIP_EVENTS); + UI_block_flag_enable(node->block, UI_BLOCK_CLIP_EVENTS); } } @@ -336,8 +336,9 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) RNA_pointer_create(&ntree->id, &RNA_NodeSocket, nsock, &sockptr); - layout = uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, - locx + NODE_DYS, dy, NODE_WIDTH(node) - NODE_DY, NODE_DY, 0, UI_GetStyle()); + layout = UI_block_layout( + node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, + locx + NODE_DYS, dy, NODE_WIDTH(node) - NODE_DY, NODE_DY, 0, UI_style_get()); /* context pointers for current node and socket */ uiLayoutSetContextPointer(layout, "node", &nodeptr); uiLayoutSetContextPointer(layout, "socket", &sockptr); @@ -348,8 +349,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) nsock->typeinfo->draw((bContext *)C, row, &sockptr, &nodeptr, IFACE_(nsock->name)); - uiBlockEndAlign(node->block); - uiBlockLayoutResolve(node->block, NULL, &buty); + UI_block_align_end(node->block); + UI_block_layout_resolve(node->block, NULL, &buty); /* ensure minimum socket height in case layout is empty */ buty = min_ii(buty, dy - NODE_DY); @@ -407,14 +408,15 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) node->butr.ymax = 0; - layout = uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, - locx + NODE_DYS, dy, node->butr.xmax, 0, 0, UI_GetStyle()); + layout = UI_block_layout( + node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, + locx + NODE_DYS, dy, node->butr.xmax, 0, 0, UI_style_get()); uiLayoutSetContextPointer(layout, "node", &nodeptr); node->typeinfo->draw_buttons(layout, (bContext *)C, &nodeptr); - uiBlockEndAlign(node->block); - uiBlockLayoutResolve(node->block, NULL, &buty); + UI_block_align_end(node->block); + UI_block_layout_resolve(node->block, NULL, &buty); dy = buty - NODE_DYS / 2; } @@ -426,8 +428,9 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) RNA_pointer_create(&ntree->id, &RNA_NodeSocket, nsock, &sockptr); - layout = uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, - locx + NODE_DYS, dy, NODE_WIDTH(node) - NODE_DY, NODE_DY, 0, UI_GetStyle()); + layout = UI_block_layout( + node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, + locx + NODE_DYS, dy, NODE_WIDTH(node) - NODE_DY, NODE_DY, 0, UI_style_get()); /* context pointers for current node and socket */ uiLayoutSetContextPointer(layout, "node", &nodeptr); uiLayoutSetContextPointer(layout, "socket", &sockptr); @@ -436,8 +439,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) nsock->typeinfo->draw((bContext *)C, row, &sockptr, &nodeptr, IFACE_(nsock->name)); - uiBlockEndAlign(node->block); - uiBlockLayoutResolve(node->block, NULL, &buty); + UI_block_align_end(node->block); + UI_block_layout_resolve(node->block, NULL, &buty); /* ensure minimum socket height in case layout is empty */ buty = min_ii(buty, dy - NODE_DY); @@ -463,11 +466,12 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) /* Set the block bounds to clip mouse events from underlying nodes. * Add a margin for sockets on each side. */ - uiExplicitBoundsBlock(node->block, - node->totr.xmin - NODE_SOCKSIZE, - node->totr.ymin, - node->totr.xmax + NODE_SOCKSIZE, - node->totr.ymax); + UI_block_bounds_set_explicit( + node->block, + node->totr.xmin - NODE_SOCKSIZE, + node->totr.ymin, + node->totr.xmax + NODE_SOCKSIZE, + node->totr.ymax); } /* based on settings in node, sets drawing rect info. each redraw! */ @@ -524,11 +528,12 @@ static void node_update_hidden(bNode *node) /* Set the block bounds to clip mouse events from underlying nodes. * Add a margin for sockets on each side. */ - uiExplicitBoundsBlock(node->block, - node->totr.xmin - NODE_SOCKSIZE, - node->totr.ymin, - node->totr.xmax + NODE_SOCKSIZE, - node->totr.ymax); + UI_block_bounds_set_explicit( + node->block, + node->totr.xmin - NODE_SOCKSIZE, + node->totr.ymin, + node->totr.xmax + NODE_SOCKSIZE, + node->totr.ymax); } void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node) @@ -739,16 +744,16 @@ void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha) { rctf *rct = &node->totr; - uiSetRoundBox(UI_CNR_ALL); + UI_draw_roundbox_corner_set(UI_CNR_ALL); if (node->parent == NULL) - ui_dropshadow(rct, radius, snode->aspect, alpha, node->flag & SELECT); + ui_draw_dropshadow(rct, radius, snode->aspect, alpha, node->flag & SELECT); else { const float margin = 3.0f; glColor4f(0.0f, 0.0f, 0.0f, 0.33f); glEnable(GL_BLEND); - uiRoundBox(rct->xmin - margin, rct->ymin - margin, - rct->xmax + margin, rct->ymax + margin, radius + margin); + UI_draw_roundbox(rct->xmin - margin, rct->ymin - margin, + rct->xmax + margin, rct->ymax + margin, radius + margin); glDisable(GL_BLEND); } } @@ -771,7 +776,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* skip if out of view */ if (BLI_rctf_isect(&node->totr, &ar->v2d.cur, NULL) == false) { - uiEndBlock(C, node->block); + UI_block_end(C, node->block); node->block = NULL; return; } @@ -800,8 +805,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN } #endif - uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); - uiRoundBox(rct->xmin, rct->ymax - NODE_DY, rct->xmax, rct->ymax, BASIS_RAD); + UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); + UI_draw_roundbox(rct->xmin, rct->ymax - NODE_DY, rct->xmax, rct->ymax, BASIS_RAD); /* show/hide icons */ iconofs = rct->xmax - 0.35f * U.widget_unit; @@ -810,27 +815,27 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN if (node->typeinfo->flag & NODE_PREVIEW) { uiBut *but; iconofs -= iconbutw; - uiBlockSetEmboss(node->block, UI_EMBOSSN); - but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_MATERIAL, + UI_block_emboss_set(node->block, UI_EMBOSS_NONE); + but = uiDefIconBut(node->block, UI_BTYPE_BUT_TOGGLE, B_REDR, ICON_MATERIAL, iconofs, rct->ymax - NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_preview_toggle"); + UI_but_func_set(but, node_toggle_button_cb, node, (void *)"NODE_OT_preview_toggle"); /* XXX this does not work when node is activated and the operator called right afterwards, * since active ID is not updated yet (needs to process the notifier). * This can only work as visual indicator! */ // if (!(node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT))) -// uiButSetFlag(but, UI_BUT_DISABLED); - uiBlockSetEmboss(node->block, UI_EMBOSS); +// UI_but_flag_enable(but, UI_BUT_DISABLED); + UI_block_emboss_set(node->block, UI_EMBOSS); } /* group edit */ if (node->type == NODE_GROUP) { uiBut *but; iconofs -= iconbutw; - uiBlockSetEmboss(node->block, UI_EMBOSSN); - but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_NODETREE, + UI_block_emboss_set(node->block, UI_EMBOSS_NONE); + but = uiDefIconBut(node->block, UI_BTYPE_BUT_TOGGLE, B_REDR, ICON_NODETREE, iconofs, rct->ymax - NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_group_edit"); - uiBlockSetEmboss(node->block, UI_EMBOSS); + UI_but_func_set(but, node_toggle_button_cb, node, (void *)"NODE_OT_group_edit"); + UI_block_emboss_set(node->block, UI_EMBOSS); } /* title */ @@ -844,15 +849,15 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN uiBut *but; int but_size = UI_UNIT_X * 0.6f; /* XXX button uses a custom triangle draw below, so make it invisible without icon */ - uiBlockSetEmboss(node->block, UI_EMBOSSN); - but = uiDefBut(node->block, TOGBUT, B_REDR, "", + UI_block_emboss_set(node->block, UI_EMBOSS_NONE); + but = uiDefBut(node->block, UI_BTYPE_BUT_TOGGLE, B_REDR, "", rct->xmin + 0.5f * U.widget_unit - but_size / 2, rct->ymax - NODE_DY / 2.0f - but_size / 2, but_size, but_size, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle"); - uiBlockSetEmboss(node->block, UI_EMBOSS); + UI_but_func_set(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle"); + UI_block_emboss_set(node->block, UI_EMBOSS); /* custom draw function for this button */ - UI_DrawTriIcon(rct->xmin + 0.5f * U.widget_unit, rct->ymax - NODE_DY / 2.0f, 'v'); + UI_draw_icon_tri(rct->xmin + 0.5f * U.widget_unit, rct->ymax - NODE_DY / 2.0f, 'v'); } /* this isn't doing anything for the label, so commenting out */ @@ -868,7 +873,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN //if (node->flag & NODE_MUTED) // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */ - uiDefBut(node->block, LABEL, 0, showname, + uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname, (int)(rct->xmin + (NODE_MARGIN_X)), (int)(rct->ymax - NODE_DY), (short)(iconofs - rct->xmin - 18.0f), (short)NODE_DY, NULL, 0, 0, 0, 0, ""); @@ -881,8 +886,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN else UI_ThemeColor4(TH_NODE); glEnable(GL_BLEND); - uiSetRoundBox(UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT); - uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax - NODE_DY, BASIS_RAD); + UI_draw_roundbox_corner_set(UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT); + UI_draw_roundbox(rct->xmin, rct->ymin, rct->xmax, rct->ymax - NODE_DY, BASIS_RAD); glDisable(GL_BLEND); /* outline active and selected emphasis */ @@ -896,8 +901,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN else UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -936,8 +941,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeClearColor(color_id); - uiEndBlock(C, node->block); - uiDrawBlock(C, node->block); + UI_block_end(C, node->block); + UI_block_draw(C, node->block); node->block = NULL; } @@ -969,7 +974,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b (void)ntree; #endif - uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); + UI_draw_roundbox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); /* outline active and selected emphasis */ if (node->flag & SELECT) { @@ -980,7 +985,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b UI_ThemeColorShadeAlpha(TH_ACTIVE, 0, -40); else UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40); - uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -992,7 +997,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b glEnable(GL_LINE_SMOOTH); glColor3fv(node->color); - uiDrawBox(GL_LINE_LOOP, rct->xmin + 1, rct->ymin + 1, rct->xmax -1, rct->ymax - 1, hiddenrad); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rct->xmin + 1, rct->ymin + 1, rct->xmax -1, rct->ymax - 1, hiddenrad); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -1009,15 +1014,15 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b uiBut *but; int but_size = UI_UNIT_X * 0.6f; /* XXX button uses a custom triangle draw below, so make it invisible without icon */ - uiBlockSetEmboss(node->block, UI_EMBOSSN); - but = uiDefBut(node->block, TOGBUT, B_REDR, "", + UI_block_emboss_set(node->block, UI_EMBOSS_NONE); + but = uiDefBut(node->block, UI_BTYPE_BUT_TOGGLE, B_REDR, "", rct->xmin + 10.0f - but_size / 2, centy - but_size / 2, but_size, but_size, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle"); - uiBlockSetEmboss(node->block, UI_EMBOSS); + UI_but_func_set(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle"); + UI_block_emboss_set(node->block, UI_EMBOSS); /* custom draw function for this button */ - UI_DrawTriIcon(rct->xmin + 10.0f, centy, 'h'); + UI_draw_icon_tri(rct->xmin + 10.0f, centy, 'h'); } /* disable lines */ @@ -1035,7 +1040,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b //if (node->flag & NODE_MUTED) // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */ - uiDefBut(node->block, LABEL, 0, showname, + uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname, (int)(rct->xmin + (NODE_MARGIN_X)), (int)(centy - 10), (short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY, NULL, 0, 0, 0, 0, ""); @@ -1063,8 +1068,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b node_socket_circle_draw(C, ntree, node, sock, socket_size, sock->flag & SELECT); } - uiEndBlock(C, node->block); - uiDrawBlock(C, node->block); + UI_block_end(C, node->block); + UI_block_draw(C, node->block); node->block = NULL; } @@ -1243,15 +1248,15 @@ static void draw_group_overlay(const bContext *C, ARegion *ar) /* shade node groups to separate them visually */ UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70); glEnable(GL_BLEND); - uiSetRoundBox(UI_CNR_NONE); - uiDrawBox(GL_POLYGON, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0); + UI_draw_roundbox_corner_set(UI_CNR_NONE); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0); glDisable(GL_BLEND); /* set the block bounds to clip mouse events from underlying nodes */ - block = uiBeginBlock(C, ar, "node tree bounds block", UI_EMBOSS); - uiExplicitBoundsBlock(block, rect.xmin, rect.ymin, rect.xmax, rect.ymax); - uiBlockSetFlag(block, UI_BLOCK_CLIP_EVENTS); - uiEndBlock(C, block); + block = UI_block_begin(C, ar, "node tree bounds block", UI_EMBOSS); + UI_block_bounds_set_explicit(block, rect.xmin, rect.ymin, rect.xmax, rect.ymax); + UI_block_flag_enable(block, UI_BLOCK_CLIP_EVENTS); + UI_block_end(C, block); } void drawnodespace(const bContext *C, ARegion *ar) diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 434d92d6531..de119cf04fb 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -562,14 +562,14 @@ static int node_group_separate_exec(bContext *C, wmOperator *op) static int node_group_separate_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { - uiPopupMenu *pup = uiPupMenuBegin(C, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Separate"), ICON_NONE); - uiLayout *layout = uiPupMenuLayout(pup); + uiPopupMenu *pup = UI_popup_menu_begin(C, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Separate"), ICON_NONE); + uiLayout *layout = UI_popup_menu_layout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); uiItemEnumO(layout, "NODE_OT_group_separate", NULL, 0, "type", NODE_GS_COPY); uiItemEnumO(layout, "NODE_OT_group_separate", NULL, 0, "type", NODE_GS_MOVE); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index de580f612a0..25f9d56c8f0 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -972,7 +972,7 @@ static void node_find_cb(const struct bContext *C, void *UNUSED(arg), const char BLI_snprintf(name, 256, "%s (%s)", node->name, node->label); else BLI_strncpy(name, node->name, 256); - if (false == uiSearchItemAdd(items, name, node, 0)) + if (false == UI_search_item_add(items, name, node, 0)) break; } } @@ -1006,18 +1006,18 @@ static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op) uiBut *but; wmOperator *op = (wmOperator *)arg_op; - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); - uiButSetSearchFunc(but, node_find_cb, op->type, node_find_call_cb, NULL); + UI_but_func_search_set(but, node_find_cb, op->type, node_find_call_cb, NULL); /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 10 - UI_searchbox_size_y(), UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL); - uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ + UI_block_bounds_set_popup(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ - // uiButActiveOnly(C, ar, block, but); XXX using this here makes Blender hang - investigate + // UI_but_active_only(C, ar, block, but); XXX using this here makes Blender hang - investigate wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; @@ -1031,7 +1031,7 @@ static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op) static int node_find_node_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - uiPupBlock(C, node_find_menu, op); + UI_popup_block_invoke(C, node_find_menu, op); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index 99a481e5d82..692aebb9072 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -454,7 +454,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) if (first) { column = uiLayoutColumn(layout, 0); - uiBlockSetCurLayout(block, column); + UI_block_layout_set_current(block, column); uiItemL(column, IFACE_(cname), ICON_NODE); but = block->buttons.last; @@ -466,7 +466,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) if (!cur_node_name || !STREQ(cur_node_name, items[i].node_name)) { cur_node_name = items[i].node_name; /* XXX Do not use uiItemL here, it would add an empty icon as we are in a menu! */ - uiDefBut(block, LABEL, 0, IFACE_(cur_node_name), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_(cur_node_name), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, ""); } @@ -478,12 +478,12 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) icon = ICON_NONE; } - but = uiDefIconTextBut(block, BUT, 0, icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, + but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input")); argN = MEM_dupallocN(arg); argN->item = items[i]; - uiButSetNFunc(but, ui_node_link, argN, NULL); + UI_but_funcN_set(but, ui_node_link, argN, NULL); } if (items) @@ -511,8 +511,8 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ bNodeSocket *sock = arg->sock; bNodeTreeType *ntreetype = arg->ntree->typeinfo; - uiBlockSetFlag(block, UI_BLOCK_NO_FLIP); - uiBlockSetCurLayout(block, layout); + UI_block_flag_enable(block, UI_BLOCK_NO_FLIP); + UI_block_layout_set_current(block, layout); split = uiLayoutSplit(layout, 0.0f, false); arg->bmain = bmain; @@ -523,20 +523,20 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb); column = uiLayoutColumn(split, false); - uiBlockSetCurLayout(block, column); + UI_block_layout_set_current(block, column); if (sock->link) { uiItemL(column, IFACE_("Link"), ICON_NONE); but = block->buttons.last; but->drawflag = UI_BUT_TEXT_LEFT; - but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, + but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input")); - uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_REMOVE)); + UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_REMOVE)); - but = uiDefBut(block, BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, + but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input")); - uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT)); + UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT)); } ui_node_menu_column(arg, NODE_CLASS_GROUP, N_("Group")); @@ -553,7 +553,7 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo arg->node = node; arg->sock = sock; - uiBlockSetCurLayout(block, layout); + UI_block_layout_set_current(block, layout); if (sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) { char name[UI_MAX_NAME_STR]; @@ -563,7 +563,7 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo else but = uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, ""); - uiButSetMenuFromPulldown(but); + UI_but_type_set_menu_from_pulldown(but); but->flag |= UI_BUT_NODE_LINK; but->poin = (char *)but; @@ -638,7 +638,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, row = uiLayoutRow(split, true); if (depth > 0) { - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); if (lnode && (lnode->inputs.first || (lnode->typeinfo->draw_buttons && lnode->type != NODE_GROUP))) { int icon = (input->flag & SOCK_COLLAPSED) ? ICON_DISCLOSURE_TRI_RIGHT : ICON_DISCLOSURE_TRI_DOWN; @@ -650,7 +650,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, bt = block->buttons.last; bt->rect.xmax = UI_UNIT_X / 2; - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } uiItemL(row, label, ICON_NONE); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index e033f781f62..f8890ceb9aa 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -584,29 +584,29 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar ob = (Object *)tselem->id; RNA_pointer_create((ID *)ob, &RNA_Object, ob, &ptr); - uiBlockSetEmboss(block, UI_EMBOSSN); - bt = uiDefIconButR_prop(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF, + UI_block_emboss_set(block, UI_EMBOSS_NONE); + bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &ptr, object_prop_hide, -1, 0, 0, -1, -1, TIP_("Restrict viewport visibility (Ctrl - Recursive)")); - uiButSetFunc(bt, restrictbutton_view_cb, scene, ob); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_view_cb, scene, ob); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - bt = uiDefIconButR_prop(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF, + bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_SELECT_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &ptr, object_prop_hide_select, -1, 0, 0, -1, -1, TIP_("Restrict viewport selection (Ctrl - Recursive)")); - uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_sel_cb, scene, ob); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - bt = uiDefIconButR_prop(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF, + bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_RENDER_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &ptr, object_prop_hide_render, -1, 0, 0, -1, -1, TIP_("Restrict rendering (Ctrl - Recursive)")); - uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_rend_cb, scene, ob); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } if (tselem->type == 0 && te->idcode == ID_GR) { @@ -617,130 +617,130 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar if (gr->id.lib) but_flag |= UI_BUT_DISABLED; - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW); - bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, + bt = uiDefIconBut(block, UI_BTYPE_ICON_TOGGLE, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); - uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr); - uiButSetFlag(bt, but_flag); + UI_but_func_set(bt, restrictbutton_gr_restrict_view, scene, gr); + UI_but_flag_enable(bt, but_flag); restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT); - bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, + bt = uiDefIconBut(block, UI_BTYPE_ICON_TOGGLE, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); - uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr); - uiButSetFlag(bt, but_flag); + UI_but_func_set(bt, restrictbutton_gr_restrict_select, scene, gr); + UI_but_flag_enable(bt, but_flag); restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER); - bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, + bt = uiDefIconBut(block, UI_BTYPE_ICON_TOGGLE, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); - uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr); - uiButSetFlag(bt, but_flag); + UI_but_func_set(bt, restrictbutton_gr_restrict_render, scene, gr); + UI_but_flag_enable(bt, but_flag); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } /* scene render layers and passes have toggle-able flags too! */ else if (tselem->type == TSE_R_LAYER) { - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); - bt = uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT - 1, + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT - 1, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Render this RenderLayer")); - uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } else if (tselem->type == TSE_R_PASS) { int *layflag = te->directdata; int passflag = 1 << tselem->nr; - uiBlockSetEmboss(block, UI_EMBOSSN); + UI_block_emboss_set(block, UI_EMBOSS_NONE); - bt = uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT - 1, + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, passflag, 0, ICON_CHECKBOX_HLT - 1, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Render this Pass")); - uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); layflag++; /* is lay_xor */ if (ELEM(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) { - bt = uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1, + bt = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Exclude this Pass from Combined")); - uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); } - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } else if (tselem->type == TSE_MODIFIER) { ModifierData *md = (ModifierData *)te->directdata; ob = (Object *)tselem->id; - uiBlockSetEmboss(block, UI_EMBOSSN); - bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF, + UI_block_emboss_set(block, UI_EMBOSS_NONE); + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); - uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_modifier_cb, scene, ob); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF, + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); - uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_modifier_cb, scene, ob); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } else if (tselem->type == TSE_POSE_CHANNEL) { bPoseChannel *pchan = (bPoseChannel *)te->directdata; Bone *bone = pchan->bone; ob = (Object *)tselem->id; - uiBlockSetEmboss(block, UI_EMBOSSN); - bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF, + UI_block_emboss_set(block, UI_EMBOSS_NONE); + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); - uiButSetFunc(bt, restrictbutton_bone_visibility_cb, ob->data, bone); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_bone_visibility_cb, ob->data, bone); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); - uiButSetFunc(bt, restrictbutton_bone_select_cb, ob->data, bone); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_bone_select_cb, ob->data, bone); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } else if (tselem->type == TSE_EBONE) { EditBone *ebone = (EditBone *)te->directdata; - uiBlockSetEmboss(block, UI_EMBOSSN); - bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF, + UI_block_emboss_set(block, UI_EMBOSS_NONE); + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); - uiButSetFunc(bt, restrictbutton_ebone_visibility_cb, NULL, ebone); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_ebone_visibility_cb, NULL, ebone); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); - uiButSetFunc(bt, restrictbutton_ebone_select_cb, NULL, ebone); - uiButSetFlag(bt, UI_BUT_DRAG_LOCK); + UI_but_func_set(bt, restrictbutton_ebone_select_cb, NULL, ebone); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } } @@ -776,7 +776,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa PointerRNA *ptr; PropertyRNA *prop; - uiBlockSetEmboss(block, UI_EMBOSST); + UI_block_emboss_set(block, UI_EMBOSS_TABLE); for (te = lb->first; te; te = te->next) { tselem = TREESTORE(te); @@ -789,7 +789,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa if (RNA_property_type(prop) == PROP_POINTER) { uiBut *but = uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y - 1); - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } else if (RNA_property_type(prop) == PROP_ENUM) { uiDefAutoButR(block, ptr, prop, -1, NULL, ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, @@ -813,7 +813,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa if (TSELEM_OPEN(tselem, soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree); } - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); } static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, TreeElement *te) @@ -837,12 +837,12 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Tre spx = te->xs + 1.8f * UI_UNIT_X; dx = ar->v2d.cur.xmax - (spx + 3.2f * UI_UNIT_X); - bt = uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, te->ys, dx, UI_UNIT_Y - 1, (void *)te->name, + bt = uiDefBut(block, UI_BTYPE_TEXT, OL_NAMEBUTTON, "", spx, te->ys, dx, UI_UNIT_Y - 1, (void *)te->name, 1.0, (float)len, 0, 0, ""); - uiButSetRenameFunc(bt, namebutton_cb, tselem); + UI_but_func_rename_set(bt, namebutton_cb, tselem); /* returns false if button got removed */ - if (false == uiButActiveOnly(C, ar, block, bt)) { + if (false == UI_but_active_only(C, ar, block, bt)) { tselem->flag &= ~TSE_TEXTBUT; /* bad! (notifier within draw) without this, we don't get a refesh */ @@ -870,11 +870,11 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon) glDisable(GL_BLEND); } else { - uiBut *but = uiDefIconBut(arg->block, LABEL, 0, icon, arg->xb, arg->yb, UI_UNIT_X, UI_UNIT_Y, NULL, + uiBut *but = uiDefIconBut(arg->block, UI_BTYPE_LABEL, 0, icon, arg->xb, arg->yb, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : ""); if (arg->id) - uiButSetDragID(but, arg->id); + UI_but_drag_set_id(but, arg->id); } } @@ -1206,13 +1206,14 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa if (active != OL_DRAWSEL_NONE) { float ufac = UI_UNIT_X / 20.0f; - uiSetRoundBox(UI_CNR_ALL); + UI_draw_roundbox_corner_set(UI_CNR_ALL); glColor4ub(255, 255, 255, 100); - uiRoundBox((float) *offsx - 1.0f * ufac, - (float)ys + 1.0f * ufac, - (float)*offsx + UI_UNIT_X - 2.0f * ufac, - (float)ys + UI_UNIT_Y - ufac, - (float)UI_UNIT_Y / 2.0f - ufac); + UI_draw_roundbox( + (float) *offsx - 1.0f * ufac, + (float)ys + 1.0f * ufac, + (float)*offsx + UI_UNIT_X - 2.0f * ufac, + (float)ys + UI_UNIT_Y - ufac, + (float)UI_UNIT_Y / 2.0f - ufac); glEnable(GL_BLEND); /* roundbox disables */ } @@ -1352,12 +1353,13 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene /* active circle */ if (active != OL_DRAWSEL_NONE) { - uiSetRoundBox(UI_CNR_ALL); - uiRoundBox((float)startx + UI_UNIT_X, - (float)*starty + 1.0f * ufac, - (float)startx + 2.0f * UI_UNIT_X - 2.0f * ufac, - (float)*starty + UI_UNIT_Y - 1.0f * ufac, - UI_UNIT_Y / 2.0f - 1.0f * ufac); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox( + (float)startx + UI_UNIT_X, + (float)*starty + 1.0f * ufac, + (float)startx + 2.0f * UI_UNIT_X - 2.0f * ufac, + (float)*starty + UI_UNIT_Y - 1.0f * ufac, + UI_UNIT_Y / 2.0f - 1.0f * ufac); glEnable(GL_BLEND); /* roundbox disables it */ te->flag |= TE_ACTIVE; // for lookup in display hierarchies @@ -1406,9 +1408,9 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f); else UI_ThemeColor(TH_TEXT); - UI_DrawString(startx + offsx, *starty + 5 * ufac, te->name); + UI_draw_string(startx + offsx, *starty + 5 * ufac, te->name); - offsx += (int)(UI_UNIT_X + UI_GetStringWidth(te->name)); + offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(te->name)); /* closed item, we draw the icons, not when it's a scene, or master-server list though */ if (!TSELEM_OPEN(tselem, soops)) { @@ -1684,7 +1686,7 @@ void draw_outliner(const bContext *C) /* draw outliner stuff (background, hierarchy lines and names) */ outliner_back(ar); - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); outliner_draw_tree((bContext *)C, block, scene, ar, soops, &te_edit); if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { @@ -1703,8 +1705,8 @@ void draw_outliner(const bContext *C) outliner_buttons(C, block, ar, te_edit); } - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); /* clear flag that allows quick redraws */ soops->storeflag &= ~SO_TREESTORE_REDRAW; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 1ec41ac6df8..3f1f8be379c 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1543,8 +1543,8 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) else { /* Menu creation */ wmOperatorType *ot = WM_operatortype_find("OUTLINER_OT_parent_drop", false); - uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE); - uiLayout *layout = uiPupMenuLayout(pup); + uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), ICON_NONE); + uiLayout *layout = UI_popup_menu_layout(pup); PointerRNA ptr; @@ -1615,7 +1615,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) uiItemFullO_ptr(layout, ot, IFACE_("Lattice Deform"), 0, ptr.data, WM_OP_EXEC_DEFAULT, 0); } - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 345988c1d5c..07daaa8ed47 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -923,5 +923,5 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot) WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME); RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_TYPE_CROSS, "Type", "Sequencer effect type"); - RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f); + RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='UI_BTYPE_COLOR')", 0.0f, 1.0f); } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 3ca74a75398..9fbca7b5748 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -788,7 +788,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline glLineStipple(1, 0x8888); } - uiDrawBoxShade(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0); + UI_draw_roundbox_shade_x(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0); if (seq->flag & SEQ_MUTE) { glDisable(GL_LINE_STIPPLE); @@ -1229,8 +1229,8 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 315f8a0aaec..1123145bad5 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -891,15 +891,15 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) UI_ThemeColor(TH_BACK); glRecti(back->xmin, back->ymin, back->xmax, back->ymax); - uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); + UI_draw_widget_scroll(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); - uiSetRoundBox(UI_CNR_ALL); + UI_draw_roundbox_corner_set(UI_CNR_ALL); rad = 0.4f * min_ii(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll)); UI_GetThemeColor3ubv(TH_HILITE, col); col[3] = 48; glColor4ubv(col); glEnable(GL_BLEND); - uiRoundBox(st->txtscroll.xmin + 1, st->txtscroll.ymin, st->txtscroll.xmax - 1, st->txtscroll.ymax, rad); + UI_draw_roundbox(st->txtscroll.xmin + 1, st->txtscroll.ymin, st->txtscroll.xmax - 1, st->txtscroll.ymax, rad); glDisable(GL_BLEND); } @@ -1033,7 +1033,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar) x = MAX2(0, ar->winx - boxw); /* not needed but stands out nicer */ - uiDrawBoxShadow(220, x, y - boxh, x + boxw, y); + UI_draw_box_shadow(220, x, y - boxh, x + boxw, y); UI_ThemeColor(TH_SHADE1); glRecti(x - 1, y + 1, x + boxw + 1, y - boxh - 1); diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index b1d57f5a75e..02bac251065 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -142,7 +142,7 @@ void TEXT_OT_start_find(wmOperatorType *ot) uiPopupMenu *pup; if (text) { - pup = uiPupMenuBegin(C, IFACE_("Text"), ICON_NONE); + pup = UI_popup_menu_begin(C, IFACE_("Text"), ICON_NONE); if (txt_has_sel(text)) { uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_cut"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_copy"); @@ -153,13 +153,13 @@ void TEXT_OT_start_find(wmOperatorType *ot) uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_save"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_save_as"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_run_script"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } else { - pup = uiPupMenuBegin(C, IFACE_("File"), ICON_NONE); + pup = UI_popup_menu_begin(C, IFACE_("File"), ICON_NONE); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_new"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_open"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } } @@ -168,11 +168,11 @@ void TEXT_OT_start_find(wmOperatorType *ot) uiPopupMenu *pup; - pup = uiPupMenuBegin(C, IFACE_("Edit"), ICON_NONE); + pup = UI_popup_menu_begin(C, IFACE_("Edit"), ICON_NONE); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_cut"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_copy"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_paste"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } { @@ -181,19 +181,19 @@ void TEXT_OT_start_find(wmOperatorType *ot) uiPopupMenu *pup; if (text) { - pup = uiPupMenuBegin(C, IFACE_("Text"), ICON_NONE); + pup = UI_popup_menu_begin(C, IFACE_("Text"), ICON_NONE); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_new"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_open"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_save"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_save_as"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_run_script"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } else { - pup = uiPupMenuBegin(C, IFACE_("File"), ICON_NONE); + pup = UI_popup_menu_begin(C, IFACE_("File"), ICON_NONE); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_new"); uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_open"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } } @@ -202,7 +202,7 @@ void TEXT_OT_start_find(wmOperatorType *ot) uiPopupMenu *pup; - pup = uiPupMenuBegin(C, IFACE_("Text"), ICON_NONE); + pup = UI_popup_menu_begin(C, IFACE_("Text"), ICON_NONE); uiItemEnumO(layout, "TEXT_OT_move", CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Top of File"), 0, "type", FILE_TOP); uiItemEnumO(layout, "TEXT_OT_move", CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Bottom of File"), @@ -210,7 +210,7 @@ void TEXT_OT_start_find(wmOperatorType *ot) uiItemEnumO(layout, "TEXT_OT_move", CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Page Up"), 0, "type", PREV_PAGE); uiItemEnumO(layout, "TEXT_OT_move", CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Page Down"), 0, "type", NEXT_PAGE); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } #endif diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 5bf0100d785..ffabefdfb29 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -171,7 +171,7 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op)) text = BKE_text_add(bmain, "Text"); /* hook into UI */ - uiIDContextProperty(C, &ptr, &prop); + UI_context_active_but_prop_get_templateID(C, &ptr, &prop); if (prop) { RNA_id_pointer_create(&text->id, &idptr); @@ -214,7 +214,7 @@ static void text_open_init(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"); - uiIDContextProperty(C, &pprop->ptr, &pprop->prop); + UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop); } static void text_open_cancel(bContext *UNUSED(C), wmOperator *op) @@ -3172,32 +3172,32 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, const wmEve case 1: if (text->flags & TXT_ISDIRTY) { /* modified locally and externally, ahhh. offer more possibilites. */ - pup = uiPupMenuBegin(C, IFACE_("File Modified Outside and Inside Blender"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("File Modified Outside and Inside Blender"), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemEnumO_ptr(layout, op->type, IFACE_("Reload from disk (ignore local changes)"), 0, "resolution", RESOLVE_RELOAD); uiItemEnumO_ptr(layout, op->type, IFACE_("Save to disk (ignore outside changes)"), 0, "resolution", RESOLVE_SAVE); uiItemEnumO_ptr(layout, op->type, IFACE_("Make text internal (separate copy)"), 0, "resolution", RESOLVE_MAKE_INTERNAL); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } else { - pup = uiPupMenuBegin(C, IFACE_("File Modified Outside Blender"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("File Modified Outside Blender"), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemEnumO_ptr(layout, op->type, IFACE_("Reload from disk"), 0, "resolution", RESOLVE_RELOAD); uiItemEnumO_ptr(layout, op->type, IFACE_("Make text internal (separate copy)"), 0, "resolution", RESOLVE_MAKE_INTERNAL); uiItemEnumO_ptr(layout, op->type, IFACE_("Ignore"), 0, "resolution", RESOLVE_IGNORE); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } break; case 2: - pup = uiPupMenuBegin(C, IFACE_("File Deleted Outside Blender"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("File Deleted Outside Blender"), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemEnumO_ptr(layout, op->type, IFACE_("Make text internal"), 0, "resolution", RESOLVE_MAKE_INTERNAL); uiItemEnumO_ptr(layout, op->type, IFACE_("Recreate file"), 0, "resolution", RESOLVE_SAVE); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); break; } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 6a43357179e..899be6359ee 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -360,7 +360,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } if (tot == 0) { - uiDefBut(block, LABEL, 0, IFACE_("Nothing selected"), 0, 130, 200, 20, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Nothing selected"), 0, 130, 200, 20, NULL, 0, 0, 0, 0, ""); return; } @@ -404,7 +404,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float memcpy(tfp->ve_median, median, sizeof(tfp->ve_median)); - uiBlockBeginAlign(block); + UI_block_align_begin(block); if (tot == 1) { if (totcurvedata) /* Curve */ c = IFACE_("Control Point:"); @@ -413,68 +413,68 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } else c = IFACE_("Median:"); - uiDefBut(block, LABEL, 0, c, 0, yi -= buth, 200, buth, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, c, 0, yi -= buth, 200, buth, NULL, 0, 0, 0, 0, ""); - uiBlockBeginAlign(block); + UI_block_align_begin(block); /* Should be no need to translate these. */ - but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("X:"), 0, yi -= buth, 200, buth, + but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("X:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[LOC_X]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Y:"), 0, yi -= buth, 200, buth, + UI_but_unit_type_set(but, PROP_UNIT_LENGTH); + but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Y:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[LOC_Y]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); - but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Z:"), 0, yi -= buth, 200, buth, + UI_but_unit_type_set(but, PROP_UNIT_LENGTH); + but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Z:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[LOC_Z]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, ""); - uiButSetUnitType(but, PROP_UNIT_LENGTH); + UI_but_unit_type_set(but, PROP_UNIT_LENGTH); if (totcurvebweight == tot) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("W:"), 0, yi -= buth, 200, buth, + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("W:"), 0, yi -= buth, 200, buth, &(tfp->ve_median[C_BWEIGHT]), 0.01, 100.0, 1, 3, ""); } - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, IFACE_("Global"), + UI_block_align_begin(block); + uiDefButBitS(block, UI_BTYPE_TOGGLE, V3D_GLOBAL_STATS, B_REDR, IFACE_("Global"), 0, yi -= buth + but_margin, 100, buth, &v3d->flag, 0, 0, 0, 0, TIP_("Displays global values")); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, IFACE_("Local"), + uiDefButBitS(block, UI_BTYPE_TOGGLE_N, V3D_GLOBAL_STATS, B_REDR, IFACE_("Local"), 100, yi, 100, buth, &v3d->flag, 0, 0, 0, 0, TIP_("Displays local values")); - uiBlockEndAlign(block); + UI_block_align_end(block); /* Meshes... */ if (has_meshdata) { if (tot) { - uiDefBut(block, LABEL, 0, tot == 1 ? IFACE_("Vertex Data:") : IFACE_("Vertices Data:"), + uiDefBut(block, UI_BTYPE_LABEL, 0, tot == 1 ? IFACE_("Vertex Data:") : IFACE_("Vertices Data:"), 0, yi -= buth + but_margin, 200, buth, NULL, 0.0, 0.0, 0, 0, ""); /* customdata layer added on demand */ - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, tot == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[M_BV_WEIGHT]), 0.0, 1.0, 1, 2, TIP_("Vertex weight used by Bevel modifier")); } if (has_skinradius) { - uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, + UI_block_align_begin(block); + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, tot == 1 ? IFACE_("Radius X:") : IFACE_("Mean Radius X:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[M_SKIN_X]), 0.0, 100.0, 1, 3, TIP_("X radius used by Skin modifier")); - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, tot == 1 ? IFACE_("Radius Y:") : IFACE_("Mean Radius Y:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[M_SKIN_Y]), 0.0, 100.0, 1, 3, TIP_("Y radius used by Skin modifier")); - uiBlockEndAlign(block); + UI_block_align_end(block); } if (totedgedata) { - uiDefBut(block, LABEL, 0, totedgedata == 1 ? IFACE_("Edge Data:") : IFACE_("Edges Data:"), + uiDefBut(block, UI_BTYPE_LABEL, 0, totedgedata == 1 ? IFACE_("Edge Data:") : IFACE_("Edges Data:"), 0, yi -= buth + but_margin, 200, buth, NULL, 0.0, 0.0, 0, 0, ""); /* customdata layer added on demand */ - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[M_BE_WEIGHT]), 0.0, 1.0, 1, 2, TIP_("Edge weight used by Bevel modifier")); /* customdata layer added on demand */ - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[M_CREASE]), 0.0, 1.0, 1, 2, TIP_("Weight used by SubSurf modifier")); @@ -482,38 +482,38 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } /* Curve... */ else if (totcurvedata == 1) { - uiDefButR(block, NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL); - uiDefButR(block, NUM, 0, IFACE_("Radius:"), 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Radius:"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL); - uiDefButR(block, NUM, 0, IFACE_("Tilt:"), 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Tilt:"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "tilt", 0, -tilt_limit, tilt_limit, 1, 3, NULL); } else if (totcurvedata > 1) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"), + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[C_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used for SoftBody Goal")); - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Radius:"), + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Radius:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[C_RADIUS]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points")); - but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Tilt:"), + but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Tilt:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[C_TILT]), -tilt_limit, tilt_limit, 1, 3, TIP_("Tilt of curve control points")); - uiButSetUnitType(but, PROP_UNIT_ROTATION); + UI_but_unit_type_set(but, PROP_UNIT_ROTATION); } /* Lattice... */ else if (totlattdata == 1) { - uiDefButR(block, NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth, + uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth, &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL); } else if (totlattdata > 1) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"), + uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"), 0, yi -= buth + but_margin, 200, buth, &(tfp->ve_median[L_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used for SoftBody Goal")); } - uiBlockEndAlign(block); + UI_block_align_end(block); } else { /* apply */ int i; @@ -834,7 +834,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) int yco = 0; int lock_count = 0; - uiBlockSetHandleFunc(block, do_view3d_vgroup_buttons, NULL); + UI_block_func_handle_set(block, do_view3d_vgroup_buttons, NULL); bcol = uiLayoutColumn(pa->layout, true); row = uiLayoutRow(bcol, true); /* The filter button row */ @@ -858,13 +858,13 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) /* The Weight Group Name */ ot = ot_weight_set_active; - but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, dg->name, + but = uiDefButO_ptr(block, UI_BTYPE_BUT, ot, WM_OP_EXEC_DEFAULT, dg->name, xco, yco, (x = UI_UNIT_X * 5), UI_UNIT_Y, ""); - but_ptr = uiButGetOperatorPtrRNA(but); + but_ptr = UI_but_operator_ptr_get(but); RNA_int_set(but_ptr, "weight_group", i); - uiButSetDrawFlag(but, UI_BUT_TEXT_RIGHT); + UI_but_drawflag_enable(but, UI_BUT_TEXT_RIGHT); if (ob->actdef != i + 1) { - uiButSetFlag(but, UI_BUT_INACTIVE); + UI_but_flag_enable(but, UI_BUT_INACTIVE); } xco += x; @@ -873,10 +873,10 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) /* The weight group value */ /* To be reworked still */ - but = uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + i, "", + but = uiDefButF(block, UI_BTYPE_NUM, B_VGRP_PNL_EDIT_SINGLE + i, "", xco, yco, (x = UI_UNIT_X * 4), UI_UNIT_Y, &dw->weight, 0.0, 1.0, 1, 3, ""); - uiButSetDrawFlag(but, UI_BUT_TEXT_LEFT); + UI_but_drawflag_enable(but, UI_BUT_TEXT_LEFT); if (locked) { lock_count++; } @@ -911,19 +911,19 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) row = uiLayoutRow(col, true); ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active_vertex", 1); - but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", + but = uiDefButO_ptr(block, UI_BTYPE_BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", 0, yco, UI_UNIT_X * 5, UI_UNIT_Y, TIP_("Normalize weights of active vertex (if affected groups are unlocked)")); if (lock_count) { - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1); - but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy", + but = uiDefButO_ptr(block, UI_BTYPE_BUT, ot, WM_OP_EXEC_DEFAULT, "Copy", UI_UNIT_X * 5, yco, UI_UNIT_X * 5, UI_UNIT_Y, TIP_("Copy active vertex to other selected vertices (if affected groups are unlocked)")); if (lock_count) { - uiButSetFlag(but, UI_BUT_DISABLED); + UI_but_flag_enable(but, UI_BUT_DISABLED); } } @@ -1145,7 +1145,7 @@ static void view3d_panel_transform(const bContext *C, Panel *pa) uiLayout *col; block = uiLayoutGetBlock(pa->layout); - uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL); + UI_block_func_handle_set(block, do_view3d_region_buttons, NULL); col = uiLayoutColumn(pa->layout, false); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 32b4e4d1809..c346e9fe29b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1221,11 +1221,11 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) hmargin = 0.1f * (x2 - x1); vmargin = 0.05f * (y2 - y1); - uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f); hmargin = 0.035f * (x2 - x1); vmargin = 0.035f * (y2 - y1); - uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f); } if (ca->flag & CAM_SHOWSENSOR) { /* determine sensor fit, and get sensor x/y, for auto fit we @@ -1260,7 +1260,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* draw */ UI_ThemeColorShade(TH_VIEW_OVERLAY, 100); - uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f); } } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index a88724a1cdd..4c19f59a148 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -262,7 +262,7 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) Object *obedit = CTX_data_edit_object(C); uiBlock *block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL); + UI_block_func_handle_set(block, do_view3d_header_buttons, NULL); if (obedit && (obedit->type == OB_MESH)) { BMEditMesh *em = BKE_editmesh_from_object(obedit); @@ -270,13 +270,13 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) row = uiLayoutRow(layout, true); block = uiLayoutGetBlock(row); - uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, + uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, TIP_("Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection")); - uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, + uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, TIP_("Edge select - Shift-Click for multiple modes, Ctrl-Click expands/contracts selection")); - uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, + uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection")); } @@ -302,10 +302,10 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr); block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL); + UI_block_func_handle_set(block, do_view3d_header_buttons, NULL); /* other buttons: */ - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); /* mode */ if (ob) { diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 187b7aa2144..48bc6448194 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -549,10 +549,11 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a /* draw text (bg) */ glColor4ubv(color_back); - uiSetRoundBox(UI_CNR_ALL); - uiRoundBox(pos[0] - bg_margin, pos[1] - bg_margin, - pos[0] + bg_margin + numstr_size[0], pos[1] + bg_margin + numstr_size[1], - bg_radius); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox( + pos[0] - bg_margin, pos[1] - bg_margin, + pos[0] + bg_margin + numstr_size[0], pos[1] + bg_margin + numstr_size[1], + bg_radius); /* draw text */ glColor3ubv(color_text); BLF_position(blf_mono_font, pos[0], pos[1], 0.0f); @@ -638,8 +639,8 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a /* draw text (bg) */ glColor4ubv(color_back); - uiSetRoundBox(UI_CNR_ALL); - uiRoundBox(pos[0] - bg_margin, pos[1] - bg_margin, + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox(pos[0] - bg_margin, pos[1] - bg_margin, pos[0] + bg_margin + numstr_size[0], pos[1] + bg_margin + numstr_size[1], bg_radius); /* draw text */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 9d5240feb43..08a69830c03 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1143,7 +1143,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int const char *name = ob->id.name + 2; BLI_strncpy(object_mouse_select_menu_data[i].idname, name, MAX_ID_NAME - 2); - object_mouse_select_menu_data[i].icon = uiIconFromID(&ob->id); + object_mouse_select_menu_data[i].icon = UI_icon_from_id(&ob->id); } { diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 11e91800f88..d416ec1640c 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -118,7 +118,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) uiLayoutSetEnabled(pa->layout, false); /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */ - uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op); + UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op); view3d_panel_operator_redo_operator(C, pa, op); } @@ -159,7 +159,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons if (BLI_strcasestr(ot->name, str)) { if (WM_operator_poll((bContext *)C, ot)) { - if (false == uiSearchItemAdd(items, ot->name, ot, 0)) + if (false == UI_search_item_add(items, ot->name, ot, 0)) break; } } @@ -179,18 +179,18 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) /* clear initial search string, then all items show */ search[0] = 0; - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU); /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 15, uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, ""); - uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL); + UI_but_func_search_set(but, operator_search_cb, arg_listbase, operator_call_cb, NULL); - uiBoundsBlock(block, 6); - uiBlockSetDirection(block, UI_DOWN); - uiEndBlock(C, block); + UI_block_bounds_set_normal(block, 6); + UI_block_direction_set(block, UI_DIR_DOWN); + UI_block_end(C, block); wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 5c607d933c1..ece681b228e 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -171,10 +171,10 @@ static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), const uiPopupMenu *pup; uiLayout *layout; - pup = uiPupMenuBegin(C, IFACE_("Orientation"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Orientation"), ICON_NONE); + layout = UI_popup_menu_layout(pup); uiItemsEnumO(layout, "TRANSFORM_OT_select_orientation", "orientation"); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index ec0471da8d3..86b96968047 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -218,8 +218,8 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha char line[FILE_MAX + 100]; wmOperatorType *ot = WM_operatortype_find(opname, 1); - pup = uiPupMenuBegin(C, IFACE_("Unpack File"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Unpack File"), ICON_NONE); + layout = UI_popup_menu_layout(pup); props_ptr = uiItemFullO_ptr(layout, ot, IFACE_("Remove Pack"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); @@ -295,7 +295,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha break; } - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } /* ********************* generic callbacks for drawcall api *********************** */ diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index a154f12a786..050631362b4 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -103,7 +103,7 @@ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings) if (n->val_flag[i] & NUM_EDITED) { /* Get the best precision, allows us to draw '10.0001' as '10' instead! */ - prec = uiFloatPrecisionCalc(prec, (double)n->val[i]); + prec = UI_calc_float_precision(prec, (double)n->val[i]); if (i == n->idx) { const char *heading_exp = "", *trailing_exp = ""; char before_cursor[NUM_STR_REP_LEN]; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 189a938e3d8..6c0efad6f26 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -536,8 +536,8 @@ static int undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE EnumPropertyItem *item = rna_undo_itemf(C, undosys, &totitem); if (totitem > 0) { - uiPopupMenu *pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); - uiLayout *layout = uiPupMenuLayout(pup); + uiPopupMenu *pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); + uiLayout *layout = UI_popup_menu_layout(pup); uiLayout *split = uiLayoutSplit(layout, 0.0f, false); uiLayout *column = NULL; const int col_size = 20 + totitem / 12; @@ -558,7 +558,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE MEM_freeN(item); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); } } diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c index 6816e785c1f..d0db3595c37 100644 --- a/source/blender/editors/uvedit/uvedit_buttons.c +++ b/source/blender/editors/uvedit/uvedit_buttons.c @@ -158,12 +158,12 @@ static void uvedit_vertex_buttons(const bContext *C, uiBlock *block) digits = 2; } - uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_UVEDIT_VERTEX, IFACE_("X:"), 0, 0, width, UI_UNIT_Y, &uvedit_old_center[0], + UI_block_align_begin(block); + uiDefButF(block, UI_BTYPE_NUM, B_UVEDIT_VERTEX, IFACE_("X:"), 0, 0, width, UI_UNIT_Y, &uvedit_old_center[0], -10 * imx, 10.0 * imx, step, digits, ""); - uiDefButF(block, NUM, B_UVEDIT_VERTEX, IFACE_("Y:"), width, 0, width, UI_UNIT_Y, &uvedit_old_center[1], + uiDefButF(block, UI_BTYPE_NUM, B_UVEDIT_VERTEX, IFACE_("Y:"), width, 0, width, UI_UNIT_Y, &uvedit_old_center[1], -10 * imy, 10.0 * imy, step, digits, ""); - uiBlockEndAlign(block); + UI_block_align_end(block); } } @@ -212,7 +212,7 @@ static void image_panel_uv(const bContext *C, Panel *pa) uiBlock *block; block = uiLayoutAbsoluteBlock(pa->layout); - uiBlockSetHandleFunc(block, do_uvedit_vertex, NULL); + UI_block_func_handle_set(block, do_uvedit_vertex, NULL); uvedit_vertex_buttons(C, block); } diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 3c39308e7dc..3b97508dd67 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -587,7 +587,7 @@ static void rna_Event_tilt_get(PointerRNA *ptr, float *values) static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr) { struct uiPopupMenu *pup = ptr->data; - uiLayout *layout = uiPupMenuLayout(pup); + uiLayout *layout = UI_popup_menu_layout(pup); PointerRNA rptr; RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr); @@ -598,7 +598,7 @@ static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr) static PointerRNA rna_PieMenu_layout_get(PointerRNA *ptr) { struct uiPieMenu *pie = ptr->data; - uiLayout *layout = uiPieMenuLayout(pie); + uiLayout *layout = UI_pie_menu_layout(pie); PointerRNA rptr; RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index ad638f2187c..e819d331124 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -298,7 +298,7 @@ static PointerRNA rna_PupMenuBegin(bContext *C, const char *title, int icon) PointerRNA r_ptr; void *data; - data = (void *)uiPupMenuBegin(C, title, icon); + data = (void *)UI_popup_menu_begin(C, title, icon); RNA_pointer_create(NULL, &RNA_UIPopupMenu, data, &r_ptr); @@ -307,7 +307,7 @@ static PointerRNA rna_PupMenuBegin(bContext *C, const char *title, int icon) static void rna_PupMenuEnd(bContext *C, PointerRNA *handle) { - uiPupMenuEnd(C, handle->data); + UI_popup_menu_end(C, handle->data); } /* pie menu wrapper */ @@ -316,7 +316,7 @@ static PointerRNA rna_PieMenuBegin(bContext *C, const char *title, int icon, Poi PointerRNA r_ptr; void *data; - data = (void *)uiPieMenuBegin(C, title, icon, event->data); + data = (void *)UI_pie_menu_begin(C, title, icon, event->data); RNA_pointer_create(NULL, &RNA_UIPieMenu, data, &r_ptr); @@ -325,7 +325,7 @@ static PointerRNA rna_PieMenuBegin(bContext *C, const char *title, int icon, Poi static void rna_PieMenuEnd(bContext *C, PointerRNA *handle) { - uiPieMenuEnd(C, handle->data); + UI_pie_menu_end(C, handle->data); } #else @@ -462,7 +462,7 @@ void RNA_api_wm(StructRNA *srna) rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN); - /* wrap uiPupMenuBegin */ + /* wrap UI_popup_menu_begin */ func = RNA_def_function(srna, "pupmenu_begin__internal", "rna_PupMenuBegin"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_string(func, "title", NULL, 0, "", ""); @@ -474,7 +474,7 @@ void RNA_api_wm(StructRNA *srna) RNA_def_property_flag(parm, PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_function_return(func, parm); - /* wrap uiPupMenuEnd */ + /* wrap UI_popup_menu_end */ func = RNA_def_function(srna, "pupmenu_end__internal", "rna_PupMenuEnd"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", ""); diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index e5bba9285b4..145e9df7eb0 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -271,16 +271,16 @@ void wm_drags_check_ops(bContext *C, wmEvent *event) static void wm_drop_operator_draw(const char *name, int x, int y) { - int width = UI_GetStringWidth(name); + int width = UI_fontstyle_string_width(name); int padding = 4 * UI_DPI_FAC; glColor4ub(0, 0, 0, 50); - uiSetRoundBox(UI_CNR_ALL | UI_RB_ALPHA); - uiRoundBox(x, y, x + width + 2 * padding, y + 4 * padding, padding); + UI_draw_roundbox_corner_set(UI_CNR_ALL | UI_RB_ALPHA); + UI_draw_roundbox(x, y, x + width + 2 * padding, y + 4 * padding, padding); glColor4ub(255, 255, 255, 255); - UI_DrawString(x + padding, y + padding, name); + UI_draw_string(x + padding, y + padding, name); } static const char *wm_drag_name(wmDrag *drag) @@ -366,12 +366,12 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) } if (rect) { - int w = UI_GetStringWidth(wm_drag_name(drag)); + int w = UI_fontstyle_string_width(wm_drag_name(drag)); drag_rect_minmax(rect, x, y, x + w, y + iconsize); } else { glColor4ub(255, 255, 255, 255); - UI_DrawString(x, y, wm_drag_name(drag)); + UI_draw_string(x, y, wm_drag_name(drag)); } /* operator name with roundbox */ @@ -394,7 +394,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) } if (rect) { - int w = UI_GetStringWidth(wm_drag_name(drag)); + int w = UI_fontstyle_string_width(wm_drag_name(drag)); drag_rect_minmax(rect, x, y, x + w, y + iconsize); } else diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 793908ec44b..f12177df331 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -269,7 +269,7 @@ void wm_event_do_notifiers(bContext *C) if (note->category == NC_SCREEN) { if (note->data == ND_SCREENBROWSE) { /* free popup handlers only [#35434] */ - UI_remove_popup_handlers_all(C, &win->modalhandlers); + UI_popup_handlers_remove_all(C, &win->modalhandlers); ED_screen_set(C, note->reference); // XXX hrms, think this over! @@ -621,7 +621,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, bool ca { if (caller_owns_reports == false) { /* popup */ if (op->reports->list.first) { - /* FIXME, temp setting window, see other call to uiPupMenuReports for why */ + /* FIXME, temp setting window, see other call to UI_popup_menu_reports for why */ wmWindow *win_prev = CTX_wm_window(C); ScrArea *area_prev = CTX_wm_area(C); ARegion *ar_prev = CTX_wm_region(C); @@ -629,7 +629,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, bool ca if (win_prev == NULL) CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); - uiPupMenuReports(C, op->reports); + UI_popup_menu_reports(C, op->reports); CTX_wm_window_set(C, win_prev); CTX_wm_area_set(C, area_prev); @@ -1720,7 +1720,7 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand wm_handler_op_context(C, handler); - /* needed for uiPupMenuReports */ + /* needed for UI_popup_menu_reports */ if (val == EVT_FILESELECT_EXEC) { int retval; @@ -1752,7 +1752,7 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); BKE_report_print_level_set(handler->op->reports, RPT_WARNING); - uiPupMenuReports(C, handler->op->reports); + UI_popup_menu_reports(C, handler->op->reports); /* XXX - copied from 'wm_operator_finished()' */ /* add reports to the global list, otherwise they are not seen */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f048562a380..b8c9fd3a7f3 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1073,12 +1073,12 @@ int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) return retval; } else { - pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); + layout = UI_popup_menu_layout(pup); /* set this so the default execution context is the same as submenus */ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN); uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -1096,19 +1096,19 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) uiBut *but; wmOperator *op = (wmOperator *)arg_op; - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); #if 0 /* ok, this isn't so easy... */ - uiDefBut(block, LABEL, 0, RNA_struct_ui_name(op->type->srna), 10, 10, uiSearchBoxWidth(), UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_struct_ui_name(op->type->srna), 10, 10, UI_searchbox_size_x(), UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); #endif but = uiDefSearchButO_ptr(block, op->type, op->ptr->data, search, 0, ICON_VIEWZOOM, sizeof(search), - 10, 10, uiSearchBoxWidth(), UI_UNIT_Y, 0, 0, ""); + 10, 10, UI_searchbox_size_x(), UI_UNIT_Y, 0, 0, ""); /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 10 - UI_searchbox_size_y(), UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL); - uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ + UI_block_bounds_set_popup(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; @@ -1123,7 +1123,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) int WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - uiPupBlock(C, wm_enum_search_menu, op); + UI_popup_block_invoke(C, wm_enum_search_menu, op); return OPERATOR_INTERFACE; } @@ -1141,10 +1141,10 @@ int WM_operator_confirm_message_ex(bContext *C, wmOperator *op, else properties = NULL; - pup = uiPupMenuBegin(C, title, icon); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, title, icon); + layout = UI_popup_menu_layout(pup); uiItemFullO_ptr(layout, op->type, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0); - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return OPERATOR_INTERFACE; } @@ -1428,19 +1428,19 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) wmOperator *op = arg_op; uiBlock *block; uiLayout *layout; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); int width = 15 * UI_UNIT_X; - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); - uiBlockClearFlag(block, UI_BLOCK_LOOP); - uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + UI_block_flag_disable(block, UI_BLOCK_LOOP); + UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); /* if register is not enabled, the operator gets freed on OPERATOR_FINISHED * ui_apply_but_funcs_after calls ED_undo_operator_repeate_cb and crashes */ assert(op->type->flag & OPTYPE_REGISTER); - uiBlockSetHandleFunc(block, wm_block_redo_cb, arg_op); - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, 0, style); + UI_block_func_handle_set(block, wm_block_redo_cb, arg_op); + layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, 0, style); if (op == WM_operator_last_redo(C)) if (!WM_operator_check_ui_enabled(C, op->type->name)) @@ -1455,7 +1455,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE); } - uiPopupBoundsBlock(block, 4, 0, 0); + UI_block_bounds_set_popup(block, 4, 0, 0); return block; } @@ -1482,7 +1482,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) /* in this case, wm_operator_ui_popup_cancel wont run */ MEM_freeN(data); - uiPupBlockClose(C, block); + UI_popup_block_close(C, block); } static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) @@ -1506,23 +1506,23 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) wmOperator *op = data->op; uiBlock *block; uiLayout *layout; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); - uiBlockClearFlag(block, UI_BLOCK_LOOP); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + UI_block_flag_disable(block, UI_BLOCK_LOOP); /* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogues have many items * where quitting by accident is very annoying */ - uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN); + UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN); - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); + layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); - uiBlockSetFunc(block, dialog_check_cb, op, NULL); + UI_block_func_set(block, dialog_check_cb, op, NULL); uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE); /* clear so the OK button is left alone */ - uiBlockSetFunc(block, NULL, NULL, NULL); + UI_block_func_set(block, NULL, NULL, NULL); /* new column so as not to interfere with custom layouts [#26436] */ { @@ -1533,12 +1533,12 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) col = uiLayoutColumn(layout, false); col_block = uiLayoutGetBlock(col); /* Create OK button, the callback of which will execute op */ - btn = uiDefBut(col_block, BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(btn, dialog_exec_cb, data, col_block); + btn = uiDefBut(col_block, UI_BTYPE_BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + UI_but_func_set(btn, dialog_exec_cb, data, col_block); } /* center around the mouse */ - uiPopupBoundsBlock(block, 4, data->width / -2, data->height / 2); + UI_block_bounds_set_popup(block, 4, data->width / -2, data->height / 2); return block; } @@ -1549,18 +1549,18 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) wmOperator *op = data->op; uiBlock *block; uiLayout *layout; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); - block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); - uiBlockClearFlag(block, UI_BLOCK_LOOP); - uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + UI_block_flag_disable(block, UI_BLOCK_LOOP); + UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); + layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); /* since ui is defined the auto-layout args are not used */ uiLayoutOperatorButs(C, layout, op, NULL, 'V', 0); - uiPopupBoundsBlock(block, 4, 0, 0); + UI_block_bounds_set_popup(block, 4, 0, 0); return block; } @@ -1601,7 +1601,7 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) data->width = width; data->height = height; data->free_op = true; /* if this runs and gets registered we may want not to free it */ - uiPupBlockEx(C, wm_operator_ui_create, NULL, wm_operator_ui_popup_cancel, data); + UI_popup_block_ex(C, wm_operator_ui_create, NULL, wm_operator_ui_popup_cancel, data); return OPERATOR_RUNNING_MODAL; } @@ -1631,7 +1631,7 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, if (!do_redo || !(U.uiflag & USER_GLOBALUNDO)) return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, UI_UNIT_Y); - uiPupBlockEx(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op); + UI_popup_block_ex(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op); if (do_call) wm_block_redo_cb(C, op, 0); @@ -1671,7 +1671,7 @@ int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int h data->free_op = true; /* if this runs and gets registered we may want not to free it */ /* op is not executed until popup OK but is clicked */ - uiPupBlockEx(C, wm_block_dialog_create, wm_operator_ui_popup_ok, wm_operator_ui_popup_cancel, data); + UI_popup_block_ex(C, wm_block_dialog_create, wm_operator_ui_popup_ok, wm_operator_ui_popup_cancel, data); return OPERATOR_RUNNING_MODAL; } @@ -1689,7 +1689,7 @@ int WM_operator_redo_popup(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - uiPupBlock(C, wm_block_create_redo, op); + UI_popup_block_invoke(C, wm_block_create_redo, op); return OPERATOR_CANCELLED; } @@ -1754,7 +1754,7 @@ static void WM_OT_operator_defaults(wmOperatorType *ot) static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg)) { - uiPupBlockClose(C, arg_block); + UI_popup_block_close(C, arg_block); } static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused); @@ -1766,8 +1766,8 @@ static void wm_block_splash_refreshmenu(bContext *UNUSED(C), void *UNUSED(arg_bl /* ugh, causes crashes in other buttons, disabling for now until * a better fix */ #if 0 - uiPupBlockClose(C, arg_block); - uiPupBlock(C, wm_block_create_splash, NULL); + UI_popup_block_close(C, arg_block); + UI_popup_block_invoke(C, wm_block_create_splash, NULL); #endif } @@ -1799,7 +1799,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiBlock *block; uiBut *but; uiLayout *layout, *split, *col; - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); const struct RecentFile *recent; int i; MenuType *mt = WM_menutype_find("USERPREF_MT_splash", true); @@ -1845,17 +1845,17 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar } #endif - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); /* note on UI_BLOCK_NO_WIN_CLIP, the window size is not always synchronized * with the OS when the splash shows, window clipping in this case gives * ugly results and clipping the splash isn't useful anyway, just disable it [#32938] */ - uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP); + UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP); /* XXX splash scales with pixelsize, should become widget-units */ - but = uiDefBut(block, BUT_IMAGE, 0, "", 0, 0.5f * U.widget_unit, U.pixelsize * 501, U.pixelsize * 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */ - uiButSetFunc(but, wm_block_splash_close, block, NULL); - uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL); + but = uiDefBut(block, UI_BTYPE_IMAGE, 0, "", 0, 0.5f * U.widget_unit, U.pixelsize * 501, U.pixelsize * 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */ + UI_but_func_set(but, wm_block_splash_close, block, NULL); + UI_block_func_set(block, wm_block_splash_refreshmenu, block, NULL); /* label for 'a' bugfix releases, or 'Release Candidate 1'... * avoids recreating splash for version updates */ @@ -1873,32 +1873,32 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar int w = 240; /* hack to have text draw 'text_sel' */ - uiBlockSetEmboss(block, UI_EMBOSSN); - but = uiDefBut(block, LABEL, 0, version_suffix, x * U.pixelsize, y * U.pixelsize, w * U.pixelsize, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + UI_block_emboss_set(block, UI_EMBOSS_NONE); + but = uiDefBut(block, UI_BTYPE_LABEL, 0, version_suffix, x * U.pixelsize, y * U.pixelsize, w * U.pixelsize, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); /* XXX, set internal flag - UI_SELECT */ - uiButSetFlag(but, 1); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_but_flag_enable(but, 1); + UI_block_emboss_set(block, UI_EMBOSS); } #ifdef WITH_BUILDINFO if (build_commit_timestamp != 0) { - uiDefBut(block, LABEL, 0, date_buf, U.pixelsize * 494 - date_width, U.pixelsize * 270, date_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, date_buf, U.pixelsize * 494 - date_width, U.pixelsize * 270, date_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); label_delta = 12; } - uiDefBut(block, LABEL, 0, hash_buf, U.pixelsize * 494 - hash_width, U.pixelsize * (270 - label_delta), hash_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, hash_buf, U.pixelsize * 494 - hash_width, U.pixelsize * (270 - label_delta), hash_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); if (!STREQ(build_branch, "master")) { char branch_buf[128] = "\0"; int branch_width; BLI_snprintf(branch_buf, sizeof(branch_buf), "Branch: %s", build_branch); branch_width = (int)BLF_width(style->widgetlabel.uifont_id, branch_buf, sizeof(branch_buf)) + U.widget_unit; - uiDefBut(block, LABEL, 0, branch_buf, U.pixelsize * 494 - branch_width, U.pixelsize * (258 - label_delta), branch_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, branch_buf, U.pixelsize * 494 - branch_width, U.pixelsize * (258 - label_delta), branch_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); } #endif /* WITH_BUILDINFO */ - layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style); + layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style); - uiBlockSetEmboss(block, UI_EMBOSS); + UI_block_emboss_set(block, UI_EMBOSS); /* show the splash menu (containing interaction presets), using python */ if (mt) { Menu menu = {NULL}; @@ -1910,7 +1910,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar // uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, ICON_NONE); } - uiBlockSetEmboss(block, UI_EMBOSSP); + UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN); split = uiLayoutSplit(layout, 0.0f, false); @@ -1959,14 +1959,14 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiItemO(col, NULL, ICON_RECOVER_LAST, "WM_OT_recover_last_session"); uiItemL(col, "", ICON_NONE); - uiCenteredBoundsBlock(block, 0); + UI_block_bounds_set_centered(block, 0); return block; } static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { - uiPupBlock(C, wm_block_create_splash, NULL); + UI_popup_block_invoke(C, wm_block_create_splash, NULL); return OPERATOR_FINISHED; } @@ -1991,16 +1991,16 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_ uiBlock *block; uiBut *but; - block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS); - uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); - but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, uiSearchBoxWidth(), UI_UNIT_Y, 0, 0, ""); - uiOperatorSearch_But(but); + but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, UI_searchbox_size_x(), UI_UNIT_Y, 0, 0, ""); + UI_but_func_operator_search(but); /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 10 - UI_searchbox_size_y(), UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL); - uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ + UI_block_bounds_set_popup(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; @@ -2019,7 +2019,7 @@ static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) static int wm_search_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - uiPupBlock(C, wm_block_search_menu, op); + UI_popup_block_invoke(C, wm_block_search_menu, op); return OPERATOR_INTERFACE; } @@ -2060,7 +2060,7 @@ static int wm_call_menu_exec(bContext *C, wmOperator *op) char idname[BKE_ST_MAXNAME]; RNA_string_get(op->ptr, "name", idname); - return uiPupMenuInvoke(C, idname, op->reports); + return UI_popup_menu_invoke(C, idname, op->reports); } static void WM_OT_call_menu(wmOperatorType *ot) @@ -2082,7 +2082,7 @@ static int wm_call_pie_menu_invoke(bContext *C, wmOperator *op, const wmEvent *e char idname[BKE_ST_MAXNAME]; RNA_string_get(op->ptr, "name", idname); - return uiPieMenuInvoke(C, idname, event); + return UI_pie_menu_invoke(C, idname, event); } static int wm_call_pie_menu_exec(bContext *C, wmOperator *op) @@ -2090,7 +2090,7 @@ static int wm_call_pie_menu_exec(bContext *C, wmOperator *op) char idname[BKE_ST_MAXNAME]; RNA_string_get(op->ptr, "name", idname); - return uiPieMenuInvoke(C, idname, CTX_wm_window(C)->eventstate); + return UI_pie_menu_invoke(C, idname, CTX_wm_window(C)->eventstate); } static void WM_OT_call_menu_pie(wmOperatorType *ot) @@ -3856,7 +3856,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd { RadialControl *rc = customdata; ARegion *ar = CTX_wm_region(C); - uiStyle *style = UI_GetStyle(); + uiStyle *style = UI_style_get(); const uiFontStyle *fstyle = &style->widget; const int fontid = fstyle->uifont_id; short fstyle_points = fstyle->points; -- cgit v1.2.3