Commit: 49b524cfa81e868efd25df95b9d0f181d068e75f
Author: Julian Eisel
Date: Thu Feb 16 20:16:37 2017 +0100
Branches: temp-workspace-multi-window
https://developer.blender.org/rB49b524cfa81e868efd25df95b9d0f181d068e75f
Add/use macro to iterate over layout-types
===================================================================
M source/blender/blenkernel/BKE_workspace.h
M source/blender/windowmanager/intern/wm_window.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_workspace.h
b/source/blender/blenkernel/BKE_workspace.h
index d6cbe43efc..2555a74d1f 100644
--- a/source/blender/blenkernel/BKE_workspace.h
+++ b/source/blender/blenkernel/BKE_workspace.h
@@ -88,6 +88,15 @@ WorkSpaceLayout *BKE_workspace_layout_iter_circular(const
WorkSpace *workspace,
bool (*callback)(const
WorkSpaceLayout *layout, void *arg),
void *arg, const bool
iter_backward);
+#define BKE_workspace_layout_type_iter_begin(_layout_type, _start_layout_type)
\
+ for (WorkSpaceLayoutType *_layout_type = _start_layout_type,
*_layout_type##_next; \
+ _layout_type; \
+ _layout_type = _layout_type##_next) \
+ { \
+ _layout_type##_next =
BKE_workspace_layout_type_next_get(_layout_type); /* support removing
layout-type from list */
+#define BKE_workspace_layout_type_iter_end } (void)0
+
+
/* -------------------------------------------------------------------- */
/* Getters/Setters */
diff --git a/source/blender/windowmanager/intern/wm_window.c
b/source/blender/windowmanager/intern/wm_window.c
index 9b723bfb93..4ac1d83cda 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1783,15 +1783,15 @@ WorkSpace *WM_window_get_active_workspace(const
wmWindow *win)
}
void WM_window_set_active_workspace(wmWindow *win, WorkSpace *workspace)
{
+ ListBase *layout_types = BKE_workspace_layout_types_get(workspace);
+
win->workspace = workspace;
BLI_freelistN(&win->workspace_layouts);
if (!workspace) {
return;
}
- for (WorkSpaceLayoutType *layout_type =
BKE_workspace_layout_types_get(workspace)->first;
- layout_type != NULL;
- layout_type = BKE_workspace_layout_type_next_get(layout_type))
+ BKE_workspace_layout_type_iter_begin(layout_type, layout_types->first)
{
bScreen *screen = BLI_findstring(&G.main->screen,
BKE_workspace_layout_type_name_get(layout_type),
offsetof(ID, name) + 2); /*
XXX */
@@ -1799,6 +1799,7 @@ void WM_window_set_active_workspace(wmWindow *win,
WorkSpace *workspace)
BLI_addhead(&win->workspace_layouts, layout);
}
+ BKE_workspace_layout_type_iter_end;
}
WorkSpaceLayout *WM_window_get_active_layout(const wmWindow *win)
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs