65 const int str_len_draw,
67 const uchar bg_sel[4])
69 const int sel[2] = {tds->
sel[0], tds->
sel[1]};
70 const int cwidth = tds->
cwidth;
71 const int lheight = tds->
lheight;
73 if (sel[0] <= str_len_draw && sel[1] >= 0) {
99 const char *
str,
const int str_len,
const int width,
int *r_lines,
int **r_offsets)
109 sizeof(**r_offsets) *
110 (str_len * column_width_max / std::max(1, width - (column_width_max - 1)) + 1),
115 int columns =
UNLIKELY(*(
str + j) ==
'\t') ? (tab_columns - (i % tab_columns)) :
118 if (i + columns > end) {
119 (*r_offsets)[*r_lines] = j;
139 const uchar icon_fg[4],
140 const uchar icon_bg[4],
141 const uchar bg_sel[4])
149 int line_bottom = tds->
xy[1];
150 int line_top = line_bottom + line_height;
152 int y_next = line_top;
157 if (y_next >= tds->
mval[1]) {
163 ofs += offsets[std::min(iofs, tot_lines - 1)];
173 CLAMP(ofs, 0, str_len);
185 if (y_next < tds->scroll_ymin) {
190 if (tds->
sel[0] != tds->
sel[1]) {
206 tds->
sel[0] = str_len - sel_orig[1];
207 tds->
sel[1] = str_len - sel_orig[0];
228 roundbox_rect.
xmin = hpadding;
229 roundbox_rect.
xmax = bg_size + hpadding;
230 roundbox_rect.
ymin = line_top - bg_size - vpadding;
231 roundbox_rect.
ymax = line_top - vpadding;
256 const int final_offset = offsets[tot_lines - 1];
257 len = str_len - final_offset;
258 s =
str + final_offset;
260 if (tds->
sel[0] != tds->
sel[1]) {
262 const int pos[2] = {tds->
xy[0], line_bottom};
274 for (i = tot_lines - 1; i > 0; i--) {
275 len = offsets[i] - offsets[i - 1];
276 s =
str + offsets[i - 1];
278 if (tds->
sel[0] != tds->
sel[1]) {
306 const int mval_init[2],
307 void **r_mval_pick_item,
308 int *r_mval_pick_offset)
315 int sel[2] = {-1, -1};
316 uchar fg[4], bg[4], icon_fg[4], icon_bg[4];
327 const int mval[2] = {
328 (mval_init[0] == INT_MAX) ?
331 (mval_init[1] == INT_MAX) ?
336 if (r_mval_pick_offset !=
nullptr) {
337 *r_mval_pick_offset = 0;
368 if (tvc->
begin(tvc)) {
369 uchar bg_sel[4] = {0};
377 const char *ext_line;
381 const int y_prev =
xy[1];
384 data_flag = tvc->
line_data(tvc, fg, bg, &icon, icon_fg, icon_bg);
387 tvc->
line_get(tvc, &ext_line, &ext_len);
407 if (is_out_of_view_y) {
412 if ((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <=
xy[1])) {
413 *r_mval_pick_item = (
void *)tvc->
iter;
419 }
while (tvc->
step(tvc));
431 return xy[1] - y_orig;
void BLF_size(int fontid, float size)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
float BLF_fixed_width(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
void BLF_position(int fontid, float x, float y, float z)
int BLF_draw_mono(int fontid, const char *str, size_t str_len, int cwidth, int tab_columns) ATTR_NONNULL(2)
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])
#define BLI_UTF8_WIDTH_MAX
int BLI_str_utf8_char_width_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_size_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_offset_from_column_with_tabs(const char *str, size_t str_len, int column_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_offset_to_column_with_tabs(const char *str, size_t str_len, int offset_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
Read Guarded memory(de)allocation.
void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
void UI_draw_roundbox_corner_set(int type)
#define UI_NO_ICON_OVERLAY_TEXT
void UI_icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], bool mono_border, const IconTextOverlay *text_overlay, const bool inverted=false)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
ccl_device_inline float2 floor(const float2 a)
enum eTextViewContext_LineFlag(* line_data)(TextViewContext *tvc, uchar fg[4], uchar bg[4], int *r_icon, uchar r_icon_fg[4], uchar r_icon_bg[4])
void(* end)(TextViewContext *tvc)
void(* const_colors)(TextViewContext *tvc, unsigned char bg_sel[4])
int(* begin)(TextViewContext *tvc)
void(* line_get)(TextViewContext *tvc, const char **r_line, int *r_len)
int(* step)(TextViewContext *tvc)
void(* draw_cursor)(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, const int str_len, const int width, int *r_lines, int **r_offsets)