From 5f6c45498c92b91a710a1317f6d41f73fbe83477 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 20 Apr 2018 17:14:03 +0200 Subject: UI: New Global Top-Bar (WIP) == Main Features/Changes for Users * Add horizontal bar at top of all non-temp windows, consisting out of two horizontal sub-bars. * Upper sub-bar contains global menus (File, Render, etc.), tabs for workspaces and scene selector. * Lower sub-bar contains object mode selector, screen-layout and render-layer selector. Later operator and/or tool settings will be placed here. * Individual sections of the topbar are individually scrollable. * Workspace tabs can be double- or ctrl-clicked for renaming and contain 'x' icon for deleting. * Top-bar should scale nicely with DPI. * The lower half of the top-bar can be hided by dragging the lower top-bar edge up. Better hiding options are planned (e.g. hide in fullscreen modes). * Info editors at the top of the window and using the full window width with be replaced by the top-bar. * In fullscreen modes, no more info editor is added on top, the top-bar replaces it. == Technical Features/Changes * Adds initial support for global areas A global area is part of the window, not part of the regular screen-layout. I've added a macro iterator to iterate over both, global and screen-layout level areas. When iterating over areas, from now on developers should always consider if they have to include global areas. * Adds a TOPBAR editor type The editor type is hidden in the UI editor type menu. * Adds a variation of the ID template to display IDs as tab buttons (template_ID_tabs in BPY) * Does various changes to RNA button creation code to improve their appearance in the horizontal top-bar. * Adds support for dynamically sized regions. That is, regions that scale automatically to the layout bounds. The code for this is currently a big hack (it's based on drawing the UI multiple times). This should definitely be improved. * Adds a template for displaying operator properties optimized for the top-bar. This will probably change a lot still and is in fact disabled in code. Since the final top-bar design depends a lot on other 2.8 designs (mainly tool-system and workspaces), we decided to not show the operator or tool settings in the top-bar for now. That means most of the lower sub-bar is empty for the time being. NOTE: Top-bar or global area data is not written to files or SDNA. They are simply added to the window when opening Blender or reading a file. This allows us doing changes to the top-bar without having to care for compatibility. == ToDo's It's a bit hard to predict all the ToDo's here are the known main ones: * Add options for the new active-tool system and for operator redo to the topbar. * Automatically hide the top-bar in fullscreen modes. * General visual polish. * Top-bar drag & drop support (WIP in temp-tab_drag_drop). * Improve dynamic regions (should also fix some layout glitches). * Make internal terminology consistent. * Enable topbar file writing once design is more advanced. * Address TODO's and XXX's in code :) Thanks @brecht for the review! And @sergey for the complaining ;) Differential Revision: D2758 --- source/blender/editors/space_clip/space_clip.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/space_clip/space_clip.c') diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 478254fb165..ba9684411b3 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -256,12 +256,14 @@ static SpaceLink *clip_new(const bContext *C) ar->regiontype = RGN_TYPE_TOOLS; ar->alignment = RGN_ALIGN_LEFT; - /* tool properties */ +#ifndef WITH_REDO_REGION_REMOVAL + /* tools view */ ar = MEM_callocN(sizeof(ARegion), "tool properties for clip"); BLI_addtail(&sc->regionbase, ar); ar->regiontype = RGN_TYPE_TOOL_PROPS; ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV; +#endif /* properties view */ ar = MEM_callocN(sizeof(ARegion), "properties for clip"); @@ -889,20 +891,25 @@ static void clip_refresh(const bContext *C, ScrArea *sa) SpaceClip *sc = (SpaceClip *)sa->spacedata.first; ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); ARegion *ar_tools = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS); - ARegion *ar_tool_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS); ARegion *ar_preview = ED_clip_has_preview_region(C, sa); ARegion *ar_properties = ED_clip_has_properties_region(sa); ARegion *ar_channels = ED_clip_has_channels_region(sa); bool main_visible = false, preview_visible = false, tools_visible = false; - bool tool_props_visible = false, properties_visible = false, channels_visible = false; + bool properties_visible = false, channels_visible = false; bool view_changed = false; +#ifndef WITH_REDO_REGION_REMOVAL + ARegion *ar_tool_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS); + bool tool_props_visible = false; +#endif switch (sc->view) { case SC_VIEW_CLIP: main_visible = true; preview_visible = false; tools_visible = true; +#ifndef WITH_REDO_REGION_REMOVAL tool_props_visible = true; +#endif properties_visible = true; channels_visible = false; break; @@ -910,7 +917,9 @@ static void clip_refresh(const bContext *C, ScrArea *sa) main_visible = false; preview_visible = true; tools_visible = false; +#ifndef WITH_REDO_REGION_REMOVAL tool_props_visible = false; +#endif properties_visible = false; channels_visible = false; @@ -920,7 +929,9 @@ static void clip_refresh(const bContext *C, ScrArea *sa) main_visible = false; preview_visible = true; tools_visible = false; +#ifndef WITH_REDO_REGION_REMOVAL tool_props_visible = false; +#endif properties_visible = false; channels_visible = true; @@ -1001,6 +1012,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa) } } +#ifndef WITH_REDO_REGION_REMOVAL if (tool_props_visible) { if (ar_tool_props && (ar_tool_props->flag & RGN_FLAG_HIDDEN)) { ar_tool_props->flag &= ~RGN_FLAG_HIDDEN; @@ -1024,6 +1036,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa) view_changed = true; } } +#endif if (preview_visible) { if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) { @@ -1607,6 +1620,7 @@ void ED_spacetype_clip(void) BLI_addhead(&st->regiontypes, art); +#ifndef WITH_REDO_REGION_REMOVAL /* tool properties */ art = MEM_callocN(sizeof(ARegionType), "spacetype clip tool properties region"); art->regionid = RGN_TYPE_TOOL_PROPS; @@ -1619,6 +1633,7 @@ void ED_spacetype_clip(void) ED_clip_tool_props_register(art); BLI_addhead(&st->regiontypes, art); +#endif /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype clip region"); -- cgit v1.2.3