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
This commit is contained in:
Campbell Barton 2014-11-09 21:20:40 +01:00
parent 2b107beffd
commit 5c6e333780
95 changed files with 2920 additions and 2881 deletions

@ -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 */

@ -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);

@ -399,7 +399,7 @@ static void draw_marker(
}
#endif
UI_DrawString(x, y, marker->name);
UI_draw_string(x, y, marker->name);
}
}

@ -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);
}

@ -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 */

@ -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);

@ -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;
}

@ -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;
}

@ -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)) {

@ -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;
}

@ -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;

@ -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;
}
}

@ -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");

@ -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);

@ -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);
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 *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);
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__ */

File diff suppressed because it is too large Load Diff

@ -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);
}

@ -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);

@ -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) ||

File diff suppressed because it is too large Load Diff

@ -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);

@ -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;

@ -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);

@ -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) {

File diff suppressed because it is too large Load Diff

@ -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);

File diff suppressed because it is too large Load Diff

@ -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) */

@ -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);
}
}

@ -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 */

@ -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;

@ -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;
}

@ -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");

@ -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! */
}

@ -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;

@ -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

@ -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};

@ -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 {

@ -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);

@ -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;
}

@ -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;
}

@ -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

@ -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 */

@ -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;

@ -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();

@ -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];

@ -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;

@ -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);
}
}

@ -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);
}
}

@ -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);
}

@ -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)

@ -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);
}

@ -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);
}

@ -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)

@ -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;

@ -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)*/

@ -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);
}

@ -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);

@ -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);

@ -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;
}

@ -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);
}
}
}

@ -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; i<sens->totlinks; 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; a<count; a++) {
@ -2401,7 +2401,7 @@ void logic_buttons(bContext *C, ARegion *ar)
/* ****************** Controllers ****************** */
xco= 21 * U.widget_unit; yco= - U.widget_unit / 2; width= 15 * 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, controller_menu, NULL, IFACE_("Controllers"), xco - U.widget_unit / 2, yco, width, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
@ -2431,7 +2431,7 @@ void logic_buttons(bContext *C, ARegion *ar)
uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
row = uiLayoutRow(split, true);
uiDefButBitS(block, TOG, 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"));
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);

@ -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)*/

@ -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);
}

@ -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;
}

@ -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);
}
}

@ -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,

@ -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)

@ -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;
}

@ -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;
}

@ -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);

@ -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;

@ -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;
}

@ -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);
}

@ -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);

@ -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);

@ -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

@ -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;
}

@ -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);

@ -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);
}
}

@ -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) {

@ -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 */

@ -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);
}
{

@ -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;

@ -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;
}

@ -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 *********************** */

@ -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];

@ -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);
}
}

@ -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);
}

@ -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);

@ -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", "", "");

@ -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

@ -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 */

@ -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;

@ -622,15 +622,15 @@ char *WM_operator_pystring(struct bContext *C, struct wmOperator *op, const bool
struct wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value) RET_NULL
struct wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value) RET_NULL
struct wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, struct EnumPropertyItem *items) RET_NULL
struct uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int icon) RET_NULL
void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu *head) RET_NONE
struct uiLayout *uiPupMenuLayout(struct uiPopupMenu *head) RET_NULL
struct uiLayout *uiPieMenuLayout(struct uiPieMenu *pie) RET_NULL
int uiPieMenuInvoke(struct bContext *C, const char *idname, const struct wmEvent *event) RET_ZERO
struct uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const struct wmEvent *event) RET_NULL
void uiPieMenuEnd(struct bContext *C, uiPieMenu *pie) RET_NONE
struct uiPopupMenu *UI_popup_menu_begin(struct bContext *C, const char *title, int icon) RET_NULL
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *head) RET_NONE
struct uiLayout *UI_popup_menu_layout(struct uiPopupMenu *head) RET_NULL
struct uiLayout *UI_pie_menu_layout(struct uiPieMenu *pie) RET_NULL
int UI_pie_menu_invoke(struct bContext *C, const char *idname, const struct wmEvent *event) RET_ZERO
struct uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, const struct wmEvent *event) RET_NULL
void UI_pie_menu_end(struct bContext *C, uiPieMenu *pie) RET_NONE
struct uiLayout *uiLayoutRadial(struct uiLayout *layout) RET_NULL
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 struct wmEvent *event) RET_ZERO
/* RNA COLLADA dependency */