From ab6c7ff2ab1531f70b0f47f30f195fd2b1c14851 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 29 Oct 2018 21:34:14 +0100 Subject: UI: Vertical Properties Editor Tabs Moves the Properties editor context switching to a vertical tabs region. Design Task: T54951 Differential Revison: D3840 The tabs are regular widgets, unlike the 'old' toolshelf tabs. This means they give mouse hover feedback, have tooltips, support the right-click menu, etc. Also, when vertical screen space gets tight, the tabs can be scrolled, they don't shrink like the toolshelf ones. The tab region is slightly larger than the header. The tabs are scaled up accordingly. This makes them nicely readable. The header is quite empty now. As shown in T54951, we wanted to have a search button there. This should be added next. Implementation Notes: * Added a new region type, RGN_TYPE_NAVIGATION. * Having the tabs in a separate region allows scrolling of the tab-bar, unlike the toolshelf tabs. We might want to remove the scrollbars though. * Added a new region flag RGN_FLAG_PREFSIZE_OR_HIDDEN, to ensure the tab region is either hidden or has a fixed size. * Added some additional flags to support fine-tuning the layout in panel and layout code. * Bumps subversion. --- .../blender/editors/space_buttons/space_buttons.c | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 8d2b5f994b3..50018b212a6 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -75,6 +75,13 @@ static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s ar->regiontype = RGN_TYPE_HEADER; ar->alignment = RGN_ALIGN_TOP; + /* navigation bar */ + ar = MEM_callocN(sizeof(ARegion), "navigation bar for buts"); + + BLI_addtail(&sbuts->regionbase, ar); + ar->regiontype = RGN_TYPE_NAV_BAR; + ar->alignment = RGN_ALIGN_LEFT; + #if 0 /* context region */ ar = MEM_callocN(sizeof(ARegion), "context region for buts"); @@ -390,6 +397,21 @@ static void buttons_header_region_message_subscribe( } } +static void buttons_navigation_bar_region_init(wmWindowManager *wm, ARegion *ar) +{ + ar->flag |= RGN_FLAG_PREFSIZE_OR_HIDDEN; + ED_region_panels_init(wm, ar); + ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y; +} + +static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *ar) +{ + for (PanelType *pt = ar->type->paneltypes.first; pt; pt = pt->next) { + pt->flag |= PNL_LAYOUT_VERT_BAR; + } + ED_region_panels(C, ar); +} + /* draw a certain button set only if properties area is currently * showing that button set, to reduce unnecessary drawing. */ static void buttons_area_redraw(ScrArea *sa, short buttons) @@ -680,5 +702,14 @@ void ED_spacetype_buttons(void) art->message_subscribe = buttons_header_region_message_subscribe; BLI_addhead(&st->regiontypes, art); + /* regions: navigation bar */ + art = MEM_callocN(sizeof(ARegionType), "spacetype nav buttons region"); + art->regionid = RGN_TYPE_NAV_BAR; + art->prefsizex = AREAMINX - 3; /* XXX Works and looks best, should we update AREAMINX accordingly? */ + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; + art->init = buttons_navigation_bar_region_init; + art->draw = buttons_navigation_bar_region_draw; + BLI_addhead(&st->regiontypes, art); + BKE_spacetype_register(st); } -- cgit v1.2.3