4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2009 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
28 #ifndef ED_TEXT_INTERN_H
29 #define ED_TEXT_INTERN_H
31 /* internal exports only */
41 struct wmOperatorType;
42 struct wmWindowManager;
45 void draw_text_main(struct SpaceText *st, struct ARegion *ar);
47 int text_font_width_character(struct SpaceText *st);
48 int text_font_width(struct SpaceText *st, const char *str);
50 void text_update_line_edited(struct TextLine *line);
51 void text_update_edited(struct Text *text);
52 void text_update_character_width(struct SpaceText *st);
53 void text_update_cursor_moved(struct bContext *C);
55 /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
57 #define TXT_SCROLL_WIDTH 20
58 #define TXT_SCROLL_SPACE 2
60 #define TEXTXLOC (st->cwidth * st->linenrs_tot)
62 #define SUGG_LIST_SIZE 7
63 #define SUGG_LIST_WIDTH 20
67 #define TOOL_SUGG_LIST 0x01
68 #define TOOL_DOCUMENT 0x02
70 #define TMARK_GRP_CUSTOM 0x00010000 /* Lower 2 bytes used for Python groups */
71 #define TMARK_GRP_FINDALL 0x00020000
73 typedef struct FlattenString {
82 int flatten_string(struct SpaceText *st, FlattenString *fs, const char *in);
83 void flatten_string_free(FlattenString *fs);
85 int wrap_width(struct SpaceText *st, struct ARegion *ar);
86 void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc);
87 void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc);
88 int text_get_char_pos(struct SpaceText *st, const char *line, int cur);
90 void text_drawcache_tag_update(struct SpaceText *st, int full);
91 void text_free_caches(struct SpaceText *st);
93 int text_file_modified(struct Text *text);
95 int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar);
96 void text_pop_suggest_list(void);
98 int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, const char *str);
99 int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to);
100 int text_get_total_lines(struct SpaceText *st, struct ARegion *ar);
103 enum { LINE_BEGIN, LINE_END, FILE_TOP, FILE_BOTTOM, PREV_CHAR, NEXT_CHAR,
104 PREV_WORD, NEXT_WORD, PREV_LINE, NEXT_LINE, PREV_PAGE, NEXT_PAGE };
105 enum { DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_NEXT_WORD, DEL_PREV_WORD };
107 void TEXT_OT_new(struct wmOperatorType *ot);
108 void TEXT_OT_open(struct wmOperatorType *ot);
109 void TEXT_OT_reload(struct wmOperatorType *ot);
110 void TEXT_OT_unlink(struct wmOperatorType *ot);
111 void TEXT_OT_save(struct wmOperatorType *ot);
112 void TEXT_OT_save_as(struct wmOperatorType *ot);
113 void TEXT_OT_make_internal(struct wmOperatorType *ot);
114 void TEXT_OT_run_script(struct wmOperatorType *ot);
115 void TEXT_OT_refresh_pyconstraints(struct wmOperatorType *ot);
117 void TEXT_OT_paste(struct wmOperatorType *ot);
118 void TEXT_OT_copy(struct wmOperatorType *ot);
119 void TEXT_OT_cut(struct wmOperatorType *ot);
121 void TEXT_OT_convert_whitespace(struct wmOperatorType *ot);
122 void TEXT_OT_uncomment(struct wmOperatorType *ot);
123 void TEXT_OT_comment(struct wmOperatorType *ot);
124 void TEXT_OT_unindent(struct wmOperatorType *ot);
125 void TEXT_OT_indent(struct wmOperatorType *ot);
127 void TEXT_OT_line_break(struct wmOperatorType *ot);
128 void TEXT_OT_insert(struct wmOperatorType *ot);
130 void TEXT_OT_markers_clear(struct wmOperatorType *ot);
131 void TEXT_OT_next_marker(struct wmOperatorType *ot);
132 void TEXT_OT_previous_marker(struct wmOperatorType *ot);
134 void TEXT_OT_select_line(struct wmOperatorType *ot);
135 void TEXT_OT_select_all(struct wmOperatorType *ot);
136 void TEXT_OT_select_word(struct wmOperatorType *ot);
138 void TEXT_OT_jump(struct wmOperatorType *ot);
139 void TEXT_OT_move(struct wmOperatorType *ot);
140 void TEXT_OT_move_select(struct wmOperatorType *ot);
141 void TEXT_OT_delete(struct wmOperatorType *ot);
142 void TEXT_OT_overwrite_toggle(struct wmOperatorType *ot);
144 void TEXT_OT_scroll(struct wmOperatorType *ot);
145 void TEXT_OT_scroll_bar(struct wmOperatorType *ot);
146 void TEXT_OT_selection_set(struct wmOperatorType *ot);
147 void TEXT_OT_cursor_set(struct wmOperatorType *ot);
148 void TEXT_OT_line_number(struct wmOperatorType *ot);
150 void TEXT_OT_properties(struct wmOperatorType *ot);
152 void TEXT_OT_find(struct wmOperatorType *ot);
153 void TEXT_OT_find_set_selected(struct wmOperatorType *ot);
154 void TEXT_OT_replace(struct wmOperatorType *ot);
155 void TEXT_OT_replace_set_selected(struct wmOperatorType *ot);
156 void TEXT_OT_mark_all(struct wmOperatorType *ot);
158 void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
160 void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
163 extern const char *text_context_dir[]; /* doc access */
165 #endif /* ED_TEXT_INTERN_H */