Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions

text_draw.c File Reference

#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "MEM_guardedalloc.h"
#include "BLF_api.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "DNA_text_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_suggestions.h"
#include "BKE_text.h"
#include "BIF_gl.h"
#include "ED_datafiles.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "text_intern.h"

Go to the source code of this file.

Classes

struct  DrawCache

Defines

#define mono   blf_mono_font

Typedefs

typedef struct DrawCache DrawCache

Functions

static void text_font_begin (SpaceText *st)
static void text_font_end (SpaceText *UNUSED(st))
static int text_font_draw (SpaceText *UNUSED(st), int x, int y, const char *str)
static int text_font_draw_character (SpaceText *st, int x, int y, char c)
static int text_font_draw_character_utf8 (SpaceText *st, int x, int y, const char *c)
static void flatten_string_append (FlattenString *fs, const char *c, int accum, int len)
int flatten_string (SpaceText *st, FlattenString *fs, const char *in)
void flatten_string_free (FlattenString *fs)
static int find_builtinfunc (char *string)
static int find_specialvar (char *string)
static int find_decorator (char *string)
static int find_bool (char *string)
static int text_check_format_len (TextLine *line, unsigned int len)
static void txt_format_line (SpaceText *st, TextLine *line, int do_next)
static void format_draw_color (char formatchar)
int wrap_width (SpaceText *st, ARegion *ar)
void wrap_offset (SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc)
void wrap_offset_in_line (SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc)
int text_get_char_pos (SpaceText *st, const char *line, int cur)
static const char * txt_utf8_get_nth (const char *str, int n)
static int text_draw_wrapped (SpaceText *st, const char *str, int x, int y, int w, const char *format, int skip)
static int text_draw (SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, const char *format)
static void text_drawcache_init (SpaceText *st)
static void text_update_drawcache (SpaceText *st, ARegion *ar)
void text_drawcache_tag_update (SpaceText *st, int full)
void text_free_caches (SpaceText *st)
static int text_get_visible_lines_no (SpaceText *st, int lineno)
int text_get_visible_lines (SpaceText *st, ARegion *ar, const char *str)
int text_get_span_wrap (SpaceText *st, ARegion *ar, TextLine *from, TextLine *to)
int text_get_total_lines (SpaceText *st, ARegion *ar)
static TextLinefirst_visible_line (SpaceText *st, ARegion *ar, int *wrap_top)
static void calc_text_rcts (SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
static void draw_textscroll (SpaceText *st, rcti *scroll, rcti *back)
static void draw_markers (SpaceText *st, ARegion *ar)
static void draw_documentation (SpaceText *st, ARegion *ar)
static void draw_suggestion_list (SpaceText *st, ARegion *ar)
static void draw_cursor (SpaceText *st, ARegion *ar)
static void draw_brackets (SpaceText *st, ARegion *ar)
void draw_text_main (SpaceText *st, ARegion *ar)
void text_update_character_width (SpaceText *st)
void text_scroll_to_cursor (SpaceText *st, ScrArea *sa)
void text_update_cursor_moved (bContext *C)

Detailed Description

Definition in file text_draw.c.


Define Documentation

#define mono   blf_mono_font

Typedef Documentation

typedef struct DrawCache DrawCache

Function Documentation

static void calc_text_rcts ( SpaceText st,
ARegion ar,
rcti scroll,
rcti back 
) [static]
static void draw_brackets ( SpaceText st,
ARegion ar 
) [static]
static void draw_cursor ( SpaceText st,
ARegion ar 
) [static]
static void draw_documentation ( SpaceText st,
ARegion ar 
) [static]
static void draw_markers ( SpaceText st,
ARegion ar 
) [static]
static void draw_suggestion_list ( SpaceText st,
ARegion ar 
) [static]
void draw_text_main ( SpaceText st,
ARegion ar 
)
static void draw_textscroll ( SpaceText st,
rcti scroll,
rcti back 
) [static]
static int find_bool ( char *  string) [static]

Definition at line 255 of file text_draw.c.

References i, and text_check_identifier().

Referenced by txt_format_line().

static int find_builtinfunc ( char *  string) [static]

Definition at line 189 of file text_draw.c.

References i, and text_check_identifier().

Referenced by txt_format_line().

static int find_decorator ( char *  string) [static]

Definition at line 243 of file text_draw.c.

References i, and text_check_identifier().

Referenced by txt_format_line().

static int find_specialvar ( char *  string) [static]

Definition at line 228 of file text_draw.c.

References i, and text_check_identifier().

Referenced by txt_format_line().

static TextLine* first_visible_line ( SpaceText st,
ARegion ar,
int *  wrap_top 
) [static]
int flatten_string ( SpaceText st,
FlattenString fs,
const char *  in 
)
static void flatten_string_append ( FlattenString fs,
const char *  c,
int  accum,
int  len 
) [static]
void flatten_string_free ( FlattenString fs)
static void format_draw_color ( char  formatchar) [static]
static int text_check_format_len ( TextLine line,
unsigned int  len 
) [static]

Definition at line 275 of file text_draw.c.

References TextLine::format, MEM_freeN(), MEM_mallocN(), and strlen().

Referenced by txt_format_line().

static int text_draw ( SpaceText st,
char *  str,
int  cshift,
int  maxwidth,
int  draw,
int  x,
int  y,
const char *  format 
) [static]
static int text_draw_wrapped ( SpaceText st,
const char *  str,
int  x,
int  y,
int  w,
const char *  format,
int  skip 
) [static]
static void text_drawcache_init ( SpaceText st) [static]
void text_drawcache_tag_update ( SpaceText st,
int  full 
)
static void text_font_begin ( SpaceText st) [static]

Definition at line 66 of file text_draw.c.

References BLF_size(), SpaceText::lheight, and mono.

Referenced by draw_text_main(), and text_update_character_width().

static int text_font_draw ( SpaceText UNUSEDst,
int  x,
int  y,
const char *  str 
) [static]

Definition at line 75 of file text_draw.c.

References BLF_draw(), BLF_DRAW_STR_DUMMY_MAX, BLF_position(), BLF_width(), and mono.

Referenced by draw_text_main(), and text_draw().

static int text_font_draw_character ( SpaceText st,
int  x,
int  y,
char  c 
) [static]

Definition at line 83 of file text_draw.c.

References BLF_draw(), BLF_position(), SpaceText::cwidth, mono, and str.

Referenced by draw_brackets().

static int text_font_draw_character_utf8 ( SpaceText st,
int  x,
int  y,
const char *  c 
) [static]
static void text_font_end ( SpaceText UNUSEDst) [static]

Definition at line 71 of file text_draw.c.

Referenced by draw_text_main(), and text_update_character_width().

void text_free_caches ( SpaceText st)

Definition at line 977 of file text_draw.c.

References SpaceText::drawcache, DrawCache::line_height, and MEM_freeN().

Referenced by text_free().

int text_get_char_pos ( SpaceText st,
const char *  line,
int  cur 
)
int text_get_span_wrap ( SpaceText st,
ARegion ar,
TextLine from,
TextLine to 
)
int text_get_total_lines ( SpaceText st,
ARegion ar 
)
int text_get_visible_lines ( SpaceText st,
ARegion ar,
const char *  str 
)
static int text_get_visible_lines_no ( SpaceText st,
int  lineno 
) [static]

Definition at line 992 of file text_draw.c.

References SpaceText::drawcache, and DrawCache::line_height.

Referenced by draw_text_main(), and first_visible_line().

void text_scroll_to_cursor ( SpaceText st,
ScrArea sa 
)
void text_update_character_width ( SpaceText st)
void text_update_cursor_moved ( bContext C)
static void text_update_drawcache ( SpaceText st,
ARegion ar 
) [static]
static void txt_format_line ( SpaceText st,
TextLine line,
int  do_next 
) [static]
static const char* txt_utf8_get_nth ( const char *  str,
int  n 
) [static]

Definition at line 691 of file text_draw.c.

References BLI_str_utf8_size().

Referenced by text_draw(), and text_draw_wrapped().

void wrap_offset ( SpaceText st,
ARegion ar,
TextLine linein,
int  cursin,
int *  offl,
int *  offc 
)
void wrap_offset_in_line ( SpaceText st,
ARegion ar,
TextLine linein,
int  cursin,
int *  offl,
int *  offc 
)
int wrap_width ( SpaceText st,
ARegion ar 
)