diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-11 19:23:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-11 19:39:46 +0300 |
commit | 3e1f83a1dc787ec518a6fa25a855f935b4a8b9b9 (patch) | |
tree | ae910592db5fea68a16a654d7a1bc989d58edb7c /source/blender/editors/screen | |
parent | 1f1ca7447637e8a5216358346698ad8f5f5ba328 (diff) |
WM: split panel drawing into layout and draw
This matches changes made to the header.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index f73ce24c24b..110e428ffff 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1891,13 +1891,16 @@ static void ed_panel_draw(const bContext *C, * Matching against any of these strings will draw the panel. * Can be NULL to skip context checks. */ -void ED_region_panels(const bContext *C, ARegion *ar, const char *contexts[], int contextnr, const bool vertical) +void ED_region_panels_layout( + const bContext *C, ARegion *ar, + const char *contexts[], int contextnr, const bool vertical) { + ar->runtime.category = NULL; + const WorkSpace *workspace = CTX_wm_workspace(C); ScrArea *sa = CTX_wm_area(C); PanelType *pt; View2D *v2d = &ar->v2d; - View2DScrollers *scrollers; int x, y, w, em; bool is_context_new = 0; int scroll; @@ -2059,6 +2062,15 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *contexts[], in #endif } + if (use_category_tabs) { + ar->runtime.category = category; + } +} + +void ED_region_panels_draw(const bContext *C, ARegion *ar) +{ + View2D *v2d = &ar->v2d; + region_clear_color(C, ar, (ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK); /* reset line width for drawing tabs */ @@ -2073,16 +2085,27 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *contexts[], in /* restore view matrix */ UI_view2d_view_restore(C); - if (use_category_tabs) { - UI_panel_category_draw_all(ar, category); + /* Set in layout. */ + if (ar->runtime.category) { + UI_panel_category_draw_all(ar, ar->runtime.category); } /* scrollers */ - scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); + View2DScrollers *scrollers = UI_view2d_scrollers_calc( + C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); UI_view2d_scrollers_draw(C, v2d, scrollers); UI_view2d_scrollers_free(scrollers); } +void ED_region_panels( + const bContext *C, ARegion *ar, + const char *contexts[], int contextnr, const bool vertical) +{ + /* TODO: remove? */ + ED_region_panels_layout(C, ar, contexts, contextnr, vertical); + ED_region_panels_draw(C, ar); +} + void ED_region_panels_init(wmWindowManager *wm, ARegion *ar) { wmKeyMap *keymap; |