Blender  V2.59
Functions | Variables
text.c File Reference
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "DNA_constraint_types.h"
#include "DNA_controller_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "DNA_userdef_types.h"
#include "DNA_object_types.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_text.h"

Go to the source code of this file.

Functions

static void txt_pop_first (Text *text)
static void txt_pop_last (Text *text)
static void txt_undo_add_op (Text *text, int op)
static void txt_undo_add_block (Text *text, int op, const char *buf)
static void txt_delete_line (Text *text, TextLine *line)
static void txt_delete_sel (Text *text)
static void txt_make_dirty (Text *text)
void txt_set_undostate (int u)
int txt_get_undostate (void)
static void init_undo_text (Text *text)
void free_text (Text *text)
Textadd_empty_text (const char *name)
static void cleanup_textline (TextLine *tl)
int reopen_text (Text *text)
Textadd_text (const char *file, const char *relpath)
Textcopy_text (Text *ta)
void unlink_text (Main *bmain, Text *text)
void clear_text (Text *text)
void write_text (Text *text, const char *str)
static void make_new_line (TextLine *line, char *newline)
static TextLinetxt_new_line (const char *str)
static TextLinetxt_new_linen (const char *str, int n)
void txt_clean_text (Text *text)
int txt_get_span (TextLine *from, TextLine *to)
static short txt_char_type (char ch)
static void txt_curs_cur (Text *text, TextLine ***linep, int **charp)
static void txt_curs_sel (Text *text, TextLine ***linep, int **charp)
static void txt_curs_first (Text *text, TextLine **linep, int *charp)
void txt_move_up (Text *text, short sel)
void txt_move_down (Text *text, short sel)
void txt_move_left (Text *text, short sel)
void txt_move_right (Text *text, short sel)
void txt_jump_left (Text *text, short sel)
void txt_jump_right (Text *text, short sel)
void txt_move_bol (Text *text, short sel)
void txt_move_eol (Text *text, short sel)
void txt_move_bof (Text *text, short sel)
void txt_move_eof (Text *text, short sel)
void txt_move_toline (Text *text, unsigned int line, short sel)
void txt_move_to (Text *text, unsigned int line, unsigned int ch, short sel)
static void txt_curs_swap (Text *text)
void txt_pop_sel (Text *text)
void txt_order_cursors (Text *text)
int txt_has_sel (Text *text)
void txt_sel_all (Text *text)
void txt_sel_line (Text *text)
char * txt_to_buf (Text *text)
int txt_find_string (Text *text, char *findstr, int wrap, int match_case)
char * txt_sel_to_buf (Text *text)
static void txt_shift_markers (Text *text, int lineno, int count)
void txt_insert_buf (Text *text, const char *in_buffer)
static int max_undo_test (Text *text, int x)
static void dump_buffer (Text *text)
void txt_print_undo (Text *text)
void txt_undo_add_toop (Text *text, int op, unsigned int froml, unsigned short fromc, unsigned int tol, unsigned short toc)
static void txt_undo_add_charop (Text *text, int op, char c)
void txt_do_undo (Text *text)
void txt_do_redo (Text *text)
void txt_split_curline (Text *text)
static void txt_combine_lines (Text *text, TextLine *linea, TextLine *lineb)
void txt_delete_char (Text *text)
void txt_delete_word (Text *text)
void txt_backspace_char (Text *text)
void txt_backspace_word (Text *text)
static void txt_convert_tab_to_spaces (Text *text)
static int txt_add_char_intern (Text *text, char add, int replace_tabs)
int txt_add_char (Text *text, char add)
int txt_add_raw_char (Text *text, char add)
void txt_delete_selected (Text *text)
int txt_replace_char (Text *text, char add)
void txt_indent (Text *text)
void txt_unindent (Text *text)
void txt_comment (Text *text)
void txt_uncomment (Text *text)
int setcurr_tab_spaces (Text *text, int space)
void txt_add_marker (Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags)
TextMarkertxt_find_marker_region (Text *text, TextLine *line, int start, int end, int group, int flags)
short txt_clear_marker_region (Text *text, TextLine *line, int start, int end, int group, int flags)
short txt_clear_markers (Text *text, int group, int flags)
TextMarkertxt_find_marker (Text *text, TextLine *line, int curs, int group, int flags)
TextMarkertxt_prev_marker (Text *text, TextMarker *marker)
TextMarkertxt_next_marker (Text *text, TextMarker *marker)
int text_check_bracket (char ch)
int text_check_delim (char ch)
int text_check_digit (char ch)
int text_check_identifier (char ch)
int text_check_whitespace (char ch)

