Blender V4.3
textview.cc File Reference
#include <algorithm>
#include "MEM_guardedalloc.h"
#include "BLF_api.hh"
#include "BLI_math_color.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "GPU_immediate.hh"
#include "GPU_state.hh"
#include "DNA_userdef_types.h"
#include "UI_interface.hh"
#include "UI_interface_icons.hh"
#include "textview.hh"

Go to the source code of this file.

Classes

struct  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, const int str_len, const 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)
 

Function Documentation

◆ textview_draw()

int textview_draw ( TextViewContext * tvc,
bool do_draw,
const int mval_init[2],
void ** r_mval_pick_item,
int * r_mval_pick_offset )
Parameters
r_mval_pick_itemThe 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_offsetThe offset in bytes of the mval_init. Use for selection.

Definition at line 304 of file textview.cc.

References TextViewContext::begin, BLF_descender(), BLF_fixed_width(), blf_mono_font, BLI_assert, TextViewDrawState::columns, TextViewContext::const_colors, TextViewDrawState::cwidth, TextViewDrawState::do_draw, TextViewContext::draw_cursor, TextViewContext::draw_rect, TextViewDrawState::draw_rect, TextViewContext::draw_rect_outer, TextViewDrawState::draw_rect_outer, TextViewContext::end, TextViewDrawState::font_id, int, TextViewContext::iter, TextViewContext::lheight, TextViewDrawState::lheight, TextViewContext::line_data, TextViewContext::line_get, TextViewDrawState::lofs, TextViewDrawState::mval, TextViewDrawState::mval_pick_offset, TextViewContext::row_vpadding, TextViewDrawState::row_vpadding, TextViewContext::scroll_ymax, TextViewDrawState::scroll_ymax, TextViewContext::scroll_ymin, TextViewDrawState::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().

◆ textview_draw_sel()

◆ textview_draw_string()

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

◆ textview_font_begin()

static void textview_font_begin ( const int font_id,
const int lheight )
static

Definition at line 29 of file textview.cc.

References BLF_size().

Referenced by textview_draw().

◆ textview_step_sel()

BLI_INLINE void textview_step_sel ( TextViewDrawState * tds,
const int step )

Definition at line 57 of file textview.cc.

References TextViewDrawState::sel.

Referenced by textview_draw_string().

◆ textview_wrap_offsets()

static int textview_wrap_offsets ( const char * str,
const int str_len,
const int width,
int * r_lines,
int ** r_offsets )
static
Warning
Allocated memory for 'r_offsets' must be freed by caller.
Returns
The length in bytes.

Definition at line 98 of file textview.cc.

References BLI_str_utf8_char_width_safe(), BLI_str_utf8_size_safe(), BLI_UTF8_WIDTH_MAX, MEM_callocN, str, TVC_TAB_COLUMNS, and UNLIKELY.

Referenced by textview_draw_string().