diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-01 20:57:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-01 21:12:07 +0300 |
commit | 26c5a1c301d3d554c4b1244b219f9883249f382d (patch) | |
tree | 57e70c82e8a594eb7592e2c06fe46d0a7a2cd5d8 /source/blender/editors/interface | |
parent | 71e65daf5c15ef54eb61b998d5b7ccfe14bd2816 (diff) |
Cleanup: right shift in interface code
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 29 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 30 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 60 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 15 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 24 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 29 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_query.c | 14 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_region_search.c | 15 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 265 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_utils.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 67 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 27 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 76 |
13 files changed, 387 insertions, 269 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 645f776db17..e5c3ebf2695 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -961,10 +961,11 @@ 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, - sizeof(but->strdata), - "%s" UI_SEP_CHAR_S "%s", - butstr_orig, shortcut_str); + BLI_snprintf( + but->strdata, + sizeof(but->strdata), + "%s" UI_SEP_CHAR_S "%s", + butstr_orig, shortcut_str); MEM_freeN(butstr_orig); but->str = but->strdata; but->flag |= UI_BUT_HAS_SEP_CHAR; @@ -2119,8 +2120,9 @@ 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, - unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad); + bUnit_AsString( + str, len_max, ui_get_but_scale_unit(but, value), precision, + unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad); } static float ui_get_but_step_unit(uiBut *but, float step_default) @@ -2337,8 +2339,9 @@ 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, - ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type)); + 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,12 +3394,14 @@ 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, - UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description); + 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, - UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description); + 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); } } } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 17dc9710756..50cd1c544c4 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -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,8 +161,9 @@ 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}}; + 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; float coltop[3], coldown[3], color[4]; @@ -267,8 +270,9 @@ 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}}; + 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; float colLeft[3], colRight[3], color[4]; @@ -1526,10 +1530,11 @@ 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, - scopes->track_search, scopes->track, - &scopes->undist_marker, true, scopes->use_track_mask, - width, height, scopes->track_pos); + 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); if (tmpibuf) { if (tmpibuf->rect_float) IMB_rect_from_float(tmpibuf); @@ -1556,8 +1561,9 @@ 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, - drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect); + glaDrawPixelsSafe( + rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, + drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect); /* draw cross for pixel position */ glTranslatef(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1], 0.f); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index a529568ccc9..06b6099cec7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -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,10 +1389,11 @@ 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, - ui_handler_region_drag_toggle, - ui_handler_region_drag_toggle_remove, - drag_info, false); + WM_event_remove_ui_handler( + &win->modalhandlers, + ui_handler_region_drag_toggle, + ui_handler_region_drag_toggle_remove, + drag_info, false); ui_handler_region_drag_toggle_remove(C, drag_info); WM_event_add_mousemove(C); @@ -3364,13 +3367,15 @@ static void ui_do_but_textedit( } break; case RIGHTARROWKEY: - ui_textedit_move(but, data, STRCUR_DIR_NEXT, - event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + 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, - event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + 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; case WHEELDOWNMOUSE: @@ -3387,8 +3392,9 @@ static void ui_do_but_textedit( } ATTR_FALLTHROUGH; case ENDKEY: - ui_textedit_move(but, data, STRCUR_DIR_NEXT, - event->shift != 0, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_NEXT, + event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; case WHEELUPMOUSE: @@ -3405,8 +3411,9 @@ static void ui_do_but_textedit( } ATTR_FALLTHROUGH; case HOMEKEY: - ui_textedit_move(but, data, STRCUR_DIR_PREV, - event->shift != 0, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_PREV, + event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; case PADENTER: @@ -3415,14 +3422,16 @@ static void ui_do_but_textedit( retval = WM_UI_HANDLER_BREAK; break; case DELKEY: - changed = ui_textedit_delete(but, data, 1, - event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + 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, - event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + changed = ui_textedit_delete( + but, data, 0, + event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; @@ -3437,10 +3446,12 @@ 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, - false, STRCUR_JUMP_ALL); - ui_textedit_move(but, data, STRCUR_DIR_NEXT, - true, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_PREV, + false, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_NEXT, + true, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; } break; @@ -9773,8 +9784,9 @@ 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, - ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove); + WM_event_free_ui_handler_all( + C, &win->modalhandlers, + ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove); } #endif diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index d7a892e0e01..e830d70e308 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -700,8 +700,9 @@ 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", - WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL); + 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) { but = uiDefButR_prop(block, UI_BTYPE_KEY_EVENT, 0, name, x, y, w, h, ptr, prop, index, 0, 0, -1, -1, NULL); @@ -1085,8 +1086,9 @@ 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, - 0.0, 0.0, 0, 0, ""); + 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,8 +2088,9 @@ 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, - RNA_struct_ui_description(ot->srna), true); + 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 */ if ((layout->root->block->flag & UI_BLOCK_LOOP) && diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 4f5e7a67367..a1dbbfd037b 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -806,9 +806,10 @@ static int editsource_exec(bContext *C, wmOperator *op) if (but_store) { if (but_store->py_dbg_ln != -1) { - ret = editsource_text_edit(C, op, - but_store->py_dbg_fn, - but_store->py_dbg_ln); + ret = editsource_text_edit( + C, op, + but_store->py_dbg_fn, + but_store->py_dbg_ln); } else { BKE_report(op->reports, RPT_ERROR, "Active button is not from a script, cannot edit source"); @@ -916,14 +917,18 @@ 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 " - "Directory' path to a valid directory"); + 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 " - "in the User Preferences", EDTSRC_I18N_OP_NAME); + 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; } /* Try to find a valid po file for current language... */ @@ -934,8 +939,9 @@ 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, - &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL); + 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); RNA_string_set(&ptr, "lang", uilng); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d4180567022..744f6b3c4d0 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -620,9 +620,10 @@ 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), - (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED, - (block->aspect / UI_DPI_FAC), 1.0f); + 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,18 +1756,21 @@ 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, - tab_curve_radius - px, roundboxtype, true, true, NULL); + 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, - tab_curve_radius, roundboxtype, true, true, NULL); + 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, - tab_curve_radius, roundboxtype, true, false, - is_active ? theme_col_back : theme_col_tab_inactive); + 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); } /* tab blackline */ @@ -1779,8 +1783,9 @@ 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_width, NULL); + category_draw_len = BLF_width_to_strlen( + fontid, category_id_draw, category_draw_len, + category_width, NULL); } BLF_position(fontid, rct->xmax - text_v_ofs, rct->ymin + tab_v_pad_text, 0.0f); diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index 5d6d03ece60..f7dbb9b14ed 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -38,16 +38,18 @@ bool ui_but_is_editable(const uiBut *but) { - return !ELEM(but->type, - UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, - UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR); + 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, - UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, - UI_BTYPE_SEARCH_MENU); + return ELEM( + but->type, + UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, + UI_BTYPE_SEARCH_MENU); } diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index c9d313a4bab..8d4389c73e6 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -418,8 +418,9 @@ 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], - (a == data->active) ? UI_ACTIVE : 0); + ui_draw_preview_item( + &data->fstyle, &rect, data->items.names[a], data->items.icons[a], + (a == data->active) ? UI_ACTIVE : 0); } /* indicate more */ @@ -443,8 +444,9 @@ 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], - (a == data->active) ? UI_ACTIVE : 0, data->use_sep); + ui_draw_menu_item( + &data->fstyle, &rect, data->items.names[a], data->items.icons[a], + (a == data->active) ? UI_ACTIVE : 0, data->use_sep); } /* indicate more */ @@ -718,8 +720,9 @@ 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), - data->items.icons[a], state, false); + 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); } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 174e5f13f66..bd4bb032717 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -276,8 +276,9 @@ 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, - template_ui.prv_rows, template_ui.prv_cols, ""); + 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, &template_ui, id_search_call_cb, idptr.data); @@ -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,10 +499,12 @@ 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, - 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_HAS_ICON | UI_BUT_ICON_PREVIEW); + 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_HAS_ICON | UI_BUT_ICON_PREVIEW); if ((idfrom && idfrom->lib) || !editable) UI_but_flag_enable(but, UI_BUT_DISABLED); @@ -508,8 +512,9 @@ 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, - TIP_(template_id_browse_tip(type))); + 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 */ UI_but_drag_set_id(but, id); @@ -526,20 +531,23 @@ 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, - &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type)); + 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, - NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change")); + 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, - NULL, 0, 0, 0, 0, TIP_("Direct linked library data-block, click to make local")); + 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,9 +561,10 @@ static void template_ID( numstr_len = BLI_snprintf(numstr, sizeof(numstr), "%d", id->us); - 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 = 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; UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ALONE)); @@ -581,41 +590,47 @@ 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_I18NCONTEXT_ID_SCENE, - BLT_I18NCONTEXT_ID_OBJECT, - BLT_I18NCONTEXT_ID_MESH, - BLT_I18NCONTEXT_ID_CURVE, - BLT_I18NCONTEXT_ID_METABALL, - BLT_I18NCONTEXT_ID_MATERIAL, - BLT_I18NCONTEXT_ID_TEXTURE, - BLT_I18NCONTEXT_ID_IMAGE, - BLT_I18NCONTEXT_ID_LATTICE, - BLT_I18NCONTEXT_ID_LAMP, - BLT_I18NCONTEXT_ID_CAMERA, - BLT_I18NCONTEXT_ID_WORLD, - BLT_I18NCONTEXT_ID_SCREEN, - BLT_I18NCONTEXT_ID_TEXT, + BLT_I18N_MSGID_MULTI_CTXT( + "New", + BLT_I18NCONTEXT_DEFAULT, + BLT_I18NCONTEXT_ID_SCENE, + BLT_I18NCONTEXT_ID_OBJECT, + BLT_I18NCONTEXT_ID_MESH, + BLT_I18NCONTEXT_ID_CURVE, + BLT_I18NCONTEXT_ID_METABALL, + BLT_I18NCONTEXT_ID_MATERIAL, + BLT_I18NCONTEXT_ID_TEXTURE, + BLT_I18NCONTEXT_ID_IMAGE, + BLT_I18NCONTEXT_ID_LATTICE, + BLT_I18NCONTEXT_ID_LAMP, + BLT_I18NCONTEXT_ID_CAMERA, + BLT_I18NCONTEXT_ID_WORLD, + BLT_I18NCONTEXT_ID_SCREEN, + BLT_I18NCONTEXT_ID_TEXT, ); - BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_ID_SPEAKER, - BLT_I18NCONTEXT_ID_SOUND, - BLT_I18NCONTEXT_ID_ARMATURE, - BLT_I18NCONTEXT_ID_ACTION, - BLT_I18NCONTEXT_ID_NODETREE, - BLT_I18NCONTEXT_ID_BRUSH, - BLT_I18NCONTEXT_ID_PARTICLESETTINGS, - BLT_I18NCONTEXT_ID_GPENCIL, - BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, + BLT_I18N_MSGID_MULTI_CTXT( + "New", + BLT_I18NCONTEXT_ID_SPEAKER, + BLT_I18NCONTEXT_ID_SOUND, + BLT_I18NCONTEXT_ID_ARMATURE, + BLT_I18NCONTEXT_ID_ACTION, + BLT_I18NCONTEXT_ID_NODETREE, + BLT_I18NCONTEXT_ID_BRUSH, + BLT_I18NCONTEXT_ID_PARTICLESETTINGS, + BLT_I18NCONTEXT_ID_GPENCIL, + BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, ); if (newop) { - 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); + 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"), - 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + 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,8 +641,9 @@ 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, - UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack")); + 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); RNA_string_set(but->opptr, "id_name", id->name + 2); @@ -638,13 +654,15 @@ 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"), - 0, 0, w, UI_UNIT_Y, NULL); + 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, - NULL, 0, 0, 0, 0, NULL); + 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,9 +683,10 @@ 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, - TIP_("Unlink data-block " - "(Shift + Click to set users to zero, data will then not be saved)")); + 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)); if (RNA_property_flag(template_ui->prop) & PROP_NEVER_NULL) { @@ -743,8 +762,9 @@ 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_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0, filter); + ui_template_id( + layout, C, ptr, propname, newop, openop, unlinkop, + UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0, filter); } void uiTemplateIDBrowse( @@ -758,8 +778,9 @@ 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_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols, filter); + 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); } /************************ ID Chooser Template ***************************/ @@ -832,8 +853,9 @@ 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), - const char *text) +void uiTemplatePathBuilder( + uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr), + const char *text) { PropertyRNA *propPath; uiLayout *row; @@ -938,8 +960,9 @@ 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, - TIP_("Convert virtual modifier to a real modifier")); + 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); } else { @@ -995,9 +1018,10 @@ 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, - 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")); + 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); } else if (mti->type != eModifierTypeType_Constructive) { @@ -1452,8 +1476,9 @@ 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, - UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, ""); + 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 */ if (pid && show_buttons) { @@ -1601,17 +1626,20 @@ 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, - 0, 0, 0, 0, TIP_("Add a new color stop to the colorband")); + 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, - NULL, 0, 0, 0, 0, TIP_("Delete the active position")); + 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, - NULL, 0, 0, 0, 0, TIP_("Flip the color ramp")); + 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); bt = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_colorband", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, xs + 6.0f * unit, ys + UI_UNIT_Y, UI_UNIT_X, UI_UNIT_Y, NULL); @@ -2012,8 +2040,9 @@ 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"), - 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, ""); + 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); UI_block_align_begin(block); @@ -2272,11 +2301,13 @@ 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, - 0, 0, dx, dx, TIP_("Tools")); + 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, - 0, 0, dx, dx, TIP_("Tools")); + 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,24 +2437,28 @@ 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, - -1, 0.0, 0.0, UI_GRAD_SV, 0, ""); + 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, - -1, 0.0, 0.0, UI_GRAD_HS, 0, ""); + 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, - -1, 0.0, 0.0, UI_GRAD_HV, 0, ""); + 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; /* user default */ 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, - -1, 0.0, 0.0, 0, 0, ""); + 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,31 +2484,36 @@ 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, - -1, softmin, softmax, UI_GRAD_L_ALT, 0, ""); + 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, - -1, softmin, softmax, UI_GRAD_SV + 3, 0, ""); + 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, - -1, softmin, softmax, UI_GRAD_HS + 3, 0, ""); + 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, - -1, softmin, softmax, UI_GRAD_HV + 3, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, + -1, softmin, softmax, UI_GRAD_HV + 3, 0, ""); break; /* user default */ 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, - -1, softmin, softmax, UI_GRAD_V_ALT, 0, ""); + 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,8 +2564,9 @@ 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, - UI_PALETTE_COLOR, col_id, ""); + 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,8 +2730,9 @@ 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, - state, 0, 0, -1, -1, sca_state_name_get(ob, state)); + 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,8 +2799,9 @@ 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, - const char *propname) +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; PropertyRNA *prop = RNA_struct_find_property(dataptr, propname); @@ -3200,9 +3243,10 @@ 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, - active_dataptr, activeprop, 0, 0, org_i, 0, 0, - TIP_("Double click to rename")); + 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))) { UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data); } @@ -3258,8 +3302,9 @@ 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, - active_dataptr, activeprop, 0, 0, 0, 0, 0, ""); + 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); break; diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 28aecc14035..1aa6f045266 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -316,8 +316,9 @@ 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), - RNA_property_identifier(but->rnaprop)); + BLI_snprintf( + r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type), + RNA_property_identifier(but->rnaprop)); return true; } else if (but->optype) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 92c7f13f140..a7de70629d1 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -358,13 +358,16 @@ 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) || - (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) || - (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; + 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) || + (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, - BLI_rcti_size_y(rect) * vnum); + minsize = min_ii( + BLI_rcti_size_x(rect) * hnum, + BLI_rcti_size_y(rect) * vnum); if (2.0f * rad > minsize) rad = 0.5f * 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], - wcol->outline[1], - wcol->outline[2], - wcol->outline[3] / WIDGET_AA_JITTER}; + const unsigned char tcol[4] = { + wcol->outline[0], + wcol->outline[1], + wcol->outline[2], + 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], - wcol->item[1], - wcol->item[2], - (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)}; + const unsigned char tcol[4] = { + wcol->item[0], + wcol->item[1], + wcol->item[2], + (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER), + }; glColor4ubv(tcol); /* for each AA step */ @@ -1272,8 +1279,9 @@ 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 - but->ofs, okwidth, &strwidth) + 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,8 +1307,9 @@ static void widget_draw_text_ime_underline( ofs_x = 0; } - width = BLF_width(fstyle->uifont_id, drawstr + but->ofs, - ime_data->composite_len + but->pos - but->ofs); + width = BLF_width( + fstyle->uifont_id, drawstr + but->ofs, + ime_data->composite_len + but->pos - but->ofs); glColor4ubv((unsigned char *)wcol->text); UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 1); @@ -1317,8 +1326,9 @@ static void widget_draw_text_ime_underline( ofs_x = 0; } - width = BLF_width(fstyle->uifont_id, drawstr + but->ofs, - sel_end + sel_start - 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,9 +1381,10 @@ 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", - but->editstr, ime_data->str_composite, - but->editstr + but->pos); + BLI_snprintf( + (char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s", + but->editstr, ime_data->str_composite, + but->editstr + but->pos); } else #endif @@ -1504,8 +1515,9 @@ 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, - drawstr_left_len - but->ofs, &font_xofs, &font_yofs); + UI_fontstyle_draw_ex( + fstyle, rect, drawstr + but->ofs, + drawstr_left_len - but->ofs, &font_xofs, &font_yofs); if (but->menu_key != '\0') { char fixedbuf[128]; @@ -2275,8 +2287,9 @@ 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, - const float mx, const float my) +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 */ const float centx = BLI_rcti_cent_x_fl(rect); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 9de0e9b88ed..299001d4e45 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1638,9 +1638,10 @@ View2DScrollers *UI_view2d_scrollers_calc( scrollers->yclamp = yclamp; scrollers->yunits = yunits; - 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)); + 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)); } /* return scrollers */ @@ -2008,12 +2009,14 @@ 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, - v2d->cur.xmin, v2d->cur.ymin, column_min, row_min); + 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, - v2d->cur.xmax, v2d->cur.ymax, column_max, row_max); + UI_view2d_listview_view_to_cell( + v2d, columnwidth, rowheight, startx, starty, + v2d->cur.xmax, v2d->cur.ymax, column_max, row_max); } } @@ -2423,13 +2426,15 @@ 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, - v2s->str, BLF_DRAW_STR_DUMMY_MAX); + 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, - v2s->str, BLF_DRAW_STR_DUMMY_MAX); + 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); } } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 8fff2957fa7..b9504a3a96b 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -187,9 +187,10 @@ static void view_pan_apply(bContext *C, wmOperator *op) { v2dViewPanData *vpd = op->customdata; - view_pan_apply_ex(C, vpd, - RNA_int_get(op->ptr, "deltax"), - RNA_int_get(op->ptr, "deltay")); + view_pan_apply_ex( + C, vpd, + RNA_int_get(op->ptr, "deltax"), + RNA_int_get(op->ptr, "deltay")); } @@ -733,9 +734,10 @@ 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, - RNA_float_get(op->ptr, "zoomfacx"), - RNA_float_get(op->ptr, "zoomfacy")); + view_zoomstep_apply_ex( + C, vzd, true, + RNA_float_get(op->ptr, "zoomfacx"), + RNA_float_get(op->ptr, "zoomfacy")); } /* --------------- Individual Operators ------------------- */ @@ -788,9 +790,10 @@ 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, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } return view_zoomin_exec(C, op); @@ -853,9 +856,10 @@ 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, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } return view_zoomout_exec(C, op); @@ -1056,9 +1060,10 @@ 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, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } if (v2d->keepofs & V2D_LOCKOFS_X) @@ -1345,9 +1350,10 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event) vzd = op->customdata; - view_zoomstep_apply_ex(C, vzd, false, - do_zoom_xy[0] ? zoom_factor : 0.0f, - do_zoom_xy[1] ? zoom_factor : 0.0f); + view_zoomstep_apply_ex( + C, vzd, false, + do_zoom_xy[0] ? zoom_factor : 0.0f, + do_zoom_xy[1] ? zoom_factor : 0.0f); view_zoomstep_exit(op); } @@ -1392,14 +1398,18 @@ 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), - BLI_rctf_size_y(rect_a)}; - 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), - BLI_rctf_cent_y(rect_a)}; - const float cent_b[2] = {BLI_rctf_cent_x(rect_b), - BLI_rctf_cent_y(rect_b)}; + 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), + BLI_rctf_size_y(rect_b)}; + 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), + BLI_rctf_cent_y(rect_b)}; float fac_max = 0.0f; float tfac; @@ -1699,9 +1709,10 @@ 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], - v2d->hor.xmin, v2d->hor.xmax, - scrollers->hor_min, scrollers->hor_max); + vsm->zone = mouse_in_scroller_handle( + event->mval[0], + v2d->hor.xmin, v2d->hor.xmax, + scrollers->hor_min, scrollers->hor_max); if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ @@ -1720,9 +1731,10 @@ 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], - v2d->vert.ymin, v2d->vert.ymax, - scrollers->vert_min, scrollers->vert_max); + vsm->zone = mouse_in_scroller_handle( + event->mval[1], + v2d->vert.ymin, v2d->vert.ymax, + scrollers->vert_min, scrollers->vert_max); if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ |