Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2018-10-29 23:34:14 +0300
committerJulian Eisel <eiseljulian@gmail.com>2018-10-29 23:44:01 +0300
commitab6c7ff2ab1531f70b0f47f30f195fd2b1c14851 (patch)
tree96ffd73c52f97ee6a8e4772480236359862c5170 /source/blender/editors
parentce148716c8163162ba7275980792d432c0b3f5ed (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')
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_layout.c2
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/resources.c2
-rw-r--r--source/blender/editors/screen/area.c19
-rw-r--r--source/blender/editors/screen/screen_edit.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c1
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c31
8 files changed, 53 insertions, 7 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index efdc9ae0118..cbca7c8c921 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -915,6 +915,7 @@ void UI_exit(void);
#define UI_LAYOUT_MENU 2
#define UI_LAYOUT_TOOLBAR 3
#define UI_LAYOUT_PIEMENU 4
+#define UI_LAYOUT_VERT_BAR 5
#define UI_UNIT_X ((void)0, U.widget_unit)
#define UI_UNIT_Y ((void)0, U.widget_unit)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a826c55afb5..e2b1818c958 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -4260,7 +4260,7 @@ uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int s
root->opcontext = WM_OP_INVOKE_REGION_WIN;
layout = MEM_callocN(sizeof(uiLayout), "uiLayout");
- layout->item.type = ITEM_LAYOUT_ROOT;
+ layout->item.type = (type == UI_LAYOUT_VERT_BAR) ? ITEM_LAYOUT_COLUMN : ITEM_LAYOUT_ROOT;
/* Only used when 'UI_ITEM_PROP_SEP' is set. */
layout->item.flag = UI_ITEM_PROP_DECORATE;
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 1897df41fd0..efa3c24afd0 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -134,7 +134,7 @@ static int panel_aligned(ScrArea *sa, ARegion *ar)
return BUT_VERTICAL;
else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
return BUT_VERTICAL;
- else if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS, RGN_TYPE_HUD))
+ else if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS, RGN_TYPE_HUD, RGN_TYPE_NAV_BAR))
return BUT_VERTICAL;
return 0;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 0ac534e5fcf..09b8933206e 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -181,6 +181,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = ts->list;
else if (theme_regionid == RGN_TYPE_HEADER)
cp = ts->header;
+ else if (theme_regionid == RGN_TYPE_NAV_BAR)
+ cp = ts->navigation_bar;
else
cp = ts->button;
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);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 8f815dd3b44..f0f8cb6d9d8 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1251,7 +1251,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
for (ar = newa->regionbase.first; ar; ar = ar->next) {
ar->flagfullscreen = ar->flag;
- if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_HEADER, RGN_TYPE_TOOLS)) {
+ if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_HEADER, RGN_TYPE_TOOLS, RGN_TYPE_NAV_BAR)) {
ar->flag |= RGN_FLAG_HIDDEN;
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e570340698f..3d32f10582d 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3585,6 +3585,7 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
ar->alignment = RGN_ALIGN_LEFT;
ED_area_tag_redraw(CTX_wm_area(C));
+ WM_event_add_mousemove(C);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
return OPERATOR_FINISHED;
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);
}