diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-05-04 20:13:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-05-04 22:19:48 +0300 |
commit | 7478eb9bd09965f7d27064b500c91322f4fe3f14 (patch) | |
tree | 1315beeaf8336d85190c5516ce12e988e66b2c9b /source/blender | |
parent | cc81b58277dcea68587d3ff2f4a3ee8a6b28c074 (diff) |
Cleanup: wrapped function indentation
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface.c | 23 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 128 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 15 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 24 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 39 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 9 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 29 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 82 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_utils.c | 7 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 10 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 199 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 10 |
15 files changed, 345 insertions, 245 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5c548d3afd5..b63871f5c82 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3105,9 +3105,10 @@ void ui_block_cm_to_scene_linear_v3(uiBlock *block, float pixel[3]) * - \a a2 Number of decimal point values to display. 0 defaults to 3 (0.000) * 1,2,3, and a maximum of 4, all greater values will be clamped to 4. */ -static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, - int x, int y, short width, short height, - void *poin, float min, float max, float a1, float a2, const char *tip) +static uiBut *ui_def_but( + uiBlock *block, int type, int retval, const char *str, + int x, int y, short width, short height, + void *poin, float min, float max, float a1, float a2, const char *tip) { uiBut *but; int slen; @@ -3375,10 +3376,11 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu * When this kind of change won't disrupt branches, best look into making more * of our UI functions take prop rather then propname. */ -static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, - int x, int y, short width, short height, - PointerRNA *ptr, PropertyRNA *prop, int index, - float min, float max, float a1, float a2, const char *tip) +static uiBut *ui_def_but_rna( + uiBlock *block, int type, int retval, const char *str, + int x, int y, short width, short height, + PointerRNA *ptr, PropertyRNA *prop, int index, + float min, float max, float a1, float a2, const char *tip) { const PropertyType proptype = RNA_property_type(prop); uiBut *but; @@ -4386,9 +4388,10 @@ static void operator_enum_call_cb(struct bContext *UNUSED(C), void *but, void *a /* Same parameters as for uiDefSearchBut, with additional operator type and properties, used by callback * to call again the right op with the right options (properties values). */ -uiBut *uiDefSearchButO_ptr(uiBlock *block, wmOperatorType *ot, IDProperty *properties, - void *arg, int retval, int icon, int maxlen, int x, int y, - short width, short height, float a1, float a2, const char *tip) +uiBut *uiDefSearchButO_ptr( + uiBlock *block, wmOperatorType *ot, IDProperty *properties, + void *arg, int retval, int icon, int maxlen, int x, int y, + short width, short height, float a1, float a2, const char *tip) { uiBut *but; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 414903fa194..e2504bbc743 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -508,8 +508,9 @@ static void draw_scope_end(const rctf *rect, GLint *scissor) UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f); } -static void histogram_draw_one(float r, float g, float b, float alpha, - float x, float y, float w, float h, const float *data, int res, const bool is_line) +static void histogram_draw_one( + float r, float g, float b, float alpha, + float x, float y, float w, float h, const float *data, int res, const bool is_line) { int i; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 7ed02c9e83e..9ee263846a4 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -52,9 +52,9 @@ #include "BLI_linklist.h" #include "BLI_string.h" #include "BLI_string_utf8.h" +#include "BLI_string_cursor_utf8.h" #include "BLI_rect.h" #include "BLI_utildefines.h" -#include "BLI_string_cursor_utf8.h" #include "BLF_translation.h" @@ -328,8 +328,9 @@ static uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, c static uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event); static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type); static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state); -static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *data, - const bool mousemove, const bool onfree); +static void button_activate_exit( + bContext *C, uiBut *but, uiHandleButtonData *data, + const bool mousemove, const bool onfree); static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *userdata); static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type); @@ -477,10 +478,9 @@ static float ui_mouse_scale_warp_factor(const bool shift) return shift ? 0.05f : 1.0f; } -static void ui_mouse_scale_warp(uiHandleButtonData *data, - const float mx, const float my, - float *r_mx, float *r_my, - const bool shift) +static void ui_mouse_scale_warp( + uiHandleButtonData *data, const float mx, const float my, + float *r_mx, float *r_my, const bool shift) { const float fac = ui_mouse_scale_warp_factor(shift); @@ -1063,8 +1063,9 @@ typedef struct uiDragToggleHandle { int xy_last[2]; } uiDragToggleHandle; -static bool ui_drag_toggle_set_xy_xy(bContext *C, ARegion *ar, const bool is_set, const eButType but_type_start, - const int xy_src[2], const int xy_dst[2]) +static bool ui_drag_toggle_set_xy_xy( + bContext *C, ARegion *ar, const bool is_set, const eButType but_type_start, + const int xy_src[2], const int xy_dst[2]) { /* popups such as layers won't re-evaluate on redraw */ const bool do_check = (ar->regiontype == RGN_TYPE_TEMPORARY); @@ -2183,8 +2184,9 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, /* this is used for both utf8 and ascii, its meant to be used for single keys, * notice the buffer is either copied or not, so its not suitable for pasting in * - campbell */ -static bool ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data, - const char *utf8_buf, int utf8_buf_len) +static bool ui_textedit_type_buf( + uiBut *but, uiHandleButtonData *data, + const char *utf8_buf, int utf8_buf_len) { char *str; int len; @@ -2228,8 +2230,9 @@ static bool ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char as return ui_textedit_type_buf(but, data, buf, 1); } -static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJumpDirection direction, - const bool select, strCursorJumpType jump) +static void ui_textedit_move( + uiBut *but, uiHandleButtonData *data, strCursorJumpDirection direction, + const bool select, strCursorJumpType jump) { const char *str = data->str; const int len = strlen(str); @@ -3128,9 +3131,13 @@ int ui_but_menu_direction(uiBut *but) return 0; } -/* Hack for uiList UI_BTYPE_LISTROW buttons to "give" events to overlaying UI_BTYPE_TEXT buttons (cltr-clic rename feature & co). */ -static uiBut *ui_but_list_row_text_activate(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event, - uiButtonActivateType activate_type) +/** + * Hack for uiList UI_BTYPE_LISTROW buttons to "give" events to overlaying UI_BTYPE_TEXT buttons + * (cltr-clic rename feature & co). + */ +static uiBut *ui_but_list_row_text_activate( + bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event, + uiButtonActivateType activate_type) { ARegion *ar = CTX_wm_region(C); uiBut *labelbut = ui_but_find_mouse_over_ex(ar, event->x, event->y, true); @@ -3472,8 +3479,9 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con } /* var names match ui_numedit_but_NUM */ -static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, float softmax, float softrange, - const enum eSnapType snap) +static float ui_numedit_apply_snapf( + uiBut *but, float tempf, float softmin, float softmax, float softrange, + const enum eSnapType snap) { if (tempf == softmin || tempf == softmax || snap == SNAP_OFF) { /* pass */ @@ -3532,8 +3540,9 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa return tempf; } -static float ui_numedit_apply_snap(int temp, float softmin, float softmax, - const enum eSnapType snap) +static float ui_numedit_apply_snap( + int temp, float softmin, float softmax, + const enum eSnapType snap) { if (temp == softmin || temp == softmax) return temp; @@ -3552,9 +3561,10 @@ static float ui_numedit_apply_snap(int temp, float softmin, float softmax, return temp; } -static bool ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, - int mx, - const enum eSnapType snap, float fac) +static bool ui_numedit_but_NUM( + uiBut *but, uiHandleButtonData *data, + int mx, + const enum eSnapType snap, float fac) { float deler, tempf, softmin, softmax, softrange; int lvalue, temp; @@ -3888,9 +3898,10 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton return retval; } -static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, - int mx, const bool is_horizontal, - const bool snap, const bool shift) +static bool ui_numedit_but_SLI( + uiBut *but, uiHandleButtonData *data, + int mx, const bool is_horizontal, + const bool snap, const bool shift) { float deler, f, tempf, softmin, softmax, softrange; int temp, lvalue; @@ -4376,9 +4387,10 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co return WM_UI_HANDLER_CONTINUE; } -static bool ui_numedit_but_UNITVEC(uiBut *but, uiHandleButtonData *data, - int mx, int my, - const enum eSnapType snap) +static bool ui_numedit_but_UNITVEC( + uiBut *but, uiHandleButtonData *data, + int mx, int my, + const enum eSnapType snap) { float dx, dy, rad, radsq, mrad, *fp; int mdx, mdy; @@ -4678,9 +4690,10 @@ static void ui_color_picker_to_rgb_HSVCUBE_v(uiBut *but, const float hsv[3], flo hsv_to_rgb_v(hsv, rgb); } -static bool ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, - int mx, int my, - const enum eSnapType snap, const bool shift) +static bool ui_numedit_but_HSVCUBE( + uiBut *but, uiHandleButtonData *data, + int mx, int my, + const enum eSnapType snap, const bool shift) { ColorPicker *cpicker = but->custom_data; float *hsv = cpicker->color_data; @@ -4797,9 +4810,10 @@ static bool ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, return changed; } -static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, - const wmNDOFMotionData *ndof, - const enum eSnapType snap, const bool shift) +static void ui_ndofedit_but_HSVCUBE( + uiBut *but, uiHandleButtonData *data, + const wmNDOFMotionData *ndof, + const enum eSnapType snap, const bool shift) { ColorPicker *cpicker = but->custom_data; float *hsv = cpicker->color_data; @@ -4962,9 +4976,10 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu return WM_UI_HANDLER_CONTINUE; } -static bool ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, - float mx, float my, - const enum eSnapType snap, const bool shift) +static bool ui_numedit_but_HSVCIRCLE( + uiBut *but, uiHandleButtonData *data, + float mx, float my, + const enum eSnapType snap, const bool shift) { rcti rect; bool changed = true; @@ -5059,9 +5074,10 @@ static bool ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, return changed; } -static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, - const wmNDOFMotionData *ndof, - const enum eSnapType snap, const bool shift) +static void ui_ndofedit_but_HSVCIRCLE( + uiBut *but, uiHandleButtonData *data, + const wmNDOFMotionData *ndof, + const enum eSnapType snap, const bool shift) { ColorPicker *cpicker = but->custom_data; float *hsv = cpicker->color_data; @@ -5320,7 +5336,8 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_CONTINUE; } -static bool ui_numedit_but_CURVE(uiBlock *block, uiBut *but, uiHandleButtonData *data, +static bool ui_numedit_but_CURVE( + uiBlock *block, uiBut *but, uiHandleButtonData *data, int evtx, int evty, bool snap, const bool shift) { @@ -5754,9 +5771,10 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, con return WM_UI_HANDLER_CONTINUE; } -static bool ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonData *data, - int mx, int my, - const bool shift) +static bool ui_numedit_but_TRACKPREVIEW( + bContext *C, uiBut *but, uiHandleButtonData *data, + int mx, int my, + const bool shift) { MovieClipScopes *scopes = (MovieClipScopes *)but->poin; bool changed = true; @@ -7197,8 +7215,9 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA } } -static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *data, - const bool mousemove, const bool onfree) +static void button_activate_exit( + bContext *C, uiBut *but, uiHandleButtonData *data, + const bool mousemove, const bool onfree) { uiBlock *block = but->block; uiBut *bt; @@ -8005,8 +8024,9 @@ static void ui_mouse_motion_towards_reinit(uiPopupBlockHandle *menu, const int x ui_mouse_motion_towards_init_ex(menu, xy, true); } -static bool ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *menu, const int xy[2], - const bool use_wiggle_room) +static bool ui_mouse_motion_towards_check( + uiBlock *block, uiPopupBlockHandle *menu, const int xy[2], + const bool use_wiggle_room) { float p1[2], p2[2], p3[2], p4[2]; float oldp[2] = {menu->towards_xy[0], menu->towards_xy[1]}; @@ -8194,8 +8214,9 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my, uiBut *to_bt) * * Without this keyboard navigation from menu's wont work. */ -static bool ui_menu_pass_event_to_parent_if_nonactive(uiPopupBlockHandle *menu, const uiBut *but, - const int level, const int retval) +static bool ui_menu_pass_event_to_parent_if_nonactive( + uiPopupBlockHandle *menu, const uiBut *but, + const int level, const int retval) { if ((level != 0) && (but == NULL)) { menu->menuretval = UI_RETURN_OUT | UI_RETURN_OUT_PARENT; @@ -9414,8 +9435,9 @@ void UI_popup_handlers_remove_all(bContext *C, ListBase *handlers) WM_event_free_ui_handler_all(C, handlers, ui_popup_handler, ui_popup_handler_remove); } -bool UI_textbutton_activate_rna(const bContext *C, ARegion *ar, - const void *rna_poin_data, const char *rna_prop_id) +bool UI_textbutton_activate_rna( + const bContext *C, ARegion *ar, + const void *rna_poin_data, const char *rna_prop_id) { uiBlock *block; uiBut *but = NULL; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 679681cb372..6536c0a869e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1037,8 +1037,9 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), } } -static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, - int UNUSED(iw), int ih, float alpha, const float rgb[3]) +static void icon_draw_texture( + float x, float y, float w, float h, int ix, int iy, + int UNUSED(iw), int ih, float alpha, const float rgb[3]) { float x1, x2, y1, y2; @@ -1088,8 +1089,9 @@ static int get_draw_size(enum eIconSizes size) -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3], - enum eIconSizes size, int draw_size, const bool UNUSED(nocreate), const bool is_preview) +static void icon_draw_size( + float x, float y, int icon_id, float aspect, float alpha, const float rgb[3], + enum eIconSizes size, int draw_size, const bool UNUSED(nocreate), const bool is_preview) { bTheme *btheme = UI_GetTheme(); Icon *icon = NULL; @@ -1317,8 +1319,9 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big return rnaicon; } -static void icon_draw_at_size(float x, float y, int icon_id, float aspect, float alpha, - enum eIconSizes size, const bool nocreate) +static void icon_draw_at_size( + float x, float y, int icon_id, float aspect, float alpha, + enum eIconSizes size, const bool nocreate) { int draw_size = get_draw_size(size); icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, false); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index d9558af5f71..a3192d3b8d0 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -451,8 +451,9 @@ extern void ui_but_hsv_set(uiBut *but); extern void ui_but_v3_get(uiBut *but, float vec[3]); extern void ui_but_v3_set(uiBut *but, const float vec[3]); -extern void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect, - const float mx, const float my); +extern void ui_hsvcircle_vals_from_pos( + float *val_rad, float *val_dist, const rcti *rect, + const float mx, const float my); extern void ui_hsvcircle_pos_from_vals(struct uiBut *but, const rcti *rect, float *hsv, float *xpos, float *ypos); extern void ui_hsvcube_pos_from_vals(struct uiBut *but, const rcti *rect, float *hsv, float *xp, float *yp); bool ui_but_is_colorpicker_display_space(struct uiBut *but); @@ -581,14 +582,17 @@ bool ui_searchbox_apply(uiBut *but, struct ARegion *ar); void ui_searchbox_free(struct bContext *C, struct ARegion *ar); void ui_but_search_refresh(uiBut *but); -uiBlock *ui_popup_block_refresh(struct bContext *C, uiPopupBlockHandle *handle, - ARegion *butregion, uiBut *but); - -uiPopupBlockHandle *ui_popup_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but, - uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, - void *arg); -uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, struct ARegion *butregion, uiBut *but, - uiMenuCreateFunc create_func, void *arg); +uiBlock *ui_popup_block_refresh( + struct bContext *C, uiPopupBlockHandle *handle, + ARegion *butregion, uiBut *but); + +uiPopupBlockHandle *ui_popup_block_create( + struct bContext *C, struct ARegion *butregion, uiBut *but, + uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, + void *arg); +uiPopupBlockHandle *ui_popup_menu_create( + struct bContext *C, struct ARegion *butregion, uiBut *but, + uiMenuCreateFunc create_func, void *arg); void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index eeda7a2c390..e8974b8571c 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -356,9 +356,10 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index) } /* create buttons for an item with an RNA array */ -static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, - PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int UNUSED(h), - bool expand, bool slider, bool toggle, bool icon_only) +static void ui_item_array( + uiLayout *layout, uiBlock *block, const char *name, int icon, + PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int UNUSED(h), + bool expand, bool slider, bool toggle, bool icon_only) { uiStyle *style = layout->root->style; uiBut *but; @@ -545,8 +546,9 @@ static void ui_item_enum_expand_handle(bContext *C, void *arg1, void *arg2) RNA_property_enum_set(&but->rnapoin, but->rnaprop, current_value); } } -static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, - const char *uiname, int h, bool icon_only) +static void ui_item_enum_expand( + uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, + const char *uiname, int h, bool icon_only) { /* XXX The way this function currently handles uiname parameter is insane and inconsistent with general UI API: * * uiname is the *enum property* label. @@ -877,8 +879,9 @@ void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int ico } -void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname, IDProperty *properties, - int context, int flag) +void uiItemsFullEnumO( + uiLayout *layout, const char *opname, const char *propname, IDProperty *properties, + int context, int flag) { wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */ @@ -1129,8 +1132,9 @@ void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname) /* RNA property items */ -static void ui_item_rna_size(uiLayout *layout, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, - int index, bool icon_only, int *r_w, int *r_h) +static void ui_item_rna_size( + uiLayout *layout, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, + int index, bool icon_only, int *r_w, int *r_h) { PropertyType type; PropertySubType subtype; @@ -1680,8 +1684,9 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) layout->root->block->flag ^= UI_BLOCK_IS_FLIP; } -static uiBut *ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN, - const char *tip, bool force_menu) +static uiBut *ui_item_menu( + uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN, + const char *tip, bool force_menu) { uiBlock *block = layout->root->block; uiBut *but; @@ -2736,8 +2741,9 @@ void ui_layout_list_set_labels_active(uiLayout *layout) } } -uiLayout *uiLayoutListBox(uiLayout *layout, uiList *ui_list, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *actptr, - PropertyRNA *actprop) +uiLayout *uiLayoutListBox( + uiLayout *layout, uiList *ui_list, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *actptr, + PropertyRNA *actprop) { uiLayoutItemBx *box = ui_layout_box(layout, UI_BTYPE_LISTBOX); uiBut *but = box->roundbox; @@ -3336,9 +3342,10 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt, #endif /* this function does not initialize the layout, functions can be called on the layout before and after */ -void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, - bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), - const char label_align, const short flag) +void uiLayoutOperatorButs( + const bContext *C, uiLayout *layout, wmOperator *op, + bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), + const char label_align, const short flag) { if (!op->properties) { IDPropertyTemplate val = {0}; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 72abfcb9293..4f78a1a440e 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -553,8 +553,9 @@ void UI_editsource_active_but_test(uiBut *but) BLI_ghash_insert(ui_editsource_info->hash, but, but_store); } -static int editsource_text_edit(bContext *C, wmOperator *op, - char filepath[FILE_MAX], int line) +static int editsource_text_edit( + bContext *C, wmOperator *op, + char filepath[FILE_MAX], int line) { struct Main *bmain = CTX_data_main(C); Text *text; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 239d6f7c493..95fca10d60b 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1508,10 +1508,11 @@ void UI_panel_category_clear_all(ARegion *ar) } /* based on UI_draw_roundbox_gl_mode, check on making a version which allows us to skip some sides */ -static void ui_panel_category_draw_tab(int mode, float minx, float miny, float maxx, float maxy, float rad, - int roundboxtype, - const bool use_highlight, const bool use_shadow, - const unsigned char highlight_fade[3]) +static void ui_panel_category_draw_tab( + int mode, float minx, float miny, float maxx, float maxy, float rad, + int roundboxtype, + const bool use_highlight, const bool use_shadow, + const unsigned char highlight_fade[3]) { float vec[4][2] = { {0.195, 0.02}, diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 7cb9dca78bf..9f5aa37351a 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -179,9 +179,10 @@ typedef struct uiTooltipData { BLI_STATIC_ASSERT(UI_TIP_LC_MAX == UI_TIP_LC_ALERT + 1, "invalid lc-max"); BLI_STATIC_ASSERT(sizeof(((uiTooltipData *)NULL)->format[0]) <= sizeof(int), "oversize"); -static void rgb_tint(float col[3], - float h, float h_strength, - float v, float v_strength) +static void rgb_tint( + float col[3], + float h, float h_strength, + float v, float v_strength) { float col_hsv_from[3]; float col_hsv_to[3]; @@ -1808,9 +1809,10 @@ uiBlock *ui_popup_block_refresh( return block; } -uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut *but, - uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, - void *arg) +uiPopupBlockHandle *ui_popup_block_create( + bContext *C, ARegion *butregion, uiBut *but, + uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, + void *arg) { wmWindow *window = CTX_wm_window(C); static ARegionType type; @@ -2571,8 +2573,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi return pup->block; } -uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut *but, - uiMenuCreateFunc menu_func, void *arg) +uiPopupBlockHandle *ui_popup_menu_create( + bContext *C, ARegion *butregion, uiBut *but, + uiMenuCreateFunc menu_func, void *arg) { wmWindow *window = CTX_wm_window(C); uiStyle *style = UI_style_get_dpi(); @@ -2850,8 +2853,9 @@ int UI_pie_menu_invoke(struct bContext *C, const char *idname, const wmEvent *ev return OPERATOR_INTERFACE; } -int UI_pie_menu_invoke_from_operator_enum(struct bContext *C, const char *title, const char *opname, - const char *propname, const wmEvent *event) +int UI_pie_menu_invoke_from_operator_enum( + struct bContext *C, const char *title, const char *opname, + const char *propname, const wmEvent *event) { uiPieMenu *pie; uiLayout *layout; @@ -2867,8 +2871,9 @@ int UI_pie_menu_invoke_from_operator_enum(struct bContext *C, const char *title, return OPERATOR_INTERFACE; } -int UI_pie_menu_invoke_from_rna_enum(struct bContext *C, const char *title, const char *path, - const wmEvent *event) +int UI_pie_menu_invoke_from_rna_enum( + struct bContext *C, const char *title, const char *path, + const wmEvent *event) { PointerRNA ctx_ptr; PointerRNA r_ptr; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8d2ee04a2e9..90bcddde0c0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -403,8 +403,9 @@ static const char *template_id_context(StructRNA *type) } #endif -static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, - const char *newop, const char *openop, const char *unlinkop) +static void template_ID( + bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, + const char *newop, const char *openop, const char *unlinkop) { uiBut *but; uiBlock *block; @@ -620,8 +621,9 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str UI_block_align_end(block); } -static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, - const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols) +static void ui_template_id( + uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, + const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols) { TemplateID *template; PropertyRNA *prop; @@ -661,21 +663,24 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const MEM_freeN(template); } -void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, - const char *openop, const char *unlinkop) +void uiTemplateID( + uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, + const char *openop, const char *unlinkop) { ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0); } -void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, - const char *openop, const char *unlinkop) +void uiTemplateIDBrowse( + uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, + const char *openop, const char *unlinkop) { ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME, 0, 0); } -void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, - const char *openop, const char *unlinkop, int rows, int cols) +void uiTemplateIDPreview( + uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, + const char *openop, const char *unlinkop, int rows, int cols) { ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols); @@ -688,8 +693,9 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const c * - propname: property identifier for property that ID-pointer gets stored to * - proptypename: property identifier for property used to determine the type of ID-pointer that can be used */ -void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, - const char *text) +void uiTemplateAnyID( + uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, + const char *text) { PropertyRNA *propID, *propType; uiLayout *split, *row, *sub; @@ -823,8 +829,9 @@ static int modifier_is_simulation(ModifierData *md) } } -static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, - ModifierData *md, int index, int cageIndex, int lastCageIndex) +static uiLayout *draw_modifier( + uiLayout *layout, Scene *scene, Object *ob, + ModifierData *md, int index, int cageIndex, int lastCageIndex) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); PointerRNA ptr; @@ -1286,8 +1293,9 @@ static void do_preview_buttons(bContext *C, void *arg, int event) } } -void uiTemplatePreview(uiLayout *layout, bContext *C, ID *id, int show_buttons, ID *parent, MTex *slot, - const char *preview_id) +void uiTemplatePreview( + uiLayout *layout, bContext *C, ID *id, int show_buttons, ID *parent, MTex *slot, + const char *preview_id) { uiLayout *row, *col; uiBlock *block; @@ -1495,8 +1503,9 @@ static void colorband_update_cb(bContext *UNUSED(C), void *bt_v, void *coba_v) bt->rnapoin.data = coba->data + coba->cur; } -static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, const rctf *butr, - RNAUpdateCb *cb, int expand) +static void colorband_buttons_layout( + uiLayout *layout, uiBlock *block, ColorBand *coba, const rctf *butr, + RNAUpdateCb *cb, int expand) { uiLayout *row, *split, *subsplit; uiBut *bt; @@ -2074,8 +2083,9 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v) } /* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */ -static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, - int brush, int neg_slope, RNAUpdateCb *cb) +static void curvemap_buttons_layout( + uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, + int brush, int neg_slope, RNAUpdateCb *cb) { CurveMapping *cumap = ptr->data; CurveMap *cm = &cumap->cm[cumap->cur]; @@ -2236,8 +2246,9 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe UI_block_funcN_set(block, NULL, NULL, NULL); } -void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propname, int type, - int levels, int brush, int neg_slope) +void uiTemplateCurveMapping( + uiLayout *layout, PointerRNA *ptr, const char *propname, int type, + int levels, int brush, int neg_slope) { RNAUpdateCb *cb; PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -2280,8 +2291,9 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn #define WHEEL_SIZE (5 * U.widget_unit) /* This template now follows User Preference for type - name is not correct anymore... */ -void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, - int lock, int lock_luminosity, int cubic) +void uiTemplateColorPicker( + uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, + int lock, int lock_luminosity, int cubic) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); uiBlock *block = uiLayoutGetBlock(layout); @@ -2456,8 +2468,9 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) * - for now, grouping of layers is determined by dividing up the length of * the array of layer bitflags */ -void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_layer) +void uiTemplateLayers( + uiLayout *layout, PointerRNA *ptr, const char *propname, + PointerRNA *used_ptr, const char *used_propname, int active_layer) { uiLayout *uRow, *uCol; PropertyRNA *prop, *used_prop = NULL; @@ -2523,8 +2536,9 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, } } -void uiTemplateGameStates(uiLayout *layout, PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_state) +void uiTemplateGameStates( + uiLayout *layout, PointerRNA *ptr, const char *propname, + PointerRNA *used_ptr, const char *used_propname, int active_state) { uiLayout *uRow, *uCol; PropertyRNA *prop, *used_prop = NULL; @@ -2764,8 +2778,9 @@ typedef struct { int end_idx; /* Index of last item to display + 1. */ } uiListLayoutdata; -static void uilist_prepare(uiList *ui_list, int len, int activei, int rows, int maxrows, int columns, - uiListLayoutdata *layoutdata) +static void uilist_prepare( + uiList *ui_list, int len, int activei, int rows, int maxrows, int columns, + uiListLayoutdata *layoutdata) { uiListDyn *dyn_data = ui_list->dyn_data; int activei_row, max_scroll; @@ -2851,9 +2866,10 @@ static char *uilist_item_tooltip_func(bContext *UNUSED(C), void *argN, const cha return BLI_sprintfN("%s - %s", tip, dyn_tooltip); } -void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, const char *list_id, - PointerRNA *dataptr, const char *propname, PointerRNA *active_dataptr, const char *active_propname, - const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns) +void uiTemplateList( + uiLayout *layout, bContext *C, const char *listtype_name, const char *list_id, + PointerRNA *dataptr, const char *propname, PointerRNA *active_dataptr, const char *active_propname, + const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns) { uiListType *ui_list_type; uiList *ui_list = NULL; diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 14d97dd883e..0823238fcb1 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -157,9 +157,10 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind * \a check_prop callback filters functions to avoid drawing certain properties, * in cases where PROP_HIDDEN flag can't be used for a property. */ -int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, - bool (*check_prop)(PointerRNA *, PropertyRNA *), - const char label_align) +int uiDefAutoButsRNA( + uiLayout *layout, PointerRNA *ptr, + bool (*check_prop)(PointerRNA *, PropertyRNA *), + const char label_align) { uiLayout *split, *col; int flag; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index cc7f975b275..f5ee8e1cf6e 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -835,8 +835,9 @@ static int ui_but_draw_menu_icon(const uiBut *but) /* icons have been standardized... and this call draws in untransformed coordinates */ -static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, - const bool show_menu_icon) +static void widget_draw_icon( + const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, + const bool show_menu_icon) { float xs = 0.0f, ys = 0.0f; float aspect, height; @@ -932,8 +933,9 @@ static void ui_text_clip_give_next_off(uiBut *but, const char *str) * This func assumes things like kerning handling have already been handled! * Return the length of modified (right-clipped + ellipsis) string. */ -static void ui_text_clip_right_ex(uiFontStyle *fstyle, char *str, const size_t max_len, const float okwidth, - const char *sep, const int sep_len, const float sep_strwidth, size_t *r_final_len) +static void ui_text_clip_right_ex( + uiFontStyle *fstyle, char *str, const size_t max_len, const float okwidth, + const char *sep, const int sep_len, const float sep_strwidth, size_t *r_final_len) { float tmp; int l_end; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 8e003e50df3..ed61518de6b 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1511,8 +1511,9 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in } /* get a 3 byte color, blended and shaded between two other char color pointers */ -void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], - float fac, int offset) +void UI_GetColorPtrBlendShade3ubv( + const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], + float fac, int offset) { int r, g, b; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index b4a120b2dea..09b97b43ea1 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -99,11 +99,12 @@ BLI_INLINE void clamp_rctf_to_rcti(rcti *dst, const rctf *src) /* XXX still unresolved: scrolls hide/unhide vs region mask handling */ /* XXX there's V2D_SCROLL_HORIZONTAL_HIDE and V2D_SCROLL_HORIZONTAL_FULLR ... */ -/* helper to allow scrollbars to dynamically hide - * - returns a copy of the scrollbar settings with the flags to display - * horizontal/vertical scrollbars removed - * - input scroll value is the v2d->scroll var - * - hide flags are set per region at drawtime +/** + * helper to allow scrollbars to dynamically hide + * - returns a copy of the scrollbar settings with the flags to display + * horizontal/vertical scrollbars removed + * - input scroll value is the v2d->scroll var + * - hide flags are set per region at drawtime */ static int view2d_scroll_mapped(int scroll) { @@ -197,11 +198,12 @@ static void view2d_masks(View2D *v2d, int check_scrollers) /* Refresh and Validation */ -/* Initialize all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize - * - for some of these presets, it is expected that the region will have defined some - * additional settings necessary for the customization of the 2D viewport to its requirements - * - this function should only be called from region init() callbacks, where it is expected that - * this is called before UI_view2d_size_update(), as this one checks that the rects are properly initialized. +/** + * Initialize all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize + * - for some of these presets, it is expected that the region will have defined some + * additional settings necessary for the customization of the 2D viewport to its requirements + * - this function should only be called from region init() callbacks, where it is expected that + * this is called before UI_view2d_size_update(), as this one checks that the rects are properly initialized. */ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) { @@ -1192,20 +1194,23 @@ static void step_to_grid(float *step, int *power, int unit) } } -/* Initialize settings necessary for drawing gridlines in a 2d-view - * - Currently, will return pointer to View2DGrid struct that needs to - * be freed with UI_view2d_grid_free() - * - Is used for scrollbar drawing too (for units drawing) - * - Units + clamping args will be checked, to make sure they are valid values that can be used - * so it is very possible that we won't return grid at all! - * - * - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames - * - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals - * - winx = width of region we're drawing to, note: not used but keeping for completeness. - * - winy = height of region we're drawing into +/** + * Initialize settings necessary for drawing gridlines in a 2d-view + * + * - Currently, will return pointer to View2DGrid struct that needs to + * be freed with UI_view2d_grid_free() + * - Is used for scrollbar drawing too (for units drawing) + * - Units + clamping args will be checked, to make sure they are valid values that can be used + * so it is very possible that we won't return grid at all! + * + * - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames + * - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals + * - winx = width of region we're drawing to, note: not used but keeping for completeness. + * - winy = height of region we're drawing into */ -View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, - short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) +View2DGrid *UI_view2d_grid_calc( + Scene *scene, View2D *v2d, + short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) { View2DGrid *grid; @@ -1483,9 +1488,11 @@ void UI_view2d_grid_free(View2DGrid *grid) /* *********************************************************************** */ /* Scrollers */ -/* View2DScrollers is typedef'd in UI_view2d.h - * WARNING: the start of this struct must not change, as view2d_ops.c uses this too. - * For now, we don't need to have a separate (internal) header for structs like this... +/** + * View2DScrollers is typedef'd in UI_view2d.h + * + * \warning The start of this struct must not change, as view2d_ops.c uses this too. + * For now, we don't need to have a separate (internal) header for structs like this... */ struct View2DScrollers { /* focus bubbles */ @@ -1502,8 +1509,9 @@ struct View2DScrollers { }; /* Calculate relevant scroller properties */ -View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, - short xunits, short xclamp, short yunits, short yclamp) +View2DScrollers *UI_view2d_scrollers_calc( + const bContext *C, View2D *v2d, + short xunits, short xclamp, short yunits, short yclamp) { View2DScrollers *scrollers; rcti vert, hor; @@ -1885,18 +1893,22 @@ void UI_view2d_scrollers_free(View2DScrollers *scrollers) /* *********************************************************************** */ /* List View Utilities */ -/* Get the view-coordinates of the nominated cell - * - columnwidth, rowheight = size of each 'cell' - * - startx, starty = coordinates (in 'tot' rect space) that the list starts from - * This should be (0,0) for most views. However, for those where the starting row was offsetted - * (like for Animation Editor channel lists, to make the first entry more visible), these will be - * the min-coordinates of the first item. - * - column, row = the 2d-coordinates (in 2D-view / 'tot' rect space) the cell exists at - * - rect = coordinates of the cell (passed as single var instead of 4 separate, as it's more useful this way) +/** Get the view-coordinates of the nominated cell + * + * \param columnwidth, rowheight: size of each 'cell' + * \param startx, starty: coordinates (in 'tot' rect space) that the list starts from. + * This should be (0,0) for most views. However, for those where the starting row was offsetted + * (like for Animation Editor channel lists, to make the first entry more visible), these will be + * the min-coordinates of the first item. + * \param column, row: The 2d-coordinates + * (in 2D-view / 'tot' rect space) the cell exists at + * \param rect: coordinates of the cell + * (passed as single var instead of 4 separate, as it's more useful this way) */ -void UI_view2d_listview_cell_to_view(View2D *v2d, float columnwidth, float rowheight, - float startx, float starty, - int column, int row, rctf *rect) +void UI_view2d_listview_cell_to_view( + View2D *v2d, float columnwidth, float rowheight, + float startx, float starty, + int column, int row, rctf *rect) { /* sanity checks */ if (ELEM(NULL, v2d, rect)) { @@ -1930,17 +1942,20 @@ void UI_view2d_listview_cell_to_view(View2D *v2d, float columnwidth, float rowhe } } -/* Get the 'cell' (row, column) that the given 2D-view coordinates (i.e. in 'tot' rect space) lie in. - * - columnwidth, rowheight = size of each 'cell' - * - startx, starty = coordinates (in 'tot' rect space) that the list starts from - * This should be (0,0) for most views. However, for those where the starting row was offsetted - * (like for Animation Editor channel lists, to make the first entry more visible), these will be - * the min-coordinates of the first item. - * - viewx, viewy = 2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for - * - column, row = the 'coordinates' of the relevant 'cell' +/** + * Get the 'cell' (row, column) that the given 2D-view coordinates (i.e. in 'tot' rect space) lie in. + * + * \param columnwidth, rowheight: size of each 'cell' + * \param startx, starty: coordinates (in 'tot' rect space) that the list starts from. + * This should be (0,0) for most views. However, for those where the starting row was offsetted + * (like for Animation Editor channel lists, to make the first entry more visible), these will be + * the min-coordinates of the first item. + * \param viewx, viewy: 2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for + * \param column, row: the 'coordinates' of the relevant 'cell' */ -void UI_view2d_listview_view_to_cell(View2D *v2d, float columnwidth, float rowheight, float startx, float starty, - float viewx, float viewy, int *column, int *row) +void UI_view2d_listview_view_to_cell( + View2D *v2d, float columnwidth, float rowheight, float startx, float starty, + float viewx, float viewy, int *column, int *row) { /* adjust view coordinates to be all positive ints, corrected for the start offset */ const int x = (int)(floorf(fabsf(viewx) + 0.5f) - startx); @@ -1967,13 +1982,16 @@ void UI_view2d_listview_view_to_cell(View2D *v2d, float columnwidth, float rowhe *row = 0; } -/* Get the 'extreme' (min/max) column and row indices which are visible within the 'cur' rect - * - columnwidth, rowheight = size of each 'cell' - * - startx, starty = coordinates that the list starts from, which should be (0,0) for most views - * - column/row_min/max = the starting and ending column/row indices +/** + * Get the 'extreme' (min/max) column and row indices which are visible within the 'cur' rect + * + * \param columnwidth, rowheight: Size of each 'cell' + * \param startx, starty: Coordinates that the list starts from, which should be (0,0) for most views + * \param column, row_min, max: The starting and ending column/row indices */ -void UI_view2d_listview_visible_cells(View2D *v2d, float columnwidth, float rowheight, float startx, float starty, - int *column_min, int *column_max, int *row_min, int *row_max) +void UI_view2d_listview_visible_cells( + View2D *v2d, float columnwidth, float rowheight, float startx, float starty, + int *column_min, int *column_max, int *row_min, int *row_max) { /* using 'cur' rect coordinates, call the cell-getting function to get the cells for this */ if (v2d) { @@ -1999,10 +2017,11 @@ float UI_view2d_region_to_view_y(struct View2D *v2d, float y) return (v2d->cur.ymin + (BLI_rctf_size_y(&v2d->cur) * (y - v2d->mask.ymin) / BLI_rcti_size_y(&v2d->mask))); } -/* Convert from screen/region space to 2d-View space - * - * - x,y = coordinates to convert - * - viewx,viewy = resultant coordinates +/** + * Convert from screen/region space to 2d-View space + * + * \param x, y: coordinates to convert + * \param viewx, viewy: resultant coordinates */ void UI_view2d_region_to_view(View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) { @@ -2030,11 +2049,12 @@ float UI_view2d_view_to_region_y(View2D *v2d, float y) return (v2d->mask.ymin + (((y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur)) * BLI_rcti_size_y(&v2d->mask))); } -/* Convert from 2d-View space to screen/region space - * - Coordinates are clamped to lie within bounds of region +/** + * Convert from 2d-View space to screen/region space + * \note Coordinates are clamped to lie within bounds of region * - * - x,y = coordinates to convert - * - regionx,regiony = resultant coordinates + * \param x, y: Coordinates to convert. + * \param regionx, regiony: Resultant coordinates. */ bool UI_view2d_view_to_region_clip(View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) { @@ -2057,11 +2077,13 @@ bool UI_view2d_view_to_region_clip(View2D *v2d, float x, float y, int *r_region_ } } -/* Convert from 2d-view space to screen/region space - * - Coordinates are NOT clamped to lie within bounds of region +/** + * Convert from 2d-view space to screen/region space * - * - x,y = coordinates to convert - * - regionx,regiony = resultant coordinates + * \note Coordinates are NOT clamped to lie within bounds of region. + * + * \param x, y: Coordinates to convert. + * \param regionx, regiony: Resultant coordinates. */ void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) { @@ -2175,25 +2197,30 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C) } -/* Calculate the scale per-axis of the drawing-area - * - Is used to inverse correct drawing of icons, etc. that need to follow view - * but not be affected by scale +/** + * Calculate the scale per-axis of the drawing-area + * + * Is used to inverse correct drawing of icons, etc. that need to follow view + * but not be affected by scale * - * - x,y = scale on each axis + * \param x, y: scale on each axis */ void UI_view2d_scale_get(View2D *v2d, float *x, float *y) { if (x) *x = BLI_rcti_size_x(&v2d->mask) / BLI_rctf_size_x(&v2d->cur); if (y) *y = BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur); } -/* Same as UI_view2d_scale_get() - 1.0f / x, y */ +/** + * Same as ``UI_view2d_scale_get() - 1.0f / x, y`` + */ void UI_view2d_scale_get_inverse(View2D *v2d, float *x, float *y) { if (x) *x = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); if (y) *y = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask); } -/* Simple functions for consistent center offset access. +/** + * Simple functions for consistent center offset access. * Used by node editor to shift view center for each individual node tree. */ void UI_view2d_center_get(struct View2D *v2d, float *x, float *y) @@ -2239,13 +2266,15 @@ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac) UI_view2d_curRect_validate(v2d); } -/* Check if mouse is within scrollers - * - Returns appropriate code for match - * 'h' = in horizontal scroller - * 'v' = in vertical scroller - * 0 = not in scroller - * - * - x,y = mouse coordinates in screen (not region) space +/** + * Check if mouse is within scrollers + * + * \param x, y: Mouse coordinates in screen (not region) space. + * + * \return appropriate code for match. + * - 'h' = in horizontal scroller. + * - 'v' = in vertical scroller. + * - 0 = not in scroller. */ short UI_view2d_mouse_in_scrollers(const bContext *C, View2D *v2d, int x, int y) { @@ -2288,8 +2317,9 @@ typedef struct View2DString { static MemArena *g_v2d_strings_arena = NULL; static View2DString *g_v2d_strings = NULL; -void UI_view2d_text_cache_add(View2D *v2d, float x, float y, - const char *str, size_t str_len, const char col[4]) +void UI_view2d_text_cache_add( + View2D *v2d, float x, float y, + const char *str, size_t str_len, const char col[4]) { int mval[2]; @@ -2319,8 +2349,9 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, } /* no clip (yet) */ -void UI_view2d_text_cache_add_rectf(View2D *v2d, const rctf *rect_view, - const char *str, size_t str_len, const char col[4]) +void UI_view2d_text_cache_add_rectf( + View2D *v2d, const rctf *rect_view, + const char *str, size_t str_len, const char col[4]) { rcti rect; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 816c9a93d8c..9fed02ee096 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -620,8 +620,9 @@ static int view_zoom_poll(bContext *C) } /* apply transform to view (i.e. adjust 'cur' rect) */ -static void view_zoomstep_apply_ex(bContext *C, v2dViewZoomData *vzd, const bool use_mousepos, - const float facx, const float facy) +static void view_zoomstep_apply_ex( + bContext *C, v2dViewZoomData *vzd, const bool use_mousepos, + const float facx, const float facy) { ARegion *ar = CTX_wm_region(C); View2D *v2d = &ar->v2d; @@ -1406,8 +1407,9 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) /* will start timer if appropriate */ /* the arguments are the desired situation */ -void UI_view2d_smooth_view(bContext *C, ARegion *ar, - const rctf *cur, const int smooth_viewtx) +void UI_view2d_smooth_view( + bContext *C, ARegion *ar, + const rctf *cur, const int smooth_viewtx) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); |