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. --- source/blender/editors/screen/area.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/screen/area.c') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index b914dd5ecae..79f2bebd0d3 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1159,7 +1159,11 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct int prefsizex = UI_DPI_FAC * ((ar->sizex > 1) ? ar->sizex + 0.5f : ar->type->prefsizex); int prefsizey; - if (ar->regiontype == RGN_TYPE_HEADER) { + if (ar->flag & RGN_FLAG_PREFSIZE_OR_HIDDEN) { + prefsizex = UI_DPI_FAC * ar->type->prefsizex; + prefsizey = UI_DPI_FAC * ar->type->prefsizey; + } + else if (ar->regiontype == RGN_TYPE_HEADER) { prefsizey = ED_area_headersize(); } else if (ED_area_is_global(sa)) { @@ -2020,14 +2024,21 @@ static void ed_panel_draw( short panelContext; /* panel context can either be toolbar region or normal panels region */ - if (ar->regiontype == RGN_TYPE_TOOLS) + if (pt->flag & PNL_LAYOUT_VERT_BAR) { + panelContext = UI_LAYOUT_VERT_BAR; + } + else if (ar->regiontype == RGN_TYPE_TOOLS) { panelContext = UI_LAYOUT_TOOLBAR; - else + } + else { panelContext = UI_LAYOUT_PANEL; + } panel->layout = UI_block_layout( block, UI_LAYOUT_VERTICAL, panelContext, - style->panelspace, 0, w - 2 * style->panelspace, em, 0, style); + (pt->flag & PNL_LAYOUT_VERT_BAR) ? 0 : style->panelspace, 0, + (pt->flag & PNL_LAYOUT_VERT_BAR) ? 0 : w - 2 * style->panelspace, + em, 0, style); pt->draw(C, panel); -- cgit v1.2.3