Cleanup: right shift in interface code

This commit is contained in:
2018-07-01 19:57:31 +02:00
parent 71e65daf5c
commit 26c5a1c301
13 changed files with 387 additions and 269 deletions

View File

@@ -961,7 +961,8 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_str
else {
butstr_orig = BLI_strdup(but->str);
}
BLI_snprintf(but->strdata,
BLI_snprintf(
but->strdata,
sizeof(but->strdata),
"%s" UI_SEP_CHAR_S "%s",
butstr_orig, shortcut_str);
@@ -2119,7 +2120,8 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va
precision = float_precision;
}
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision,
bUnit_AsString(
str, len_max, ui_get_but_scale_unit(but, value), precision,
unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad);
}
@@ -2337,7 +2339,8 @@ static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char
/* ugly, use the draw string to get the value,
* this could cause problems if it includes some text which resolves to a unit */
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr,
bUnit_ReplaceString(
str_unit_convert, sizeof(str_unit_convert), but->drawstr,
ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
return BPY_execute_string_as_number(C, str_unit_convert, true, r_value);
@@ -3391,11 +3394,13 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
}
else {
if (item->icon) {
uiDefIconTextButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0,
uiDefIconTextButI(
block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0,
UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
}
else {
uiDefButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0,
uiDefButI(
block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0,
UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
}
}

View File

@@ -81,8 +81,10 @@ int UI_draw_roundbox_corner_get(void)
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}};
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},
};
int a;
/* mult */
@@ -159,7 +161,8 @@ 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},
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}};
const float div = maxy - miny;
const float idiv = 1.0f / div;
@@ -267,7 +270,8 @@ 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},
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}};
const float div = maxx - minx;
const float idiv = 1.0f / div;
@@ -1526,7 +1530,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
if (scopes->track_preview)
IMB_freeImBuf(scopes->track_preview);
ImBuf *tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width, scopes->frame_height,
ImBuf *tmpibuf = BKE_tracking_sample_pattern(
scopes->frame_width, scopes->frame_height,
scopes->track_search, scopes->track,
&scopes->undist_marker, true, scopes->use_track_mask,
width, height, scopes->track_pos);
@@ -1556,7 +1561,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
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,
glaDrawPixelsSafe(
rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y,
drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect);
/* draw cross for pixel position */

View File

