Blender  V3.3
text_intern.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 /* internal exports only */
11 
12 struct ARegion;
13 struct ScrArea;
14 struct SpaceText;
15 struct Text;
16 struct TextLine;
17 struct bContext;
18 struct wmOperatorType;
19 
20 /* text_draw.c */
21 
22 void draw_text_main(struct SpaceText *st, struct ARegion *region);
23 
24 void text_update_line_edited(struct TextLine *line);
25 void text_update_edited(struct Text *text);
32 
33 /* Padding around line numbers in character widths. */
34 #define TXT_NUMCOL_PAD 1.0f
35 /* Total width of the optional line numbers column. */
36 #define TXT_NUMCOL_WIDTH(st) \
37  ((st)->runtime.cwidth_px * ((st)->runtime.line_number_display_digits + (2 * TXT_NUMCOL_PAD)))
38 
39 /* Padding on left of body text in character units. */
40 #define TXT_BODY_LPAD 1.0f
41 /* Left position of body text. */
42 #define TXT_BODY_LEFT(st) \
43  ((st)->showlinenrs ? TXT_NUMCOL_WIDTH(st) : 0) + (TXT_BODY_LPAD * (st)->runtime.cwidth_px)
44 
45 #define TXT_SCROLL_WIDTH U.widget_unit
46 #define TXT_SCROLL_SPACE ((int)(0.1f * U.widget_unit))
47 
48 /* Space between lines, in relation to letter height. */
49 #define TXT_LINE_VPAD 0.3f
50 /* Space between lines. */
51 #define TXT_LINE_SPACING(st) ((int)(TXT_LINE_VPAD * st->runtime.lheight_px))
52 /* Total height of each line. */
53 #define TXT_LINE_HEIGHT(st) ((int)((1.0f + TXT_LINE_VPAD) * st->runtime.lheight_px))
54 
55 #define SUGG_LIST_SIZE 7
56 #define SUGG_LIST_WIDTH 20
57 #define DOC_WIDTH 40
58 #define DOC_HEIGHT 10
59 
60 #define TOOL_SUGG_LIST 0x01
61 #define TOOL_DOCUMENT 0x02
62 
63 int wrap_width(const struct SpaceText *st, struct ARegion *region);
67 void wrap_offset(const struct SpaceText *st,
68  struct ARegion *region,
69  struct TextLine *linein,
70  int cursin,
71  int *offl,
72  int *offc);
76 void wrap_offset_in_line(const struct SpaceText *st,
77  struct ARegion *region,
78  struct TextLine *linein,
79  int cursin,
80  int *offl,
81  int *offc);
82 int text_get_char_pos(const struct SpaceText *st, const char *line, int cur);
83 
84 void text_drawcache_tag_update(struct SpaceText *st, int full);
86 
87 bool text_do_suggest_select(struct SpaceText *st, struct ARegion *region, const int mval[2]);
88 void text_pop_suggest_list(void);
89 
90 int text_get_visible_lines(const struct SpaceText *st, struct ARegion *region, const char *str);
91 int text_get_span_wrap(const struct SpaceText *st,
92  struct ARegion *region,
93  struct TextLine *from,
94  struct TextLine *to);
95 int text_get_total_lines(struct SpaceText *st, struct ARegion *region);
96 
97 /* text_ops.c */
98 
99 enum {
111  NEXT_PAGE
112 };
114 
115 void TEXT_OT_new(struct wmOperatorType *ot);
116 void TEXT_OT_open(struct wmOperatorType *ot);
117 void TEXT_OT_reload(struct wmOperatorType *ot);
118 void TEXT_OT_unlink(struct wmOperatorType *ot);
119 void TEXT_OT_save(struct wmOperatorType *ot);
120 void TEXT_OT_save_as(struct wmOperatorType *ot);
122 void TEXT_OT_run_script(struct wmOperatorType *ot);
124 
125 void TEXT_OT_paste(struct wmOperatorType *ot);
126 void TEXT_OT_copy(struct wmOperatorType *ot);
127 void TEXT_OT_cut(struct wmOperatorType *ot);
129 
132 void TEXT_OT_unindent(struct wmOperatorType *ot);
133 void TEXT_OT_indent(struct wmOperatorType *ot);
135 
136 void TEXT_OT_line_break(struct wmOperatorType *ot);
137 void TEXT_OT_insert(struct wmOperatorType *ot);
138 
140 void TEXT_OT_select_all(struct wmOperatorType *ot);
142 
143 void TEXT_OT_move_lines(struct wmOperatorType *ot);
144 
145 void TEXT_OT_jump(struct wmOperatorType *ot);
146 void TEXT_OT_move(struct wmOperatorType *ot);
148 void TEXT_OT_delete(struct wmOperatorType *ot);
150 
151 void TEXT_OT_scroll(struct wmOperatorType *ot);
152 void TEXT_OT_scroll_bar(struct wmOperatorType *ot);
154 void TEXT_OT_cursor_set(struct wmOperatorType *ot);
156 
157 /* find = find indicated text */
158 void TEXT_OT_find(struct wmOperatorType *ot);
160 void TEXT_OT_replace(struct wmOperatorType *ot);
162 
163 /* text_find = open properties, activate search button */
164 void TEXT_OT_start_find(struct wmOperatorType *ot);
165 
167 
169 
170 bool text_space_edit_poll(struct bContext *C);
171 
172 /* text_autocomplete.c */
173 
175 
176 /* space_text.c */
177 
178 extern const char *text_context_dir[]; /* doc access */
NSNotificationCenter * center
#define C
Definition: RandGen.cpp:25
StackEntry * from
#define str(s)
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
void text_pop_suggest_list(void)
void TEXT_OT_delete(struct wmOperatorType *ot)
Definition: text_ops.c:2463
const char * text_context_dir[]
Definition: space_text.c:221
void TEXT_OT_indent_or_autocomplete(struct wmOperatorType *ot)
Definition: text_ops.c:1109
int text_get_span_wrap(const struct SpaceText *st, struct ARegion *region, struct TextLine *from, struct TextLine *to)
void TEXT_OT_selection_set(struct wmOperatorType *ot)
Definition: text_ops.c:3305
void TEXT_OT_save(struct wmOperatorType *ot)
Definition: text_ops.c:666
void text_free_caches(struct SpaceText *st)
void text_update_line_edited(struct TextLine *line)
Definition: text_ops.c:243
void TEXT_OT_replace(struct wmOperatorType *ot)
Definition: text_ops.c:3706
@ DEL_PREV_WORD
Definition: text_intern.h:113
@ DEL_PREV_CHAR
Definition: text_intern.h:113
@ DEL_NEXT_WORD
Definition: text_intern.h:113
@ DEL_NEXT_CHAR
Definition: text_intern.h:113
void TEXT_OT_select_line(struct wmOperatorType *ot)
Definition: text_ops.c:1536
void TEXT_OT_paste(struct wmOperatorType *ot)
Definition: text_ops.c:942
void TEXT_OT_find_set_selected(struct wmOperatorType *ot)
Definition: text_ops.c:3749
void text_scroll_to_cursor__area(struct SpaceText *st, struct ScrArea *area, bool center)
void TEXT_OT_new(struct wmOperatorType *ot)
Definition: text_ops.c:300
int text_get_total_lines(struct SpaceText *st, struct ARegion *region)
void TEXT_OT_line_break(struct wmOperatorType *ot)
Definition: text_ops.c:1251
void TEXT_OT_cut(struct wmOperatorType *ot)
Definition: text_ops.c:1074
void TEXT_OT_overwrite_toggle(struct wmOperatorType *ot)
Definition: text_ops.c:2505
void TEXT_OT_move_select(struct wmOperatorType *ot)
Definition: text_ops.c:2288
void text_update_cursor_moved(struct bContext *C)
void wrap_offset_in_line(const struct SpaceText *st, struct ARegion *region, struct TextLine *linein, int cursin, int *offl, int *offc)
void TEXT_OT_select_word(struct wmOperatorType *ot)
Definition: text_ops.c:1569
void TEXT_OT_scroll_bar(struct wmOperatorType *ot)
Definition: text_ops.c:2899
void TEXT_OT_line_number(struct wmOperatorType *ot)
Definition: text_ops.c:3421
void TEXT_OT_unlink(struct wmOperatorType *ot)
Definition: text_ops.c:530
void TEXT_OT_move_lines(struct wmOperatorType *ot)
Definition: text_ops.c:1607
@ NEXT_LINE
Definition: text_intern.h:109
@ NEXT_CHAR
Definition: text_intern.h:105
@ FILE_TOP
Definition: text_intern.h:102
@ LINE_BEGIN
Definition: text_intern.h:100
@ PREV_WORD
Definition: text_intern.h:106
@ PREV_LINE
Definition: text_intern.h:108
@ FILE_BOTTOM
Definition: text_intern.h:103
@ PREV_CHAR
Definition: text_intern.h:104
@ LINE_END
Definition: text_intern.h:101
@ PREV_PAGE
Definition: text_intern.h:110
@ NEXT_PAGE
Definition: text_intern.h:111
@ NEXT_WORD
Definition: text_intern.h:107
bool text_do_suggest_select(struct SpaceText *st, struct ARegion *region, const int mval[2])
void text_update_edited(struct Text *text)
Definition: text_ops.c:253
void TEXT_OT_copy(struct wmOperatorType *ot)
Definition: text_ops.c:1034
void TEXT_OT_make_internal(struct wmOperatorType *ot)
Definition: text_ops.c:566
void TEXT_OT_run_script(struct wmOperatorType *ot)
Definition: text_ops.c:816
void wrap_offset(const struct SpaceText *st, struct ARegion *region, struct TextLine *linein, int cursin, int *offl, int *offc)
void TEXT_OT_jump(struct wmOperatorType *ot)
Definition: text_ops.c:2341
void TEXT_OT_insert(struct wmOperatorType *ot)
Definition: text_ops.c:3528
void TEXT_OT_unindent(struct wmOperatorType *ot)
Definition: text_ops.c:1194
void TEXT_OT_autocomplete(struct wmOperatorType *ot)
void TEXT_OT_resolve_conflict(struct wmOperatorType *ot)
Definition: text_ops.c:3902
void TEXT_OT_convert_whitespace(struct wmOperatorType *ot)
Definition: text_ops.c:1465
void TEXT_OT_indent(struct wmOperatorType *ot)
Definition: text_ops.c:1154
int wrap_width(const struct SpaceText *st, struct ARegion *region)
void TEXT_OT_save_as(struct wmOperatorType *ot)
Definition: text_ops.c:737
bool text_space_edit_poll(struct bContext *C)
Definition: text_ops.c:198
void TEXT_OT_refresh_pyconstraints(struct wmOperatorType *ot)
Definition: text_ops.c:884
void TEXT_OT_cursor_set(struct wmOperatorType *ot)
Definition: text_ops.c:3354
void TEXT_OT_replace_set_selected(struct wmOperatorType *ot)
Definition: text_ops.c:3780
void TEXT_OT_start_find(struct wmOperatorType *ot)
Definition: text_header.c:84
void draw_text_main(struct SpaceText *st, struct ARegion *region)
void TEXT_OT_select_all(struct wmOperatorType *ot)
Definition: text_ops.c:1506
void TEXT_OT_open(struct wmOperatorType *ot)
Definition: text_ops.c:400
void TEXT_OT_find(struct wmOperatorType *ot)
Definition: text_ops.c:3637
void TEXT_OT_scroll(struct wmOperatorType *ot)
Definition: text_ops.c:2793
void TEXT_OT_comment_toggle(struct wmOperatorType *ot)
Definition: text_ops.c:1307
int text_get_visible_lines(const struct SpaceText *st, struct ARegion *region, const char *str)
void TEXT_OT_move(struct wmOperatorType *ot)
Definition: text_ops.c:2260
void text_drawcache_tag_update(struct SpaceText *st, int full)
void TEXT_OT_reload(struct wmOperatorType *ot)
Definition: text_ops.c:479
int text_get_char_pos(const struct SpaceText *st, const char *line, int cur)
void TEXT_OT_duplicate_line(struct wmOperatorType *ot)
Definition: text_ops.c:988
void text_update_character_width(struct SpaceText *st)
void TEXT_OT_to_3d_object(struct wmOperatorType *ot)
Definition: text_ops.c:3939
wmOperatorType * ot
Definition: wm_files.c:3479