Blender  V2.59
DNA_text_types.h
Go to the documentation of this file.
00001 /*
00002  * $Id: DNA_text_types.h 34941 2011-02-17 20:48:12Z 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) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 #ifndef DNA_TEXT_TYPES_H
00030 #define DNA_TEXT_TYPES_H
00031 
00037 #include "DNA_listBase.h"
00038 #include "DNA_ID.h"
00039 
00040 typedef struct TextLine {
00041         struct TextLine *next, *prev;
00042 
00043         char *line;
00044         char *format; /* may be NULL if syntax is off or not yet formatted */
00045         int len, blen; /* blen unused */
00046 } TextLine;
00047 
00048 typedef struct TextMarker {
00049         struct TextMarker *next, *prev;
00050 
00051         int lineno, start, end, pad1; /* line number and start/end character indices */
00052         
00053         int group, flags; /* see BKE_text.h for flag defines */
00054         unsigned char color[4], pad[4]; /* draw color of the marker */
00055 } TextMarker;
00056 
00057 typedef struct Text {
00058         ID id;
00059         
00060         char *name;
00061 
00062         int flags, nlines;
00063         
00064         ListBase lines;
00065         TextLine *curl, *sell;
00066         int curc, selc;
00067         ListBase markers;
00068         
00069         char *undo_buf;
00070         int undo_pos, undo_len;
00071         
00072         void *compiled;
00073         double mtime;
00074 } Text;
00075 
00076 #define TXT_TABSIZE     4
00077 #define TXT_INIT_UNDO 1024
00078 #define TXT_MAX_UNDO    (TXT_INIT_UNDO*TXT_INIT_UNDO)
00079 
00080 /* text flags */
00081 #define TXT_ISDIRTY             0x0001
00082 #define TXT_DEPRECATED          0x0004 /* deprecated ISTMP flag */
00083 #define TXT_ISMEM               0x0004
00084 #define TXT_ISEXT               0x0008
00085 #define TXT_ISSCRIPT            0x0010 /* used by space handler scriptlinks */
00086 #define TXT_READONLY            0x0100
00087 #define TXT_FOLLOW              0x0200 /* always follow cursor (console) */
00088 #define TXT_TABSTOSPACES        0x0400 /* use space instead of tabs */
00089 
00090 /* format continuation flags */
00091 #define TXT_NOCONT                              0x00 /* no continuation */
00092 #define TXT_SNGQUOTSTR                  0x01 /* single quotes */
00093 #define TXT_DBLQUOTSTR                  0x02 /* double quotes */
00094 #define TXT_TRISTR                              0x04 /* triplets of quotes: """ or ''' */
00095 #define TXT_SNGTRISTR                   0x05 /*(TXT_TRISTR | TXT_SNGQUOTSTR)*/
00096 #define TXT_DBLTRISTR                   0x06 /*(TXT_TRISTR | TXT_DBLQUOTSTR)*/
00097 
00098 #endif