141 if (mask_scroll ==
NULL) {
142 mask_scroll = &v2d->
mask;
174 float scroll_width, scroll_height;
181 v2d->
vert = *mask_scroll;
186 v2d->
vert = *mask_scroll;
201 v2d->
hor = *mask_scroll;
206 v2d->
hor = *mask_scroll;
242 bool tot_changed =
false, do_init;
288 tot_changed = do_init;
304 tot_changed = do_init;
329 tot_changed = do_init;
354 const float panelzoom = (style) ? style->
panelzoom : 1.0f;
363 v2d->
cur.
xmax = (winx)*panelzoom;
366 v2d->
cur.
ymin = (-winy) * panelzoom;
408 float totwidth, totheight, curwidth, curheight,
width,
height;
451 if (
width < FLT_MIN) {
470 oldzoom = v2d->
oldwinx / curwidth;
472 if (oldzoom != zoom) {
473 width *= zoom / oldzoom;
479 oldzoom = v2d->
oldwiny / curheight;
481 if (oldzoom != zoom) {
493 const float zoom = winx /
width;
494 if (zoom < v2d->minzoom) {
497 else if (zoom > v2d->
maxzoom) {
504 const float zoom = winy /
height;
505 if (zoom < v2d->minzoom) {
508 else if (zoom > v2d->
maxzoom) {
522 bool do_x =
false, do_y =
false, do_cur ;
523 float curRatio, winRatio;
536 winRatio = winy / winx;
549 else if (winRatio > curRatio) {
568 if (winx < v2d->oldwinx) {
569 const float temp = v2d->
oldwinx - winx;
590 if (winy < v2d->oldwiny) {
591 const float temp = v2d->
oldwiny - winy;
616 if ((
width != curwidth) || (
height != curheight)) {
620 if (
width != curwidth) {
636 cur->
xmin = temp - dh;
637 cur->
xmax = temp + dh;
640 if (
height != curheight) {
656 cur->
ymin = temp - dh;
657 cur->
ymax = temp + dh;
671 if ((curwidth > totwidth) &&
700 if ((cur->
xmin - temp) < tot->
xmin) {
726 diff = curwidth * 0.5f;
745 if ((cur->
xmin - temp) < tot->
xmin) {
760 if ((curheight > totheight) &&
782 diff = curheight * 0.5f;
887 if (v2dcur != ®ion->v2d) {
892 region->v2d.cur.ymin = v2dcur->
cur.
ymin;
893 region->v2d.cur.ymax = v2dcur->
cur.
ymax;
897 v2dcur->
cur.
ymin = region->v2d.cur.ymin;
898 v2dcur->
cur.
ymax = region->v2d.cur.ymax;
916 if (v2dcur != ®ion->v2d) {
921 region->v2d.cur.xmin = v2dcur->
cur.
xmin;
922 region->v2d.cur.xmax = v2dcur->
cur.
xmax;
926 v2dcur->
cur.
xmin = region->v2d.cur.xmin;
927 v2dcur->
cur.
xmax = region->v2d.cur.xmax;
965 const float dx =
width / 2.0f;
984 const float dy =
height / 2.0f;
1002 printf(
"Error: View2D totRect set exiting: v2d=%p width=%d height=%d\n",
1063 if (
G.is_rendering) {
1082 *r_curmasked = v2d->
cur;
1090 if (sizex > 0.0f && sizey > 0.0f) {
1117 const float eps = 0.001f;
1118 float xofs = 0.0f, yofs = 0.0f;
1207 float start_x, start_y;
1208 int count_x, count_y;
1211 if (start_x < 0.0) {
1218 if (start_x > v2d->
cur.
xmax) {
1222 count_x = (v2d->
cur.
xmax - start_x) / step + 1;
1226 if (start_y < 0.0) {
1233 if (start_y > v2d->
cur.
ymax) {
1237 count_y = (v2d->
cur.
ymax - start_y) / step + 1;
1240 if (count_x > 0 || count_y > 0) {
1244 float theme_color[3];
1252 for (
int i = 0; i < count_x; start_x += step, i++) {
1257 for (
int i = 0; i < count_y; start_y += step, i++) {
1278 const View2D *v2d,
int colorid,
float step,
int level_size,
int totlevels)
1281 if (totlevels == 0) {
1287 uchar grid_line_color[3];
1290 uint vertex_count = 4;
1291 vertex_count += 2 * ((int)((v2d->
cur.
xmax - v2d->
cur.
xmin) / lstep) + 1);
1292 vertex_count += 2 * ((int)((v2d->
cur.
ymax - v2d->
cur.
ymin) / lstep) + 1);
1304 for (
int level = 0; level < totlevels; level++) {
1309 int i = (int)(v2d->
cur.
xmin / lstep);
1313 float start = i * lstep;
1315 for (; start < v2d->
cur.
xmax; start += lstep, i++) {
1316 if (i == 0 || (level < totlevels - 1 && i % level_size == 0)) {
1326 i = (int)(v2d->
cur.
ymin / lstep);
1332 for (; start < v2d->
cur.
ymax; start += lstep, i++) {
1333 if (i == 0 || (level < totlevels - 1 && i % level_size == 0)) {
1343 lstep *= level_size;
1349 colorid,
TH_GRID, 0.5f, -18 + ((totlevels - 1) * -6), grid_line_color);
1390 const rcti *mask_custom,
1394 float fac1, fac2, totsize, scrollsize;
1411 smaller = (int)(0.1f *
U.widget_unit);
1413 hor.
ymin += smaller;
1416 hor.
ymax -= smaller;
1420 vert.
xmin += smaller;
1423 vert.
xmax -= smaller;
1430 r_scrollers->
vert = vert;
1431 r_scrollers->
hor = hor;
1443 if (totsize == 0.0f) {
1452 r_scrollers->
hor_min = (int)(hor.
xmin + (fac1 * scrollsize));
1460 r_scrollers->
hor_max = (int)(hor.
xmin + (fac2 * scrollsize));
1481 if (totsize == 0.0f) {
1490 r_scrollers->
vert_min = (int)(vert.
ymin + (fac1 * scrollsize));
1498 r_scrollers->
vert_max = (int)(vert.
ymin + (fac2 * scrollsize));
1524 uchar scrollers_back_color[4];
1530 vert = scrollers.
vert;
1531 hor = scrollers.
hor;
1536 const float alpha_fac = v2d->
alpha_hor / 255.0f;
1547 wcol.
inner[3] *= alpha_fac;
1548 wcol.
item[3] *= alpha_fac;
1571 const float alpha_fac = v2d->
alpha_vert / 255.0f;
1581 wcol.
inner[3] *= alpha_fac;
1582 wcol.
item[3] *= alpha_fac;
1633 if (columnwidth > 0) {
1635 *r_column =
floorf((viewx - startx) / columnwidth);
1643 if (rowheight > 0) {
1645 *r_row =
floorf((starty - viewy) / rowheight);
1677 const View2D *v2d,
float x,
float y,
float *r_view_x,
float *r_view_y)
1689 (cur_size[0] * (rect_src->
xmin - v2d->
mask.
xmin) / mask_size[0]));
1691 (cur_size[0] * (rect_src->
xmax - v2d->
mask.
xmin) / mask_size[0]));
1693 (cur_size[1] * (rect_src->
ymin - v2d->
mask.
ymin) / mask_size[1]));
1695 (cur_size[1] * (rect_src->
ymax - v2d->
mask.
ymin) / mask_size[1]));
1717 const View2D *v2d,
float x,
float y,
int *r_region_x,
int *r_region_y)
1724 if ((
x >= 0.0f) && (
x <= 1.0f) && (
y >= 0.0f) && (
y <= 1.0f)) {
1746 const View2D *v2d,
float x,
float y,
int *r_region_x,
int *r_region_y)
1762 const View2D *v2d,
float x,
float y,
float *r_region_x,
float *r_region_y)
1816 if (((rect_tmp.
xmax < 0.0f) || (rect_tmp.
xmin > 1.0f) || (rect_tmp.
ymax < 0.0f) ||
1817 (rect_tmp.
ymin > 1.0f)) == 0) {
1848 if (region ==
NULL) {
1851 return &(region->
v2d);
1863 if (region ==
NULL) {
1868 return region_win ? &(region_win->
v2d) :
NULL;
1870 return &(region->
v2d);
1966 if (xfac != -1.0f) {
1968 const float xmin = v2d->
tot.
xmin;
1969 const float xmax = v2d->
tot.
xmax - xsize;
1971 v2d->
cur.
xmin = (xmin * (1.0f - xfac)) + (xmax * xfac);
1975 if (yfac != -1.0f) {
1977 const float ymin = v2d->
tot.
ymin;
1978 const float ymax = v2d->
tot.
ymax - ysize;
1980 v2d->
cur.
ymin = (ymin * (1.0f - yfac)) + (ymax * yfac);
1999 const ARegion *region,
const View2D *v2d,
int x,
int y,
int *r_scroll)
2035 rcti rect_region = *rect;
2054 int scroll_dummy = 0;
2060 int scroll_dummy = 0;
2095 const int alloc_len = str_len + 1;
2108 memset(&v2s->
rect, 0,
sizeof(v2s->
rect));
2110 v2s->
mval[0] = mval[0];
2111 v2s->
mval[1] = mval[1];
2113 memcpy(v2s->
str,
str, alloc_len);
2126 const int alloc_len = str_len + 1;
2144 memcpy(v2s->
str,
str, alloc_len);
2151 int col_pack_prev = 0;
2169 if (col_pack_prev != v2s->
col.
pack) {
2171 col_pack_prev = v2s->
col.
pack;
2176 (
float)(v2s->
mval[1] + yofs),
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct ARegion * BKE_area_find_region_type(const struct ScrArea *area, int type)
void BLF_draw_default(float x, float y, float z, const char *str, size_t len) ATTR_NONNULL()
void BLF_color3ubv(int fontid, const unsigned char rgb[3])
void BLF_cache_clear(void)
#define BLF_DRAW_STR_DUMMY_MAX
void BLF_disable(int fontid, int option)
float BLF_height(int fontid, const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLF_enable(int fontid, int option)
void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax)
int BLF_set_default(void)
A (mainly) macro array library.
Single link-list utility macros. (header only api).
#define BLI_LINKS_PREPEND(list, link)
#define LISTBASE_FOREACH(type, var, list)
void unit_m4(float m[4][4])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
struct MemArena * BLI_memarena_new(const size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2) ATTR_MALLOC
void BLI_rctf_translate(struct rctf *rect, float x, float y)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
void BLI_rctf_transform_calc_m4_pivot_min(const rctf *dst, const rctf *src, float matrix[4][4])
void BLI_rctf_recenter(struct rctf *rect, float x, float y)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
@ V2D_VIEWSYNC_SCREEN_TIME
@ V2D_VIEWSYNC_AREA_VERTICAL
@ V2D_SCROLL_HORIZONTAL_FULLR
@ V2D_SCROLL_HORIZONTAL_HIDE
@ V2D_SCROLL_VERTICAL_FULLR
@ V2D_SCROLL_VERTICAL_HIDE
@ V2D_SCROLL_VERTICAL_HANDLES
@ V2D_SCROLL_HORIZONTAL_HANDLES
void ED_region_tag_redraw_no_rebuild(struct ARegion *region)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
void GPU_matrix_identity_set(void)
@ GPU_SHADER_2D_FLAT_COLOR
void GPU_line_width(float width)
Read Guarded memory(de)allocation.
#define MEM_SIZE_OPTIMAL(size)
Group RGB to Bright Vector Camera CLAMP
const struct uiStyle * UI_style_get(void)
void UI_draw_widget_scroll(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state)
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
struct bTheme * UI_GetTheme(void)
void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3])
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
#define V2D_SCROLL_HEIGHT
#define V2D_SCROLL_HANDLE_HEIGHT
#define V2D_SCROLL_THUMB_SIZE_MIN
#define IN_2D_HORIZ_SCROLL(v2d, co)
#define V2D_SCROLL_HANDLE_WIDTH
#define IN_2D_VERT_SCROLL(v2d, co)
#define UI_TIME_SCRUB_MARGIN_Y
#define IN_2D_VERT_SCROLL_RECT(v2d, rct)
#define V2D_SCROLL_HANDLE_SIZE_HOTSPOT
@ V2D_COMMONVIEW_STANDARD
@ V2D_COMMONVIEW_PANELS_UI
#define IN_2D_HORIZ_SCROLL_RECT(v2d, rct)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static void area(int d1, int d2, int e1, int e2, float weights[2])
void(* on_view2d_changed)(const struct bContext *C, struct ARegion *region)
struct ARegionType * type
uiWidgetColors wcol_scroll
unsigned char widget_emboss[4]
union View2DString::@423 col
struct View2DString * next
__forceinline const avxi abs(const avxi &a)
ccl_device_inline float2 fabs(const float2 &a)
ccl_device_inline float3 ceil(const float3 &a)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
char UI_view2d_rect_in_scrollers(const ARegion *region, const View2D *v2d, const rcti *rect)
struct View2DString View2DString
void UI_view2d_curRect_validate(View2D *v2d)
void UI_view2d_center_set(struct View2D *v2d, float x, float y)
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
void UI_view2d_scale_get_inverse(const View2D *v2d, float *r_x, float *r_y)
void UI_view2d_curRect_reset(View2D *v2d)
static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize)
void UI_view2d_scroller_size_get(const View2D *v2d, float *r_x, float *r_y)
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y)
void UI_view2d_view_orthoSpecial(ARegion *region, View2D *v2d, const bool xaxis)
void UI_view2d_multi_grid_draw(const View2D *v2d, int colorid, float step, int level_size, int totlevels)
static View2DString * g_v2d_strings
void UI_view2d_view_to_region_rcti(const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
bool UI_view2d_view_to_region_clip(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y)
bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom)
BLI_INLINE void clamp_rctf_to_rcti(rcti *dst, const rctf *src)
View2D * UI_view2d_fromcontext(const bContext *C)
void UI_view2d_view_restore(const bContext *C)
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
void UI_view2d_curRect_changed(const bContext *C, View2D *v2d)
void UI_view2d_text_cache_draw(ARegion *region)
void UI_view2d_totRect_set(View2D *v2d, int width, int height)
void UI_view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst)
static int view2d_scroll_mapped(int scroll)
float UI_view2d_view_to_region_y(const View2D *v2d, float y)
char UI_view2d_mouse_in_scrollers(const ARegion *region, const View2D *v2d, int x, int y)
void UI_view2d_listview_view_to_cell(float columnwidth, float rowheight, float startx, float starty, float viewx, float viewy, int *r_column, int *r_row)
void UI_view2d_view_ortho(const View2D *v2d)
static MemArena * g_v2d_strings_arena
void UI_view2d_view_to_region(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y)
void UI_view2d_zoom_cache_reset(void)
View2D * UI_view2d_fromcontext_rwin(const bContext *C)
float UI_view2d_scale_get_y(const View2D *v2d)
void UI_view2d_scale_get(const View2D *v2d, float *r_x, float *r_y)
bool UI_view2d_area_supports_sync(ScrArea *area)
void UI_view2d_mask_from_win(const View2D *v2d, rcti *r_mask)
char UI_view2d_rect_in_scrollers_ex(const ARegion *region, const View2D *v2d, const rcti *rect, int *r_scroll)
void UI_view2d_view_to_region_m4(const View2D *v2d, float matrix[4][4])
void UI_view2d_view_to_region_fl(const View2D *v2d, float x, float y, float *r_region_x, float *r_region_y)
float UI_view2d_region_to_view_x(const struct View2D *v2d, float x)
void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, size_t str_len, const uchar col[4])
float UI_view2d_view_to_region_x(const View2D *v2d, float x)
void UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom, struct View2DScrollers *r_scrollers)
void UI_view2d_center_get(const struct View2D *v2d, float *r_x, float *r_y)
char UI_view2d_mouse_in_scrollers_ex(const ARegion *region, const View2D *v2d, int x, int y, int *r_scroll)
void UI_view2d_constant_grid_draw(const View2D *v2d, float step)
float UI_view2d_region_to_view_y(const struct View2D *v2d, float y)
static void view2d_map_cur_using_mask(const View2D *v2d, rctf *r_curmasked)
void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resize)
BLI_INLINE int clamp_float_to_int(const float f)
static void view2d_masks(View2D *v2d, const rcti *mask_scroll)
void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac)
void UI_view2d_text_cache_add_rectf(View2D *v2d, const rctf *rect_view, const char *str, size_t str_len, const uchar col[4])
float UI_view2d_scale_get_x(const View2D *v2d)
void wmOrtho2(float x1, float x2, float y1, float y2)
void wmOrtho2_region_pixelspace(const ARegion *region)