Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_ops.c
| Context not available. | |||||
| dist = BLI_rcti_size_y(&sa->totrct); | dist = BLI_rcti_size_y(&sa->totrct); | ||||
| } | } | ||||
| /* regions in regions. */ | |||||
| if (scalear->alignment &RGN_SPLIT_PREV) { | |||||
JacquesLucke: style | |||||
| if (ELEM(scalear->alignment, RGN_ALIGN_TOP | RGN_SPLIT_PREV, RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV)) { | |||||
JacquesLuckeUnsubmitted Done Inline ActionsThis will break when another flag is added in the future. JacquesLucke: This will break when another flag is added in the future.
Better use a mask to get the lower… | |||||
| ar = scalear->prev; | |||||
| dist = ar->winy + scalear->winy - U.pixelsize; | |||||
| } | |||||
| else if (ELEM(scalear->alignment, RGN_ALIGN_LEFT | RGN_SPLIT_PREV, RGN_ALIGN_RIGHT | RGN_SPLIT_PREV)) { | |||||
| ar = scalear->prev; | |||||
| dist = ar->winx + scalear->winx - U.pixelsize; | |||||
| } | |||||
| } | |||||
| /* subtractwidth of regions on opposite side | /* subtractwidth of regions on opposite side | ||||
| * prevents dragging regions into other opposite regions */ | * prevents dragging regions into other opposite regions */ | ||||
| for (ar = sa->regionbase.first; ar; ar = ar->next) { | else { | ||||
| if (ar == scalear) | for (ar = sa->regionbase.first; ar; ar = ar->next) { | ||||
| continue; | if (ar == scalear) | ||||
| continue; | |||||
| if (scalear->alignment == RGN_ALIGN_TOP && ar->alignment == RGN_ALIGN_BOTTOM) | |||||
| dist -= ar->winy; | if (scalear->alignment == RGN_ALIGN_LEFT && ar->alignment == RGN_ALIGN_RIGHT) { | ||||
| else if (scalear->alignment == RGN_ALIGN_BOTTOM && ar->alignment == RGN_ALIGN_TOP) | dist -= ar->winx; | ||||
| dist -= ar->winy; | } | ||||
| else if (scalear->alignment == RGN_ALIGN_LEFT && ar->alignment == RGN_ALIGN_RIGHT) | else if (scalear->alignment == RGN_ALIGN_RIGHT && ar->alignment == RGN_ALIGN_LEFT) { | ||||
| dist -= ar->winx; | dist -= ar->winx; | ||||
| else if (scalear->alignment == RGN_ALIGN_RIGHT && ar->alignment == RGN_ALIGN_LEFT) | } | ||||
| dist -= ar->winx; | else if (scalear->alignment == RGN_ALIGN_TOP && | ||||
| (ar->alignment == RGN_ALIGN_BOTTOM || ar->regiontype == RGN_TYPE_HEADER)) { | |||||
| /* case of regions in regions, like operator properties panel */ | dist -= ar->winy; | ||||
| /* these can sit on top of other regions such as headers, so account for this */ | } | ||||
| else if (edge == AE_BOTTOM_TO_TOPLEFT && scalear->alignment & RGN_ALIGN_TOP && | else if (scalear->alignment == RGN_ALIGN_BOTTOM && | ||||
| ar->alignment == RGN_ALIGN_TOP && ar->regiontype == RGN_TYPE_HEADER) | (ar->alignment == RGN_ALIGN_TOP || ar->regiontype == RGN_TYPE_HEADER)) { | ||||
JacquesLuckeUnsubmitted Done Inline Actionsstyle: use spaces to indent a second line of the condition. JacquesLucke: style: use spaces to indent a second line of the condition. | |||||
| { | dist -= ar->winy; | ||||
| dist -= ar->winy; | } | ||||
| } | |||||
| else if (edge == AE_TOP_TO_BOTTOMRIGHT && scalear->alignment & RGN_ALIGN_BOTTOM && | |||||
| ar->alignment == RGN_ALIGN_BOTTOM && ar->regiontype == RGN_TYPE_HEADER) | |||||
| { | |||||
| dist -= ar->winy; | |||||
| } | } | ||||
| } | } | ||||
| dist /= UI_DPI_FAC; | |||||
| return dist; | return dist; | ||||
| } | } | ||||
| Context not available. | |||||
| if (az->ar) { | if (az->ar) { | ||||
| RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData"); | RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData"); | ||||
| int maxsize; | |||||
| op->customdata = rmd; | op->customdata = rmd; | ||||
| Context not available. | |||||
| rmd->origval = rmd->ar->sizey; | rmd->origval = rmd->ar->sizey; | ||||
| } | } | ||||
Done Inline ActionsHeader size is coded in other place, this part makes no difference anymore. Gvgeo: Header size is coded in other place, this part makes no difference anymore. | |||||
Done Inline Actionsregion_rect_recursive Gvgeo: `region_rect_recursive` | |||||
| /* limit headers to standard height for now */ | CLAMP(rmd->maxsize, 0, 1000); | ||||
| if (rmd->ar->regiontype == RGN_TYPE_HEADER) | |||||
| maxsize = ED_area_headersize(); | |||||
| else | |||||
| maxsize = 1000; | |||||
| CLAMP(rmd->maxsize, 0, maxsize); | |||||
| /* add temp handler */ | /* add temp handler */ | ||||
| WM_event_add_modal_handler(C, op); | WM_event_add_modal_handler(C, op); | ||||
| Context not available. | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int region_scale_get_maxsize(RegionMoveData *rmd) | |||||
| { | |||||
| int maxsize = 0; | |||||
| if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) { | |||||
| return (int) ( (rmd->sa->winx / UI_DPI_FAC) - UI_UNIT_X); | |||||
| } | |||||
| if (rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) { | |||||
| /* this calculation seems overly verbose | |||||
| * can someone explain why this method is necessary? - campbell */ | |||||
| 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; | |||||
| } | |||||
| static void region_scale_validate_size(RegionMoveData *rmd) | static void region_scale_validate_size(RegionMoveData *rmd) | ||||
| { | { | ||||
| if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) { | if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) { | ||||
| Context not available. | |||||
| else | else | ||||
| size = &rmd->ar->sizey; | size = &rmd->ar->sizey; | ||||
| maxsize = region_scale_get_maxsize(rmd); | maxsize = rmd->maxsize - (UI_UNIT_Y / UI_DPI_FAC); | ||||
| if (*size > maxsize && maxsize > 0) | if (*size > maxsize && maxsize > 0) | ||||
| *size = maxsize; | *size = maxsize; | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| int maxsize = region_scale_get_maxsize(rmd); | |||||
| delta = event->y - rmd->origy; | delta = event->y - rmd->origy; | ||||
| if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) delta = -delta; | if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) delta = -delta; | ||||
| Context not available. | |||||
| if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) | if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) | ||||
| region_scale_toggle_hidden(C, rmd); | region_scale_toggle_hidden(C, rmd); | ||||
| } | } | ||||
| else if (maxsize > 0 && (rmd->ar->sizey > maxsize)) { | |||||
| rmd->ar->sizey = maxsize; | |||||
| } | |||||
| else if (rmd->ar->flag & RGN_FLAG_HIDDEN) { | else if (rmd->ar->flag & RGN_FLAG_HIDDEN) { | ||||
| region_scale_toggle_hidden(C, rmd); | region_scale_toggle_hidden(C, rmd); | ||||
| } | } | ||||
| Context not available. | |||||
style