diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-19 23:37:17 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-19 23:37:17 +0400 |
commit | 881dbac5d93cffd2f6a9f5c3896d1c84ebfd0ce5 (patch) | |
tree | cf604a1c693c0b4ea57eb13064786a162499e632 /source/blender/editors/space_buttons/space_buttons.c | |
parent | d54d00ef845a7bb4f0d8e08133b2489983dbe907 (diff) |
This commit tackles the "context" buttons in Properties header, which were still using "ugly" old UI code.
It removes buttons_header.c file, adds a (small) space_properties.py one, with a PROPERTIES_HT_header class, which simply uses the RNA enum to draw the context buttons.
It also fixes that enum, btw, it always featured all contexts, which means you could (try to!) set through RNA invalid contexts...
Thanks to brecht and dingto for the reviews.
Diffstat (limited to 'source/blender/editors/space_buttons/space_buttons.c')
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 02b06e08eed..e6c6df416bf 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -87,7 +87,7 @@ static SpaceLink *buttons_new(const bContext *UNUSED(C)) BLI_addtail(&sbuts->regionbase, ar); ar->regiontype = RGN_TYPE_WINDOW; - + return (SpaceLink *)sbuts; } @@ -200,22 +200,17 @@ static void buttons_keymap(struct wmKeyConfig *keyconf) /* add handlers, stuff you only do once or on area/region changes */ static void buttons_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); + ED_region_header_init(ar); } static void buttons_header_area_draw(const bContext *C, ARegion *ar) { - /* clear */ - UI_ThemeClearColor(ED_screen_area_active(C) ? TH_HEADER : TH_HEADERDESEL); - glClear(GL_COLOR_BUFFER_BIT); - - /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(&ar->v2d); - - buttons_header_buttons(C, ar); + SpaceButs *sbuts = CTX_wm_space_buts(C); + + /* Needed for RNA to get the good values! */ + buttons_context_compute(C, sbuts); - /* restore view matrix? */ - UI_view2d_view_restore(C); + ED_region_header(C, ar); } /* draw a certain button set only if properties area is currently |