~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/Text.h

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* 
 
2
 * $Id: Text.h,v 1.13 2004/10/07 19:25:40 stiv Exp $
2
3
 *
3
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4
5
 *
32
33
#ifndef EXPP_TEXT_H
33
34
#define EXPP_TEXT_H
34
35
 
35
 
#include <Python.h>
36
 
#include <stdio.h>
37
 
 
38
 
#include <BKE_main.h>
39
 
#include <BKE_global.h>
40
 
#include <BKE_library.h>
41
 
#include <BKE_sca.h>
42
 
#include <BIF_drawtext.h>
43
 
#include <BKE_text.h>
44
 
#include <BLI_blenlib.h>
45
36
#include <DNA_text_types.h>
46
37
 
47
 
#include "gen_utils.h"
48
 
#include "modules.h"
49
 
#include "../BPY_extern.h"
50
 
 
51
 
#define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW
52
 
 
53
 
/*****************************************************************************/
54
 
/* Python API function prototypes for the Text module.                       */
55
 
/*****************************************************************************/
56
 
static PyObject *M_Text_New (PyObject *self, PyObject *args,
57
 
                PyObject *keywords);
58
 
static PyObject *M_Text_Get (PyObject *self, PyObject *args);
59
 
static PyObject *M_Text_Load (PyObject *self, PyObject *args);
60
 
static PyObject *M_Text_unlink (PyObject *self, PyObject *args);
61
 
 
62
 
/*****************************************************************************/
63
 
/* The following string definitions are used for documentation strings.      */
64
 
/* In Python these will be written to the console when doing a               */
65
 
/* Blender.Text.__doc__                                                      */
66
 
/*****************************************************************************/
67
 
static char M_Text_doc[] =
68
 
"The Blender Text module\n\n";
69
 
 
70
 
static char M_Text_New_doc[] =
71
 
"() - return a new Text object";
72
 
 
73
 
static char M_Text_Get_doc[] =
74
 
"(name) - return the Text with name 'name', \
75
 
returns None if not found.\n If 'name' is not specified, \
76
 
it returns a list of all Texts in the\ncurrent scene.";
77
 
 
78
 
static char M_Text_Load_doc[] =
79
 
"(filename) - return text from file filename as a Text Object, \
80
 
returns None if not found.\n";
81
 
 
82
 
static char M_Text_unlink_doc[] =
83
 
"(text) - remove Text object 'text' from Blender";
84
 
 
85
 
/*****************************************************************************/
86
 
/* Python method structure definition for Blender.Text module:               */
87
 
/*****************************************************************************/
88
 
struct PyMethodDef M_Text_methods[] = {
89
 
  {"New",(PyCFunction)M_Text_New, METH_VARARGS|METH_KEYWORDS,
90
 
          M_Text_New_doc},
91
 
  {"Get",         M_Text_Get,         METH_VARARGS, M_Text_Get_doc},
92
 
  {"get",         M_Text_Get,         METH_VARARGS, M_Text_Get_doc},
93
 
  {"Load",        M_Text_Load,        METH_VARARGS, M_Text_Load_doc},
94
 
  {"unlink",      M_Text_unlink,      METH_VARARGS, M_Text_unlink_doc},
95
 
  {NULL, NULL, 0, NULL}
96
 
};
97
 
 
98
 
/*****************************************************************************/
99
 
/* Python BPy_Text structure definition:                                     */
100
 
/*****************************************************************************/
101
 
typedef struct {
102
 
  PyObject_HEAD
103
 
  Text *text;
104
 
 
105
 
} BPy_Text;
106
 
 
107
 
/*****************************************************************************/
108
 
/* Python BPy_Text methods declarations:                                     */
109
 
/*****************************************************************************/
110
 
static PyObject *Text_getName(BPy_Text *self);
111
 
static PyObject *Text_getFilename(BPy_Text *self);
112
 
static PyObject *Text_getNLines(BPy_Text *self);
113
 
static PyObject *Text_setName(BPy_Text *self, PyObject *args);
114
 
