Blender  V2.59
text_intern.h
Go to the documentation of this file.
00001 /*
00002  * $Id: text_intern.h 35242 2011-02-27 20:29:51Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version. 
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2009 Blender Foundation.
00021  * All rights reserved.
00022  *
00023  * 
00024  * Contributor(s): Blender Foundation
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00033 #ifndef ED_TEXT_INTERN_H
00034 #define ED_TEXT_INTERN_H
00035 
00036 /* internal exports only */
00037 
00038 struct ARegion;
00039 struct ARegionType;
00040 struct bContext;
00041 struct ReportList;
00042 struct ScrArea;
00043 struct SpaceText;
00044 struct Text;
00045 struct TextLine;
00046 struct wmOperatorType;
00047 struct wmWindowManager;
00048 
00049 /* text_draw.c */
00050 void draw_text_main(struct SpaceText *st, struct ARegion *ar);
00051 
00052 int text_font_width_character(struct SpaceText *st);
00053 int text_font_width(struct SpaceText *st, const char *str);
00054 
00055 void text_update_line_edited(struct TextLine *line);
00056 void text_update_edited(struct Text *text);
00057 void text_update_character_width(struct SpaceText *st);
00058 void text_update_cursor_moved(struct bContext *C);
00059 
00060         /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
00061 #define TXT_OFFSET 15
00062 #define TXT_SCROLL_WIDTH 20
00063 #define TXT_SCROLL_SPACE 2
00064 
00065 #define TEXTXLOC                (st->cwidth * st->linenrs_tot)
00066 
00067 #define SUGG_LIST_SIZE  7
00068 #define SUGG_LIST_WIDTH 20
00069 #define DOC_WIDTH               40
00070 #define DOC_HEIGHT              10
00071 
00072 #define TOOL_SUGG_LIST  0x01
00073 #define TOOL_DOCUMENT   0x02
00074 
00075 #define TMARK_GRP_CUSTOM        0x00010000      /* Lower 2 bytes used for Python groups */
00076 #define TMARK_GRP_FINDALL       0x00020000
00077 
00078 typedef struct FlattenString {
00079         char fixedbuf[256];
00080         int fixedaccum[256];
00081 
00082         char *buf;
00083         int *accum;
00084         int pos, len;
00085 } FlattenString;
00086 
00087 int flatten_string(struct SpaceText *st, FlattenString *fs, const char *in);
00088 void flatten_string_free(FlattenString *fs);
00089 
00090 int wrap_width(struct SpaceText *st, struct ARegion *ar);
00091 void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc);
00092 void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc);
00093 int text_get_char_pos(struct SpaceText *st, const char *line, int cur);
00094 
00095 void text_drawcache_tag_update(struct SpaceText *st, int full);
00096 void text_free_caches(struct SpaceText *st);
00097 
00098 int text_file_modified(struct Text *text);
00099 
00100 int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar);
00101 void text_pop_suggest_list(void);
00102 
00103 int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, const char *str);
00104 int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to);
00105 int text_get_total_lines(struct SpaceText *st, struct ARegion *ar);
00106 
00107 /* text_ops.c */
00108 enum { LINE_BEGIN, LINE_END, FILE_TOP, FILE_BOTTOM, PREV_CHAR, NEXT_CHAR,
00109            PREV_WORD, NEXT_WORD, PREV_LINE, NEXT_LINE, PREV_PAGE, NEXT_PAGE };
00110 enum { DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_NEXT_WORD, DEL_PREV_WORD };
00111 
00112 void TEXT_OT_new(struct wmOperatorType *ot);
00113 void TEXT_OT_open(struct wmOperatorType *ot);
00114 void TEXT_OT_reload(struct wmOperatorType *ot);
00115 void TEXT_OT_unlink(struct wmOperatorType *ot);
00116 void TEXT_OT_save(struct wmOperatorType *ot);
00117 void TEXT_OT_save_as(struct wmOperatorType *ot);
00118 void TEXT_OT_make_internal(struct wmOperatorType *ot);
00119 void TEXT_OT_run_script(struct wmOperatorType *ot);
00120 void TEXT_OT_refresh_pyconstraints(struct wmOperatorType *ot);
00121 
00122 void TEXT_OT_paste(struct wmOperatorType *ot);
00123 void TEXT_OT_copy(struct wmOperatorType *ot);
00124 void TEXT_OT_cut(struct wmOperatorType *ot);
00125 
00126 void TEXT_OT_convert_whitespace(struct wmOperatorType *ot);
00127 void TEXT_OT_uncomment(struct wmOperatorType *ot);
00128 void TEXT_OT_comment(struct wmOperatorType *ot);
00129 void TEXT_OT_unindent(struct wmOperatorType *ot);
00130 void TEXT_OT_indent(struct wmOperatorType *ot);
00131 
00132 void TEXT_OT_line_break(struct wmOperatorType *ot);
00133 void TEXT_OT_insert(struct wmOperatorType *ot);
00134 
00135 void TEXT_OT_markers_clear(struct wmOperatorType *ot);
00136 void TEXT_OT_next_marker(struct wmOperatorType *ot);
00137 void TEXT_OT_previous_marker(struct wmOperatorType *ot);
00138 
00139 void TEXT_OT_select_line(struct wmOperatorType *ot);
00140 void TEXT_OT_select_all(struct wmOperatorType *ot);
00141 void TEXT_OT_select_word(struct wmOperatorType *ot);
00142 
00143 void TEXT_OT_jump(struct wmOperatorType *ot);
00144 void TEXT_OT_move(struct wmOperatorType *ot);
00145 void TEXT_OT_move_select(struct wmOperatorType *ot);
00146 void TEXT_OT_delete(struct wmOperatorType *ot);
00147 void TEXT_OT_overwrite_toggle(struct wmOperatorType *ot);
00148 
00149 void TEXT_OT_scroll(struct wmOperatorType *ot);
00150 void TEXT_OT_scroll_bar(struct wmOperatorType *ot);
00151 void TEXT_OT_selection_set(struct wmOperatorType *ot);
00152 void TEXT_OT_cursor_set(struct wmOperatorType *ot);
00153 void TEXT_OT_line_number(struct wmOperatorType *ot);
00154 
00155 void TEXT_OT_properties(struct wmOperatorType *ot);
00156 
00157 void TEXT_OT_find(struct wmOperatorType *ot);
00158 void TEXT_OT_find_set_selected(struct wmOperatorType *ot);
00159 void TEXT_OT_replace(struct wmOperatorType *ot);
00160 void TEXT_OT_replace_set_selected(struct wmOperatorType *ot);
00161 void TEXT_OT_mark_all(struct wmOperatorType *ot);
00162 
00163 void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
00164 
00165 void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
00166 
00167 /* space_text.c */
00168 extern const char *text_context_dir[]; /* doc access */
00169 
00170 #endif /* ED_TEXT_INTERN_H */
00171