Blender V5.3
text_intern.hh File Reference
#include <optional>
#include "BLI_math_vector_types.hh"
#include "DNA_vec_types.h"

Go to the source code of this file.

Classes

struct  blender::ed::text::SpaceText_Runtime

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::ed
namespace  blender::ed::text

Macros

#define TXT_NUMCOL_PAD   1.0f
#define TXT_NUMCOL_WIDTH(st)
#define TXT_BODY_LPAD   1.0f
#define TXT_BODY_LEFT(st)
#define TXT_SCROLL_WIDTH   U.widget_unit
#define TXT_SCROLL_SPACE   int(0.1f * U.widget_unit)
#define TXT_LINE_VPAD   0.3f
#define TXT_LINE_SPACING(st)
#define TXT_LINE_HEIGHT(st)
#define SUGG_LIST_SIZE   7
#define SUGG_LIST_WIDTH   20
#define TOOL_SUGG_LIST   0x01

Enumerations

enum  {
  blender::LINE_BEGIN , blender::LINE_END , blender::FILE_TOP , blender::FILE_BOTTOM ,
  blender::PREV_CHAR , blender::NEXT_CHAR , blender::PREV_WORD , blender::NEXT_WORD ,
  blender::PREV_LINE , blender::NEXT_LINE , blender::PREV_PAGE , blender::NEXT_PAGE
}
enum  { blender::DEL_NEXT_CHAR , blender::DEL_PREV_CHAR , blender::DEL_NEXT_WORD , blender::DEL_PREV_WORD }

Functions

void blender::TEXT_OT_start_find (wmOperatorType *ot)
Main Region Drawing
void blender::draw_text_main (SpaceText *st, ARegion *region)
Update & Coordinate Conversion
std::optional< int2 > blender::space_text_cursor_region_xy_get (const SpaceText *st, const ARegion *region)
void blender::space_text_update_character_width (SpaceText *st)
void blender::space_text_scroll_to_cursor_with_area (SpaceText *st, ScrArea *area, const bool center)
void blender::space_text_update_cursor_moved (bContext *C)
Updates
void blender::text_update_line_edited (TextLine *line)
void blender::text_update_edited (Text *text)
Draw Text

Notes on Word-Wrap

All word-wrap functions follow the algorithm below to maintain consistency:

  • line: The line to wrap (tabs converted to spaces)
  • view_width: The maximum number of characters displayable in the region This equals region_width/font_width for the region
  • wrap_chars: Characters that allow wrapping. This equals [" ", "\t", "-"]