@@ -1314,8 +1314,10 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
if (but) {
if (but->flag & UI_BUT_DRAG_LOCK) {
const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect),
BLI_rctf_cent_y(&but->rect)};
const float but_cent_new[2] = {
BLI_rctf_cent_x(&but->rect),
BLI_rctf_cent_y(&but->rect),
};
/* check if this is a different button, chances are high the button wont move about :) */
if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
@@ -1387,7 +1389,8 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
ui_apply_but_undo(but);
}
WM_event_remove_ui_handler(&win->modalhandlers,
WM_event_remove_ui_handler(
&win->modalhandlers,
ui_handler_region_drag_toggle,
ui_handler_region_drag_toggle_remove,
drag_info, false);
@@ -3364,12 +3367,14 @@ static void ui_do_but_textedit(
}
break;
case RIGHTARROWKEY:
ui_textedit_move(but, data, STRCUR_DIR_NEXT,
ui_textedit_move(
but, data, STRCUR_DIR_NEXT,
event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case LEFTARROWKEY:
ui_textedit_move(but, data, STRCUR_DIR_PREV,
ui_textedit_move(
but, data, STRCUR_DIR_PREV,
event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
@@ -3387,7 +3392,8 @@ static void ui_do_but_textedit(
}
ATTR_FALLTHROUGH;
case ENDKEY:
ui_textedit_move(but, data, STRCUR_DIR_NEXT,
ui_textedit_move(
but, data, STRCUR_DIR_NEXT,
event->shift != 0, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
break;
@@ -3405,7 +3411,8 @@ static void ui_do_but_textedit(
}
ATTR_FALLTHROUGH;
case HOMEKEY:
ui_textedit_move(but, data, STRCUR_DIR_PREV,
ui_textedit_move(
but, data, STRCUR_DIR_PREV,
event->shift != 0, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
break;
@@ -3415,13 +3422,15 @@ static void ui_do_but_textedit(
retval = WM_UI_HANDLER_BREAK;
break;
case DELKEY:
changed = ui_textedit_delete(but, data, 1,
changed = ui_textedit_delete(
but, data, 1,
event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case BACKSPACEKEY:
changed = ui_textedit_delete(but, data, 0,
changed = ui_textedit_delete(
but, data, 0,
event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
@@ -3437,9 +3446,11 @@ static void ui_do_but_textedit(
if (event->ctrl && !IS_EVENT_MOD(event, shift, alt, oskey))
#endif
{
ui_textedit_move(but, data, STRCUR_DIR_PREV,
ui_textedit_move(
but, data, STRCUR_DIR_PREV,
false, STRCUR_JUMP_ALL);
ui_textedit_move(but, data, STRCUR_DIR_NEXT,
ui_textedit_move(
but, data, STRCUR_DIR_NEXT,
true, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
}
@@ -9773,7 +9784,8 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
#ifdef USE_DRAG_TOGGLE
{
WM_event_free_ui_handler_all(C, &win->modalhandlers,
WM_event_free_ui_handler_all(
C, &win->modalhandlers,
ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove);
}
#endif

View File

@@ -700,7 +700,8 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w - UI_UNIT_X, h);
/* 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",
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) {
@@ -1085,7 +1086,8 @@ void uiItemsFullEnumO_items(
}
else {
/* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
but = uiDefBut(block, UI_BTYPE_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);
@@ -2086,7 +2088,8 @@ void uiItemMenuEnumO_ptr(
BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname));
lvl->opcontext = layout->root->opcontext;
but = ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl,
but = ui_item_menu(
layout, name, icon, menu_item_enum_opname_menu, NULL, lvl,
RNA_struct_ui_description(ot->srna), true);
/* add hotkey here, lower UI code can't detect it */

View File

@@ -806,7 +806,8 @@ static int editsource_exec(bContext *C, wmOperator *op)
if (but_store) {
if (but_store->py_dbg_ln != -1) {
ret = editsource_text_edit(C, op,
ret = editsource_text_edit(
C, op,
but_store->py_dbg_fn,
but_store->py_dbg_ln);
}
@@ -916,13 +917,17 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL};
if (!BLI_is_dir(root)) {
BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' 'Translation Branches "
BKE_report(
op->reports, RPT_ERROR,
"Please set your User Preferences' 'Translation Branches "
"Directory' path to a valid directory");
return OPERATOR_CANCELLED;
}
ot = WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0);
if (ot == NULL) {
BKE_reportf(op->reports, RPT_ERROR, "Could not find operator '%s'! Please enable ui_translate add-on "
BKE_reportf(
op->reports, RPT_ERROR,
"Could not find operator '%s'! Please enable ui_translate add-on "
"in the User Preferences", EDTSRC_I18N_OP_NAME);
return OPERATOR_CANCELLED;
}
@@ -934,7 +939,8 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
UI_but_string_info_get(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);

View File

@@ -620,7 +620,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
#endif
{
glEnable(GL_BLEND);
UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
UI_icon_draw_aspect(
headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
(panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
(block->aspect / UI_DPI_FAC), 1.0f);
glDisable(GL_BLEND);
@@ -1755,16 +1756,19 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
#endif
{
glColor3ubv(is_active ? theme_col_tab_active : theme_col_tab_inactive);
ui_panel_category_draw_tab(GL_POLYGON, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
ui_panel_category_draw_tab(
GL_POLYGON, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
tab_curve_radius - px, roundboxtype, true, true, NULL);
/* tab outline */
glColor3ubv(theme_col_tab_outline);
ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px,
ui_panel_category_draw_tab(
GL_LINE_STRIP, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px,
tab_curve_radius, roundboxtype, true, true, NULL);
/* tab highlight (3d look) */
glColor3ubv(is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive);
ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
ui_panel_category_draw_tab(
GL_LINE_STRIP, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
tab_curve_radius, roundboxtype, true, false,
is_active ? theme_col_back : theme_col_tab_inactive);
}
@@ -1779,7 +1783,8 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
}
if (do_scaletabs) {
category_draw_len = BLF_width_to_strlen(fontid, category_id_draw, category_draw_len,
category_draw_len = BLF_width_to_strlen(
fontid, category_id_draw, category_draw_len,
category_width, NULL);
}

View File

@@ -38,14 +38,16 @@
bool ui_but_is_editable(const uiBut *but)
{
return !ELEM(but->type,
return !ELEM(
but->type,
UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE,
UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR);
}
bool ui_but_is_editable_as_text(const uiBut *but)
{
return ELEM(but->type,
return ELEM(
but->type,
UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER,
UI_BTYPE_SEARCH_MENU);

View File

@@ -418,7 +418,8 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
ui_draw_preview_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
ui_draw_preview_item(
&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
(a == data->active) ? UI_ACTIVE : 0);
}
@@ -443,7 +444,8 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
ui_draw_menu_item(
&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
(a == data->active) ? UI_ACTIVE : 0, data->use_sep);
}
@@ -718,7 +720,8 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe
}
rect_pre.xmax += 4; /* sneaky, avoid showing ugly margin */
ui_draw_menu_item(&data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre),
ui_draw_menu_item(
&data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre),
data->items.icons[a], state, false);
ui_draw_menu_item(&data->fstyle, &rect_post, data->items.names[a], 0, state, data->use_sep);
}

View File

@@ -276,7 +276,8 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
/* fake button, it holds space for search items */
uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 26, w, h, NULL, 0, 0, 0, 0, NULL);
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, UI_UNIT_Y,
but = uiDefSearchBut(
block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, UI_UNIT_Y,
template_ui.prv_rows, template_ui.prv_cols, "");
UI_but_func_search_set(
but, ui_searchbox_create_generic, id_search_cb_p,
@@ -394,8 +395,9 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
break;
case UI_ID_ALONE:
if (id) {
const bool do_scene_obj = (GS(id->name) == ID_OB) &&
(template_ui->ptr.type == &RNA_SceneObjects);
const bool do_scene_obj = (
(GS(id->name) == ID_OB) &&
(template_ui->ptr.type == &RNA_SceneObjects));
/* make copy */
if (do_scene_obj) {
@@ -497,9 +499,11 @@ static void template_ID(
if (flag & UI_ID_PREVIEWS) {
template_ui->preview = true;
but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template_ui), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6,
but = uiDefBlockButN(
block, id_search_menu, MEM_dupallocN(template_ui), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6,
TIP_(template_id_browse_tip(type)));
ui_def_but_icon(but, id ? ui_id_icon_get(C, id, true) : RNA_struct_ui_icon(type),
ui_def_but_icon(
but, id ? ui_id_icon_get(C, id, true) : RNA_struct_ui_icon(type),
UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
if ((idfrom && idfrom->lib) || !editable)
@@ -508,7 +512,8 @@ static void template_ID(
uiLayoutRow(layout, true);
}
else if (flag & UI_ID_BROWSE) {
but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template_ui), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y,
but = uiDefBlockButN(
block, id_search_menu, MEM_dupallocN(template_ui), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y,
TIP_(template_id_browse_tip(type)));
ui_def_but_icon(but, RNA_struct_ui_icon(type), UI_HAS_ICON);
/* default dragging of icon for id browse buttons */
@@ -526,19 +531,22 @@ static void template_ID(
//text_idbutton(id, name);
name[0] = '\0';
but = uiDefButR(block, UI_BTYPE_TEXT, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y,
but = uiDefButR(
block, UI_BTYPE_TEXT, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y,
&idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type));
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_RENAME));
if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT);
if (id->lib) {
if (id->tag & LIB_TAG_INDIRECT) {
but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
but = uiDefIconBut(
block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change"));
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
else {
but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
but = uiDefIconBut(
block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Direct linked library data-block, click to make local"));
if (!id_make_local(CTX_data_main(C), id, true /* test */, false) || (idfrom && idfrom->lib))
UI_but_flag_enable(but, UI_BUT_DISABLED);
@@ -553,7 +561,8 @@ static void template_ID(
numstr_len = BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
but = uiDefBut(block, UI_BTYPE_BUT, 0, numstr, 0, 0,
but = uiDefBut(
block, UI_BTYPE_BUT, 0, numstr, 0, 0,
numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Display number of users of this data (click to make a single-user copy)"));
but->flag |= UI_BUT_UNDO;
@@ -581,7 +590,9 @@ static void template_ID(
int w = id ? UI_UNIT_X : (flag & UI_ID_OPEN) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
/* i18n markup, does nothing! */
BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_DEFAULT,
BLT_I18N_MSGID_MULTI_CTXT(
"New",
BLT_I18NCONTEXT_DEFAULT,
BLT_I18NCONTEXT_ID_SCENE,
BLT_I18NCONTEXT_ID_OBJECT,
BLT_I18NCONTEXT_ID_MESH,
@@ -597,7 +608,9 @@ static void template_ID(
BLT_I18NCONTEXT_ID_SCREEN,
BLT_I18NCONTEXT_ID_TEXT,
);
BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_ID_SPEAKER,
BLT_I18N_MSGID_MULTI_CTXT(
"New",
BLT_I18NCONTEXT_ID_SPEAKER,
BLT_I18NCONTEXT_ID_SOUND,
BLT_I18NCONTEXT_ID_ARMATURE,
BLT_I18NCONTEXT_ID_ACTION,
@@ -609,12 +622,14 @@ static void template_ID(
);
if (newop) {
but = uiDefIconTextButO(block, UI_BTYPE_BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
but = uiDefIconTextButO(
block, UI_BTYPE_BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
(id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, UI_UNIT_Y, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
else {
but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"),
but = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"),
0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
@@ -626,7 +641,8 @@ static void template_ID(
/* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack.
* Only for images, sound and fonts */
if (id && BKE_pack_check(id)) {
but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
but = uiDefIconButO(
block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));
UI_but_operator_ptr_get(but);
@@ -638,12 +654,14 @@ static void template_ID(
int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
if (openop) {
but = uiDefIconTextButO(block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
but = uiDefIconTextButO(
block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
0, 0, w, UI_UNIT_Y, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
}
else {
but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
but = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
NULL, 0, 0, 0, 0, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
}
@@ -665,7 +683,8 @@ static void template_ID(
}
else {
if ((RNA_property_flag(template_ui->prop) & PROP_NEVER_UNLINK) == 0) {
but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
but = uiDefIconBut(
block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Unlink data-block "
"(Shift + Click to set users to zero, data will then not be saved)"));
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_DELETE));
@@ -743,7 +762,8 @@ void uiTemplateID(
uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
const char *openop, const char *unlinkop, int filter)
{
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
ui_template_id(
layout, C, ptr, propname, newop, openop, unlinkop,
UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0, filter);
}
@@ -758,7 +778,8 @@ void uiTemplateIDPreview(
uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
const char *openop, const char *unlinkop, int rows, int cols, int filter)
{
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
ui_template_id(
layout, C, ptr, propname, newop, openop, unlinkop,
UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols, filter);
}
@@ -832,7 +853,8 @@ void uiTemplateAnyID(
* - propname: property identifier for property that path gets stored to
* - root_ptr: struct that path gets built from
*/
void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
void uiTemplatePathBuilder(
uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
const char *text)
{
PropertyRNA *propPath;
@@ -938,7 +960,8 @@ static uiLayout *draw_modifier(
BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name);
uiDefBut(block, UI_BTYPE_LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name"));
but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
but = uiDefBut(
block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
TIP_("Convert virtual modifier to a real modifier"));
UI_but_func_set(but, modifiers_convertToReal, ob, md);
}
@@ -995,7 +1018,8 @@ static uiLayout *draw_modifier(
if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
/* add disabled pre-tessellated button, so users could have
* message for this modifiers */
but = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
but = uiDefIconButBitI(
block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
TIP_("This modifier can only be applied on splines' points"));
UI_but_flag_enable(but, UI_BUT_DISABLED);
@@ -1452,7 +1476,8 @@ void uiTemplatePreview(
UI_but_func_drawextra_set(block, ED_preview_draw, pparent, slot);
UI_block_func_handle_set(block, do_preview_buttons, NULL);
uiDefIconButS(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height,
uiDefIconButS(
block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height,
UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, "");
/* add buttons */
@@ -1601,16 +1626,19 @@ static void colorband_buttons_layout(
UI_block_align_begin(block);
row = uiLayoutRow(split, false);
bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL,
bt = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL,
0, 0, 0, 0, TIP_("Add a new color stop to the colorband"));
UI_but_funcN_set(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
bt = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Delete the active position"));
UI_but_funcN_set(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
bt = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
UI_but_funcN_set(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
@@ -2012,7 +2040,8 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, UI_BTYPE_LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
bt = uiDefButBitI(block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
bt = uiDefButBitI(
block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
UI_but_func_set(bt, curvemap_buttons_setclip, cumap, NULL);
@@ -2272,10 +2301,12 @@ static void curvemap_buttons_layout(
if (brush)
bt = uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
else if (neg_slope)
bt = uiDefIconBlockBut(block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER,
bt = uiDefIconBlockBut(
block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER,
0, 0, dx, dx, TIP_("Tools"));
else
bt = uiDefIconBlockBut(block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER,
bt = uiDefIconBlockBut(
block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER,
0, 0, dx, dx, TIP_("Tools"));
UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -2406,15 +2437,18 @@ void uiTemplateColorPicker(
switch (U.color_picker_type) {
case USER_CP_SQUARE_SV:
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
-1, 0.0, 0.0, UI_GRAD_SV, 0, "");
break;
case USER_CP_SQUARE_HS:
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
-1, 0.0, 0.0, UI_GRAD_HS, 0, "");
break;
case USER_CP_SQUARE_HV:
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
-1, 0.0, 0.0, UI_GRAD_HV, 0, "");
break;
@@ -2422,7 +2456,8 @@ void uiTemplateColorPicker(
case USER_CP_CIRCLE_HSV:
case USER_CP_CIRCLE_HSL:
default:
but = uiDefButR_prop(block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
-1, 0.0, 0.0, 0, 0, "");
break;
@@ -2449,22 +2484,26 @@ void uiTemplateColorPicker(
switch (U.color_picker_type) {
case USER_CP_CIRCLE_HSL:
uiItemS(row);
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
-1, softmin, softmax, UI_GRAD_L_ALT, 0, "");
break;
case USER_CP_SQUARE_SV:
uiItemS(col);
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
-1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
break;
case USER_CP_SQUARE_HS:
uiItemS(col);
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
-1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
break;
case USER_CP_SQUARE_HV:
uiItemS(col);
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
-1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
break;
@@ -2472,7 +2511,8 @@ void uiTemplateColorPicker(
case USER_CP_CIRCLE_HSV:
default:
uiItemS(row);
but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
but = uiDefButR_prop(
block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
-1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
break;
}
@@ -2524,7 +2564,8 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname,
}
RNA_pointer_create(&palette->id, &RNA_PaletteColor, color, &color_ptr);
uiDefButR(block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0,
uiDefButR(
block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0,
UI_PALETTE_COLOR, col_id, "");
row_cols++;
col_id++;
@@ -2689,7 +2730,8 @@ void uiTemplateGameStates(
else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, state))
icon = ICON_LAYER_USED;
but = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop,
but = uiDefIconButR_prop(
block, UI_BTYPE_ICON_TOGGLE, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop,
state, 0, 0, -1, -1, sca_state_name_get(ob, state));
UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state));
but->type = UI_BTYPE_TOGGLE;
@@ -2757,7 +2799,8 @@ static int cmpstringp(const void *p1, const void *p2)
return BLI_strcasecmp(((StringCmp *) p1)->name, ((StringCmp *) p2)->name);
}
static void uilist_filter_items_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr,
static void uilist_filter_items_default(
struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr,
const char *propname)
{
uiListDyn *dyn_data = ui_list->dyn_data;
@@ -3200,7 +3243,8 @@ void uiTemplateList(
/* list item behind label & other buttons */
sub = uiLayoutRow(overlap, false);
but = uiDefButR_prop(subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
but = uiDefButR_prop(
subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
active_dataptr, activeprop, 0, 0, org_i, 0, 0,
TIP_("Double click to rename"));
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr, item_dyntip_propname))) {
@@ -3258,7 +3302,8 @@ void uiTemplateList(
/* next/prev button */
BLI_snprintf(numstr, sizeof(numstr), "%d :", dyn_data->items_shown);
but = uiDefIconTextButR_prop(block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
but = uiDefIconTextButR_prop(
block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
active_dataptr, activeprop, 0, 0, 0, 0, 0, "");
if (dyn_data->items_shown == 0)
UI_but_flag_enable(but, UI_BUT_DISABLED);

View File

@@ -316,7 +316,8 @@ int UI_calc_float_precision(int prec, double value)
bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
{
if (but->rnapoin.id.data && but->rnapoin.data && but->rnaprop) {
BLI_snprintf(r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type),
BLI_snprintf(
r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type),
RNA_property_identifier(but->rnaprop));
return true;
}

View File

@@ -358,12 +358,15 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re
float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize;
const int hnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
const int hnum = (
(roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
(roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
const int vnum = (
(roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
(roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
minsize = min_ii(BLI_rcti_size_x(rect) * hnum,
minsize = min_ii(
BLI_rcti_size_x(rect) * hnum,
BLI_rcti_size_y(rect) * vnum);
if (2.0f * rad > minsize)
@@ -769,10 +772,12 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
float triangle_strip[WIDGET_SIZE_MAX * 2 + 2][2]; /* + 2 because the last pair is wrapped */
float triangle_strip_emboss[WIDGET_SIZE_MAX * 2][2]; /* only for emboss */
const unsigned char tcol[4] = {wcol->outline[0],
const unsigned char tcol[4] = {
wcol->outline[0],
wcol->outline[1],
wcol->outline[2],
wcol->outline[3] / WIDGET_AA_JITTER};
wcol->outline[3] / WIDGET_AA_JITTER,
};
unsigned char emboss[4];
widget_verts_to_triangle_strip(wtb, wtb->totvert, triangle_strip);
@@ -810,10 +815,12 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
/* decoration */
if (wtb->tria1.tot || wtb->tria2.tot) {
const unsigned char tcol[4] = {wcol->item[0],
const unsigned char tcol[4] = {
wcol->item[0],
wcol->item[1],
wcol->item[2],
(unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)};
(unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER),
};
glColor4ubv(tcol);
/* for each AA step */
@@ -1272,7 +1279,8 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
/* once the label's gone, chop off the least significant digits */
if (but->strwidth > okwidth) {
float strwidth;
drawstr_len = BLF_width_to_strlen(fstyle->uifont_id, but->drawstr + but->ofs,
drawstr_len = BLF_width_to_strlen(
fstyle->uifont_id, but->drawstr + but->ofs,
drawstr_len - but->ofs, okwidth, &strwidth) + but->ofs;
but->strwidth = strwidth;
but->drawstr[drawstr_len] = 0;
@@ -1299,7 +1307,8 @@ static void widget_draw_text_ime_underline(
ofs_x = 0;
}
width = BLF_width(fstyle->uifont_id, drawstr + but->ofs,
width = BLF_width(
fstyle->uifont_id, drawstr + but->ofs,
ime_data->composite_len + but->pos - but->ofs);
glColor4ubv((unsigned char *)wcol->text);
@@ -1317,7 +1326,8 @@ static void widget_draw_text_ime_underline(
ofs_x = 0;
}
width = BLF_width(fstyle->uifont_id, drawstr + but->ofs,
width = BLF_width(
fstyle->uifont_id, drawstr + but->ofs,
sel_end + sel_start - but->ofs);
UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 2);
@@ -1371,7 +1381,8 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
if (ime_data && ime_data->composite_len) {
/* insert composite string into cursor pos */
BLI_snprintf((char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s",
BLI_snprintf(
(char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s",
but->editstr, ime_data->str_composite,
but->editstr + but->pos);
}
@@ -1504,7 +1515,8 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
/* for underline drawing */
float font_xofs, font_yofs;
UI_fontstyle_draw_ex(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') {
@@ -2275,7 +2287,8 @@ static void ui_hsv_cursor(float x, float y)
glPopMatrix();
}
void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect,
void ui_hsvcircle_vals_from_pos(
float *val_rad, float *val_dist, const rcti *rect,
const float mx, const float my)
{
/* duplication of code... well, simple is better now */

View File

@@ -1638,7 +1638,8 @@ View2DScrollers *UI_view2d_scrollers_calc(
scrollers->yclamp = yclamp;
scrollers->yunits = yunits;
scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d,
scrollers->grid = UI_view2d_grid_calc(
CTX_data_scene(C), v2d,
xunits, xclamp, yunits, yclamp,
BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert));
}
@@ -2008,11 +2009,13 @@ void UI_view2d_listview_visible_cells(
/* using 'cur' rect coordinates, call the cell-getting function to get the cells for this */
if (v2d) {
/* min */
UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty,
UI_view2d_listview_view_to_cell(
v2d, columnwidth, rowheight, startx, starty,
v2d->cur.xmin, v2d->cur.ymin, column_min, row_min);
/* max*/
UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty,
UI_view2d_listview_view_to_cell(
v2d, columnwidth, rowheight, startx, starty,
v2d->cur.xmax, v2d->cur.ymax, column_max, row_max);
}
}
@@ -2423,12 +2426,14 @@ void UI_view2d_text_cache_draw(ARegion *ar)
}
if (v2s->rect.xmin >= v2s->rect.xmax)
BLF_draw_default((float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0,
BLF_draw_default(
(float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0,
v2s->str, BLF_DRAW_STR_DUMMY_MAX);
else {
BLF_clipping_default(v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
BLF_enable_default(BLF_CLIPPING);
BLF_draw_default(v2s->rect.xmin + xofs, v2s->rect.ymin + yofs, 0.0f,
BLF_draw_default(
v2s->rect.xmin + xofs, v2s->rect.ymin + yofs, 0.0f,
v2s->str, BLF_DRAW_STR_DUMMY_MAX);
BLF_disable_default(BLF_CLIPPING);
}

View File

@@ -187,7 +187,8 @@ static void view_pan_apply(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd = op->customdata;
view_pan_apply_ex(C, vpd,
view_pan_apply_ex(
C, vpd,
RNA_int_get(op->ptr, "deltax"),
RNA_int_get(op->ptr, "deltay"));
@@ -733,7 +734,8 @@ static void view_zoomstep_apply_ex(
static void view_zoomstep_apply(bContext *C, wmOperator *op)
{
v2dViewZoomData *vzd = op->customdata;
view_zoomstep_apply_ex(C, vzd, true,
view_zoomstep_apply_ex(
C, vzd, true,
RNA_float_get(op->ptr, "zoomfacx"),
RNA_float_get(op->ptr, "zoomfacy"));
}
@@ -788,7 +790,8 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
UI_view2d_region_to_view(
&ar->v2d,
event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -853,7 +856,8 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
UI_view2d_region_to_view(
&ar->v2d,
event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -1056,7 +1060,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
UI_view2d_region_to_view(
&ar->v2d,
event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -1345,7 +1350,8 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
vzd = op->customdata;
view_zoomstep_apply_ex(C, vzd, false,
view_zoomstep_apply_ex(
C, vzd, false,
do_zoom_xy[0] ? zoom_factor : 0.0f,
do_zoom_xy[1] ? zoom_factor : 0.0f);
@@ -1392,13 +1398,17 @@ struct SmoothView2DStore {
*/
static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
{
const float size_a[2] = {BLI_rctf_size_x(rect_a),
const float size_a[2] = {
BLI_rctf_size_x(rect_a),
BLI_rctf_size_y(rect_a)};
const float size_b[2] = {BLI_rctf_size_x(rect_b),
const float size_b[2] = {
BLI_rctf_size_x(rect_b),
BLI_rctf_size_y(rect_b)};
const float cent_a[2] = {BLI_rctf_cent_x(rect_a),
const float cent_a[2] = {
BLI_rctf_cent_x(rect_a),
BLI_rctf_cent_y(rect_a)};
const float cent_b[2] = {BLI_rctf_cent_x(rect_b),
const float cent_b[2] = {
BLI_rctf_cent_x(rect_b),
BLI_rctf_cent_y(rect_b)};
float fac_max = 0.0f;
@@ -1699,7 +1709,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(event->mval[0],
vsm->zone = mouse_in_scroller_handle(
event->mval[0],
v2d->hor.xmin, v2d->hor.xmax,
scrollers->hor_min, scrollers->hor_max);
@@ -1720,7 +1731,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(event->mval[1],
vsm->zone = mouse_in_scroller_handle(
event->mval[1],
v2d->vert.ymin, v2d->vert.ymax,
scrollers->vert_min, scrollers->vert_max);