From b05cf040cbce513095c1525c2f5c2d075743f57d Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 1 Jul 2015 21:48:42 +0200 Subject: Cleanup: Use bool instead of int --- source/blender/editors/include/ED_screen.h | 7 +++-- source/blender/editors/screen/area.c | 6 ++--- .../blender/editors/space_buttons/space_buttons.c | 30 +++++++++++----------- source/blender/editors/space_clip/clip_draw.c | 6 ++--- source/blender/editors/space_clip/space_clip.c | 4 +-- source/blender/editors/space_file/space_file.c | 2 +- source/blender/editors/space_graph/space_graph.c | 2 +- source/blender/editors/space_image/image_draw.c | 2 +- source/blender/editors/space_image/space_image.c | 4 +-- source/blender/editors/space_logic/space_logic.c | 2 +- source/blender/editors/space_nla/space_nla.c | 2 +- source/blender/editors/space_node/space_node.c | 4 +-- .../editors/space_sequencer/space_sequencer.c | 2 +- source/blender/editors/space_text/space_text.c | 2 +- .../editors/space_userpref/space_userpref.c | 2 +- source/blender/editors/space_view3d/space_view3d.c | 4 +-- source/blender/editors/space_view3d/view3d_draw.c | 2 +- 17 files changed, 43 insertions(+), 40 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 79b1751fcb9..588b046a0fb 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -61,11 +61,14 @@ void ED_region_tag_redraw_partial(struct ARegion *ar, const struct rcti *rct) void ED_region_tag_redraw_overlay(struct ARegion *ar); void ED_region_tag_refresh_ui(struct ARegion *ar); void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *ar); -void ED_region_panels(const struct bContext *C, struct ARegion *ar, int vertical, const char *context, int contextnr); +void ED_region_panels( + const struct bContext *C, struct ARegion *ar, + const char *context, int contextnr, + const bool vertical); void ED_region_header_init(struct ARegion *ar); void ED_region_header(const struct bContext *C, struct ARegion *ar); void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar); -void ED_region_info_draw(struct ARegion *ar, const char *text, int block, float fill_color[4]); +void ED_region_info_draw(struct ARegion *ar, const char *text, float fill_color[4], const bool full_redraw); void ED_region_image_metadata_draw(int x, int y, struct ImBuf *ibuf, rctf frame, float zoomx, float zoomy); void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy); float ED_region_blend_factor(struct ARegion *ar); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 1b8680804a5..48b00376667 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1716,7 +1716,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) /************************ standard UI regions ************************/ -void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *context, int contextnr) +void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int contextnr, const bool vertical) { ScrArea *sa = CTX_wm_area(C); uiStyle *style = UI_style_get_dpi(); @@ -2030,7 +2030,7 @@ int ED_area_headersize(void) return (int)(HEADERY * UI_DPI_FAC); } -void ED_region_info_draw(ARegion *ar, const char *text, int block, float fill_color[4]) +void ED_region_info_draw(ARegion *ar, const char *text, float fill_color[4], const bool full_redraw) { const int header_height = UI_UNIT_Y; uiStyle *style = UI_style_get_dpi(); @@ -2043,7 +2043,7 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float fill_co rect.ymin = BLI_rcti_size_y(&ar->winrct) - header_height; /* box fill entire width or just around text */ - if (!block) + if (!full_redraw) rect.xmax = min_ii(rect.xmax, rect.xmin + BLF_width(fontid, text, BLF_DRAW_STR_DUMMY_MAX) + 1.2f * U.widget_unit); rect.ymax = BLI_rcti_size_y(&ar->winrct); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index a778df4b783..6704431c705 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -137,38 +137,38 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ SpaceButs *sbuts = CTX_wm_space_buts(C); - int vertical = (sbuts->align == BUT_VERTICAL); + const bool vertical = (sbuts->align == BUT_VERTICAL); buttons_context_compute(C, sbuts); if (sbuts->mainb == BCONTEXT_SCENE) - ED_region_panels(C, ar, vertical, "scene", sbuts->mainb); + ED_region_panels(C, ar, "scene", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_RENDER) - ED_region_panels(C, ar, vertical, "render", sbuts->mainb); + ED_region_panels(C, ar, "render", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_RENDER_LAYER) - ED_region_panels(C, ar, vertical, "render_layer", sbuts->mainb); + ED_region_panels(C, ar, "render_layer", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_WORLD) - ED_region_panels(C, ar, vertical, "world", sbuts->mainb); + ED_region_panels(C, ar, "world", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_OBJECT) - ED_region_panels(C, ar, vertical, "object", sbuts->mainb); + ED_region_panels(C, ar, "object", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_DATA) - ED_region_panels(C, ar, vertical, "data", sbuts->mainb); + ED_region_panels(C, ar, "data", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_MATERIAL) - ED_region_panels(C, ar, vertical, "material", sbuts->mainb); + ED_region_panels(C, ar, "material", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_TEXTURE) - ED_region_panels(C, ar, vertical, "texture", sbuts->mainb); + ED_region_panels(C, ar, "texture", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_PARTICLE) - ED_region_panels(C, ar, vertical, "particle", sbuts->mainb); + ED_region_panels(C, ar, "particle", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_PHYSICS) - ED_region_panels(C, ar, vertical, "physics", sbuts->mainb); + ED_region_panels(C, ar, "physics", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_BONE) - ED_region_panels(C, ar, vertical, "bone", sbuts->mainb); + ED_region_panels(C, ar, "bone", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_MODIFIER) - ED_region_panels(C, ar, vertical, "modifier", sbuts->mainb); + ED_region_panels(C, ar, "modifier", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_CONSTRAINT) - ED_region_panels(C, ar, vertical, "constraint", sbuts->mainb); + ED_region_panels(C, ar, "constraint", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT) - ED_region_panels(C, ar, vertical, "bone_constraint", sbuts->mainb); + ED_region_panels(C, ar, "bone_constraint", sbuts->mainb, vertical); sbuts->re_align = 0; sbuts->mainbo = sbuts->mainb; diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 76954ede522..05e7354ac79 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -252,11 +252,11 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar) MovieClip *clip = ED_space_clip_get_clip(sc); MovieTracking *tracking = &clip->tracking; char str[256] = {0}; - bool block = false; + bool full_redraw = false; if (tracking->stats) { BLI_strncpy(str, tracking->stats->message, sizeof(str)); - block = true; + full_redraw = true; } else { if (sc->flag & SC_LOCK_SELECTION) @@ -265,7 +265,7 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar) if (str[0]) { float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.6f}; - ED_region_info_draw(ar, str, block, fill_color); + ED_region_info_draw(ar, str, fill_color, full_redraw); } } diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 5ba82f7f71f..f119fe23c12 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1445,7 +1445,7 @@ static void clip_tools_area_init(wmWindowManager *wm, ARegion *ar) static void clip_tools_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } /****************** tool properties region ******************/ @@ -1492,7 +1492,7 @@ static void clip_properties_area_draw(const bContext *C, ARegion *ar) BKE_movieclip_update_scopes(sc->clip, &sc->user, &sc->scopes); - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void clip_properties_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index c7e0e4ad4e9..a8b71238e14 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -561,7 +561,7 @@ static void file_tools_area_init(wmWindowManager *wm, ARegion *ar) static void file_tools_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void file_tools_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index ad6f3ff5c7e..4c7ac532411 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -384,7 +384,7 @@ static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void graph_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void graph_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 36419ccd10d..3a178ed0277 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -99,7 +99,7 @@ static void draw_render_info(const bContext *C, if (rr && rr->text) { float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f}; - ED_region_info_draw(ar, rr->text, 1, fill_color); + ED_region_info_draw(ar, rr->text, fill_color, true); } BKE_image_release_renderresult(stats_scene, ima); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index a9a5e601e10..928e064b730 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -835,7 +835,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void image_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void image_buttons_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) @@ -908,7 +908,7 @@ static void image_tools_area_draw(const bContext *C, ARegion *ar) } ED_space_image_release_buffer(sima, ibuf, lock); - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void image_tools_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 733cac7794e..34a5fee88eb 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -282,7 +282,7 @@ static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void logic_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } /************************* header region **************************/ diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index ec584525aeb..9fc7b5d6f8f 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -349,7 +349,7 @@ static void nla_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void nla_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void nla_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index de90c417bdd..b9b925f1829 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -598,7 +598,7 @@ static void node_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void node_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } /* add handlers, stuff you only do once or on area/region changes */ @@ -614,7 +614,7 @@ static void node_toolbar_area_init(wmWindowManager *wm, ARegion *ar) static void node_toolbar_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 769718e1567..9b6c61c7af0 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -657,7 +657,7 @@ static void sequencer_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void sequencer_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void sequencer_buttons_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index d890b9f9b4d..ff53d306e69 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -541,7 +541,7 @@ static void text_properties_area_draw(const bContext *C, ARegion *ar) { SpaceText *st = CTX_wm_space_text(C); - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); /* this flag trick is make sure buttons have been added already */ if (st->flags & ST_FIND_ACTIVATE) { diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index f986e909c7f..b5a6821d147 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -113,7 +113,7 @@ static void userpref_main_area_init(wmWindowManager *wm, ARegion *ar) static void userpref_main_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void userpref_operatortypes(void) diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 096d9e8a40a..5d65cccb213 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1093,7 +1093,7 @@ static void view3d_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void view3d_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } static void view3d_buttons_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) @@ -1199,7 +1199,7 @@ static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar) static void view3d_tools_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, CTX_data_mode_string(C), -1); + ED_region_panels(C, ar, CTX_data_mode_string(C), -1, true); } static void view3d_props_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index fb0f437884a..33c883822a0 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -3581,7 +3581,7 @@ static void view3d_main_area_draw_engine_info(View3D *v3d, RegionView3D *rv3d, A fill_color[3] = 1.0f; } - ED_region_info_draw(ar, rv3d->render_engine->text, 1, fill_color); + ED_region_info_draw(ar, rv3d->render_engine->text, fill_color, true); } static bool view3d_stereo3d_active(const bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d) -- cgit v1.2.3