Variables

static unsigned char undoing
static char tab_to_spaces [] = " "

Detailed Description

Definition in file text.c.


Function Documentation

Text* add_empty_text ( const char *  name) [read]
Text* add_text ( const char *  file,
const char *  relpath 
) [read]
static void cleanup_textline ( TextLine tl) [static]

Definition at line 225 of file text.c.

References i, TextLine::len, and TextLine::line.

Referenced by add_text(), and reopen_text().

void clear_text ( Text text)
Text* copy_text ( Text ta) [read]
static void dump_buffer ( Text text) [static]

Definition at line 1454 of file text.c.

References i, Text::undo_buf, and Text::undo_pos.

Referenced by txt_print_undo().

void free_text ( Text text)
static void init_undo_text ( Text text) [static]
static void make_new_line ( TextLine line,
char *  newline 
) [static]
static int max_undo_test ( Text text,
int  x 
) [static]
int reopen_text ( Text text)
int setcurr_tab_spaces ( Text text,
int  space 
)

Definition at line 2731 of file text.c.

References Text::curc, Text::curl, Text::flags, i, TextLine::line, NULL, rna_array::test, and TXT_TABSTOSPACES.

Referenced by line_break_exec().

int text_check_bracket ( char  ch)

Definition at line 2934 of file text.c.

Referenced by draw_brackets().

int text_check_delim ( char  ch)

Definition at line 2949 of file text.c.

Referenced by move_exec(), and txt_format_line().

int text_check_digit ( char  ch)

Definition at line 2961 of file text.c.

Referenced by txt_format_line().

int text_check_identifier ( char  ch)
int text_check_whitespace ( char  ch)

Definition at line 2979 of file text.c.

Referenced by do_texttools(), and move_exec().

int txt_add_char ( Text text,
char  add 
)
static int txt_add_char_intern ( Text text,
char  add,
int  replace_tabs 
) [static]
void txt_add_marker ( Text text,
TextLine line,
int  start,
int  end,
const unsigned char  color[4],
int  group,
int  flags 
)
int txt_add_raw_char ( Text text,
char  add 
)

Definition at line 2466 of file text.c.

References txt_add_char_intern().

Referenced by txt_insert_buf().

void txt_backspace_char ( Text text)
void txt_backspace_word ( Text text)

Definition at line 2387 of file text.c.

References txt_delete_sel(), and txt_jump_left().

Referenced by delete_exec().

static short txt_char_type ( char  ch) [static]

Definition at line 702 of file text.c.

Referenced by txt_jump_left(), and txt_jump_right().

void txt_clean_text ( Text text)
short txt_clear_marker_region ( Text text,
TextLine line,
int  start,
int  end,
int  group,
int  flags 
)
short txt_clear_markers ( Text text,
int  group,
int  flags 
)
static void txt_combine_lines ( Text text,
TextLine linea,
TextLine lineb 
) [static]
void txt_comment ( Text text)
static void txt_convert_tab_to_spaces ( Text text) [static]

Definition at line 2398 of file text.c.

References Text::curc, tab_to_spaces, txt_insert_buf(), and TXT_TABSIZE.

Referenced by txt_add_char_intern().

static void txt_curs_cur ( Text text,
TextLine ***  linep,
int **  charp 
) [static]
static void txt_curs_first ( Text text,
TextLine **  linep,
int *  charp 
) [static]

Definition at line 729 of file text.c.

References Text::curc, Text::curl, ListBase::first, Text::lines, Text::selc, Text::sell, and txt_get_span().

Referenced by txt_do_undo().

static void txt_curs_sel ( Text text,
TextLine ***  linep,
int **  charp 
) [static]
static void txt_curs_swap ( Text text) [static]
void txt_delete_char ( Text text)
static void txt_delete_line ( Text text,
TextLine line 
) [static]
static void txt_delete_sel ( Text text) [static]
void txt_delete_selected ( Text text)

Definition at line 2471 of file text.c.

References txt_delete_sel(), and txt_make_dirty().

Referenced by cut_exec().

void txt_delete_word ( Text text)

Definition at line 2322 of file text.c.

References txt_delete_sel(), and txt_jump_right().

Referenced by delete_exec().

