Merge branch 'blender2.7'
[blender.git] / source / blender / blenkernel / intern / screen.c
index a6053c80fe7bbf1d61170bfcae750375b6423712..7a2b93e6833eef07a6efe11efdb0f6329c78b7b5 100644 (file)
@@ -17,8 +17,8 @@
  * All rights reserved.
  */
 
-/** \file blender/blenkernel/intern/screen.c
- *  \ingroup bke
+/** \file
+ * \ingroup bke
  */
 
 #ifdef WIN32
@@ -847,3 +847,20 @@ bool BKE_screen_is_used(const bScreen *screen)
 {
        return (screen->winid != 0);
 }
+
+void BKE_screen_header_alignment_reset(bScreen *screen)
+{
+       int alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+               for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+                       if (ar->regiontype == RGN_TYPE_HEADER) {
+                               if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) {
+                                       ar->alignment = RGN_ALIGN_TOP;
+                                       continue;
+                               }
+                               ar->alignment = alignment;
+                       }
+               }
+       }
+       screen->do_refresh = true;
+}