From 2a98e83abdb7d00da68242685c1323a6ae1d5d9b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 21 Jul 2012 16:21:42 +0000 Subject: [PATCH] style cleanup --- source/blender/blenlib/intern/math_rotation.c | 4 +-- source/blender/editors/interface/interface.c | 25 ++++++++++++++----- .../editors/interface/interface_icons.c | 9 ++++--- source/blender/editors/interface/resources.c | 6 +++-- source/blender/editors/interface/view2d_ops.c | 16 ++++++------ 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 6dca708a048..78f0badc3b1 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1164,8 +1164,8 @@ void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3]) compatible_eul(eul1, oldrot); compatible_eul(eul2, oldrot); - d1 = (float)fabsf(eul1[0] - oldrot[0]) + (float)fabsf(eul1[1] - oldrot[1]) + (float)fabsf(eul1[2] - oldrot[2]); - d2 = (float)fabsf(eul2[0] - oldrot[0]) + (float)fabsf(eul2[1] - oldrot[1]) + (float)fabsf(eul2[2] - oldrot[2]); + d1 = fabsf(eul1[0] - oldrot[0]) + fabsf(eul1[1] - oldrot[1]) + fabsf(eul1[2] - oldrot[2]); + d2 = fabsf(eul2[0] - oldrot[0]) + fabsf(eul2[1] - oldrot[1]) + fabsf(eul2[2] - oldrot[2]); /* return best, which is just the one with lowest difference */ if (d1 > d2) { diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 4ed547e9248..8f15a63ac33 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2243,8 +2243,12 @@ void ui_check_but(uiBut *but) UI_GET_BUT_VALUE_INIT(but, value); if (ui_is_but_float(but)) { - if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); - else if (value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str); + if (value == (double) FLT_MAX) { + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); + } + else if (value == (double) -FLT_MAX) { + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str); + } /* support length type buttons */ else if (ui_is_but_unit(but)) { char new_str[sizeof(but->drawstr)]; @@ -2550,7 +2554,9 @@ void ui_block_do_align(uiBlock *block) * - \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 x1, int y1, short x2, short y2, 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 x1, int y1, short x2, short y2, + void *poin, float min, float max, float a1, float a2, const char *tip) { uiBut *but; int slen; @@ -2622,10 +2628,14 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, } } - if ((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR)) + if ((block->flag & UI_BLOCK_LOOP) || + ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR)) + { but->flag |= (UI_TEXT_LEFT | UI_ICON_LEFT); - else if (but->type == BUT_TOGDUAL) + } + else if (but->type == BUT_TOGDUAL) { but->flag |= UI_ICON_LEFT; + } but->flag |= (block->flag & UI_BUT_ALIGN); @@ -2670,7 +2680,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, but->lockstr = "" -static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, 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 x1, int y1, short x2, short y2, + 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; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 737c0377f27..002c3d48a01 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -861,7 +861,8 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIco prv_img->w[size], prv_img->h[size]); } -static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, const float rgb[3], short is_preview) +static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, + unsigned int *rect, float alpha, const float rgb[3], short is_preview) { ImBuf *ima = NULL; @@ -914,7 +915,8 @@ 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; @@ -957,7 +959,8 @@ static int get_draw_size(enum eIconSizes size) return 0; } -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, int UNUSED(nocreate), short 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, int UNUSED(nocreate), short is_preview) { bTheme *btheme = UI_GetTheme(); Icon *icon = NULL; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 1d7a423a15a..50f93f7e9f5 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1213,7 +1213,8 @@ 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; @@ -1740,7 +1741,8 @@ void init_userdef_do_versions(void) } if (bmain->versionfile < 257) { - /* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */ + /* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, + * so that it doesn't linger around from old configs like a ghost */ U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET; } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 3be41d1f46e..244a4ea15de 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -499,15 +499,15 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot) /* ********************************************************* */ /* SINGLE-STEP VIEW ZOOMING OPERATOR */ -/* This group of operators come in several forms: - * 1) Scrollwheel 'steps' - rolling mousewheel by one step zooms view by predefined amount - * 2) Scrollwheel 'steps' + alt + ctrl/shift - zooms view on one axis only (ctrl=x, shift=y) // XXX this could be implemented... - * 3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount +/* This group of operators come in several forms: + * 1) Scrollwheel 'steps' - rolling mousewheel by one step zooms view by predefined amount + * 2) Scrollwheel 'steps' + alt + ctrl/shift - zooms view on one axis only (ctrl=x, shift=y) // XXX this could be implemented... + * 3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount * - * In order to make sure this works, each operator must define the following RNA-Operator Props: - * zoomfacx, zoomfacy - These two zoom factors allow for non-uniform scaling. - * It is safe to scale by 0, as these factors are used to determine - * amount to enlarge 'cur' by + * In order to make sure this works, each operator must define the following RNA-Operator Props: + * zoomfacx, zoomfacy - These two zoom factors allow for non-uniform scaling. + * It is safe to scale by 0, as these factors are used to determine + * amount to enlarge 'cur' by */ /* ------------------ 'Shared' stuff ------------------------ */