Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/view2d.c
| Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | static void view2d_masks(View2D *v2d, bool check_scrollers, const rcti *mask_scroll) | ||||
| UI_view2d_mask_from_win(v2d, &v2d->mask); | UI_view2d_mask_from_win(v2d, &v2d->mask); | ||||
| if (mask_scroll == NULL) { | if (mask_scroll == NULL) { | ||||
| mask_scroll = &v2d->mask; | mask_scroll = &v2d->mask; | ||||
| } | } | ||||
| if (check_scrollers) { | if (check_scrollers) { | ||||
| /* check size if hiding flag is set: */ | /* check size if hiding flag is set: */ | ||||
| if (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE) { | if (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE) { | ||||
| if (!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL)) { | if (!(v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES)) { | ||||
| if (BLI_rctf_size_x(&v2d->tot) > BLI_rctf_size_x(&v2d->cur)) { | if (BLI_rctf_size_x(&v2d->tot) > BLI_rctf_size_x(&v2d->cur)) { | ||||
| v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_FULLR; | v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_FULLR; | ||||
| } | } | ||||
| else { | else { | ||||
| v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR; | v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE) { | if (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE) { | ||||
| if (!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL)) { | if (!(v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES)) { | ||||
| if (BLI_rctf_size_y(&v2d->tot) + 0.01f > BLI_rctf_size_y(&v2d->cur)) { | if (BLI_rctf_size_y(&v2d->tot) + 0.01f > BLI_rctf_size_y(&v2d->cur)) { | ||||
| v2d->scroll &= ~V2D_SCROLL_VERTICAL_FULLR; | v2d->scroll &= ~V2D_SCROLL_VERTICAL_FULLR; | ||||
| } | } | ||||
| else { | else { | ||||
| v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR; | v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| scroll = view2d_scroll_mapped(v2d->scroll); | scroll = view2d_scroll_mapped(v2d->scroll); | ||||
| /* scrollers are based off regionsize | /* scrollers are based off regionsize | ||||
| * - they can only be on one to two edges of the region they define | * - they can only be on one to two edges of the region they define | ||||
| * - if they overlap, they must not occupy the corners (which are reserved for other widgets) | * - if they overlap, they must not occupy the corners (which are reserved for other widgets) | ||||
| */ | */ | ||||
| if (scroll) { | if (scroll) { | ||||
| const int scroll_width = (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) ? V2D_SCROLL_WIDTH_TEXT : | const int scroll_width = (v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) ? | ||||
| V2D_SCROLL_WIDTH_HANDLES : | |||||
| V2D_SCROLL_WIDTH; | V2D_SCROLL_WIDTH; | ||||
| const int scroll_height = (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) ? | const int scroll_height = (v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) ? | ||||
| V2D_SCROLL_HEIGHT_TEXT : | V2D_SCROLL_HEIGHT_HANDLES : | ||||
| V2D_SCROLL_HEIGHT; | V2D_SCROLL_HEIGHT; | ||||
| /* vertical scroller */ | /* vertical scroller */ | ||||
| if (scroll & V2D_SCROLL_LEFT) { | if (scroll & V2D_SCROLL_LEFT) { | ||||
| /* on left-hand edge of region */ | /* on left-hand edge of region */ | ||||
| v2d->vert = *mask_scroll; | v2d->vert = *mask_scroll; | ||||
| v2d->vert.xmax = scroll_width; | v2d->vert.xmax = scroll_width; | ||||
| } | } | ||||
| else if (scroll & V2D_SCROLL_RIGHT) { | else if (scroll & V2D_SCROLL_RIGHT) { | ||||
| /* on right-hand edge of region */ | /* on right-hand edge of region */ | ||||
| v2d->vert = *mask_scroll; | v2d->vert = *mask_scroll; | ||||
| v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */ | v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */ | ||||
| v2d->vert.xmin = v2d->vert.xmax - scroll_width; | v2d->vert.xmin = v2d->vert.xmax - scroll_width; | ||||
| } | } | ||||
| /* Currently, all regions that have vertical scale text, | /* Currently, all regions that have vertical scale handles, | ||||
| * also have the scrubbing area at the top. | * also have the scrubbing area at the top. | ||||
| * So the scrollbar has to move down a bit. */ | * So the scrollbar has to move down a bit. */ | ||||
| if (scroll & V2D_SCROLL_SCALE_VERTICAL) { | if (scroll & V2D_SCROLL_VERTICAL_HANDLES) { | ||||
| v2d->vert.ymax -= UI_SCRUBBING_MARGIN_Y; | v2d->vert.ymax -= UI_SCRUBBING_MARGIN_Y; | ||||
| } | } | ||||
| /* horizontal scroller */ | /* horizontal scroller */ | ||||
| if (scroll & (V2D_SCROLL_BOTTOM)) { | if (scroll & (V2D_SCROLL_BOTTOM)) { | ||||
| /* on bottom edge of region */ | /* on bottom edge of region */ | ||||
| v2d->hor = *mask_scroll; | v2d->hor = *mask_scroll; | ||||
| v2d->hor.ymax = scroll_height; | v2d->hor.ymax = scroll_height; | ||||
| ▲ Show 20 Lines • Show All 1,391 Lines • ▼ Show 20 Lines | if (scroll & V2D_SCROLL_HORIZONTAL) { | ||||
| /* show zoom handles if: | /* show zoom handles if: | ||||
| * - zooming on x-axis is allowed (no scroll otherwise) | * - zooming on x-axis is allowed (no scroll otherwise) | ||||
| * - slider bubble is large enough (no overdraw confusion) | * - slider bubble is large enough (no overdraw confusion) | ||||
| * - scale is shown on the scroller | * - scale is shown on the scroller | ||||
| * (workaround to make sure that button windows don't show these, | * (workaround to make sure that button windows don't show these, | ||||
| * and only the time-grids with their zoomability can do so) | * and only the time-grids with their zoomability can do so) | ||||
| */ | */ | ||||
| if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) && | if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) && | ||||
| (BLI_rcti_size_x(&slider) > V2D_SCROLLER_HANDLE_SIZE)) { | (BLI_rcti_size_x(&slider) > V2D_SCROLLER_HANDLE_SIZE)) { | ||||
| state |= UI_SCROLL_ARROWS; | state |= UI_SCROLL_ARROWS; | ||||
| } | } | ||||
| UI_draw_widget_scroll(&wcol, &hor, &slider, state); | UI_draw_widget_scroll(&wcol, &hor, &slider, state); | ||||
| } | } | ||||
| /* vertical scrollbar */ | /* vertical scrollbar */ | ||||
| Show All 17 Lines | if (scroll & V2D_SCROLL_VERTICAL) { | ||||
| /* show zoom handles if: | /* show zoom handles if: | ||||
| * - zooming on y-axis is allowed (no scroll otherwise) | * - zooming on y-axis is allowed (no scroll otherwise) | ||||
| * - slider bubble is large enough (no overdraw confusion) | * - slider bubble is large enough (no overdraw confusion) | ||||
| * - scale is shown on the scroller | * - scale is shown on the scroller | ||||
| * (workaround to make sure that button windows don't show these, | * (workaround to make sure that button windows don't show these, | ||||
| * and only the time-grids with their zoomability can do so) | * and only the time-grids with their zoomability can do so) | ||||
| */ | */ | ||||
| if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 && (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) && | if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 && (v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) && | ||||
| (BLI_rcti_size_y(&slider) > V2D_SCROLLER_HANDLE_SIZE)) { | (BLI_rcti_size_y(&slider) > V2D_SCROLLER_HANDLE_SIZE)) { | ||||
| state |= UI_SCROLL_ARROWS; | state |= UI_SCROLL_ARROWS; | ||||
| } | } | ||||
| UI_draw_widget_scroll(&wcol, &vert, &slider, state); | UI_draw_widget_scroll(&wcol, &vert, &slider, state); | ||||
| } | } | ||||
| /* Was changed above, so reset. */ | /* Was changed above, so reset. */ | ||||
| ▲ Show 20 Lines • Show All 567 Lines • Show Last 20 Lines | |||||