Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLF_api.h"
#include "BLI_math.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
#include "DNA_userdef_types.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "textview.h"
Go to the source code of this file.
Classes | |
struct | TextViewDrawState |
Typedefs | |
typedef struct TextViewDrawState | TextViewDrawState |
Functions | |
static void | textview_font_begin (const int font_id, const int lheight) |
BLI_INLINE void | textview_step_sel (TextViewDrawState *tds, const int step) |
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 int | textview_wrap_offsets (const char *str, int len, int width, int *r_lines, int **r_offsets) |
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]) |
int | textview_draw (TextViewContext *tvc, const bool do_draw, const int mval_init[2], void **r_mval_pick_item, int *r_mval_pick_offset) |
typedef struct TextViewDrawState TextViewDrawState |
int textview_draw | ( | struct TextViewContext * | tvc, |
bool | do_draw, | ||
const int | mval_init[2], | ||
void ** | r_mval_pick_item, | ||
int * | r_mval_pick_offset | ||
) |
r_mval_pick_item | The resulting item clicked on using mval_init. Set from the void pointer which holds the current iterator. Its type depends on the data being iterated over. |
r_mval_pick_offset | The offset in bytes of the mval_init. Use for selection. |
Definition at line 293 of file textview.c.
References TextViewContext::begin, BLF_descender(), BLF_fixed_width(), blf_mono_font, BLI_assert, CLAMPIS, TextViewDrawState::columns, TextViewContext::const_colors, TextViewDrawState::cwidth, TextViewDrawState::do_draw, TextViewContext::draw_cursor, TextViewDrawState::draw_rect, TextViewContext::draw_rect, TextViewDrawState::draw_rect_outer, TextViewContext::draw_rect_outer, TextViewContext::end, TextViewDrawState::font_id, if(), TextViewContext::iter, TextViewDrawState::lheight, TextViewContext::lheight, TextViewContext::line_data, TextViewContext::line_get, TextViewDrawState::lofs, TextViewDrawState::mval, TextViewDrawState::mval_pick_offset, NULL, TextViewDrawState::row_vpadding, TextViewContext::row_vpadding, TextViewDrawState::scroll_ymax, TextViewContext::scroll_ymax, TextViewDrawState::scroll_ymin, TextViewContext::scroll_ymin, TextViewDrawState::sel, TextViewContext::sel_end, TextViewContext::sel_start, TextViewContext::step, textview_draw_string(), textview_font_begin(), TVC_LINE_BG, TVC_LINE_FG, TVC_LINE_ICON, TVC_LINE_ICON_BG, TVC_LINE_ICON_FG, rcti::xmax, rcti::xmin, TextViewDrawState::xy, xy, rcti::ymax, and rcti::ymin.
Referenced by console_textview_main__internal(), and info_textview_main__internal().
|
static |
Definition at line 59 of file textview.c.
References BLI_str_utf8_offset_to_column(), TextViewDrawState::cwidth, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_I32, GPU_FETCH_INT_TO_FLOAT, GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBindBuiltinProgram(), immRecti(), immUnbindProgram(), immUniformColor4ubv(), immVertexFormat(), TextViewDrawState::lheight, max_ii(), min_ii(), pos, TextViewDrawState::sel, str, and xy.
Referenced by textview_draw_string().
|
static |
return false if the last line is off the screen should be able to use this for any string type.
Definition at line 124 of file textview.c.
References BLF_color4ubv(), BLF_draw_mono(), BLF_position(), BLI_str_utf8_offset_from_column(), CLAMP, col, TextViewDrawState::columns, copy_v2_v2_int(), TextViewDrawState::cwidth, TextViewDrawState::do_draw, TextViewDrawState::draw_rect, TextViewDrawState::draw_rect_outer, blender::math::floor(), TextViewDrawState::font_id, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_I32, GPU_FETCH_INT_TO_FLOAT, GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBindBuiltinProgram(), immRecti(), immUnbindProgram(), immUniformColor4ubv(), immVertexFormat(), len, TextViewDrawState::lheight, TextViewDrawState::lofs, MEM_freeN, MIN2, TextViewDrawState::mval, TextViewDrawState::mval_pick_offset, pos, rgba_uchar_to_float(), TextViewDrawState::row_vpadding, TextViewDrawState::scroll_ymax, TextViewDrawState::sel, str, textview_draw_sel(), textview_step_sel(), textview_wrap_offsets(), UI_CNR_ALL, UI_DPI_FAC, UI_DPI_ICON_SIZE, UI_draw_roundbox_4fv(), UI_draw_roundbox_corner_set(), UI_icon_draw_ex(), rcti::xmax, rcti::xmin, and TextViewDrawState::xy.
Referenced by textview_draw().
|
static |
BLI_INLINE void textview_step_sel | ( | TextViewDrawState * | tds, |
const int | step | ||
) |
Definition at line 53 of file textview.c.
References TextViewDrawState::sel.
Referenced by textview_draw_string().
|
static |
Definition at line 92 of file textview.c.
References BLI_str_utf8_char_width_safe(), BLI_str_utf8_size_safe(), BLI_UTF8_WIDTH_MAX, len, MAX2, MEM_callocN, str, and width.
Referenced by textview_draw_string().