42 BLF_size(font_id, 0.8f * lheight, 72);
75 const int str_len_draw,
77 const uchar bg_sel[4])
79 const int sel[2] = {tds->
sel[0], tds->
sel[1]};
80 const int cwidth = tds->
cwidth;
81 const int lheight = tds->
lheight;
83 if (sel[0] <= str_len_draw && sel[1] >= 0) {
94 immRecti(
pos, xy[0] + (cwidth * sta), xy[1] + lheight, xy[0] + (cwidth * end), xy[1]);
107 const char *
str,
int len,
int width,
int *r_lines,
int **r_offsets)
115 sizeof(**r_offsets) *
123 if (i + columns > end) {
124 (*r_offsets)[*r_lines] = j;
144 const uchar icon_fg[4],
145 const uchar icon_bg[4],
146 const uchar bg_sel[4])
154 int line_bottom = tds->
xy[1];
155 int line_top = line_bottom + line_height;
157 int y_next = line_top;
162 if (y_next >= tds->
mval[1]) {
167 int iofs = (int)((
float)(y_next - tds->
mval[1]) / tds->
lheight);
168 ofs += offsets[
MIN2(iofs, tot_lines - 1)];
175 CLAMP(ofs, 0, str_len);
187 if (y_next < tds->scroll_ymin) {
192 if (tds->
sel[0] != tds->
sel[1]) {
208 tds->
sel[0] = str_len - sel_orig[1];
209 tds->
sel[1] = str_len - sel_orig[0];
231 .xmax = bg_size + hpadding,
232 .ymin = line_top - bg_size - vpadding,
233 .ymax = line_top - vpadding,
259 const int final_offset = offsets[tot_lines - 1];
260 len = str_len - final_offset;
261 s =
str + final_offset;
266 if (tds->
sel[0] != tds->
sel[1]) {
268 const int pos[2] = {tds->
xy[0], line_bottom};
276 for (i = tot_lines - 1; i > 0; i--) {
277 len = offsets[i] - offsets[i - 1];
278 s =
str + offsets[i - 1];
283 if (tds->
sel[0] != tds->
sel[1]) {
315 const int mval_init[2],
316 void **r_mval_pick_item,
317 int *r_mval_pick_offset)
324 int sel[2] = {-1, -1};
325 uchar fg[4], bg[4], icon_fg[4], icon_bg[4];
336 const int mval[2] = {
337 (mval_init[0] == INT_MAX) ?
340 (mval_init[1] == INT_MAX) ?
345 if (r_mval_pick_offset !=
NULL) {
346 *r_mval_pick_offset = 0;
377 if (tvc->
begin(tvc)) {
378 uchar bg_sel[4] = {0};
386 const char *ext_line;
390 const int y_prev = xy[1];
393 data_flag = tvc->
line_data(tvc, fg, bg, &icon, icon_fg, icon_bg);
396 tvc->
line_get(tvc, &ext_line, &ext_len);
416 if (is_out_of_view_y) {
421 if ((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
422 *r_mval_pick_item = (
void *)tvc->
iter;
428 }
while (tvc->
step(tvc));
440 return xy[1] - y_orig;
float BLF_fixed_width(int fontid) ATTR_WARN_UNUSED_RESULT
int BLF_draw_mono(int fontid, const char *str, size_t len, int cwidth) ATTR_NONNULL(2)
float BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_size(int fontid, int size, int dpi)
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
void BLF_position(int fontid, float x, float y, float z)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
int BLI_str_utf8_char_width_safe(const char *p) ATTR_NONNULL()
int BLI_str_utf8_size_safe(const char *p) ATTR_NONNULL()
#define BLI_UTF8_WIDTH_MAX
int BLI_str_utf8_offset_from_column(const char *str, int column)
int BLI_str_utf8_offset_to_column(const char *str, int offset)
_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
@ GPU_SHADER_2D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
void UI_draw_roundbox_4fv(const struct rctf *rect, bool filled, float rad, const float col[4])
void UI_draw_roundbox_corner_set(int type)
void UI_icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], const bool mono_border)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void(* line_get)(struct TextViewContext *tvc, const char **r_line, int *r_len)
int(* begin)(struct TextViewContext *tvc)
void(* const_colors)(struct TextViewContext *tvc, unsigned char bg_sel[4])
enum eTextViewContext_LineFlag(* line_data)(struct TextViewContext *tvc, uchar fg[4], uchar bg[4], int *r_icon, uchar r_icon_fg[4], uchar r_icon_bg[4])
void(* end)(struct TextViewContext *tvc)
int(* step)(struct TextViewContext *tvc)
void(* draw_cursor)(struct TextViewContext *tvc, int cwidth, int columns)
const rcti * draw_rect_outer
static bool textview_draw_string(TextViewDrawState *tds, const char *str, int str_len, const uchar fg[4], const uchar bg[4], int icon, const uchar icon_fg[4], const uchar icon_bg[4], const uchar bg_sel[4])
static void textview_draw_sel(const char *str, const int xy[2], const int str_len_draw, TextViewDrawState *tds, const uchar bg_sel[4])
static void textview_font_begin(const int font_id, const int lheight)
int textview_draw(TextViewContext *tvc, const bool do_draw, const int mval_init[2], void **r_mval_pick_item, int *r_mval_pick_offset)
BLI_INLINE void textview_step_sel(TextViewDrawState *tds, const int step)
static int textview_wrap_offsets(const char *str, int len, int width, int *r_lines, int **r_offsets)
struct TextViewDrawState TextViewDrawState
ccl_device_inline float2 floor(const float2 &a)