diff options
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 6352dacad80..fb8e7e8d68f 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -234,7 +234,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) */ case V2D_COMMONVIEW_STANDARD: { - /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ + /* for now, aspect ratio should be maintained, + * and zoom is clamped within sane default limits */ v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM); v2d->minzoom = 0.01f; v2d->maxzoom = 1000.0f; @@ -289,7 +290,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) /* scroller settings are currently not set here... that is left for regions... */ break; } - /* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */ + /* 'header' regions - zoom, aspect ratio, + * alignment, and panning restrictions are set here */ case V2D_COMMONVIEW_HEADER: { /* zoom + aspect ratio are locked */ @@ -322,7 +324,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) case V2D_COMMONVIEW_PANELS_UI: { - /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ + /* for now, aspect ratio should be maintained, + * and zoom is clamped within sane default limits */ v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM | V2D_KEEPZOOM); v2d->minzoom = 0.5f; v2d->maxzoom = 2.0f; @@ -357,7 +360,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) } /* other view types are completely defined using their own settings already */ default: - /* we don't do anything here, as settings should be fine, but just make sure that rect */ + /* we don't do anything here, + * as settings should be fine, but just make sure that rect */ break; } @@ -377,7 +381,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) } /* set 'tot' rect before setting cur? */ - /* XXX confusing stuff here still - I made this function not check scroller hide - that happens in totrect_set */ + /* XXX confusing stuff here still - + * I made this function not check scroller hide - that happens in totrect_set */ if (tot_changed) UI_view2d_totRect_set_resize(v2d, winx, winy, !do_init); else @@ -486,7 +491,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas } } else { - /* make sure sizes don't exceed that of the min/max sizes (even though we're not doing zoom clamping) */ + /* make sure sizes don't exceed that of the min/max sizes + * (even though we're not doing zoom clamping) */ CLAMP(width, v2d->min[0], v2d->max[0]); CLAMP(height, v2d->min[1], v2d->max[1]); } @@ -576,7 +582,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas v2d->oldwiny = (short)winy; } - /* Step 2: apply new sizes to cur rect, but need to take into account alignment settings here... */ + /* Step 2: apply new sizes to cur rect, + * but need to take into account alignment settings here... */ if ((width != curwidth) || (height != curheight)) { float temp, dh; @@ -675,7 +682,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas * (XXX - in the past, max was favored... if there are bugs, swap!) */ if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) { - /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */ + /* outside boundaries on both sides, + * so take middle-point of tot, and place in balanced way */ temp = BLI_rctf_cent_x(tot); diff = curwidth * 0.5f; @@ -725,7 +733,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas * We favour moving the 'minimum' across, as that's origin for most things */ if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) { - /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */ + /* outside boundaries on both sides, + * so take middle-point of tot, and place in balanced way */ temp = BLI_rctf_cent_y(tot); diff = curheight * 0.5f; @@ -803,7 +812,8 @@ void UI_view2d_curRect_validate(View2D *v2d) /* ------------------ */ -/* Called by menus to activate it, or by view2d operators to make sure 'related' views stay in synchrony */ +/* Called by menus to activate it, or by view2d operators + * to make sure 'related' views stay in synchrony */ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) { ScrArea *sa; @@ -992,7 +1002,8 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height) UI_view2d_totRect_set_resize(v2d, width, height, 0); - /* solve bad recursion... if scroller state changed, mask is different, so you get different rects */ + /* solve bad recursion... if scroller state changed, + * mask is different, so you get different rects */ if (scroll != view2d_scroll_mapped(v2d->scroll)) { UI_view2d_totRect_set_resize(v2d, width, height, 0); } @@ -1072,7 +1083,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked) float sizex = BLI_rcti_size_x(&v2d->mask); float sizey = BLI_rcti_size_y(&v2d->mask); - /* prevent tiny or narrow regions to get invalid coordinates - mask can get negative even... */ + /* prevent tiny or narrow regions to get + * invalid coordinates - mask can get negative even... */ if (sizex > 0.0f && sizey > 0.0f) { float dx = BLI_rctf_size_x(&v2d->cur) / (sizex + 1); float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1); @@ -1109,7 +1121,8 @@ void UI_view2d_view_ortho(View2D *v2d) if (sizey > 0) yofs = eps * BLI_rctf_size_y(&v2d->cur) / sizey; - /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ + /* apply mask-based adjustments to cur rect (due to scrollers), + * to eliminate scaling artifacts */ view2d_map_cur_using_mask(v2d, &curmasked); BLI_rctf_translate(&curmasked, -xofs, -yofs); @@ -1145,7 +1158,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis) xofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? GLA_PIXEL_OFS : 0.0f; yofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? GLA_PIXEL_OFS : 0.0f; - /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ + /* apply mask-based adjustments to cur rect (due to scrollers), + * to eliminate scaling artifacts */ view2d_map_cur_using_mask(v2d, &curmasked); /* only set matrix with 'cur' coordinates on relevant axes */ @@ -1202,7 +1216,9 @@ static void step_to_grid(float *step, int *power, int unit) /* for frames, we want 1.0 frame intervals only */ if (unit == V2D_UNIT_FRAMES) { rem = 1.0f; - *step = 2.0f; /* use 2 since there are grid lines drawn in between, this way to get 1 line per frame */ + /* use 2 since there are grid lines drawn in between, + * this way to get 1 line per frame */ + *step = 2.0f; } /* prevents printing 1.0 2.0 3.0 etc */ @@ -1806,7 +1822,8 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power BLI_timecode_string_from_time_seconds(timecode_str, sizeof(timecode_str), power, val); } - /* get length of string, and adjust printing location to fit it into the horizontal scrollbar */ + /* get length of string, + * and adjust printing location to fit it into the horizontal scrollbar */ len = strlen(timecode_str); if (dir == 'h') { /* seconds/timecode display has slightly longer strings... */ @@ -1935,7 +1952,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v break; case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ - /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */ + /* HACK: although we're drawing horizontal, + * we make this draw as 'vertical', just to get degree signs */ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); break; } @@ -2004,7 +2022,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v UI_FontThemeColor(font_id, TH_TEXT); val = grid->starty; - /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */ + /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), + * apply correction */ if (vs->yclamp == V2D_GRID_CLAMP) fac += 0.5f * dfac; |