Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/area.c
| Show First 20 Lines • Show All 1,166 Lines • ▼ Show 20 Lines | static void region_azones_add(const bScreen *screen, ScrArea *area, ARegion *region) | ||||
| if (is_fullscreen) { | if (is_fullscreen) { | ||||
| fullscreen_azone_init(area, region); | fullscreen_azone_init(area, region); | ||||
| } | } | ||||
| region_azones_scrollbars_init(area, region); | region_azones_scrollbars_init(area, region); | ||||
| } | } | ||||
| /* dir is direction to check, not the splitting edge direction! */ | /* dir is direction to check, not the splitting edge direction! */ | ||||
| static int rct_fits(const rcti *rect, char dir, int size) | static int rct_fits(const rcti *rect, const eScreenAxis dir_axis, int size) | ||||
| { | { | ||||
| if (dir == 'h') { | if (dir_axis == SCREEN_AXIS_H) { | ||||
| return BLI_rcti_size_x(rect) + 1 - size; | return BLI_rcti_size_x(rect) + 1 - size; | ||||
| } | } | ||||
| /* 'v' */ | /* Vertical. */ | ||||
| return BLI_rcti_size_y(rect) + 1 - size; | return BLI_rcti_size_y(rect) + 1 - size; | ||||
| } | } | ||||
| /* *************************************************************** */ | /* *************************************************************** */ | ||||
| /* region should be overlapping */ | /* region should be overlapping */ | ||||
| /* function checks if some overlapping region was defined before - on same place */ | /* function checks if some overlapping region was defined before - on same place */ | ||||
| static void region_overlap_fix(ScrArea *area, ARegion *region) | static void region_overlap_fix(ScrArea *area, ARegion *region) | ||||
| ▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | rcti winrct_test = { | ||||
| .ymax = region->winrct.ymin + size_min[1], | .ymax = region->winrct.ymin + size_min[1], | ||||
| }; | }; | ||||
| BLI_rcti_isect(&winrct_test, &overlap_remainder_margin, &winrct_test); | BLI_rcti_isect(&winrct_test, &overlap_remainder_margin, &winrct_test); | ||||
| if (BLI_rcti_size_x(&winrct_test) < size_min[0] || | if (BLI_rcti_size_x(&winrct_test) < size_min[0] || | ||||
| BLI_rcti_size_y(&winrct_test) < size_min[1]) { | BLI_rcti_size_y(&winrct_test) < size_min[1]) { | ||||
| region->flag |= RGN_FLAG_TOO_SMALL; | region->flag |= RGN_FLAG_TOO_SMALL; | ||||
| } | } | ||||
| } | } | ||||
| else if (rct_fits(remainder, 'v', 1) < 0 || rct_fits(remainder, 'h', 1) < 0) { | else if (rct_fits(remainder, SCREEN_AXIS_V, 1) < 0 || | ||||
| rct_fits(remainder, SCREEN_AXIS_H, 1) < 0) { | |||||
| /* remainder is too small for any usage */ | /* remainder is too small for any usage */ | ||||
| region->flag |= RGN_FLAG_TOO_SMALL; | region->flag |= RGN_FLAG_TOO_SMALL; | ||||
| } | } | ||||
| else if (alignment == RGN_ALIGN_NONE) { | else if (alignment == RGN_ALIGN_NONE) { | ||||
| /* typically last region */ | /* typically last region */ | ||||
| region->winrct = *remainder; | region->winrct = *remainder; | ||||
| BLI_rcti_init(remainder, 0, 0, 0, 0); | BLI_rcti_init(remainder, 0, 0, 0, 0); | ||||
| } | } | ||||
| else if (ELEM(alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) { | else if (ELEM(alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) { | ||||
| rcti *winrct = (region->overlap) ? overlap_remainder : remainder; | rcti *winrct = (region->overlap) ? overlap_remainder : remainder; | ||||
| if ((prefsizey == 0) || (rct_fits(winrct, 'v', prefsizey) < 0)) { | if ((prefsizey == 0) || (rct_fits(winrct, SCREEN_AXIS_V, prefsizey) < 0)) { | ||||
| region->flag |= RGN_FLAG_TOO_SMALL; | region->flag |= RGN_FLAG_TOO_SMALL; | ||||
| } | } | ||||
| else { | else { | ||||
| int fac = rct_fits(winrct, 'v', prefsizey); | int fac = rct_fits(winrct, SCREEN_AXIS_V, prefsizey); | ||||
| if (fac < 0) { | if (fac < 0) { | ||||
| prefsizey += fac; | prefsizey += fac; | ||||
| } | } | ||||
| region->winrct = *winrct; | region->winrct = *winrct; | ||||
| if (alignment == RGN_ALIGN_TOP) { | if (alignment == RGN_ALIGN_TOP) { | ||||
| region->winrct.ymin = region->winrct.ymax - prefsizey + 1; | region->winrct.ymin = region->winrct.ymax - prefsizey + 1; | ||||
| winrct->ymax = region->winrct.ymin - 1; | winrct->ymax = region->winrct.ymin - 1; | ||||
| } | } | ||||
| else { | else { | ||||
| region->winrct.ymax = region->winrct.ymin + prefsizey - 1; | region->winrct.ymax = region->winrct.ymin + prefsizey - 1; | ||||
| winrct->ymin = region->winrct.ymax + 1; | winrct->ymin = region->winrct.ymax + 1; | ||||
| } | } | ||||
| BLI_rcti_sanitize(winrct); | BLI_rcti_sanitize(winrct); | ||||
| } | } | ||||
| } | } | ||||
| else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) { | else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) { | ||||
| rcti *winrct = (region->overlap) ? overlap_remainder : remainder; | rcti *winrct = (region->overlap) ? overlap_remainder : remainder; | ||||
| if ((prefsizex == 0) || (rct_fits(winrct, 'h', prefsizex) < 0)) { | if ((prefsizex == 0) || (rct_fits(winrct, SCREEN_AXIS_H, prefsizex) < 0)) { | ||||
| region->flag |= RGN_FLAG_TOO_SMALL; | region->flag |= RGN_FLAG_TOO_SMALL; | ||||
| } | } | ||||
| else { | else { | ||||
| int fac = rct_fits(winrct, 'h', prefsizex); | int fac = rct_fits(winrct, SCREEN_AXIS_H, prefsizex); | ||||
| if (fac < 0) { | if (fac < 0) { | ||||
| prefsizex += fac; | prefsizex += fac; | ||||
| } | } | ||||
| region->winrct = *winrct; | region->winrct = *winrct; | ||||
| if (alignment == RGN_ALIGN_RIGHT) { | if (alignment == RGN_ALIGN_RIGHT) { | ||||
| region->winrct.xmin = region->winrct.xmax - prefsizex + 1; | region->winrct.xmin = region->winrct.xmax - prefsizex + 1; | ||||
| winrct->xmax = region->winrct.xmin - 1; | winrct->xmax = region->winrct.xmin - 1; | ||||
| } | } | ||||
| else { | else { | ||||
| region->winrct.xmax = region->winrct.xmin + prefsizex - 1; | region->winrct.xmax = region->winrct.xmin + prefsizex - 1; | ||||
| winrct->xmin = region->winrct.xmax + 1; | winrct->xmin = region->winrct.xmax + 1; | ||||
| } | } | ||||
| BLI_rcti_sanitize(winrct); | BLI_rcti_sanitize(winrct); | ||||
| } | } | ||||
| } | } | ||||
| else if (ELEM(alignment, RGN_ALIGN_VSPLIT, RGN_ALIGN_HSPLIT)) { | else if (ELEM(alignment, RGN_ALIGN_VSPLIT, RGN_ALIGN_HSPLIT)) { | ||||
| /* percentage subdiv*/ | /* percentage subdiv*/ | ||||
| region->winrct = *remainder; | region->winrct = *remainder; | ||||
| if (alignment == RGN_ALIGN_HSPLIT) { | if (alignment == RGN_ALIGN_HSPLIT) { | ||||
| if (rct_fits(remainder, 'h', prefsizex) > 4) { | if (rct_fits(remainder, SCREEN_AXIS_H, prefsizex) > 4) { | ||||
| region->winrct.xmax = BLI_rcti_cent_x(remainder); | region->winrct.xmax = BLI_rcti_cent_x(remainder); | ||||
| remainder->xmin = region->winrct.xmax + 1; | remainder->xmin = region->winrct.xmax + 1; | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_rcti_init(remainder, 0, 0, 0, 0); | BLI_rcti_init(remainder, 0, 0, 0, 0); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (rct_fits(remainder, 'v', prefsizey) > 4) { | if (rct_fits(remainder, SCREEN_AXIS_V, prefsizey) > 4) { | ||||
| region->winrct.ymax = BLI_rcti_cent_y(remainder); | region->winrct.ymax = BLI_rcti_cent_y(remainder); | ||||
| remainder->ymin = region->winrct.ymax + 1; | remainder->ymin = region->winrct.ymax + 1; | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_rcti_init(remainder, 0, 0, 0, 0); | BLI_rcti_init(remainder, 0, 0, 0, 0); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,330 Lines • Show Last 20 Lines | |||||