Blender  V3.3
Classes | Typedefs | Functions
textview.c File Reference
#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 Documentation

◆ TextViewDrawState

Function Documentation

◆ textview_draw()

int textview_draw ( struct 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 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().

◆ textview_draw_sel()

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

◆ 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 25 of file textview.c.

References BLF_size().

Referenced by textview_draw().

◆ textview_step_sel()

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().

◆ textview_wrap_offsets()

static int textview_wrap_offsets ( const char *  str,
int  len,
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 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().