From 599d213115c4df93315e0f481f3fef20f797a4cc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 May 2012 07:59:25 +0000 Subject: style cleanup: line length and ensure some macros error when not ending with ';' --- source/blender/editors/animation/anim_filter.c | 6 ++-- source/blender/editors/interface/interface_draw.c | 38 +++++++++++++++++----- .../blender/editors/interface/interface_handlers.c | 17 ++++++---- source/blender/editors/interface/interface_icons.c | 3 +- .../blender/editors/interface/interface_intern.h | 3 +- source/blender/editors/interface/interface_panel.c | 5 +-- .../blender/editors/interface/interface_regions.c | 23 +++++++++---- source/blender/editors/sculpt_paint/paint_image.c | 18 +++++----- 8 files changed, 77 insertions(+), 36 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index fcf424e34dc..160e6957513 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -379,7 +379,7 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) /* ... standard sub-channel filtering can go on here now ... */ #define END_ANIMFILTER_SUBCHANNELS \ filter_mode = _filter; \ - } + } (void)0 /* ............................... */ @@ -447,7 +447,7 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) } \ } \ } \ - } + } (void)0 /* ............................... */ @@ -467,7 +467,7 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) items ++; \ ale_statement \ } \ - } + } (void)0 #define ANIMCHANNEL_NEW_CHANNEL(channel_data, channel_type, owner_id) \ ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, {}) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 8c5913e23fb..2f9e763a7d0 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -252,7 +252,8 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* linear vertical shade within button or in outline */ /* view2d scrollers use it */ -void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight) +void uiDrawBoxVerticalShade(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}}; @@ -656,7 +657,8 @@ static void draw_scope_end(rctf *rect, GLint *scissor) uiDrawBox(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, float *data, int res) +static void histogram_draw_one(float r, float g, float b, float alpha, + float x, float y, float w, float h, float *data, int res) { int i; @@ -716,7 +718,10 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) /* need scissor test, histogram can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); + glScissor(ar->winrct.xmin + (rect.xmin - 1), + ar->winrct.ymin + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); glColor4f(1.f, 1.f, 1.f, 0.08f); /* draw grid lines here */ @@ -786,7 +791,10 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* need scissor test, waveform can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); + glScissor(ar->winrct.xmin + (rect.xmin - 1), + ar->winrct.ymin + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); glColor4f(1.f, 1.f, 1.f, 0.08f); /* draw grid lines here */ @@ -851,7 +859,12 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), } /* RGB / YCC (3 channels) */ - else if (ELEM4(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG)) { + else if (ELEM4(scopes->wavefrm_mode, + SCOPES_WAVEFRM_RGB, + SCOPES_WAVEFRM_YCC_601, + SCOPES_WAVEFRM_YCC_709, + SCOPES_WAVEFRM_YCC_JPEG)) + { int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB); glBlendFunc(GL_ONE, GL_ONE); @@ -996,7 +1009,10 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco /* need scissor test, hvectorscope can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); + glScissor(ar->winrct.xmin + (rect.xmin - 1), + ar->winrct.ymin + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); glColor4f(1.f, 1.f, 1.f, 0.08f); /* draw grid elements */ @@ -1507,7 +1523,10 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc /* need scissor test, preview image can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); + glScissor(ar->winrct.xmin + (rect.xmin - 1), + ar->winrct.ymin + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); if (scopes->track_disabled) { glColor4f(0.7f, 0.3f, 0.3f, 0.3f); @@ -1550,7 +1569,10 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc /* draw cross for pizel position */ glTranslatef(off_x + rect.xmin + track_pos[0] * zoomx, off_y + rect.ymin + track_pos[1] * zoomy, 0.f); - glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, rect.xmax - rect.xmin, rect.ymax - rect.ymin); + glScissor(ar->winrct.xmin + rect.xmin, + ar->winrct.ymin + rect.ymin, + rect.xmax - rect.xmin, + rect.ymax - rect.ymin); for (a = 0; a < 2; a++) { if (a == 1) { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 94ebdb7c0b9..8b0c3ecfcf3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -286,7 +286,9 @@ static void ui_apply_but_func(bContext *C, uiBut *but) * handling is done, i.e. menus are closed, in order to avoid conflicts * with these functions removing the buttons we are working with */ - if (but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) { + if (but->func || but->funcN || block->handle_func || but->rename_func || + (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) + { after = MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc"); if (but->func && ELEM(but, but->func_arg1, but->func_arg2)) { @@ -4553,7 +4555,8 @@ static int ui_but_menu(bContext *C, uiBut *but) PointerRNA ptr_props; if (but->rnapoin.data && but->rnaprop) { - BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + BLI_snprintf(buf, sizeof(buf), "%s.%s", + RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); WM_operator_properties_create(&ptr_props, "WM_OT_doc_view"); RNA_string_set(&ptr_props, "doc_id", buf); @@ -5128,8 +5131,10 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s WM_event_add_ui_handler(C, &data->window->modalhandlers, ui_handler_region_menu, NULL, data); } else { - if (button_modal_state(data->state)) - WM_event_remove_ui_handler(&data->window->modalhandlers, ui_handler_region_menu, NULL, data, 1); /* 1 = postpone free */ + if (button_modal_state(data->state)) { + /* TRUE = postpone free */ + WM_event_remove_ui_handler(&data->window->modalhandlers, ui_handler_region_menu, NULL, data, TRUE); + } } } @@ -6548,7 +6553,7 @@ static void ui_handler_remove_popup(bContext *C, void *userdata) void UI_add_region_handlers(ListBase *handlers) { - WM_event_remove_ui_handler(handlers, ui_handler_region, ui_handler_remove_region, NULL, 0); + WM_event_remove_ui_handler(handlers, ui_handler_region, ui_handler_remove_region, NULL, FALSE); WM_event_add_ui_handler(NULL, handlers, ui_handler_region, ui_handler_remove_region, NULL); } @@ -6559,7 +6564,7 @@ void UI_add_popup_handlers(bContext *C, ListBase *handlers, uiPopupBlockHandle * void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup) { - WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, 0); + WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, FALSE); } diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index e9186aff666..385f74acbd2 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -533,7 +533,8 @@ static void init_internal_icons(void) } } if (bbuf == NULL) - bbuf = IMB_ibImageFromMemory((unsigned char *)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, ""); + bbuf = IMB_ibImageFromMemory((unsigned char *)datatoc_blender_icons_png, + datatoc_blender_icons_png_size, IB_rect, ""); if (bbuf) { /* free existing texture if any */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 9e073055fc3..2c4ec9ac482 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -428,7 +428,8 @@ void ui_but_search_test(uiBut *but); typedef uiBlock * (*uiBlockHandleCreateFunc)(struct bContext *C, struct uiPopupBlockHandle *handle, void *arg1); uiPopupBlockHandle *ui_popup_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but, - uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg); + 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, char *str); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 0be1761eaf5..dc2c3b4eea9 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1253,7 +1253,8 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat if (data && data->state != PANEL_STATE_ANIMATION) { /* XXX: * - the panel tabbing function call below (test_add_new_tabs()) has been commented out - * "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit." - BillRey + * "It is too easy to do by accident when reordering panels, + * is very hard to control and use, and has no real benefit." - BillRey * Aligorith, 2009Sep */ //test_add_new_tabs(ar); // also copies locations of tabs in dragged panel @@ -1274,7 +1275,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat MEM_freeN(data); pa->activedata = NULL; - WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, 0); + WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, FALSE); } else { if (!data) { diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 9bcda7d86ed..a36b2dd2c45 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -429,7 +429,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - /* special case, enum rna buttons only have enum item description, use general enum description too before the specific one */ + /* special case, enum rna buttons only have enum item description, + * use general enum description too before the specific one */ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) { const char *descr = RNA_property_description(but->rnaprop); if (descr && descr[0]) { @@ -448,7 +449,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) for (i = 0; i < totitem; i++) { if (item[i].identifier[0] && item[i].value == value) { if (item[i].description && item[i].description[0]) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", + item[i].name, item[i].description); data->color_id[data->totline] = UI_TIP_LC_SUBMENU; data->totline++; } @@ -496,7 +498,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (unit_type == PROP_UNIT_ROTATION) { if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { - float value = RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop); + float value = RNA_property_array_check(but->rnaprop) ? + RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : + RNA_property_float_get(&but->rnapoin, but->rnaprop); BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Radians: %f"), value); data->color_id[data->totline] = UI_TIP_LC_NORMAL; data->totline++; @@ -514,7 +518,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* rna info */ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), + RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); data->color_id[data->totline] = UI_TIP_LC_PYTHON; data->totline++; } @@ -1553,7 +1558,9 @@ void ui_popup_block_scrolltest(uiBlock *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; @@ -1881,7 +1888,8 @@ static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3]) if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart); if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); - BLI_snprintf(col, sizeof(col), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); + BLI_snprintf(col, sizeof(col), "%02X%02X%02X", + FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); strcpy(bt->poin, col); } @@ -2382,7 +2390,8 @@ 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, char *str) +uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut *but, + uiMenuCreateFunc menu_func, void *arg, char *str) { wmWindow *window = CTX_wm_window(C); uiStyle *style = UI_GetStyle(); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ead85486ec0..9effba5b433 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -114,24 +114,24 @@ (c)[0]= FTOCHAR((f)[0]); \ (c)[1]= FTOCHAR((f)[1]); \ (c)[2]= FTOCHAR((f)[2]); \ -} +} (void)0 #define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { \ (c)[0]= FTOCHAR((f)[0]); \ (c)[1]= FTOCHAR((f)[1]); \ (c)[2]= FTOCHAR((f)[2]); \ (c)[3]= FTOCHAR((f)[3]); \ -} +} (void)0 #define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { \ (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ -} +} (void)0 #define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { \ (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \ (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \ (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \ (f)[3]= IMAPAINT_CHAR_TO_FLOAT((c)[3]); \ -} +} (void)0 #define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b) @@ -1547,7 +1547,7 @@ static ProjPixel *project_paint_uvpixel_init( if (ibuf_other->rect_float) { /* float to char */ float rgba[4]; project_face_pixel(tf_other, ibuf_other, w, side, NULL, rgba); - IMAPAINT_FLOAT_RGBA_TO_CHAR(((ProjPixelClone *)projPixel)->clonepx.ch, rgba) + IMAPAINT_FLOAT_RGBA_TO_CHAR(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); } else { /* char to char */ project_face_pixel(tf_other, ibuf_other, w, side, ((ProjPixelClone *)projPixel)->clonepx.ch, NULL); @@ -4206,7 +4206,7 @@ static void imapaint_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const short is_toru } else { char *rrgb = (char *)ibuf->rect + (ibuf->x * y + x) * 4; - IMAPAINT_CHAR_RGB_TO_FLOAT(r_rgb, rrgb) + IMAPAINT_CHAR_RGB_TO_FLOAT(r_rgb, rrgb); } } static void imapaint_ibuf_rgb_set(ImBuf *ibuf, int x, int y, const short is_torus, const float rgb[3]) @@ -4224,7 +4224,7 @@ static void imapaint_ibuf_rgb_set(ImBuf *ibuf, int x, int y, const short is_toru } else { char *rrgb = (char *)ibuf->rect + (ibuf->x * y + x) * 4; - IMAPAINT_FLOAT_RGB_TO_CHAR(rrgb, rgb) + IMAPAINT_FLOAT_RGB_TO_CHAR(rrgb, rgb); } } @@ -4237,7 +4237,9 @@ static int imapaint_ibuf_add_if(ImBuf *ibuf, unsigned int x, unsigned int y, flo if (torus) imapaint_ibuf_rgb_get(ibuf, x, y, 1, inrgb); else return 0; } - else imapaint_ibuf_rgb_get(ibuf, x, y, 0, inrgb); + else { + imapaint_ibuf_rgb_get(ibuf, x, y, 0, inrgb); + } outrgb[0] += inrgb[0]; outrgb[1] += inrgb[1]; -- cgit v1.2.3