void txt_do_redo ( Text text)
void txt_do_undo ( Text text)
TextMarker* txt_find_marker ( Text text,
TextLine line,
int  curs,
int  group,
int  flags 
) [read]
TextMarker* txt_find_marker_region ( Text text,
TextLine line,
int  start,
int  end,
int  group,
int  flags 
) [read]
int txt_find_string ( Text text,
char *  findstr,
int  wrap,
int  match_case 
)
int txt_get_span ( TextLine from,
TextLine to 
)
int txt_get_undostate ( void  )

Definition at line 149 of file text.c.

References undoing.

Referenced by clear_text(), and write_text().

int txt_has_sel ( Text text)
void txt_indent ( Text text)
void txt_insert_buf ( Text text,
const char *  in_buffer 
)
void txt_jump_left ( Text text,
short  sel 
)
void txt_jump_right ( Text text,
short  sel 
)
static void txt_make_dirty ( Text text) [static]
void txt_move_bof ( Text text,
short  sel 
)
void txt_move_bol ( Text text,
short  sel 
)
void txt_move_down ( Text text,
short  sel 
)
void txt_move_eof ( Text text,
short  sel 
)
void txt_move_eol ( Text text,
short  sel 
)
void txt_move_left ( Text text,
short  sel 
)
void txt_move_right ( Text text,
short  sel 
)
void txt_move_to ( Text text,
unsigned int  line,
unsigned int  ch,
short  sel 
)
void txt_move_toline ( Text text,
unsigned int  line,
short  sel 
)

Definition at line 981 of file text.c.

References txt_move_to().

Referenced by find_and_replace(), jump_exec(), line_number_invoke(), txt_do_redo(), and txt_do_undo().

void txt_move_up ( Text text,
short  sel 
)
static TextLine* txt_new_line ( const char *  str) [static]

Definition at line 598 of file text.c.

References TextLine::format, TextLine::len, TextLine::line, MEM_mallocN(), TextLine::next, NULL, and TextLine::prev.

Referenced by txt_clean_text().

static TextLine* txt_new_linen ( const char *  str,
int  n 
) [static]
TextMarker* txt_next_marker ( Text text,
TextMarker marker 
) [read]

Definition at line 2918 of file text.c.

References ListBase::first, TextMarker::group, Text::markers, TextMarker::next, and NULL.

Referenced by do_textmarkers().

void txt_order_cursors ( Text text)
static void txt_pop_first ( Text text) [static]
static void txt_pop_last ( Text text) [static]
void txt_pop_sel ( Text text)
TextMarker* txt_prev_marker ( Text text,
TextMarker marker 
) [read]

Definition at line 2905 of file text.c.

References TextMarker::group, ListBase::last, Text::markers, NULL, and TextMarker::prev.

void txt_print_undo ( Text text)
int txt_replace_char ( Text text,
char  add 
)
void txt_sel_all ( Text text)
void txt_sel_line ( Text text)

Definition at line 1164 of file text.c.

References Text::curc, Text::curl, TextLine::len, Text::selc, and Text::sell.

Referenced by select_line_exec().

char* txt_sel_to_buf ( Text text)
void txt_set_undostate ( int  u)

Definition at line 144 of file text.c.

References undoing.

Referenced by clear_text(), and write_text().

static void txt_shift_markers ( Text text,
int  lineno,
int  count 
) [static]

Definition at line 1356 of file text.c.

References ListBase::first, TextMarker::lineno, Text::markers, and TextMarker::next.

Referenced by txt_insert_buf().

void txt_split_curline ( Text text)
char* txt_to_buf ( Text text)
void txt_uncomment ( Text text)
static void txt_undo_add_block ( Text text,
int  op,
const char *  buf 
) [static]

Definition at line 1607 of file text.c.

References length(), max_undo_test(), Text::undo_buf, and Text::undo_pos.

Referenced by txt_delete_sel(), and txt_insert_buf().

static void txt_undo_add_charop ( Text text,
int  op,
char  c 
) [static]
static void txt_undo_add_op ( Text text,
int  op 
) [static]
void txt_undo_add_toop ( Text text,
int  op,
unsigned int  froml,
unsigned short  fromc,
unsigned int  tol,
unsigned short  toc 
)
void txt_unindent ( Text text)
void unlink_text ( Main bmain,
Text text 
)
void write_text ( Text text,
const char *  str 
)

Variable Documentation

char tab_to_spaces[] = " " [static]

Definition at line 2396 of file text.c.

Referenced by txt_convert_tab_to_spaces(), txt_indent(), and txt_unindent().

unsigned char undoing [static]