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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-05-06 19:36:54 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-05-06 21:14:58 +0300
commit16e220c95929365e3e75479018bdbd71b0ad2981 (patch)
tree9d9c2f6bc27468e3e7076f167dbc35ed5c0f0edc
parenta3e74acd9ee2879898389cb9d33950f44494932e (diff)
Cleanup: deprecate area.headertype.
This was still used in a few places but not kept in sync with the actual header position. Always get alignment from the header region now.
-rw-r--r--source/blender/blenloader/intern/versioning_250.c2
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c2
-rw-r--r--source/blender/editors/screen/area.c14
-rw-r--r--source/blender/editors/screen/screen_edit.c23
-rw-r--r--source/blender/editors/screen/screen_ops.c3
-rw-r--r--source/blender/makesdna/DNA_screen_types.h5
7 files changed, 29 insertions, 21 deletions
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index b7108c882a2..3f85011db0b 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -99,7 +99,7 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
BLI_addtail(lb, ar);
ar->regiontype = RGN_TYPE_HEADER;
- if (sa->headertype == HEADERDOWN)
+ if (sa->headertype == 1)
ar->alignment = RGN_ALIGN_BOTTOM;
else
ar->alignment = RGN_ALIGN_TOP;
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index a1c429043cc..5bfa73f6271 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -135,6 +135,7 @@ void ED_area_newspace(struct bContext *C, ScrArea *sa, int type, const bool s
void ED_area_prevspace(struct bContext *C, ScrArea *sa);
void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2);
int ED_area_headersize(void);
+int ED_area_header_alignment(const ScrArea *area);
int ED_area_global_size_y(const ScrArea *area);
bool ED_area_is_global(const ScrArea *area);
int ED_region_global_size_y(void);
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index a2491e85aab..a6046e551c6 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -290,7 +290,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
/* for a header menu we set the direction automatic */
if (!pup->slideout && flip) {
ScrArea *sa = CTX_wm_area(C);
- if (sa && sa->headertype == HEADERDOWN) {
+ if (sa && ED_area_header_alignment(sa) == RGN_ALIGN_BOTTOM) {
ARegion *ar = CTX_wm_region(C);
if (ar && ar->regiontype == RGN_TYPE_HEADER) {
UI_block_direction_set(block, UI_DIR_UP);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 611e5fdd636..2357f5cdb69 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1729,7 +1729,6 @@ void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free)
const char spacetype = sa_dst->spacetype;
const short flag_copy = HEADER_NO_PULLDOWN;
- sa_dst->headertype = sa_src->headertype;
sa_dst->spacetype = sa_src->spacetype;
sa_dst->type = sa_src->type;
@@ -1759,7 +1758,6 @@ void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free)
void ED_area_data_swap(ScrArea *sa_dst, ScrArea *sa_src)
{
- SWAP(short, sa_dst->headertype, sa_src->headertype);
SWAP(char, sa_dst->spacetype, sa_src->spacetype);
SWAP(SpaceType *, sa_dst->type, sa_src->type);
@@ -2327,6 +2325,18 @@ int ED_area_headersize(void)
return (int)(HEADERY * UI_DPI_FAC);
}
+
+int ED_area_header_alignment(const ScrArea *area)
+{
+ for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_HEADER) {
+ return ar->alignment;
+ }
+ }
+
+ return RGN_ALIGN_NONE;
+}
+
/**
* \return the final height of a global \a area, accounting for DPI.
*/
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 1cadefadd5c..d024262121c 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -170,7 +170,7 @@ ScrEdge *screen_find_active_scredge(
static ScrArea *screen_addarea_ex(
ScrAreaMap *area_map,
ScrVert *bottom_left, ScrVert *top_left, ScrVert *top_right, ScrVert *bottom_right,
- short headertype, short spacetype)
+ short spacetype)
{
ScrArea *sa = MEM_callocN(sizeof(ScrArea), "addscrarea");
@@ -178,7 +178,6 @@ static ScrArea *screen_addarea_ex(
sa->v2 = top_left;
sa->v3 = top_right;
sa->v4 = bottom_right;
- sa->headertype = headertype;
sa->spacetype = spacetype;
BLI_addtail(&area_map->areabase, sa);
@@ -188,10 +187,10 @@ static ScrArea *screen_addarea_ex(
static ScrArea *screen_addarea(
bScreen *sc,
ScrVert *left_bottom, ScrVert *left_top, ScrVert *right_top, ScrVert *right_bottom,
- short headertype, short spacetype)
+ short spacetype)
{
return screen_addarea_ex(AREAMAP_FROM_SCREEN(sc), left_bottom, left_top, right_top, right_bottom,
- headertype, spacetype);
+ spacetype);
}
static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa)
@@ -273,7 +272,7 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
if (fac > 0.5f) {
/* new areas: top */
- newa = screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype);
+ newa = screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->spacetype);
/* area below */
sa->v2 = sv1;
@@ -281,7 +280,7 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
}
else {
/* new areas: bottom */
- newa = screen_addarea(sc, sa->v1, sv1, sv2, sa->v4, sa->headertype, sa->spacetype);
+ newa = screen_addarea(sc, sa->v1, sv1, sv2, sa->v4, sa->spacetype);
/* area above */
sa->v1 = sv1;
@@ -305,7 +304,7 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
if (fac > 0.5f) {
/* new areas: right */
- newa = screen_addarea(sc, sv1, sv2, sa->v3, sa->v4, sa->headertype, sa->spacetype);
+ newa = screen_addarea(sc, sv1, sv2, sa->v3, sa->v4, sa->spacetype);
/* area left */
sa->v3 = sv2;
@@ -313,7 +312,7 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
}
else {
/* new areas: left */
- newa = screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype);
+ newa = screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->spacetype);
/* area right */
sa->v1 = sv1;
@@ -355,7 +354,7 @@ bScreen *screen_add(const char *name, const int winsize_x, const int winsize_y)
screen_addedge(sc, sv4, sv1);
/* dummy type, no spacedata */
- screen_addarea(sc, sv1, sv2, sv3, sv4, HEADERDOWN, SPACE_EMPTY);
+ screen_addarea(sc, sv1, sv2, sv3, sv4, SPACE_EMPTY);
return sc;
}
@@ -1093,7 +1092,7 @@ int ED_screen_area_active(const bContext *C)
*/
static ScrArea *screen_area_create_with_geometry(
ScrAreaMap *area_map, const rcti *rect,
- short headertype, short spacetype)
+ short spacetype)
{
ScrVert *bottom_left = screen_addvert_ex(area_map, rect->xmin, rect->ymin);
ScrVert *top_left = screen_addvert_ex(area_map, rect->xmin, rect->ymax);
@@ -1105,7 +1104,7 @@ static ScrArea *screen_area_create_with_geometry(
screen_addedge_ex(area_map, top_right, bottom_right);
screen_addedge_ex(area_map, bottom_right, bottom_left);
- return screen_addarea_ex(area_map, bottom_left, top_left, top_right, bottom_right, headertype, spacetype);
+ return screen_addarea_ex(area_map, bottom_left, top_left, top_right, bottom_right, spacetype);
}
void ED_screen_global_topbar_area_create(wmWindow *win, const bScreen *screen)
@@ -1120,7 +1119,7 @@ void ED_screen_global_topbar_area_create(wmWindow *win, const bScreen *screen)
BLI_rcti_init(&rect, 0, WM_window_pixels_x(win) - 1, 0, WM_window_pixels_y(win) - 1);
rect.ymin = rect.ymax - size_y;
- sa = screen_area_create_with_geometry(&win->global_areas, &rect, HEADERTOP, SPACE_TOPBAR);
+ sa = screen_area_create_with_geometry(&win->global_areas, &rect, SPACE_TOPBAR);
st = BKE_spacetype_from_id(SPACE_TOPBAR);
sl = st->new(sa, WM_window_get_active_scene(win));
sa->regionbase = sl->regionbase;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 5a231a24304..3d18e9cbaee 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2112,7 +2112,8 @@ static int region_scale_get_maxsize(RegionMoveData *rmd)
if (rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
/* this calculation seems overly verbose
* can someone explain why this method is necessary? - campbell */
- maxsize = rmd->maxsize - ((rmd->sa->headertype == HEADERTOP) ? UI_UNIT_Y * 2 : UI_UNIT_Y) - (UI_UNIT_Y / 4);
+ const bool top_header = ED_area_header_alignment(rmd->sa) == RGN_ALIGN_TOP;
+ maxsize = rmd->maxsize - ((top_header) ? UI_UNIT_Y * 2 : UI_UNIT_Y) - (UI_UNIT_Y / 4);
}
return maxsize;
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 4274f348b2d..7392a56722e 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -264,7 +264,7 @@ typedef struct ScrArea {
short winx, winy; /* size */
- short headertype; /* OLD! 0=no header, 1= down, 2= up */
+ short headertype DNA_DEPRECATED;/* OLD! 0=no header, 1= down, 2= up */
short do_refresh; /* private, for spacetype refresh callback */
short flag;
short region_active_win; /* index of last used region of 'RGN_TYPE_WINDOW'
@@ -355,9 +355,6 @@ enum {
#define AREAMINX 32
#define HEADERY 26
-#define HEADERDOWN 1
-#define HEADERTOP 2
-
/* screen->state */
enum {
SCREENNORMAL = 0,