Blender V5.0
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
8
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
34void space_text_scroll_to_cursor_with_area(SpaceText *st, ScrArea *area, bool center);
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);
96int space_text_get_total_lines(SpaceText *st, const ARegion *region);
97
98/* `text_ops.cc` */
99
100enum {
113};
115
124
129
135
138
142
144
150
156
157/* The term: `find` means: find indicated text. */
163
164/* The term `text_find` means: open properties, activate search button. */
166
168
170
172
174
175/* `text_autocomplete.cc` */
176
178
179/* `space_text.cc` */
180
181extern "C" const char *text_context_dir[]; /* Doc access. */
182
185
187 int lheight_px = 0;
188
190 int cwidth_px = 0;
191
196
199
201 int viewlines = 0;
202
204 float scroll_px_per_line = 0.0f;
205
210 int scroll_ofs_px[2]{0, 0};
211
213 void *drawcache = nullptr;
214};
215} // namespace blender::ed::text
#define C
Definition RandGen.cpp:29
#define NEXT_CHAR(fmt)
@ DEL_PREV_WORD
@ DEL_PREV_CHAR
@ DEL_NEXT_WORD
@ DEL_NEXT_CHAR
@ NEXT_LINE
@ LINE_BEGIN
@ PREV_WORD
@ PREV_LINE
@ PREV_CHAR
@ LINE_END
@ PREV_PAGE
@ NEXT_PAGE
@ NEXT_WORD
#define str(s)
const char * text_context_dir[]
cursin
Definition text_draw.cc:252
void TEXT_OT_replace_set_selected(wmOperatorType *ot)
Definition text_ops.cc:3979
void space_text_drawcache_tag_update(SpaceText *st, bool full)
Definition text_draw.cc:734
void TEXT_OT_unlink(wmOperatorType *ot)
Definition text_ops.cc:643
void TEXT_OT_autocomplete(wmOperatorType *ot)
void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
Definition text_ops.cc:2618
int space_text_wrap_width(const SpaceText *st, const ARegion *region)
void TEXT_OT_reload(wmOperatorType *ot)
Definition text_ops.cc:581
void TEXT_OT_open(wmOperatorType *ot)
Definition text_ops.cc:491
void text_update_edited(Text *text)
Definition text_ops.cc:334
void TEXT_OT_update_shader(wmOperatorType *ot)
Definition text_ops.cc:4422
void TEXT_OT_replace(wmOperatorType *ot)
Definition text_ops.cc:3905
void TEXT_OT_run_script(wmOperatorType *ot)
Definition text_ops.cc:944
void space_text_free_caches(SpaceText *st)
Definition text_draw.cc:783
void TEXT_OT_copy(wmOperatorType *ot)
Definition text_ops.cc:1103
void TEXT_OT_select_line(wmOperatorType *ot)
Definition text_ops.cc:1631
void draw_text_main(SpaceText *st, ARegion *region)
void TEXT_OT_new(wmOperatorType *ot)
Definition text_ops.cc:379
void TEXT_OT_indent_or_autocomplete(wmOperatorType *ot)
Definition text_ops.cc:1181
void TEXT_OT_scroll(wmOperatorType *ot)
Definition text_ops.cc:2911
void TEXT_OT_line_break(wmOperatorType *ot)
Definition text_ops.cc:1325
void TEXT_OT_save_as(wmOperatorType *ot)
Definition text_ops.cc:864
void TEXT_OT_paste(wmOperatorType *ot)
Definition text_ops.cc:1009
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:679
void TEXT_OT_to_3d_object(wmOperatorType *ot)
Definition text_ops.cc:4307
void TEXT_OT_indent(wmOperatorType *ot)
Definition text_ops.cc:1227
bool text_space_edit_poll(bContext *C)
Definition text_ops.cc:279
void space_text_update_character_width(SpaceText *st)
void TEXT_OT_select_all(wmOperatorType *ot)
Definition text_ops.cc:1599
void TEXT_OT_select_word(wmOperatorType *ot)
Definition text_ops.cc:1664
void TEXT_OT_save(wmOperatorType *ot)
Definition text_ops.cc:784
int space_text_get_visible_lines(const SpaceText *st, const ARegion *region, const char *str)
Definition text_draw.cc:810
void space_text_wrap_offset_in_line(const SpaceText *st, const ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
Definition text_draw.cc:313
void TEXT_OT_move_lines(wmOperatorType *ot)
Definition text_ops.cc:1702
void TEXT_OT_cursor_set(wmOperatorType *ot)
Definition text_ops.cc:3471
void TEXT_OT_scroll_bar(wmOperatorType *ot)
Definition text_ops.cc:3021
void TEXT_OT_find(wmOperatorType *ot)
Definition text_ops.cc:3836
void TEXT_OT_duplicate_line(wmOperatorType *ot)
Definition text_ops.cc:1057
void TEXT_OT_move_select(wmOperatorType *ot)
Definition text_ops.cc:2399
void TEXT_OT_jump(wmOperatorType *ot)
Definition text_ops.cc:2454
void TEXT_OT_delete(wmOperatorType *ot)
Definition text_ops.cc:2576
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:3422
void TEXT_OT_find_set_selected(wmOperatorType *ot)
Definition text_ops.cc:3948
int space_text_get_span_wrap(const SpaceText *st, const ARegion *region, const TextLine *from, const TextLine *to)
Definition text_draw.cc:849
void TEXT_OT_unindent(wmOperatorType *ot)
Definition text_ops.cc:1268
void TEXT_OT_insert(wmOperatorType *ot)
Definition text_ops.cc:3725
@ FILE_TOP
@ FILE_BOTTOM
int space_text_get_total_lines(SpaceText *st, const ARegion *region)
Definition text_draw.cc:872
void TEXT_OT_comment_toggle(wmOperatorType *ot)
Definition text_ops.cc:1383
void TEXT_OT_jump_to_file_at_point(wmOperatorType *ot)
Definition text_ops.cc:4149
void text_pop_suggest_list()
void TEXT_OT_resolve_conflict(wmOperatorType *ot)
Definition text_ops.cc:4270
void TEXT_OT_move(wmOperatorType *ot)
Definition text_ops.cc:2371
void TEXT_OT_line_number(wmOperatorType *ot)
Definition text_ops.cc:3541
void text_update_line_edited(TextLine *line)
Definition text_ops.cc:324
void TEXT_OT_convert_whitespace(wmOperatorType *ot)
Definition text_ops.cc:1556
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)
Definition text_draw.cc:385
void TEXT_OT_cut(wmOperatorType *ot)
Definition text_ops.cc:1144
wmOperatorType * ot
Definition wm_files.cc:4237