diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2018-10-29 23:34:14 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2018-10-29 23:44:01 +0300 |
commit | ab6c7ff2ab1531f70b0f47f30f195fd2b1c14851 (patch) | |
tree | 96ffd73c52f97ee6a8e4772480236359862c5170 /source/blender/editors/space_buttons | |
parent | ce148716c8163162ba7275980792d432c0b3f5ed (diff) |
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.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 31 |
1 files changed, 31 insertions, 0 deletions
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); } |