static PyObject *Text_clear(BPy_Text *self, PyObject *args);
115
 
static PyObject *Text_write(BPy_Text *self, PyObject *args);
116
 
static PyObject *Text_set(BPy_Text *self, PyObject *args);
117
 
static PyObject *Text_asLines(BPy_Text *self, PyObject *args);
118
 
 
119
 
/*****************************************************************************/
120
 
/* Python BPy_Text methods table:                                            */
121
 
/*****************************************************************************/
122
 
static PyMethodDef BPy_Text_methods[] = {
123
 
 /* name, method, flags, doc */
124
 
  {"getName", (PyCFunction)Text_getName, METH_NOARGS,
125
 
          "() - Return Text Object name"},
126
 
  {"getFilename", (PyCFunction)Text_getFilename, METH_VARARGS,
127
 
          "() - Return Text Object filename"},
128
 
  {"getNLines", (PyCFunction)Text_getNLines, METH_VARARGS,
129
 
          "() - Return number of lines in text buffer"},
130
 
  {"setName", (PyCFunction)Text_setName, METH_VARARGS,
131
 
          "(str) - Change Text Object name"},
132
 
  {"clear", (PyCFunction)Text_clear, METH_VARARGS,
133
 
          "() - Clear Text buffer"},
134
 
  {"write", (PyCFunction)Text_write, METH_VARARGS,
135
 
          "(line) - Append string 'str' to Text buffer"},
136
 
  {"set", (PyCFunction)Text_set, METH_VARARGS,
137
 
          "(name, val) - Set attribute 'name' to value 'val'"},
138
 
  {"asLines", (PyCFunction)Text_asLines, METH_VARARGS,
139
 
          "() - Return text buffer as a list of lines"},
140
 
  {0}
141
 
};
142
 
 
143
 
/*****************************************************************************/
144
 
/* Python Text_Type callback function prototypes:                            */
145
 
/*****************************************************************************/
146
 
static void Text_dealloc (BPy_Text *self);
147
 
static int Text_setAttr (BPy_Text *self, char *name, PyObject *v);
148
 
static PyObject *Text_getAttr (BPy_Text *self, char *name);
149
 
static int Text_compare (BPy_Text *a, BPy_Text *b);
150
 
static PyObject *Text_repr (BPy_Text *self);
151
 
 
152
 
/*****************************************************************************/
153
 
/* Python Text_Type structure definition:                                    */
154
 
/*****************************************************************************/
155
 
PyTypeObject Text_Type =
156
 
{
157
 
  PyObject_HEAD_INIT(NULL)
158
 
  0,                                    /* ob_size */
159
 
  "Blender Text",                       /* tp_name */
160
 
  sizeof (BPy_Text),                    /* tp_basicsize */
161
 
  0,                                    /* tp_itemsize */
162
 
  /* methods */
163
 
  (destructor)Text_dealloc,             /* tp_dealloc */
164
 
  0,                                    /* tp_print */
165
 
  (getattrfunc)Text_getAttr,            /* tp_getattr */
166
 
  (setattrfunc)Text_setAttr,            /* tp_setattr */
167
 
  (cmpfunc)Text_compare,                /* tp_compare */
168
 
  (reprfunc)Text_repr,                  /* tp_repr */
169
 
  0,                                    /* tp_as_number */
170
 
  0,                                    /* tp_as_sequence */
171
 
  0,                                    /* tp_as_mapping */
172
 
  0,                                    /* tp_as_hash */
173
 
  0,0,0,0,0,0,
174
 
  0,                                    /* tp_doc */ 
175
 
  0,0,0,0,0,0,
176
 
  BPy_Text_methods,                     /* tp_methods */
177
 
  0,                                    /* tp_members */
178
 
};
179
 
 
180
 
static int Text_IsLinked(BPy_Text *self);
181
 
 
182
 
#endif /* EXPP_TEXT_H */
 
38
PyObject *Text_Init( void );
 
39
PyObject *Text_CreatePyObject( Text * txt );
 
40
 
 
41
#endif                          /* EXPP_TEXT_H */