35 BLF_size(font_id, 0.8f * line_height);
68 const int str_len_draw,
70 const uchar bg_sel[4])
72 const int sel[2] = {tds->
sel[0], tds->
sel[1]};
76 if (sel[0] <= str_len_draw && sel[1] >= 0) {
90 pos, xy[0] + (char_width * sta), xy[1] + line_height, xy[0] + (char_width * end), xy[1]);
99 const char *
str,
const int str_len,
const int width,
int *r_lines,
int **r_offsets)
109 (str_len * column_width_max / std::max(1, width - (column_width_max - 1)) + 1), __func__);
113 int columns =
UNLIKELY(*(
str + j) ==
'\t') ? (tab_columns - (i % tab_columns)) :
116 if (i + columns > end) {
117 (*r_offsets)[*r_lines] = j;
137 const uchar icon_fg[4],
138 const uchar icon_bg[4],
139 const uchar bg_sel[4])
147 int line_bottom = tds->
xy[1];
148 int line_top = line_bottom + line_height;
150 int y_next = line_top;
155 if (y_next >= tds->
mval[1]) {
161 ofs += offsets[std::min(iofs, tot_lines - 1)];
171 CLAMP(ofs, 0, str_len);
183 if (y_next < tds->scroll_ymin) {
188 if (tds->
sel[0] != tds->
sel[1]) {
204 tds->
sel[0] = str_len - sel_orig[1];
205 tds->
sel[1] = str_len - sel_orig[0];
226 roundbox_rect.
xmin = hpadding;
227 roundbox_rect.
xmax = bg_size + hpadding;
228 roundbox_rect.
ymin = line_top - bg_size - vpadding;
229 roundbox_rect.
ymax = line_top - vpadding;
254 const int final_offset = offsets[tot_lines - 1];
255 len = str_len - final_offset;
256 s =
str + final_offset;
258 if (tds->
sel[0] != tds->
sel[1]) {
260 const int pos[2] = {tds->
xy[0], line_bottom};
272 for (i = tot_lines - 1; i > 0; i--) {
273 len = offsets[i] - offsets[i - 1];
274 s =
str + offsets[i - 1];
276 if (tds->
sel[0] != tds->
sel[1]) {
304 const int mval_init[2],
305 void **r_mval_pick_item,
306 int *r_mval_pick_offset)
313 int sel[2] = {-1, -1};
314 uchar fg[4], bg[4], icon_fg[4], icon_bg[4];
325 const int mval[2] = {
334 if (r_mval_pick_offset !=
nullptr) {
335 *r_mval_pick_offset = 0;
364 if (tvc->
begin(tvc)) {
365 uchar bg_sel[4] = {0};
373 const char *ext_line;
377 const int y_prev = xy[1];
380 data_flag = tvc->
line_data(tvc, fg, bg, &icon, icon_fg, icon_bg);
383 tvc->
line_get(tvc, &ext_line, &ext_len);
403 if (is_out_of_view_y) {
408 if ((mval[1] !=
INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
409 *r_mval_pick_item =
const_cast<void *
>(tvc->
iter);
415 }
while (tvc->
step(tvc));
427 return xy[1] - y_orig;
#define BLI_UTF8_WIDTH_MAX
Read Blender memory allocation and freeing.
#define UI_NO_ICON_OVERLAY_TEXT
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
void 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, float scale=1.0f)
void draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
void BLF_position(int fontid, float x, float y, float z)
int BLI_str_utf8_char_width_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
GPUVertFormat * immVertexFormat()
MINLINE int max_ii(int a, int b)
int textview_wrap_offsets(const char *str, const int str_len, const int width, int *r_lines, int **r_offsets)
int textview_draw(TextViewContext *tvc, const bool do_draw, const int mval_init[2], void **r_mval_pick_item, int *r_mval_pick_offset)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void BLF_size(int fontid, float size)
static void textview_draw_sel(const char *str, const int xy[2], const int str_len_draw, TextViewDrawState *tds, const uchar bg_sel[4])
@ GPU_SHADER_3D_UNIFORM_COLOR
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)
int BLI_str_utf8_size_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
float BLF_fixed_width(int fontid) ATTR_WARN_UNUSED_RESULT
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
int BLF_draw_mono(int fontid, const char *str, size_t str_len, int char_width, int tab_columns) ATTR_NONNULL(2)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void textview_step_sel(TextViewDrawState *tds, const int step)
void GPU_blend(GPUBlend blend)
void immUniformColor4ubv(const unsigned char rgba[4])
MINLINE int min_ii(int a, int b)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
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)
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])
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
static void textview_font_begin(const int font_id, const int line_height)
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 char_width, int columns)
void(*) end(TextViewContext *tvc)
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])
const rcti * draw_rect_outer