Commit: 1be01b3d5b73feea2a3de1a1ce33e47f1c7edba6
Author: Julian Eisel
Date:   Fri Apr 19 22:15:34 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rB1be01b3d5b73feea2a3de1a1ce33e47f1c7edba6

Merge 'master' into 'filebrowser_redesign'

===================================================================



===================================================================

diff --cc source/blender/editors/screen/area.c
index 5be930b2772,f0e8fb3fa2f..94ee6ae498b
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@@ -1139,230 -1188,236 +1188,233 @@@ bool ED_region_is_overlap(int spacetype
  static void region_rect_recursive(
      ScrArea *sa, ARegion *ar, rcti *remainder, rcti *overlap_remainder, int 
quad)
  {
-       rcti *remainder_prev = remainder;
- 
-       if (ar == NULL)
-               return;
- 
-       int prev_winx = ar->winx;
-       int prev_winy = ar->winy;
- 
-       /* no returns in function, winrct gets set in the end again */
-       BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
- 
-       /* for test; allow split of previously defined region */
-       if (ar->alignment & RGN_SPLIT_PREV)
-               if (ar->prev)
-                       remainder = &ar->prev->winrct;
- 
-       int alignment = ar->alignment & ~RGN_SPLIT_PREV;
- 
-       /* set here, assuming userpref switching forces to call this again */
-       ar->overlap = ED_region_is_overlap(sa->spacetype, ar->regiontype);
- 
-       /* clear state flags first */
-       ar->flag &= ~(RGN_FLAG_TOO_SMALL | RGN_FLAG_SIZE_CLAMP_X | 
RGN_FLAG_SIZE_CLAMP_Y);
-       /* user errors */
-       if ((ar->next == NULL) && !ELEM(alignment, RGN_ALIGN_QSPLIT, 
RGN_ALIGN_FLOAT)) {
-               alignment = RGN_ALIGN_NONE;
-       }
- 
-       /* prefsize, taking into account DPI */
-       int prefsizex = UI_DPI_FAC * ((ar->sizex > 1) ? ar->sizex + 0.5f : 
ar->type->prefsizex);
-       int prefsizey;
- 
-       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 (ar->regiontype == RGN_TYPE_FOOTER) {
-               prefsizey = ED_area_footersize();
-       }
-       else if (ED_area_is_global(sa)) {
-               prefsizey = ED_region_global_size_y();
-       }
-       else {
-               prefsizey = UI_DPI_FAC * (ar->sizey > 1 ? ar->sizey + 0.5f : 
ar->type->prefsizey);
-       }
- 
-       if (ar->flag & RGN_FLAG_HIDDEN) {
-               /* hidden is user flag */
-       }
-       else if (alignment == RGN_ALIGN_FLOAT) {
-               /**
-                * \note Currently this window type is only used for 
#RGN_TYPE_HUD,
-                * We expect the panel to resize it's self to be larger.
-                *
-                * This aligns to the lower left of the area.
-                */
-               const int size_min[2] = {UI_UNIT_X, UI_UNIT_Y};
-               rcti overlap_remainder_margin = *overlap_remainder;
+   rcti *remainder_prev = remainder;
+ 
+   if (ar == NULL)
+     return;
+ 
+   int prev_winx = ar->winx;
+   int prev_winy = ar->winy;
+ 
+   /* no returns in function, winrct gets set in the end again */
+   BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
+ 
+   /* for test; allow split of previously defined region */
+   if (ar->alignment & RGN_SPLIT_PREV)
+     if (ar->prev)
+       remainder = &ar->prev->winrct;
+ 
+   int alignment = ar->alignment & ~RGN_SPLIT_PREV;
+ 
+   /* set here, assuming userpref switching forces to call this again */
+   ar->overlap = ED_region_is_overlap(sa->spacetype, ar->regiontype);
+ 
+   /* clear state flags first */
+   ar->flag &= ~(RGN_FLAG_TOO_SMALL | RGN_FLAG_SIZE_CLAMP_X | 
RGN_FLAG_SIZE_CLAMP_Y);
+   /* user errors */
+   if ((ar->next == NULL) && !ELEM(alignment, RGN_ALIGN_QSPLIT, 
RGN_ALIGN_FLOAT)) {
+     alignment = RGN_ALIGN_NONE;
+   }
+ 
+   /* prefsize, taking into account DPI */
+   int prefsizex = UI_DPI_FAC * ((ar->sizex > 1) ? ar->sizex + 0.5f : 
ar->type->prefsizex);
+   int prefsizey;
+ 
+   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 (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
+     prefsizey = ED_area_headersize();
+   }
+   else if (ar->regiontype == RGN_TYPE_FOOTER) {
+     prefsizey = ED_area_footersize();
+   }
+   else if (ED_area_is_global(sa)) {
+     prefsizey = ED_region_global_size_y();
+   }
 -  else if (ar->regiontype == RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
 -    prefsizey = UI_UNIT_Y * 2 + (UI_UNIT_Y / 2);
 -  }
+   else {
+     prefsizey = UI_DPI_FAC * (ar->sizey > 1 ? ar->sizey + 0.5f : 
ar->type->prefsizey);
+   }
+ 
+   if (ar->flag & RGN_FLAG_HIDDEN) {
+     /* hidden is user flag */
+   }
+   else if (alignment == RGN_ALIGN_FLOAT) {
+     /**
+      * \note Currently this window type is only used for #RGN_TYPE_HUD,
+      * We expect the panel to resize it's self to be larger.
+      *
+      * This aligns to the lower left of the area.
+      */
+     const int size_min[2] = {UI_UNIT_X, UI_UNIT_Y};
+     rcti overlap_remainder_margin = *overlap_remainder;
      BLI_rcti_resize(&overlap_remainder_margin,
-                       max_ii(0, BLI_rcti_size_x(overlap_remainder) - 
UI_UNIT_X / 2),
-                       max_ii(0, BLI_rcti_size_y(overlap_remainder) - 
UI_UNIT_Y / 2));
-               ar->winrct.xmin = overlap_remainder_margin.xmin;
-               ar->winrct.ymin = overlap_remainder_margin.ymin;
-               ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
-               ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
- 
-               BLI_rcti_isect(&ar->winrct, &overlap_remainder_margin, 
&ar->winrct);
- 
-               if (BLI_rcti_size_x(&ar->winrct) != prefsizex - 1) {
-                       ar->flag |= RGN_FLAG_SIZE_CLAMP_X;
-               }
-               if (BLI_rcti_size_y(&ar->winrct) != prefsizey - 1) {
-                       ar->flag |= RGN_FLAG_SIZE_CLAMP_Y;
-               }
- 
-               /* We need to use a test that wont have been previously 
clamped. */
-               rcti winrct_test = {
-                       .xmin = ar->winrct.xmin,
-                       .ymin = ar->winrct.ymin,
-                       .xmax = ar->winrct.xmin + size_min[0],
-                       .ymax = ar->winrct.ymin + size_min[1],
-               };
-               BLI_rcti_isect(&winrct_test, &overlap_remainder_margin, 
&winrct_test);
-               if (BLI_rcti_size_x(&winrct_test) < size_min[0] ||
+                     max_ii(0, BLI_rcti_size_x(overlap_remainder) - UI_UNIT_X 
/ 2),
+                     max_ii(0, BLI_rcti_size_y(overlap_remainder) - UI_UNIT_Y 
/ 2));
+     ar->winrct.xmin = overlap_remainder_margin.xmin;
+     ar->winrct.ymin = overlap_remainder_margin.ymin;
+     ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
+     ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
+ 
+     BLI_rcti_isect(&ar->winrct, &overlap_remainder_margin, &ar->winrct);
+ 
+     if (BLI_rcti_size_x(&ar->winrct) != prefsizex - 1) {
+       ar->flag |= RGN_FLAG_SIZE_CLAMP_X;
+     }
+     if (BLI_rcti_size_y(&ar->winrct) != prefsizey - 1) {
+       ar->flag |= RGN_FLAG_SIZE_CLAMP_Y;
+     }
+ 
+     /* We need to use a test that wont have been previously clamped. */
+     rcti winrct_test = {
+         .xmin = ar->winrct.xmin,
+         .ymin = ar->winrct.ymin,
+         .xmax = ar->winrct.xmin + size_min[0],
+         .ymax = ar->winrct.ymin + size_min[1],
+     };
+     BLI_rcti_isect(&winrct_test, &overlap_remainder_margin, &winrct_test);
+     if (BLI_rcti_size_x(&winrct_test) < size_min[0] ||
          BLI_rcti_size_y(&winrct_test) < size_min[1]) {
-                       ar->flag |= RGN_FLAG_TOO_SMALL;
-               }
-       }
-       else if (rct_fits(remainder, 'v', 1) < 0 || rct_fits(remainder, 'h', 1) 
< 0) {
-               /* remainder is too small for any usage */
-               ar->flag |= RGN_FLAG_TOO_SMALL;
-       }
-       else if (alignment == RGN_ALIGN_NONE) {
-               /* typically last region */
-               ar->winrct = *remainder;
-               BLI_rcti_init(remainder, 0, 0, 0, 0);
-       }
-       else if (alignment == RGN_ALIGN_TOP || alignment == RGN_ALIGN_BOTTOM) {
-               rcti *winrct = (ar->overlap) ? overlap_remainder : remainder;
- 
-               if (rct_fits(winrct, 'v', prefsizey) < 0) {
-                       ar->flag |= RGN_FLAG_TOO_SMALL;
-               }
-               else {
-                       int fac = rct_fits(winrct, 'v', prefsizey);
- 
-                       if (fac < 0)
-                               prefsizey += fac;
- 
-                       ar->winrct = *winrct;
- 
-                       if (alignment == RGN_ALIGN_TOP) {
-                               ar->winrct.ymin = ar->winrct.ymax - prefsizey + 
1;
-                               winrct->ymax = ar->winrct.ymin - 1;
-                       }
-                       else {
-                               ar->winrct.ymax = ar->winrct.ymin + prefsizey - 
1;
-                               winrct->ymin = ar->winrct.ymax + 1;
-                       }
-               }
-       }
-       else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) {
-               rcti *winrct = (ar->overlap) ? overlap_remainder : remainder;
- 
-               if (rct_fits(winrct, 'h', prefsizex) < 0) {
-                       ar->flag |= RGN_FLAG_TOO_SMALL;
-               }
-               else {
-                       int fac = rct_fits(winrct, 'h', prefsizex);
- 
-                       if (fac < 0)
-                               prefsizex += fac;
- 
-                       ar->winrct = *winrct;
- 
-                       if (alignment == RGN_ALIGN_RIGHT) {
-                               ar->winrct.xmin = ar->winrct.xmax - prefsizex + 
1;
-                               winrct->xmax = ar->winrct.xmin - 1;
-                       }
-                       else {
-                               ar->winrct.xmax = ar->winrct.xmin + prefsizex - 
1;
-                               winrct->xmin = ar->winrct.xmax + 1;
-                       }
-               }
-       }
-       else if (alignment == RGN_ALIGN_VSPLIT || alignment == 
RGN_ALIGN_HSPLIT) {
-               /* percentage subdiv*/
-               ar->winrct = *remainder;
- 
-               if (alignment == RGN_ALIGN_HSPLIT) {
-                       if (rct_fits(remainder, 'h', prefsizex) > 4) {
-                               ar->winrct.xmax = BLI_rcti_cent_x(remainder);
-                               remainder->xmin = ar->winrct.xmax + 1;
-                       }
-                       else {
-                               BLI_rcti_init(remainder, 0, 0, 0, 0);
-                       }
-               }
-               else {
-                       if (rct_fits(remainder, 'v', prefsizey) > 4) {
-                               ar->winrct.ymax = BLI_rcti_cent_y(remainder);
-                               remainder->ymin = ar->winrct.ymax + 1;
-                       }
-                       else {
-                               BLI_rcti_init(remainder, 0, 0, 0, 0);
-                       }
-               }
-       }
-       else if (alignment == RGN_ALIGN_QSPLIT) {
-               ar->winrct = *remainder;
- 
-               /* test if there's still 4 regions left */
-               if (quad == 0) {
-                       ARegion *artest = ar->next;
-                       int count = 1;
- 
-                       while (artest) {
-                               artest->alignment = RGN_ALIGN_QSPLIT;
-                               artest = artest->next;
-                               count++;
-                       }
- 
-                       if (count != 4) {
-                               /* let's stop adding regions */
-                               BLI_rcti_init(remainder, 0, 0, 0, 0);
-                               if (G.debug & G_DEBUG)
-                                       printf("region quadsplit failed\n");
-                       }
-                       else {
-                               quad = 1;
-                       }
-               }
-               if (quad) {
-                       if (quad == 1) { /* left bottom */
-                               ar->winrct.xmax = BLI_rcti_cent_x(remainder);
-                               ar->winrct.ymax = BLI_rcti_cent_y(remainder);
-                       }
-                       else if (quad == 2) { /* left top */
-                               ar->winrct.xmax = BLI_rcti_cent_x(remainder);
-                               ar->winrct.ymin = BLI_rcti_cent_y(remainder) + 
1;
-                       }
-                       else if (quad == 3) { /* right bottom */
-                               ar->winrct.xmin = BLI_rcti_cent_x(remainder) + 
1;
-                               ar->winrct.ymax = BLI_rcti_cent_y(remainder);
-                       }
-                       el

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to