def wrap(line, view_width, wrap_chars):
draw_start = 0
draw_end = view_width
pos = 0
for c in line:
if pos-draw_start >= view_width:
print line[draw_start:draw_end]
draw_start = draw_end
draw_end += view_width
elif c in wrap_chars:
draw_end = pos+1
pos += 1
print line[draw_start:]
float wrap(float a, float b, float c)
int blender::space_text_wrap_width (const SpaceText *st, const ARegion *region)
void blender::space_text_wrap_offset (const SpaceText *st, const ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
void blender::space_text_wrap_offset_in_line (const SpaceText *st, const ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
int blender::space_text_get_char_pos (const SpaceText *st, const char *line, int cur)
Cache Utilities
void blender::space_text_drawcache_tag_update (SpaceText *st, const bool full)
void blender::space_text_free_caches (SpaceText *st)
Public API
bool blender::space_text_do_suggest_select (SpaceText *st, const ARegion *region, const int mval[2])
void blender::text_pop_suggest_list ()
Word-Wrap Utilities
int blender::space_text_get_visible_lines (const SpaceText *st, const ARegion *region, const char *str)
int blender::space_text_get_span_wrap (const SpaceText *st, const ARegion *region, const TextLine *from, const TextLine *to)
int blender::space_text_get_total_lines (SpaceText *st, const ARegion *region)
New Operator
void blender::TEXT_OT_new (wmOperatorType *ot)
Open Operator
void blender::TEXT_OT_open (wmOperatorType *ot)
Reload Operator
void blender::TEXT_OT_reload (wmOperatorType *ot)
Delete Operator
void blender::TEXT_OT_unlink (wmOperatorType *ot)
void blender::TEXT_OT_delete (wmOperatorType *ot)
Save Operator
void blender::TEXT_OT_save (wmOperatorType *ot)
Save As Operator
void blender::TEXT_OT_save_as (wmOperatorType *ot)
Make Internal Operator
void blender::TEXT_OT_make_internal (wmOperatorType *ot)
Run Script Operator
void blender::TEXT_OT_run_script (wmOperatorType *ot)
Paste Operator
void blender::TEXT_OT_paste (wmOperatorType *ot)
Copy Operator
void blender::TEXT_OT_copy (wmOperatorType *ot)
Cut Operator
void blender::TEXT_OT_cut (wmOperatorType *ot)
Duplicate Operator
void blender::TEXT_OT_duplicate_line (wmOperatorType *ot)
Convert Whitespace Operator
void blender::TEXT_OT_convert_whitespace (wmOperatorType *ot)
Toggle-Comment Operator
void blender::TEXT_OT_comment_toggle (wmOperatorType *ot)
Unindent Operator
void blender::TEXT_OT_unindent (wmOperatorType *ot)
Indent Operator
void blender::TEXT_OT_indent (wmOperatorType *ot)
Indent or Autocomplete Operator
void blender::TEXT_OT_indent_or_autocomplete (wmOperatorType *ot)
Line Break Operator
void blender::TEXT_OT_line_break (wmOperatorType *ot)
Insert Operator
void blender::TEXT_OT_insert (wmOperatorType *ot)
Select Line Operator
void blender::TEXT_OT_select_line (wmOperatorType *ot)
Select All Operator
void blender::TEXT_OT_select_all (wmOperatorType *ot)
Select Word Operator
void blender::TEXT_OT_select_word (wmOperatorType *ot)
Move Lines Operators
void blender::TEXT_OT_move_lines (wmOperatorType *ot)
Jump Operator
void blender::TEXT_OT_jump (wmOperatorType *ot)
Move Operator
void blender::TEXT_OT_move (wmOperatorType *ot)
Move Select Operator
void blender::TEXT_OT_move_select (wmOperatorType *ot)
Toggle Overwrite Operator
void blender::TEXT_OT_overwrite_toggle (wmOperatorType *ot)
Scroll Operator
void blender::TEXT_OT_scroll (wmOperatorType *ot)
Scroll Bar Operator
void blender::TEXT_OT_scroll_bar (wmOperatorType *ot)
Set Selection Operator
void blender::TEXT_OT_selection_set (wmOperatorType *ot)
Set Cursor Operator
void blender::TEXT_OT_cursor_set (wmOperatorType *ot)
Line Number Operator
void blender::TEXT_OT_line_number (wmOperatorType *ot)
Find Operator
void blender::TEXT_OT_find (wmOperatorType *ot)
Find Set Selected
void blender::TEXT_OT_find_set_selected (wmOperatorType *ot)
Replace Operator
void blender::TEXT_OT_replace (wmOperatorType *ot)
Replace Set Selected
void blender::TEXT_OT_replace_set_selected (wmOperatorType *ot)
Jump to File at Point
void blender::TEXT_OT_jump_to_file_at_point (wmOperatorType *ot)
To 3D Object Operator
void blender::TEXT_OT_to_3d_object (wmOperatorType *ot)
Resolve Conflict Operator
void blender::TEXT_OT_resolve_conflict (wmOperatorType *ot)
Operator Poll
bool blender::text_space_edit_poll (bContext *C)
Shader Update
void blender::TEXT_OT_update_shader (wmOperatorType *ot)
Auto Complete Operator
void blender::TEXT_OT_autocomplete (wmOperatorType *ot)

Macro Definition Documentation

◆ SUGG_LIST_SIZE

◆ SUGG_LIST_WIDTH

#define SUGG_LIST_WIDTH   20

◆ TOOL_SUGG_LIST

#define TOOL_SUGG_LIST   0x01

Definition at line 79 of file text_intern.hh.

Referenced by blender::text_autocomplete_modal().

◆ TXT_BODY_LEFT

◆ TXT_BODY_LPAD

#define TXT_BODY_LPAD   1.0f

Definition at line 61 of file text_intern.hh.

Referenced by blender::text_line_number_invoke().

◆ TXT_LINE_HEIGHT

◆ TXT_LINE_SPACING

#define TXT_LINE_SPACING ( st)
Value:
int(TXT_LINE_VPAD * st->runtime->line_height_px)

Definition at line 72 of file text_intern.hh.

Referenced by blender::draw_text_decoration().

◆ TXT_LINE_VPAD

#define TXT_LINE_VPAD   0.3f

Definition at line 70 of file text_intern.hh.

◆ TXT_NUMCOL_PAD

#define TXT_NUMCOL_PAD   1.0f

Definition at line 54 of file text_intern.hh.

Referenced by blender::draw_text_main().

◆ TXT_NUMCOL_WIDTH

#define TXT_NUMCOL_WIDTH ( st)
Value:
((st)->runtime->char_width_px * \
((st)->runtime->line_number_display_digits + (2 * TXT_NUMCOL_PAD)))
#define TXT_NUMCOL_PAD

Definition at line 56 of file text_intern.hh.

Referenced by blender::draw_text_main(), and blender::text_line_number_invoke().

◆ TXT_SCROLL_SPACE

#define TXT_SCROLL_SPACE   int(0.1f * U.widget_unit)

Definition at line 67 of file text_intern.hh.

Referenced by blender::text_scroll_bar_invoke().

◆ TXT_SCROLL_WIDTH

#define TXT_SCROLL_WIDTH   U.widget_unit