Blender V4.3
text_intern.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "DNA_vec_types.h"
12
13/* internal exports only */
14
15struct ARegion;
16struct ScrArea;
17struct SpaceText;
18struct Text;
19struct TextLine;
20struct bContext;
21struct wmOperatorType;
22
23/* `text_draw.cc` */
24
25void draw_text_main(SpaceText *st, ARegion *region);
26
28void text_update_edited(Text *text);
29
36
37/* Padding around line numbers in character widths. */
38#define TXT_NUMCOL_PAD 1.0f
39/* Total width of the optional line numbers column. */
40#define TXT_NUMCOL_WIDTH(st) \
41 ((st)->runtime->cwidth_px * ((st)->runtime->line_number_display_digits + (2 * TXT_NUMCOL_PAD)))
42
43/* Padding on left of body text in character units. */
44#define TXT_BODY_LPAD 1.0f
45/* Left position of body text. */
46#define TXT_BODY_LEFT(st) \
47 ((st)->showlinenrs ? TXT_NUMCOL_WIDTH(st) : 0) + (TXT_BODY_LPAD * (st)->runtime->cwidth_px)
48
49#define TXT_SCROLL_WIDTH U.widget_unit
50#define TXT_SCROLL_SPACE ((int)(0.1f * U.widget_unit))
51
52/* Space between lines, in relation to letter height. */
53#define TXT_LINE_VPAD 0.3f
54/* Space between lines. */
55#define TXT_LINE_SPACING(st) ((int)(TXT_LINE_VPAD * st->runtime->lheight_px))
56/* Total height of each line. */
57#define TXT_LINE_HEIGHT(st) ((int)((1.0f + TXT_LINE_VPAD) * st->runtime->lheight_px))
58
59#define SUGG_LIST_SIZE 7
60#define SUGG_LIST_WIDTH 20
61
62#define TOOL_SUGG_LIST 0x01
63
64int space_text_wrap_width(const SpaceText *st, const ARegion *region);
69 const ARegion *region,
70 TextLine *linein,
71 int cursin,
72 int *offl,
73 int *offc);
78 const ARegion *region,
79 TextLine *linein,
80 int cursin,
81 int *offl,
82 int *offc);
83int space_text_get_char_pos(const SpaceText *st, const char *line, int cur);
84
87
88bool space_text_do_suggest_select(SpaceText *st, const ARegion *region, const int mval[2]);
90
91int space_text_get_visible_lines(const SpaceText *st, const ARegion *region, const char *str);
93 const ARegion *region,
94 const TextLine *from,
95 const TextLine *to);
97
98/* `text_ops.cc` */
99
100enum {
115
125
130
136
139
143
145
151
157
158/* find = find indicated text */
164
165/* text_find = open properties, activate search button */
167
169
171
173
174/* `text_autocomplete.cc` */
175
177
178/* `space_text.cc` */
179
180extern "C" const char *text_context_dir[]; /* doc access */
181
184
186 int lheight_px = 0;
187
189 int cwidth_px = 0;
190
195
198
200 int viewlines = 0;
201
203 float scroll_px_per_line = 0.0f;
204
209 int scroll_ofs_px[2]{0, 0};
210
212 void *drawcache = nullptr;
213};
214} // namespace blender::ed::text
#define str(s)
void TEXT_OT_replace_set_selected(wmOperatorType *ot)
Definition text_ops.cc:4000
void space_text_drawcache_tag_update(SpaceText *st, bool full)
const char * text_context_dir[]
void TEXT_OT_unlink(wmOperatorType *ot)
Definition text_ops.cc:616
void TEXT_OT_autocomplete(wmOperatorType *ot)
void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
Definition text_ops.cc:2648
int space_text_wrap_width(const SpaceText *st, const ARegion *region)
@ DEL_PREV_WORD
@ DEL_PREV_CHAR
@ DEL_NEXT_WORD
@ DEL_NEXT_CHAR
void TEXT_OT_reload(wmOperatorType *ot)
Definition text_ops.cc:554
void TEXT_OT_open(wmOperatorType *ot)
Definition text_ops.cc:464
void text_update_edited(Text *text)
Definition text_ops.cc:319
void TEXT_OT_replace(wmOperatorType *ot)
Definition text_ops.cc:3926
void TEXT_OT_run_script(wmOperatorType *ot)
Definition text_ops.cc:907
void space_text_free_caches(SpaceText *st)
void TEXT_OT_copy(wmOperatorType *ot)
Definition text_ops.cc:1131
void TEXT_OT_select_line(wmOperatorType *ot)
Definition text_ops.cc:1659
void draw_text_main(SpaceText *st, ARegion *region)
void TEXT_OT_new(wmOperatorType *ot)
Definition text_ops.cc:364
void TEXT_OT_indent_or_autocomplete(wmOperatorType *ot)
Definition text_ops.cc:1207
void TEXT_OT_scroll(wmOperatorType *ot)
Definition text_ops.cc:2937
void TEXT_OT_line_break(wmOperatorType *ot)
Definition text_ops.cc:1351
void TEXT_OT_save_as(wmOperatorType *ot)
Definition text_ops.cc:827
void TEXT_OT_paste(wmOperatorType *ot)
Definition text_ops.cc:1037
void space_text_update_cursor_moved(bContext *C)
void space_text_wrap_offset(const SpaceText *st, const ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
void TEXT_OT_start_find(wmOperatorType *ot)
void TEXT_OT_make_internal(wmOperatorType *ot)
Definition text_ops.cc:652
void TEXT_OT_to_3d_object(wmOperatorType *ot)
Definition text_ops.cc:4321
void TEXT_OT_indent(wmOperatorType *ot)
Definition text_ops.cc:1253
bool text_space_edit_poll(bContext *C)
Definition text_ops.cc:264
void space_text_update_character_width(SpaceText *st)
void TEXT_OT_select_all(wmOperatorType *ot)
Definition text_ops.cc:1627
@ NEXT_LINE
@ NEXT_CHAR
@ FILE_TOP
@ LINE_BEGIN
@ PREV_WORD
@ PREV_LINE
@ FILE_BOTTOM
@ PREV_CHAR
@ LINE_END
@ PREV_PAGE
@ NEXT_PAGE
@ NEXT_WORD
void TEXT_OT_select_word(wmOperatorType *ot)
Definition text_ops.cc:1692
void TEXT_OT_save(wmOperatorType *ot)
Definition text_ops.cc:756
int space_text_get_visible_lines(const SpaceText *st, const ARegion *region, const char *str)
void space_text_wrap_offset_in_line(const SpaceText *st, const ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
void TEXT_OT_move_lines(wmOperatorType *ot)
Definition text_ops.cc:1730
void TEXT_OT_cursor_set(wmOperatorType *ot)
Definition text_ops.cc:3494
void TEXT_OT_scroll_bar(wmOperatorType *ot)
Definition text_ops.cc:3047
void TEXT_OT_find(wmOperatorType *ot)
Definition text_ops.cc:3857
void TEXT_OT_duplicate_line(wmOperatorType *ot)
Definition text_ops.cc:1085
void TEXT_OT_move_select(wmOperatorType *ot)
Definition text_ops.cc:2429
void TEXT_OT_jump(wmOperatorType *ot)
Definition text_ops.cc:2484
void TEXT_OT_delete(wmOperatorType *ot)
Definition text_ops.cc:2606
void space_text_scroll_to_cursor_with_area(SpaceText *st, ScrArea *area, bool center)
void TEXT_OT_selection_set(wmOperatorType *ot)
Definition text_ops.cc:3445
void TEXT_OT_find_set_selected(wmOperatorType *ot)
Definition text_ops.cc:3969
int space_text_get_span_wrap(const SpaceText *st, const ARegion *region, const TextLine *from, const TextLine *to)
void TEXT_OT_unindent(wmOperatorType *ot)
Definition text_ops.cc:1294
void TEXT_OT_insert(wmOperatorType *ot)
Definition text_ops.cc:3746
int space_text_get_total_lines(SpaceText *st, const ARegion *region)
void TEXT_OT_comment_toggle(wmOperatorType *ot)
Definition text_ops.cc:1409
void TEXT_OT_jump_to_file_at_point(wmOperatorType *ot)
Definition text_ops.cc:4148
void text_pop_suggest_list()
void TEXT_OT_resolve_conflict(wmOperatorType *ot)
Definition text_ops.cc:4284
void TEXT_OT_move(wmOperatorType *ot)
Definition text_ops.cc:2401
void TEXT_OT_line_number(wmOperatorType *ot)
Definition text_ops.cc:3562
void text_update_line_edited(TextLine *line)
Definition text_ops.cc:309
void TEXT_OT_convert_whitespace(wmOperatorType *ot)
Definition text_ops.cc:1584
bool space_text_do_suggest_select(SpaceText *st, const ARegion *region, const int mval[2])
int space_text_get_char_pos(const SpaceText *st, const char *line, int cur)
void TEXT_OT_cut(wmOperatorType *ot)
Definition text_ops.cc:1172
void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
Definition text_ops.cc:975
wmOperatorType * ot
Definition wm_files.cc:4125