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-04-20 18:14:03 +0300
committerJulian Eisel <eiseljulian@gmail.com>2018-04-20 18:14:52 +0300
commit5f6c45498c92b91a710a1317f6d41f73fbe83477 (patch)
tree93b136fb49c656c2c2a5463c91e8a6a38d518354 /source/blender/editors/undo/ed_undo.c
parent4bfb6d21df96688187f6f1a5d95dd62bcbf85116 (diff)
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
Diffstat (limited to 'source/blender/editors/undo/ed_undo.c')
-rw-r--r--source/blender/editors/undo/ed_undo.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 18366f87b59..03dd1ad26e7 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -304,12 +304,44 @@ void ED_OT_undo_redo(wmOperatorType *ot)
/** \} */
+#ifdef WITH_REDO_REGION_REMOVAL
+struct OperatorRepeatContextHandle {
+ ScrArea *restore_area;
+ ARegion *restore_region;
+};
+
+/**
+ * Resets the context to the state \a op was executed in (or at least, was in when registering).
+ * #ED_operator_repeat_reset_context should be called when done repeating!
+ */
+const OperatorRepeatContextHandle *ED_operator_repeat_prepare_context(bContext *C, wmOperator *op)
+{
+ static OperatorRepeatContextHandle context_info;
+
+ context_info.restore_area = CTX_wm_area(C);
+ context_info.restore_region = CTX_wm_region(C);
+
+ CTX_wm_area_set(C, op->execution_area);
+ CTX_wm_region_set(C, op->execution_region);
+
+ return &context_info;
+}
+/**
+ * Resets context to the old state from before #ED_operator_repeat_prepare_context was called.
+ */
+void ED_operator_repeat_reset_context(bContext *C, const OperatorRepeatContextHandle *context_info)
+{
+ CTX_wm_area_set(C, context_info->restore_area);
+ CTX_wm_region_set(C, context_info->restore_region);
+}
+#endif
+
/* -------------------------------------------------------------------- */
/** \name Operator Repeat
* \{ */
/* ui callbacks should call this rather than calling WM_operator_repeat() themselves */
-int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
+int ED_undo_operator_repeat(bContext *C, wmOperator *op)
{
int ret = 0;
@@ -318,12 +350,17 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
wmWindowManager *wm = CTX_wm_manager(C);
struct Scene *scene = CTX_data_scene(C);
+#ifdef WITH_REDO_REGION_REMOVAL
+ const OperatorRepeatContextHandle *context_info;
+ context_info = ED_operator_repeat_prepare_context(C, op);
+#else
/* keep in sync with logic in view3d_panel_operator_redo() */
ARegion *ar = CTX_wm_region(C);
ARegion *ar1 = BKE_area_find_region_active_win(CTX_wm_area(C));
if (ar1)
CTX_wm_region_set(C, ar1);
+#endif
if ((WM_operator_repeat_check(C, op)) &&
(WM_operator_poll(C, op->type)) &&
@@ -369,8 +406,12 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
}
}
+#ifdef WITH_REDO_REGION_REMOVAL
+ ED_operator_repeat_reset_context(C, context_info);
+#else
/* set region back */
CTX_wm_region_set(C, ar);
+#endif
}
else {
CLOG_WARN(&LOG, "called with NULL 'op'");