Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_ops.c
| Context not available. | |||||
| if (ar == scalear) | if (ar == scalear) | ||||
| continue; | continue; | ||||
| if (scalear->alignment == RGN_ALIGN_TOP && ar->alignment == RGN_ALIGN_BOTTOM) | if (scalear->alignment == RGN_ALIGN_LEFT && ar->alignment == RGN_ALIGN_RIGHT) | ||||
| dist -= ar->winy; | |||||
| else if (scalear->alignment == RGN_ALIGN_BOTTOM && ar->alignment == RGN_ALIGN_TOP) | |||||
| dist -= ar->winy; | |||||
| else if (scalear->alignment == RGN_ALIGN_LEFT && ar->alignment == RGN_ALIGN_RIGHT) | |||||
| dist -= ar->winx; | dist -= ar->winx; | ||||
| else if (scalear->alignment == RGN_ALIGN_RIGHT && ar->alignment == RGN_ALIGN_LEFT) | else if (scalear->alignment == RGN_ALIGN_RIGHT && ar->alignment == RGN_ALIGN_LEFT) { | ||||
| dist -= ar->winx; | dist -= ar->winx; | ||||
| /* case of regions in regions, like operator properties panel */ | |||||
| /* 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 && | |||||
| ar->alignment == RGN_ALIGN_TOP && ar->regiontype == RGN_TYPE_HEADER) | |||||
| { | |||||
| dist -= ar->winy; | |||||
| } | } | ||||
| else if (edge == AE_TOP_TO_BOTTOMRIGHT && scalear->alignment & RGN_ALIGN_BOTTOM && | /* regions with Y axis alignment. | ||||
| ar->alignment == RGN_ALIGN_BOTTOM && ar->regiontype == RGN_TYPE_HEADER) | * assuming no space, with two dynamic size regions on Y axis exist. | ||||
| { | * needed for tools props region in file browser. */ | ||||
| else if (scalear->alignment &(RGN_ALIGN_TOP | RGN_ALIGN_BOTTOM) && ar->regiontype == RGN_TYPE_HEADER) { | |||||
| dist -= ar->winy; | dist -= ar->winy; | ||||
| } | } | ||||
| } | } | ||||
| dist /= UI_DPI_FAC; | |||||
| return dist; | return dist; | ||||
| } | } | ||||
JacquesLucke: style: use spaces to indent a second line of the condition. | |||||
| 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. | |||||
| } | } | ||||
| CLAMP(rmd->ar->sizey, 0, rmd->maxsize); | CLAMP(rmd->ar->sizey, 0, rmd->maxsize); | ||||
| /* note, 'UI_UNIT_Y/4' means you need to drag the header almost | /* note, 'UI_UNIT_Y/4' means you need to drag the execute region almost | ||||
| * all the way down for it to become hidden, this is done | * all the way down for it to become hidden, this is done | ||||
| * otherwise its too easy to do this by accident */ | * otherwise its too easy to do this by accident */ | ||||
| if (rmd->ar->sizey < UI_UNIT_Y / 4) { | if (rmd->ar->sizey < UI_UNIT_Y / 4) { | ||||
| 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: use spaces to indent a second line of the condition.