Mercurial > cpython-lru_cache-weakref
annotate Modules/stdwinmodule.c @ 4703:e0bb1dac2dbf legacy-trunk
Renamed, but *not* tested or compiled. I don't even have the STDWIN
library.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Thu, 12 Dec 1996 22:48:20 +0000 |
| parents | 65d2d8e67da3 |
| children | 2c29b8982643 |
| rev | line source |
|---|---|
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
1 /*********************************************************** |
|
2061
172ba04a5191
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
|
172ba04a5191
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
3 The Netherlands. |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
4 |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
5 All Rights Reserved |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
6 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
7 Permission to use, copy, modify, and distribute this software and its |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
8 documentation for any purpose and without fee is hereby granted, |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
9 provided that the above copyright notice appear in all copies and that |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
10 both that copyright notice and this permission notice appear in |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
11 supporting documentation, and that the names of Stichting Mathematisch |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
12 Centrum or CWI or Corporation for National Research Initiatives or |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
13 CNRI not be used in advertising or publicity pertaining to |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
14 distribution of the software without specific, written prior |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
15 permission. |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
16 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
17 While CWI is the initial source for this software, a modified version |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
18 is made available by the Corporation for National Research Initiatives |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
19 (CNRI) at the Internet address ftp://ftp.python.org. |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
20 |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
2975
diff
changeset
|
28 PERFORMANCE OF THIS SOFTWARE. |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
29 |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
30 ******************************************************************/ |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
142
diff
changeset
|
31 |
| 6 | 32 /* Stdwin module */ |
| 33 | |
| 34 /* Stdwin itself is a module, not a separate object type. | |
| 35 Object types defined here: | |
| 36 wp: a window | |
| 37 dp: a drawing structure (only one can exist at a time) | |
| 38 mp: a menu | |
| 39 tp: a textedit block | |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
40 bp: a bitmap |
| 6 | 41 */ |
| 42 | |
| 43 /* Rules for translating C stdwin function calls into Python stwin: | |
| 44 - All names drop their initial letter 'w' | |
| 45 - Functions with a window as first parameter are methods of window objects | |
| 46 - There is no equivalent for wclose(); just delete the window object | |
| 47 (all references to it!) (XXX maybe this is a bad idea) | |
| 48 - w.begindrawing() returns a drawing object | |
| 49 - There is no equivalent for wenddrawing(win); just delete the drawing | |
| 50 object (all references to it!) (XXX maybe this is a bad idea) | |
| 51 - Functions that may only be used inside wbegindrawing / wendddrawing | |
| 52 are methods of the drawing object; this includes the text measurement | |
| 53 functions (which however have doubles as module functions). | |
| 54 - Methods of the drawing object drop an initial 'draw' from their name | |
| 55 if they have it, e.g., wdrawline() --> d.line() | |
| 56 - The obvious type conversions: int --> intobject; string --> stringobject | |
| 57 - A text parameter followed by a length parameter is only a text (string) | |
| 58 parameter in Python | |
| 59 - A point or other pair of horizontal and vertical coordinates is always | |
| 60 a pair of integers in Python | |
| 61 - Two points forming a rectangle or endpoints of a line segment are a | |
| 62 pair of points in Python | |
| 63 - The arguments to d.elarc() are three points. | |
| 64 - The functions wgetclip() and wsetclip() are translated into | |
| 65 stdwin.getcutbuffer() and stdwin.setcutbuffer(); 'clip' is really | |
| 66 a bad word for what these functions do (clipping has a different | |
| 67 meaning in the drawing world), while cutbuffer is standard X jargon. | |
|
50
b94822f54991
Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
68 XXX This must change again in the light of changes to stdwin! |
| 6 | 69 - For textedit, similar rules hold, but they are less strict. |
| 70 XXX more? | |
| 71 */ | |
| 72 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
73 #include "Python.h" |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
74 |
|
2975
82356bddf712
Shuffled include's around (name conflict on Mac wrt teclick())
Jack Jansen <jack.jansen@cwi.nl>
parents:
2506
diff
changeset
|
75 #ifdef macintosh |
|
82356bddf712
Shuffled include's around (name conflict on Mac wrt teclick())
Jack Jansen <jack.jansen@cwi.nl>
parents:
2506
diff
changeset
|
76 #include "macglue.h" |
|
82356bddf712
Shuffled include's around (name conflict on Mac wrt teclick())
Jack Jansen <jack.jansen@cwi.nl>
parents:
2506
diff
changeset
|
77 #endif |
| 6 | 78 |
|
1191
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
79 #ifdef macintosh |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
80 #include ":::stdwin:H:stdwin.h" |
|
1191
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
81 #else /* !macintosh */ |
| 86 | 82 #include "stdwin.h" |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
83 #define HAVE_BITMAPS |
|
1191
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
84 #endif /* !macintosh */ |
| 6 | 85 |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
86 #ifdef WITH_THREAD |
| 926 | 87 |
| 88 #include "thread.h" | |
| 89 | |
| 90 static type_lock StdwinLock; /* Lock held when interpreter not locked */ | |
| 91 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
92 #define BGN_STDWIN Py_BEGIN_ALLOW_THREADS acquire_lock(StdwinLock, 1); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
93 #define RET_STDWIN release_lock(StdwinLock); Py_BLOCK_THREADS |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
94 #define END_STDWIN release_lock(StdwinLock); Py_END_ALLOW_THREADS |
| 926 | 95 |
| 96 #else | |
| 97 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
98 #define BGN_STDWIN Py_BEGIN_ALLOW_THREADS |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
99 #define RET_STDWIN Py_BLOCK_THREADS |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
100 #define END_STDWIN Py_END_ALLOW_THREADS |
| 926 | 101 |
| 102 #endif | |
| 103 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
104 #define getpointarg(v, a) PyArg_Parse(v, "(ii)", a, (a)+1) |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
105 #define get3pointarg(v, a) PyArg_Parse(v, "((ii)(ii)(ii))", \ |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
106 a, a+1, a+2, a+3, a+4, a+5) |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
107 #define getrectarg(v, a) PyArg_Parse(v, "((ii)(ii))", a, a+1, a+2, a+3) |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
108 #define getrectintarg(v, a) PyArg_Parse(v, "(((ii)(ii))i)", \ |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
109 a, a+1, a+2, a+3, a+4) |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
110 #define getpointintarg(v, a) PyArg_Parse(v, "((ii)i)", a, a+1, a+2) |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
111 #define getrectpointarg(v, a) PyArg_Parse(v, "(((ii)(ii))(ii))", \ |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
112 a, a+1, a+2, a+3, a+4, a+5) |
|
1313
6ee380349c84
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
113 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
114 static PyObject *StdwinError; /* Exception stdwin.error */ |
| 475 | 115 |
| 6 | 116 /* Window and menu object types declared here because of forward references */ |
| 117 | |
| 118 typedef struct { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
119 PyObject_HEAD |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
120 PyObject *w_title; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
121 WINDOW *w_win; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
122 PyObject *w_attr; /* Attributes dictionary */ |
| 6 | 123 } windowobject; |
| 124 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
125 staticforward PyTypeObject Windowtype; |
| 6 | 126 |
| 127 #define is_windowobject(wp) ((wp)->ob_type == &Windowtype) | |
| 128 | |
| 129 typedef struct { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
130 PyObject_HEAD |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
131 MENU *m_menu; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
132 int m_id; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
133 PyObject *m_attr; /* Attributes dictionary */ |
| 6 | 134 } menuobject; |
| 135 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
136 staticforward PyTypeObject Menutype; |
| 6 | 137 |
| 138 #define is_menuobject(mp) ((mp)->ob_type == &Menutype) | |
| 139 | |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
140 typedef struct { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
141 PyObject_HEAD |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
142 BITMAP *b_bitmap; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
143 PyObject *b_attr; /* Attributes dictionary */ |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
144 } bitmapobject; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
145 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
146 staticforward PyTypeObject Bitmaptype; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
147 |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
148 #define is_bitmapobject(mp) ((mp)->ob_type == &Bitmaptype) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
149 |
| 6 | 150 |
| 151 /* Strongly stdwin-specific argument handlers */ | |
| 152 | |
| 153 static int | |
| 154 getmenudetail(v, ep) | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
155 PyObject *v; |
| 6 | 156 EVENT *ep; |
| 157 { | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
158 menuobject *mp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
159 if (!PyArg_Parse(v, "(Oi)", &mp, &ep->u.m.item)) |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
160 return 0; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
161 if (!is_menuobject(mp)) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
162 return PyErr_BadArgument(); |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
163 ep->u.m.id = mp->m_id; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
164 return 1; |
| 6 | 165 } |
| 166 | |
| 167 static int | |
| 168 geteventarg(v, ep) | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
169 PyObject *v; |
| 6 | 170 EVENT *ep; |
| 171 { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
172 PyObject *wp, *detail; |
| 6 | 173 int a[4]; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
174 if (!PyArg_Parse(v, "(iOO)", &ep->type, &wp, &detail)) |
| 6 | 175 return 0; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
176 if (is_windowobject(wp)) |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
177 ep->window = ((windowobject *)wp) -> w_win; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
178 else if (wp == Py_None) |
| 6 | 179 ep->window = NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
180 else |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
181 return PyErr_BadArgument(); |
| 6 | 182 switch (ep->type) { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
183 case WE_CHAR: { |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
184 char c; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
185 if (!PyArg_Parse(detail, "c", &c)) |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
186 return 0; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
187 ep->u.character = c; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
188 return 1; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
189 } |
| 6 | 190 case WE_COMMAND: |
| 191 return getintarg(detail, &ep->u.command); | |
| 192 case WE_DRAW: | |
| 193 if (!getrectarg(detail, a)) | |
| 194 return 0; | |
| 195 ep->u.area.left = a[0]; | |
| 196 ep->u.area.top = a[1]; | |
| 197 ep->u.area.right = a[2]; | |
| 198 ep->u.area.bottom = a[3]; | |
| 199 return 1; | |
| 200 case WE_MOUSE_DOWN: | |
| 201 case WE_MOUSE_UP: | |
| 202 case WE_MOUSE_MOVE: | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
203 return PyArg_Parse(detail, "((ii)iii)", |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
204 &ep->u.where.h, &ep->u.where.v, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
205 &ep->u.where.clicks, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
206 &ep->u.where.button, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
207 &ep->u.where.mask); |
| 6 | 208 case WE_MENU: |
| 209 return getmenudetail(detail, ep); | |
|
907
32010d355fb6
added WE_KEY detail format to stdwinmodule.c.
Guido van Rossum <guido@python.org>
parents:
902
diff
changeset
|
210 case WE_KEY: |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
211 return PyArg_Parse(detail, "(ii)", |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
212 &ep->u.key.code, &ep->u.key.mask); |
| 6 | 213 default: |
| 214 return 1; | |
| 215 } | |
| 216 } | |
| 217 | |
| 218 | |
| 219 /* Return construction tools */ | |
| 220 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
221 static PyObject * |
| 6 | 222 makepoint(a, b) |
| 223 int a, b; | |
| 224 { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
225 return Py_BuildValue("(ii)", a, b); |
| 6 | 226 } |
| 227 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
228 static PyObject * |
| 6 | 229 makerect(a, b, c, d) |
| 230 int a, b, c, d; | |
| 231 { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
232 return Py_BuildValue("((ii)(ii))", a, b, c, d); |
| 6 | 233 } |
| 234 | |
| 235 | |
| 236 /* Drawing objects */ | |
| 237 | |
| 238 typedef struct { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
239 PyObject_HEAD |
| 6 | 240 windowobject *d_ref; |
| 241 } drawingobject; | |
| 242 | |
| 243 static drawingobject *Drawing; /* Set to current drawing object, or NULL */ | |
| 244 | |
| 245 /* Drawing methods */ | |
| 246 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
247 static PyObject * |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
248 drawing_close(dp) |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
249 drawingobject *dp; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
250 { |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
251 if (dp->d_ref != NULL) { |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
252 wenddrawing(dp->d_ref->w_win); |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
253 Drawing = NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
254 Py_DECREF(dp->d_ref); |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
255 dp->d_ref = NULL; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
256 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
257 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
258 return Py_None; |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
259 } |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
260 |
| 6 | 261 static void |
| 262 drawing_dealloc(dp) | |
| 263 drawingobject *dp; | |
| 264 { | |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
265 if (dp->d_ref != NULL) { |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
266 wenddrawing(dp->d_ref->w_win); |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
267 Drawing = NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
268 Py_DECREF(dp->d_ref); |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
269 dp->d_ref = NULL; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
270 } |
| 6 | 271 free((char *)dp); |
| 272 } | |
| 273 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
274 static PyObject * |
| 6 | 275 drawing_generic(dp, args, func) |
| 276 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
277 PyObject *args; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
278 void (*func) Py_FPROTO((int, int, int, int)); |
| 6 | 279 { |
| 280 int a[4]; | |
| 281 if (!getrectarg(args, a)) | |
| 282 return NULL; | |
| 283 (*func)(a[0], a[1], a[2], a[3]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
284 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
285 return Py_None; |
| 6 | 286 } |
| 287 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
288 static PyObject * |
| 6 | 289 drawing_line(dp, args) |
| 290 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
291 PyObject *args; |
| 6 | 292 { |
|
157
47cc0ce7999c
Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
293 return drawing_generic(dp, args, wdrawline); |
| 6 | 294 } |
| 295 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
296 static PyObject * |
| 6 | 297 drawing_xorline(dp, args) |
| 298 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
299 PyObject *args; |
| 6 | 300 { |
|
157
47cc0ce7999c
Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
301 return drawing_generic(dp, args, wxorline); |
| 6 | 302 } |
| 303 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
304 static PyObject * |
| 6 | 305 drawing_circle(dp, args) |
| 306 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
307 PyObject *args; |
| 6 | 308 { |
| 309 int a[3]; | |
| 310 if (!getpointintarg(args, a)) | |
| 311 return NULL; | |
| 312 wdrawcircle(a[0], a[1], a[2]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
313 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
314 return Py_None; |
| 6 | 315 } |
| 244 | 316 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
317 static PyObject * |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
318 drawing_fillcircle(dp, args) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
319 drawingobject *dp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
320 PyObject *args; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
321 { |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
322 int a[3]; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
323 if (!getpointintarg(args, a)) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
324 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
325 wfillcircle(a[0], a[1], a[2]); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
326 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
327 return Py_None; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
328 } |
| 6 | 329 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
330 static PyObject * |
| 244 | 331 drawing_xorcircle(dp, args) |
| 332 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
333 PyObject *args; |
| 244 | 334 { |
| 335 int a[3]; | |
| 336 if (!getpointintarg(args, a)) | |
| 337 return NULL; | |
| 338 wxorcircle(a[0], a[1], a[2]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
339 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
340 return Py_None; |
| 244 | 341 } |
| 342 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
343 static PyObject * |
| 6 | 344 drawing_elarc(dp, args) |
| 345 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
346 PyObject *args; |
| 6 | 347 { |
| 348 int a[6]; | |
| 349 if (!get3pointarg(args, a)) | |
| 350 return NULL; | |
| 351 wdrawelarc(a[0], a[1], a[2], a[3], a[4], a[5]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
352 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
353 return Py_None; |
| 6 | 354 } |
| 355 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
356 static PyObject * |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
357 drawing_fillelarc(dp, args) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
358 drawingobject *dp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
359 PyObject *args; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
360 { |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
361 int a[6]; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
362 if (!get3pointarg(args, a)) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
363 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
364 wfillelarc(a[0], a[1], a[2], a[3], a[4], a[5]); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
365 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
366 return Py_None; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
367 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
368 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
369 static PyObject * |
| 244 | 370 drawing_xorelarc(dp, args) |
| 371 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
372 PyObject *args; |
| 244 | 373 { |
| 374 int a[6]; | |
| 375 if (!get3pointarg(args, a)) | |
| 376 return NULL; | |
| 377 wxorelarc(a[0], a[1], a[2], a[3], a[4], a[5]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
378 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
379 return Py_None; |
| 244 | 380 } |
| 381 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
382 static PyObject * |
| 6 | 383 drawing_box(dp, args) |
| 384 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
385 PyObject *args; |
| 6 | 386 { |
|
157
47cc0ce7999c
Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
387 return drawing_generic(dp, args, wdrawbox); |
| 6 | 388 } |
| 389 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
390 static PyObject * |
| 6 | 391 drawing_erase(dp, args) |
| 392 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
393 PyObject *args; |
| 6 | 394 { |
|
157
47cc0ce7999c
Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
395 return drawing_generic(dp, args, werase); |
| 6 | 396 } |
| 397 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
398 static PyObject * |
| 6 | 399 drawing_paint(dp, args) |
| 400 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
401 PyObject *args; |
| 6 | 402 { |
|
157
47cc0ce7999c
Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
403 return drawing_generic(dp, args, wpaint); |
| 6 | 404 } |
| 405 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
406 static PyObject * |
| 6 | 407 drawing_invert(dp, args) |
| 408 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
409 PyObject *args; |
| 6 | 410 { |
|
157
47cc0ce7999c
Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
411 return drawing_generic(dp, args, winvert); |
| 6 | 412 } |
| 413 | |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
414 static POINT * |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
415 getpointsarray(v, psize) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
416 PyObject *v; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
417 int *psize; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
418 { |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
419 int n = -1; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
420 PyObject * (*getitem) Py_PROTO((PyObject *, int)); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
421 int i; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
422 POINT *points; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
423 |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
424 if (v == NULL) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
425 ; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
426 else if (PyList_Check(v)) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
427 n = PyList_Size(v); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
428 getitem = PyList_GetItem; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
429 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
430 else if (PyTuple_Check(v)) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
431 n = PyTuple_Size(v); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
432 getitem = PyTuple_GetItem; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
433 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
434 |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
435 if (n <= 0) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
436 (void) PyErr_BadArgument(); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
437 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
438 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
439 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
440 points = PyMem_NEW(POINT, n); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
441 if (points == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
442 (void) PyErr_NoMemory(); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
443 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
444 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
445 |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
446 for (i = 0; i < n; i++) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
447 PyObject *w = (*getitem)(v, i); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
448 int a[2]; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
449 if (!getpointarg(w, a)) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
450 PyMem_DEL(points); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
451 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
452 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
453 points[i].h = a[0]; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
454 points[i].v = a[1]; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
455 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
456 |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
457 *psize = n; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
458 return points; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
459 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
460 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
461 static PyObject * |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
462 drawing_poly(dp, args) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
463 drawingobject *dp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
464 PyObject *args; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
465 { |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
466 int n; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
467 POINT *points = getpointsarray(args, &n); |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
468 if (points == NULL) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
469 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
470 wdrawpoly(n, points); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
471 PyMem_DEL(points); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
472 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
473 return Py_None; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
474 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
475 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
476 static PyObject * |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
477 drawing_fillpoly(dp, args) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
478 drawingobject *dp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
479 PyObject *args; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
480 { |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
481 int n; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
482 POINT *points = getpointsarray(args, &n); |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
483 if (points == NULL) |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
484 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
485 wfillpoly(n, points); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
486 PyMem_DEL(points); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
487 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
488 return Py_None; |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
489 } |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
490 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
491 static PyObject * |
| 244 | 492 drawing_xorpoly(dp, args) |
| 493 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
494 PyObject *args; |
| 244 | 495 { |
| 496 int n; | |
| 497 POINT *points = getpointsarray(args, &n); | |
| 498 if (points == NULL) | |
| 499 return NULL; | |
| 500 wxorpoly(n, points); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
501 PyMem_DEL(points); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
502 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
503 return Py_None; |
| 244 | 504 } |
| 505 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
506 static PyObject * |
| 6 | 507 drawing_cliprect(dp, args) |
| 508 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
509 PyObject *args; |
| 6 | 510 { |
|
157
47cc0ce7999c
Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
511 return drawing_generic(dp, args, wcliprect); |
| 6 | 512 } |
| 513 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
514 static PyObject * |
| 6 | 515 drawing_noclip(dp, args) |
| 516 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
517 PyObject *args; |
| 6 | 518 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
519 if (!PyArg_NoArgs(args)) |
| 6 | 520 return NULL; |
| 521 wnoclip(); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
522 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
523 return Py_None; |
| 6 | 524 } |
| 525 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
526 static PyObject * |
| 6 | 527 drawing_shade(dp, args) |
| 528 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
529 PyObject *args; |
| 6 | 530 { |
| 531 int a[5]; | |
| 532 if (!getrectintarg(args, a)) | |
| 533 return NULL; | |
| 534 wshade(a[0], a[1], a[2], a[3], a[4]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
535 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
536 return Py_None; |
| 6 | 537 } |
| 538 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
539 static PyObject * |
| 6 | 540 drawing_text(dp, args) |
| 541 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
542 PyObject *args; |
| 6 | 543 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
544 int h, v, size; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
545 char *text; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
546 if (!PyArg_Parse(args, "((ii)s#)", &h, &v, &text, &size)) |
| 6 | 547 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
548 wdrawtext(h, v, text, size); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
549 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
550 return Py_None; |
| 6 | 551 } |
| 552 | |
| 553 /* The following four are also used as stdwin functions */ | |
| 554 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
555 static PyObject * |
| 6 | 556 drawing_lineheight(dp, args) |
| 557 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
558 PyObject *args; |
| 6 | 559 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
560 if (!PyArg_NoArgs(args)) |
| 6 | 561 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
562 return PyInt_FromLong((long)wlineheight()); |
| 6 | 563 } |
| 564 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
565 static PyObject * |
| 6 | 566 drawing_baseline(dp, args) |
| 567 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
568 PyObject *args; |
| 6 | 569 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
570 if (!PyArg_NoArgs(args)) |
| 6 | 571 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
572 return PyInt_FromLong((long)wbaseline()); |
| 6 | 573 } |
| 574 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
575 static PyObject * |
| 6 | 576 drawing_textwidth(dp, args) |
| 577 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
578 PyObject *args; |
| 6 | 579 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
580 char *text; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
581 int size; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
582 if (!PyArg_Parse(args, "s#", &text, &size)) |
| 6 | 583 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
584 return PyInt_FromLong((long)wtextwidth(text, size)); |
| 6 | 585 } |
| 586 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
587 static PyObject * |
| 6 | 588 drawing_textbreak(dp, args) |
| 589 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
590 PyObject *args; |
| 6 | 591 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
592 char *text; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
593 int size, width; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
594 if (!PyArg_Parse(args, "(s#i)", &text, &size, &width)) |
| 6 | 595 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
596 return PyInt_FromLong((long)wtextbreak(text, size, width)); |
| 6 | 597 } |
| 598 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
599 static PyObject * |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
600 drawing_setfont(self, args) |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
601 drawingobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
602 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
603 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
604 char *font; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
605 char style = '\0'; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
606 int size = 0; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
607 if (args == NULL || !PyTuple_Check(args)) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
608 if (!PyArg_Parse(args, "z", &font)) |
|
184
1b08df41587b
More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents:
171
diff
changeset
|
609 return NULL; |
|
1b08df41587b
More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents:
171
diff
changeset
|
610 } |
|
1b08df41587b
More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents:
171
diff
changeset
|
611 else { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
612 int n = PyTuple_Size(args); |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
613 if (n == 2) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
614 if (!PyArg_Parse(args, "(zi)", &font, &size)) |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
615 return NULL; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
616 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
617 else if (!PyArg_Parse(args, "(zic)", &font, &size, &style)) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
618 PyErr_Clear(); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
619 if (!PyArg_Parse(args, "(zci)", &font, &style, &size)) |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
620 return NULL; |
|
184
1b08df41587b
More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents:
171
diff
changeset
|
621 } |
|
1b08df41587b
More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents:
171
diff
changeset
|
622 } |
|
1191
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
623 if (font != NULL) { |
|
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
624 if (!wsetfont(font)) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
625 PyErr_SetString(StdwinError, "font not found"); |
|
1191
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
626 return NULL; |
|
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
627 } |
|
38f0054f44a7
Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
628 } |
|
184
1b08df41587b
More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents:
171
diff
changeset
|
629 if (size != 0) |
|
1b08df41587b
More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents:
171
diff
changeset
|
630 wsetsize(size); |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
631 switch (style) { |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
632 case 'b': |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
633 wsetbold(); |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
634 break; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
635 case 'i': |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
636 wsetitalic(); |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
637 break; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
638 case 'o': |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
639 wsetbolditalic(); |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
640 break; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
641 case 'u': |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
642 wsetunderline(); |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
643 break; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
644 case 'p': |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
645 wsetplain(); |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
646 break; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
647 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
648 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
649 return Py_None; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
650 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
651 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
652 static PyObject * |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
653 drawing_getbgcolor(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
654 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
655 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
656 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
657 if (!PyArg_NoArgs(args)) |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
658 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
659 return PyInt_FromLong((long)wgetbgcolor()); |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
660 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
661 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
662 static PyObject * |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
663 drawing_getfgcolor(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
664 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
665 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
666 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
667 if (!PyArg_NoArgs(args)) |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
668 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
669 return PyInt_FromLong((long)wgetfgcolor()); |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
670 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
671 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
672 static PyObject * |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
673 drawing_setbgcolor(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
674 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
675 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
676 { |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
677 long color; |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
678 if (!getlongarg(args, &color)) |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
679 return NULL; |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
680 wsetbgcolor((COLOR)color); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
681 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
682 return Py_None; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
683 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
684 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
685 static PyObject * |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
686 drawing_setfgcolor(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
687 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
688 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
689 { |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
690 long color; |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
691 if (!getlongarg(args, &color)) |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
692 return NULL; |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
693 wsetfgcolor((COLOR)color); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
694 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
695 return Py_None; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
696 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
697 |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
698 #ifdef HAVE_BITMAPS |
|
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
699 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
700 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
701 drawing_bitmap(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
702 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
703 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
704 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
705 int h, v; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
706 PyObject *bp; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
707 PyObject *mask = NULL; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
708 if (!PyArg_Parse(args, "((ii)O)", &h, &v, &bp)) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
709 PyErr_Clear(); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
710 if (!PyArg_Parse(args, "((ii)OO)", &h, &v, &bp, &mask)) |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
711 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
712 if (mask == Py_None) |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
713 mask = NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
714 else if (!is_bitmapobject(mask)) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
715 PyErr_BadArgument(); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
716 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
717 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
718 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
719 if (!is_bitmapobject(bp)) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
720 PyErr_BadArgument(); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
721 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
722 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
723 if (((bitmapobject *)bp)->b_bitmap == NULL || |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
724 mask != NULL && ((bitmapobject *)mask)->b_bitmap == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
725 PyErr_SetString(StdwinError, "bitmap object already close"); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
726 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
727 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
728 if (mask == NULL) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
729 wdrawbitmap(h, v, ((bitmapobject *)bp)->b_bitmap, ALLBITS); |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
730 else |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
731 wdrawbitmap(h, v, |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
732 ((bitmapobject *)bp)->b_bitmap, |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
733 ((bitmapobject *)bp)->b_bitmap); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
734 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
735 return Py_None; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
736 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
737 |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
738 #endif /* HAVE_BITMAPS */ |
|
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
739 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
740 static PyMethodDef drawing_methods[] = { |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
741 #ifdef HAVE_BITMAPS |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
742 {"bitmap", (PyCFunction)drawing_bitmap}, |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
743 #endif |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
744 {"box", (PyCFunction)drawing_box}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
745 {"circle", (PyCFunction)drawing_circle}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
746 {"cliprect", (PyCFunction)drawing_cliprect}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
747 {"close", (PyCFunction)drawing_close}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
748 {"elarc", (PyCFunction)drawing_elarc}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
749 {"enddrawing", (PyCFunction)drawing_close}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
750 {"erase", (PyCFunction)drawing_erase}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
751 {"fillcircle", (PyCFunction)drawing_fillcircle}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
752 {"fillelarc", (PyCFunction)drawing_fillelarc}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
753 {"fillpoly", (PyCFunction)drawing_fillpoly}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
754 {"invert", (PyCFunction)drawing_invert}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
755 {"line", (PyCFunction)drawing_line}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
756 {"noclip", (PyCFunction)drawing_noclip}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
757 {"paint", (PyCFunction)drawing_paint}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
758 {"poly", (PyCFunction)drawing_poly}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
759 {"shade", (PyCFunction)drawing_shade}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
760 {"text", (PyCFunction)drawing_text}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
761 {"xorcircle", (PyCFunction)drawing_xorcircle}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
762 {"xorelarc", (PyCFunction)drawing_xorelarc}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
763 {"xorline", (PyCFunction)drawing_xorline}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
764 {"xorpoly", (PyCFunction)drawing_xorpoly}, |
| 6 | 765 |
| 766 /* Text measuring methods: */ | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
767 {"baseline", (PyCFunction)drawing_baseline}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
768 {"lineheight", (PyCFunction)drawing_lineheight}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
769 {"textbreak", (PyCFunction)drawing_textbreak}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
770 {"textwidth", (PyCFunction)drawing_textwidth}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
771 |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
772 /* Font setting methods: */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
773 {"setfont", (PyCFunction)drawing_setfont}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
774 |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
775 /* Color methods: */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
776 {"getbgcolor", (PyCFunction)drawing_getbgcolor}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
777 {"getfgcolor", (PyCFunction)drawing_getfgcolor}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
778 {"setbgcolor", (PyCFunction)drawing_setbgcolor}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
779 {"setfgcolor", (PyCFunction)drawing_setfgcolor}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
780 |
| 6 | 781 {NULL, NULL} /* sentinel */ |
| 782 }; | |
| 783 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
784 static PyObject * |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
785 drawing_getattr(dp, name) |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
786 drawingobject *dp; |
| 6 | 787 char *name; |
| 788 { | |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
789 if (dp->d_ref == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
790 PyErr_SetString(StdwinError, "drawing object already closed"); |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
791 return NULL; |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
792 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
793 return Py_FindMethod(drawing_methods, (PyObject *)dp, name); |
| 6 | 794 } |
| 795 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
796 PyTypeObject Drawingtype = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
797 PyObject_HEAD_INIT(&PyType_Type) |
| 6 | 798 0, /*ob_size*/ |
| 799 "drawing", /*tp_name*/ | |
| 800 sizeof(drawingobject), /*tp_size*/ | |
| 801 0, /*tp_itemsize*/ | |
| 802 /* methods */ | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
803 (destructor)drawing_dealloc, /*tp_dealloc*/ |
| 6 | 804 0, /*tp_print*/ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
805 (getattrfunc)drawing_getattr, /*tp_getattr*/ |
| 6 | 806 0, /*tp_setattr*/ |
| 807 0, /*tp_compare*/ | |
| 808 0, /*tp_repr*/ | |
| 809 }; | |
| 810 | |
| 811 | |
| 812 /* Text(edit) objects */ | |
| 813 | |
| 814 typedef struct { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
815 PyObject_HEAD |
| 6 | 816 TEXTEDIT *t_text; |
| 817 windowobject *t_ref; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
818 PyObject *t_attr; /* Attributes dictionary */ |
| 6 | 819 } textobject; |
| 820 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
821 staticforward PyTypeObject Texttype; |
| 6 | 822 |
| 823 static textobject * | |
| 824 newtextobject(wp, left, top, right, bottom) | |
| 825 windowobject *wp; | |
| 826 int left, top, right, bottom; | |
| 827 { | |
| 828 textobject *tp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
829 tp = PyObject_NEW(textobject, &Texttype); |
| 6 | 830 if (tp == NULL) |
| 831 return NULL; | |
| 832 tp->t_attr = NULL; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
833 Py_INCREF(wp); |
| 6 | 834 tp->t_ref = wp; |
| 835 tp->t_text = tecreate(wp->w_win, left, top, right, bottom); | |
| 836 if (tp->t_text == NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
837 Py_DECREF(tp); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
838 return (textobject *) PyErr_NoMemory(); |
| 6 | 839 } |
| 840 return tp; | |
| 841 } | |
| 842 | |
| 843 /* Text(edit) methods */ | |
| 844 | |
| 845 static void | |
| 846 text_dealloc(tp) | |
| 847 textobject *tp; | |
| 848 { | |
| 849 if (tp->t_text != NULL) | |
| 850 tefree(tp->t_text); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
851 Py_XDECREF(tp->t_attr); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
852 Py_XDECREF(tp->t_ref); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
853 PyMem_DEL(tp); |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
854 } |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
855 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
856 static PyObject * |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
857 text_close(tp, args) |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
858 textobject *tp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
859 PyObject *args; |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
860 { |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
861 if (tp->t_text != NULL) { |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
862 tefree(tp->t_text); |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
863 tp->t_text = NULL; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
864 } |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
865 if (tp->t_attr != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
866 Py_DECREF(tp->t_attr); |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
867 tp->t_attr = NULL; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
868 } |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
869 if (tp->t_ref != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
870 Py_DECREF(tp->t_ref); |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
871 tp->t_ref = NULL; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
872 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
873 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
874 return Py_None; |
| 6 | 875 } |
| 876 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
877 static PyObject * |
| 6 | 878 text_arrow(self, args) |
| 879 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
880 PyObject *args; |
| 6 | 881 { |
| 882 int code; | |
| 883 if (!getintarg(args, &code)) | |
| 884 return NULL; | |
| 885 tearrow(self->t_text, code); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
886 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
887 return Py_None; |
| 6 | 888 } |
| 889 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
890 static PyObject * |
| 6 | 891 text_draw(self, args) |
| 892 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
893 PyObject *args; |
| 6 | 894 { |
| 895 register TEXTEDIT *tp = self->t_text; | |
| 896 int a[4]; | |
| 897 int left, top, right, bottom; | |
| 898 if (!getrectarg(args, a)) | |
| 899 return NULL; | |
| 900 if (Drawing != NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
901 PyErr_SetString(StdwinError, "already drawing"); |
| 6 | 902 return NULL; |
| 903 } | |
| 904 /* Clip to text area and ignore if area is empty */ | |
| 905 left = tegetleft(tp); | |
| 906 top = tegettop(tp); | |
| 907 right = tegetright(tp); | |
| 908 bottom = tegetbottom(tp); | |
| 909 if (a[0] < left) a[0] = left; | |
| 910 if (a[1] < top) a[1] = top; | |
| 911 if (a[2] > right) a[2] = right; | |
| 912 if (a[3] > bottom) a[3] = bottom; | |
| 913 if (a[0] < a[2] && a[1] < a[3]) { | |
| 914 wbegindrawing(self->t_ref->w_win); | |
| 915 tedrawnew(tp, a[0], a[1], a[2], a[3]); | |
| 916 wenddrawing(self->t_ref->w_win); | |
| 917 } | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
918 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
919 return Py_None; |
| 6 | 920 } |
| 921 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
922 static PyObject * |
| 6 | 923 text_event(self, args) |
| 924 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
925 PyObject *args; |
| 6 | 926 { |
| 927 register TEXTEDIT *tp = self->t_text; | |
| 928 EVENT e; | |
| 929 if (!geteventarg(args, &e)) | |
| 930 return NULL; | |
| 931 if (e.type == WE_MOUSE_DOWN) { | |
|
137
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
932 /* Cheat at the margins */ |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
933 int width, height; |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
934 wgetdocsize(e.window, &width, &height); |
| 6 | 935 if (e.u.where.h < 0 && tegetleft(tp) == 0) |
| 936 e.u.where.h = 0; | |
|
137
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
937 else if (e.u.where.h > width && tegetright(tp) == width) |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
938 e.u.where.h = width; |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
939 if (e.u.where.v < 0 && tegettop(tp) == 0) |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
940 e.u.where.v = 0; |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
941 else if (e.u.where.v > height && tegetright(tp) == height) |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
942 e.u.where.v = height; |
| 6 | 943 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
944 return PyInt_FromLong((long) teevent(tp, &e)); |
| 6 | 945 } |
| 946 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
947 static PyObject * |
| 6 | 948 text_getfocus(self, args) |
| 949 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
950 PyObject *args; |
| 6 | 951 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
952 if (!PyArg_NoArgs(args)) |
| 6 | 953 return NULL; |
| 954 return makepoint(tegetfoc1(self->t_text), tegetfoc2(self->t_text)); | |
| 955 } | |
| 956 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
957 static PyObject * |
| 6 | 958 text_getfocustext(self, args) |
| 959 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
960 PyObject *args; |
| 6 | 961 { |
| 962 int f1, f2; | |
| 963 char *text; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
964 if (!PyArg_NoArgs(args)) |
| 6 | 965 return NULL; |
| 966 f1 = tegetfoc1(self->t_text); | |
| 967 f2 = tegetfoc2(self->t_text); | |
| 968 text = tegettext(self->t_text); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
969 return PyString_FromStringAndSize(text + f1, f2-f1); |
| 6 | 970 } |
| 971 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
972 static PyObject * |
| 6 | 973 text_getrect(self, args) |
| 974 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
975 PyObject *args; |
| 6 | 976 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
977 if (!PyArg_NoArgs(args)) |
| 6 | 978 return NULL; |
| 979 return makerect(tegetleft(self->t_text), | |
| 980 tegettop(self->t_text), | |
| 981 tegetright(self->t_text), | |
| 982 tegetbottom(self->t_text)); | |
| 983 } | |
| 984 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
985 static PyObject * |
| 6 | 986 text_gettext(self, args) |
| 987 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
988 PyObject *args; |
| 6 | 989 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
990 if (!PyArg_NoArgs(args)) |
| 6 | 991 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
992 return PyString_FromStringAndSize(tegettext(self->t_text), |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
993 tegetlen(self->t_text)); |
| 6 | 994 } |
| 995 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
996 static PyObject * |
| 6 | 997 text_move(self, args) |
| 998 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
999 PyObject *args; |
| 6 | 1000 { |
| 1001 int a[4]; | |
| 1002 if (!getrectarg(args, a)) | |
| 1003 return NULL; | |
| 1004 temovenew(self->t_text, a[0], a[1], a[2], a[3]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1005 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1006 return Py_None; |
| 6 | 1007 } |
| 1008 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1009 static PyObject * |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1010 text_replace(self, args) |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1011 textobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1012 PyObject *args; |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1013 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1014 char *text; |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1015 if (!getstrarg(args, &text)) |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1016 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1017 tereplace(self->t_text, text); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1018 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1019 return Py_None; |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1020 } |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1021 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1022 static PyObject * |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1023 text_setactive(self, args) |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1024 textobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1025 PyObject *args; |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1026 { |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1027 int flag; |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1028 if (!getintarg(args, &flag)) |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1029 return NULL; |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1030 tesetactive(self->t_text, flag); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1031 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1032 return Py_None; |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1033 } |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1034 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1035 static PyObject * |
| 6 | 1036 text_setfocus(self, args) |
| 1037 textobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1038 PyObject *args; |
| 6 | 1039 { |
| 1040 int a[2]; | |
| 1041 if (!getpointarg(args, a)) | |
| 1042 return NULL; | |
| 1043 tesetfocus(self->t_text, a[0], a[1]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1044 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1045 return Py_None; |
| 6 | 1046 } |
| 1047 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1048 static PyObject * |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1049 text_settext(self, args) |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1050 textobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1051 PyObject *args; |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1052 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1053 char *text; |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1054 char *buf; |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1055 int size; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1056 if (!PyArg_Parse(args, "s#", &text, &size)) |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1057 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1058 if ((buf = PyMem_NEW(char, size)) == NULL) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1059 return PyErr_NoMemory(); |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1060 } |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1061 memcpy(buf, text, size); |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1062 tesetbuf(self->t_text, buf, size); /* Becomes owner of buffer */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1063 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1064 return Py_None; |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1065 } |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1066 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1067 static PyObject * |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1068 text_setview(self, args) |
| 6 | 1069 textobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1070 PyObject *args; |
| 6 | 1071 { |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1072 int a[4]; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1073 if (args == Py_None) |
|
248
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1074 tenoview(self->t_text); |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1075 else { |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1076 if (!getrectarg(args, a)) |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1077 return NULL; |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1078 tesetview(self->t_text, a[0], a[1], a[2], a[3]); |
|
9eb13c67ae6f
Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents:
244
diff
changeset
|
1079 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1080 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1081 return Py_None; |
| 6 | 1082 } |
| 1083 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1084 static PyMethodDef text_methods[] = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1085 {"arrow", (PyCFunction)text_arrow}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1086 {"close", (PyCFunction)text_close}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1087 {"draw", (PyCFunction)text_draw}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1088 {"event", (PyCFunction)text_event}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1089 {"getfocus", (PyCFunction)text_getfocus}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1090 {"getfocustext",(PyCFunction)text_getfocustext}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1091 {"getrect", (PyCFunction)text_getrect}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1092 {"gettext", (PyCFunction)text_gettext}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1093 {"move", (PyCFunction)text_move}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1094 {"replace", (PyCFunction)text_replace}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1095 {"setactive", (PyCFunction)text_setactive}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1096 {"setfocus", (PyCFunction)text_setfocus}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1097 {"settext", (PyCFunction)text_settext}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1098 {"setview", (PyCFunction)text_setview}, |
| 6 | 1099 {NULL, NULL} /* sentinel */ |
| 1100 }; | |
| 1101 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1102 static PyObject * |
| 6 | 1103 text_getattr(tp, name) |
| 1104 textobject *tp; | |
| 1105 char *name; | |
| 1106 { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1107 PyObject *v = NULL; |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1108 if (tp->t_ref == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1109 PyErr_SetString(StdwinError, "text object already closed"); |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1110 return NULL; |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1111 } |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1112 if (strcmp(name, "__dict__") == 0) { |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1113 v = tp->t_attr; |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1114 if (v == NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1115 v = Py_None; |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1116 } |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1117 else if (tp->t_attr != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1118 v = PyDict_GetItemString(tp->t_attr, name); |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1119 } |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1120 if (v != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1121 Py_INCREF(v); |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1122 return v; |
| 6 | 1123 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1124 return Py_FindMethod(text_methods, (PyObject *)tp, name); |
| 6 | 1125 } |
| 1126 | |
| 1127 static int | |
| 1128 text_setattr(tp, name, v) | |
| 1129 textobject *tp; | |
| 1130 char *name; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1131 PyObject *v; |
| 6 | 1132 { |
| 1133 if (tp->t_attr == NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1134 tp->t_attr = PyDict_New(); |
| 6 | 1135 if (tp->t_attr == NULL) |
| 1136 return -1; | |
| 1137 } | |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1138 if (v == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1139 int rv = PyDict_DelItemString(tp->t_attr, name); |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1140 if (rv < 0) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1141 PyErr_SetString(PyExc_AttributeError, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1142 "delete non-existing text object attribute"); |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1143 return rv; |
|
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1144 } |
| 6 | 1145 else |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1146 return PyDict_SetItemString(tp->t_attr, name, v); |
| 6 | 1147 } |
| 1148 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1149 statichere PyTypeObject Texttype = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1150 PyObject_HEAD_INIT(&PyType_Type) |
| 6 | 1151 0, /*ob_size*/ |
| 1152 "textedit", /*tp_name*/ | |
| 1153 sizeof(textobject), /*tp_size*/ | |
| 1154 0, /*tp_itemsize*/ | |
| 1155 /* methods */ | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1156 (destructor)text_dealloc, /*tp_dealloc*/ |
| 6 | 1157 0, /*tp_print*/ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1158 (getattrfunc)text_getattr, /*tp_getattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1159 (setattrfunc)text_setattr, /*tp_setattr*/ |
| 6 | 1160 0, /*tp_compare*/ |
| 1161 0, /*tp_repr*/ | |
| 1162 }; | |
| 1163 | |
| 1164 | |
| 1165 /* Menu objects */ | |
| 1166 | |
|
142
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
1167 #define IDOFFSET 10 /* Menu IDs we use start here */ |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
1168 #define MAXNMENU 200 /* Max #menus we allow */ |
|
142
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
1169 static menuobject *menulist[MAXNMENU]; |
| 6 | 1170 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1171 static menuobject *newmenuobject Py_PROTO((char *)); |
| 6 | 1172 static menuobject * |
| 1173 newmenuobject(title) | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1174 char *title; |
| 6 | 1175 { |
| 1176 int id; | |
| 1177 MENU *menu; | |
| 1178 menuobject *mp; | |
|
142
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
1179 for (id = 0; id < MAXNMENU; id++) { |
| 6 | 1180 if (menulist[id] == NULL) |
| 1181 break; | |
| 1182 } | |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
1183 if (id >= MAXNMENU) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1184 PyErr_SetString(StdwinError, "creating too many menus"); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
1185 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
1186 } |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1187 menu = wmenucreate(id + IDOFFSET, title); |
| 6 | 1188 if (menu == NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1189 return (menuobject *) PyErr_NoMemory(); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1190 mp = PyObject_NEW(menuobject, &Menutype); |
| 6 | 1191 if (mp != NULL) { |
| 1192 mp->m_menu = menu; | |
|
142
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
1193 mp->m_id = id + IDOFFSET; |
| 6 | 1194 mp->m_attr = NULL; |
| 1195 menulist[id] = mp; | |
| 1196 } | |
| 1197 else | |
| 1198 wmenudelete(menu); | |
| 1199 return mp; | |
| 1200 } | |
| 1201 | |
| 1202 /* Menu methods */ | |
| 1203 | |
| 1204 static void | |
| 1205 menu_dealloc(mp) | |
| 1206 menuobject *mp; | |
| 1207 { | |
| 1208 | |
|
142
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
1209 int id = mp->m_id - IDOFFSET; |
|
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
1210 if (id >= 0 && id < MAXNMENU && menulist[id] == mp) { |
| 6 | 1211 menulist[id] = NULL; |
| 1212 } | |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1213 if (mp->m_menu != NULL) |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1214 wmenudelete(mp->m_menu); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1215 Py_XDECREF(mp->m_attr); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1216 PyMem_DEL(mp); |
| 6 | 1217 } |
| 1218 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1219 static PyObject * |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1220 menu_close(mp, args) |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1221 menuobject *mp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1222 PyObject *args; |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1223 { |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1224 int id = mp->m_id - IDOFFSET; |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1225 if (id >= 0 && id < MAXNMENU && menulist[id] == mp) { |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1226 menulist[id] = NULL; |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1227 } |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1228 mp->m_id = -1; |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1229 if (mp->m_menu != NULL) |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1230 wmenudelete(mp->m_menu); |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1231 mp->m_menu = NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1232 Py_XDECREF(mp->m_attr); |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1233 mp->m_attr = NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1234 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1235 return Py_None; |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1236 } |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1237 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1238 static PyObject * |
| 6 | 1239 menu_additem(self, args) |
| 1240 menuobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1241 PyObject *args; |
| 6 | 1242 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1243 char *text; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1244 int shortcut = -1; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1245 if (PyTuple_Check(args)) { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1246 char c; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1247 if (!PyArg_Parse(args, "(sc)", &text, &c)) |
| 6 | 1248 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1249 shortcut = c; |
| 6 | 1250 } |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1251 else if (!getstrarg(args, &text)) |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1252 return NULL; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1253 wmenuadditem(self->m_menu, text, shortcut); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1254 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1255 return Py_None; |
| 6 | 1256 } |
| 1257 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1258 static PyObject * |
| 6 | 1259 menu_setitem(self, args) |
| 1260 menuobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1261 PyObject *args; |
| 6 | 1262 { |
| 1263 int index; | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1264 char *text; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1265 if (!PyArg_Parse(args, "(is)", &index, &text)) |
| 6 | 1266 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1267 wmenusetitem(self->m_menu, index, text); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1268 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1269 return Py_None; |
| 6 | 1270 } |
| 1271 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1272 static PyObject * |
| 6 | 1273 menu_enable(self, args) |
| 1274 menuobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1275 PyObject *args; |
| 6 | 1276 { |
| 1277 int index; | |
| 1278 int flag; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1279 if (!PyArg_Parse(args, "(ii)", &index, &flag)) |
| 6 | 1280 return NULL; |
| 1281 wmenuenable(self->m_menu, index, flag); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1282 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1283 return Py_None; |
| 6 | 1284 } |
| 1285 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1286 static PyObject * |
| 6 | 1287 menu_check(self, args) |
| 1288 menuobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1289 PyObject *args; |
| 6 | 1290 { |
| 1291 int index; | |
| 1292 int flag; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1293 if (!PyArg_Parse(args, "(ii)", &index, &flag)) |
| 6 | 1294 return NULL; |
| 1295 wmenucheck(self->m_menu, index, flag); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1296 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1297 return Py_None; |
| 6 | 1298 } |
| 1299 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1300 static PyMethodDef menu_methods[] = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1301 {"additem", (PyCFunction)menu_additem}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1302 {"setitem", (PyCFunction)menu_setitem}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1303 {"enable", (PyCFunction)menu_enable}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1304 {"check", (PyCFunction)menu_check}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1305 {"close", (PyCFunction)menu_close}, |
| 6 | 1306 {NULL, NULL} /* sentinel */ |
| 1307 }; | |
| 1308 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1309 static PyObject * |
| 6 | 1310 menu_getattr(mp, name) |
| 1311 menuobject *mp; | |
| 1312 char *name; | |
| 1313 { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1314 PyObject *v = NULL; |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1315 if (mp->m_menu == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1316 PyErr_SetString(StdwinError, "menu object already closed"); |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1317 return NULL; |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1318 } |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1319 if (strcmp(name, "__dict__") == 0) { |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1320 v = mp->m_attr; |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1321 if (v == NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1322 v = Py_None; |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1323 } |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1324 else if (mp->m_attr != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1325 v = PyDict_GetItemString(mp->m_attr, name); |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1326 } |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1327 if (v != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1328 Py_INCREF(v); |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1329 return v; |
| 6 | 1330 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1331 return Py_FindMethod(menu_methods, (PyObject *)mp, name); |
| 6 | 1332 } |
| 1333 | |
| 1334 static int | |
| 1335 menu_setattr(mp, name, v) | |
| 1336 menuobject *mp; | |
| 1337 char *name; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1338 PyObject *v; |
| 6 | 1339 { |
| 1340 if (mp->m_attr == NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1341 mp->m_attr = PyDict_New(); |
| 6 | 1342 if (mp->m_attr == NULL) |
| 1343 return -1; | |
| 1344 } | |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1345 if (v == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1346 int rv = PyDict_DelItemString(mp->m_attr, name); |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1347 if (rv < 0) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1348 PyErr_SetString(PyExc_AttributeError, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1349 "delete non-existing menu object attribute"); |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1350 return rv; |
|
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1351 } |
| 6 | 1352 else |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1353 return PyDict_SetItemString(mp->m_attr, name, v); |
| 6 | 1354 } |
| 1355 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1356 statichere PyTypeObject Menutype = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1357 PyObject_HEAD_INIT(&PyType_Type) |
| 6 | 1358 0, /*ob_size*/ |
| 1359 "menu", /*tp_name*/ | |
| 1360 sizeof(menuobject), /*tp_size*/ | |
| 1361 0, /*tp_itemsize*/ | |
| 1362 /* methods */ | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1363 (destructor)menu_dealloc, /*tp_dealloc*/ |
| 6 | 1364 0, /*tp_print*/ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1365 (getattrfunc)menu_getattr, /*tp_getattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1366 (setattrfunc)menu_setattr, /*tp_setattr*/ |
| 6 | 1367 0, /*tp_compare*/ |
| 1368 0, /*tp_repr*/ | |
| 1369 }; | |
| 1370 | |
| 1371 | |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1372 #ifdef HAVE_BITMAPS |
|
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1373 |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1374 /* Bitmaps objects */ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1375 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1376 static bitmapobject *newbitmapobject Py_PROTO((int, int)); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1377 static bitmapobject * |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1378 newbitmapobject(width, height) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1379 int width, height; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1380 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1381 BITMAP *bitmap; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1382 bitmapobject *bp; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1383 bitmap = wnewbitmap(width, height); |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1384 if (bitmap == NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1385 return (bitmapobject *) PyErr_NoMemory(); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1386 bp = PyObject_NEW(bitmapobject, &Bitmaptype); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1387 if (bp != NULL) { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1388 bp->b_bitmap = bitmap; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1389 bp->b_attr = NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1390 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1391 else |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1392 wfreebitmap(bitmap); |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1393 return bp; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1394 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1395 |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1396 /* Bitmap methods */ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1397 |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1398 static void |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1399 bitmap_dealloc(bp) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1400 bitmapobject *bp; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1401 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1402 if (bp->b_bitmap != NULL) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1403 wfreebitmap(bp->b_bitmap); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1404 Py_XDECREF(bp->b_attr); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1405 PyMem_DEL(bp); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1406 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1407 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1408 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1409 bitmap_close(bp, args) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1410 bitmapobject *bp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1411 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1412 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1413 if (bp->b_bitmap != NULL) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1414 wfreebitmap(bp->b_bitmap); |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1415 bp->b_bitmap = NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1416 Py_XDECREF(bp->b_attr); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1417 bp->b_attr = NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1418 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1419 return Py_None; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1420 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1421 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1422 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1423 bitmap_setbit(self, args) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1424 bitmapobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1425 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1426 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1427 int a[3]; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1428 if (!getpointintarg(args, a)) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1429 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1430 wsetbit(self->b_bitmap, a[0], a[1], a[2]); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1431 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1432 return Py_None; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1433 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1434 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1435 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1436 bitmap_getbit(self, args) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1437 bitmapobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1438 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1439 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1440 int a[2]; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1441 if (!getpointarg(args, a)) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1442 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1443 return PyInt_FromLong((long) wgetbit(self->b_bitmap, a[0], a[1])); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1444 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1445 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1446 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1447 bitmap_getsize(self, args) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1448 bitmapobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1449 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1450 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1451 int width, height; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1452 if (!PyArg_NoArgs(args)) |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1453 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1454 wgetbitmapsize(self->b_bitmap, &width, &height); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1455 return Py_BuildValue("(ii)", width, height); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1456 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1457 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1458 static PyMethodDef bitmap_methods[] = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1459 {"close", (PyCFunction)bitmap_close}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1460 {"getsize", (PyCFunction)bitmap_getsize}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1461 {"getbit", (PyCFunction)bitmap_getbit}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1462 {"setbit", (PyCFunction)bitmap_setbit}, |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1463 {NULL, NULL} /* sentinel */ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1464 }; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1465 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1466 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1467 bitmap_getattr(bp, name) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1468 bitmapobject *bp; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1469 char *name; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1470 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1471 PyObject *v = NULL; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1472 if (bp->b_bitmap == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1473 PyErr_SetString(StdwinError, "bitmap object already closed"); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1474 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1475 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1476 if (strcmp(name, "__dict__") == 0) { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1477 v = bp->b_attr; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1478 if (v == NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1479 v = Py_None; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1480 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1481 else if (bp->b_attr != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1482 v = PyDict_GetItemString(bp->b_attr, name); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1483 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1484 if (v != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1485 Py_INCREF(v); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1486 return v; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1487 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1488 return Py_FindMethod(bitmap_methods, (PyObject *)bp, name); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1489 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1490 |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1491 static int |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1492 bitmap_setattr(bp, name, v) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1493 bitmapobject *bp; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1494 char *name; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1495 PyObject *v; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1496 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1497 if (bp->b_attr == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1498 bp->b_attr = PyDict_New(); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1499 if (bp->b_attr == NULL) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1500 return -1; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1501 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1502 if (v == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1503 int rv = PyDict_DelItemString(bp->b_attr, name); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1504 if (rv < 0) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1505 PyErr_SetString(PyExc_AttributeError, |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1506 "delete non-existing bitmap object attribute"); |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1507 return rv; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1508 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1509 else |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1510 return PyDict_SetItemString(bp->b_attr, name, v); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1511 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1512 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1513 statichere PyTypeObject Bitmaptype = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1514 PyObject_HEAD_INIT(&PyType_Type) |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1515 0, /*ob_size*/ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1516 "bitmap", /*tp_name*/ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1517 sizeof(bitmapobject), /*tp_size*/ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1518 0, /*tp_itemsize*/ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1519 /* methods */ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1520 (destructor)bitmap_dealloc, /*tp_dealloc*/ |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1521 0, /*tp_print*/ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1522 (getattrfunc)bitmap_getattr, /*tp_getattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1523 (setattrfunc)bitmap_setattr, /*tp_setattr*/ |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1524 0, /*tp_compare*/ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1525 0, /*tp_repr*/ |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1526 }; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1527 |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1528 #endif /* HAVE_BITMAPS */ |
|
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1529 |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1530 |
| 6 | 1531 /* Windows */ |
| 1532 | |
| 1533 #define MAXNWIN 50 | |
| 1534 static windowobject *windowlist[MAXNWIN]; | |
| 1535 | |
| 1536 /* Window methods */ | |
| 1537 | |
| 1538 static void | |
| 1539 window_dealloc(wp) | |
| 1540 windowobject *wp; | |
| 1541 { | |
| 1542 if (wp->w_win != NULL) { | |
| 1543 int tag = wgettag(wp->w_win); | |
| 1544 if (tag >= 0 && tag < MAXNWIN) | |
| 1545 windowlist[tag] = NULL; | |
| 1546 else | |
| 1547 fprintf(stderr, "XXX help! tag %d in window_dealloc\n", | |
| 1548 tag); | |
| 1549 wclose(wp->w_win); | |
| 1550 } | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1551 Py_DECREF(wp->w_title); |
| 6 | 1552 if (wp->w_attr != NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1553 Py_DECREF(wp->w_attr); |
| 6 | 1554 free((char *)wp); |
| 1555 } | |
| 1556 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1557 static PyObject * |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1558 window_close(wp, args) |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1559 windowobject *wp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1560 PyObject *args; |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1561 { |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1562 if (wp->w_win != NULL) { |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1563 int tag = wgettag(wp->w_win); |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1564 if (tag >= 0 && tag < MAXNWIN) |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1565 windowlist[tag] = NULL; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1566 wclose(wp->w_win); |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1567 wp->w_win = NULL; |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1568 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1569 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1570 return Py_None; |
|
453
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1571 } |
|
34abca182f18
Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents:
397
diff
changeset
|
1572 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1573 static PyObject * |
| 6 | 1574 window_begindrawing(wp, args) |
| 1575 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1576 PyObject *args; |
| 6 | 1577 { |
| 1578 drawingobject *dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1579 if (!PyArg_NoArgs(args)) |
| 6 | 1580 return NULL; |
| 1581 if (Drawing != NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1582 PyErr_SetString(StdwinError, "already drawing"); |
| 6 | 1583 return NULL; |
| 1584 } | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1585 dp = PyObject_NEW(drawingobject, &Drawingtype); |
| 6 | 1586 if (dp == NULL) |
| 1587 return NULL; | |
| 1588 Drawing = dp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1589 Py_INCREF(wp); |
| 6 | 1590 dp->d_ref = wp; |
| 1591 wbegindrawing(wp->w_win); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1592 return (PyObject *)dp; |
| 6 | 1593 } |
| 1594 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1595 static PyObject * |
| 6 | 1596 window_change(wp, args) |
| 1597 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1598 PyObject *args; |
| 6 | 1599 { |
| 1600 int a[4]; | |
| 1601 if (!getrectarg(args, a)) | |
| 1602 return NULL; | |
| 1603 wchange(wp->w_win, a[0], a[1], a[2], a[3]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1604 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1605 return Py_None; |
| 6 | 1606 } |
| 1607 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1608 static PyObject * |
| 6 | 1609 window_gettitle(wp, args) |
| 1610 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1611 PyObject *args; |
| 6 | 1612 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1613 if (!PyArg_NoArgs(args)) |
| 6 | 1614 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1615 Py_INCREF(wp->w_title); |
| 6 | 1616 return wp->w_title; |
| 1617 } | |
| 1618 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1619 static PyObject * |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1620 window_getwinpos(wp, args) |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1621 windowobject *wp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1622 PyObject *args; |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1623 { |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1624 int h, v; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1625 if (!PyArg_NoArgs(args)) |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1626 return NULL; |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1627 wgetwinpos(wp->w_win, &h, &v); |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1628 return makepoint(h, v); |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1629 } |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
1630 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1631 static PyObject * |
| 6 | 1632 window_getwinsize(wp, args) |
| 1633 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1634 PyObject *args; |
| 6 | 1635 { |
| 1636 int width, height; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1637 if (!PyArg_NoArgs(args)) |
| 6 | 1638 return NULL; |
| 1639 wgetwinsize(wp->w_win, &width, &height); | |
| 1640 return makepoint(width, height); | |
| 1641 } | |
| 1642 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1643 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1644 window_setwinpos(wp, args) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1645 windowobject *wp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1646 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1647 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1648 int a[2]; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1649 if (!getpointarg(args, a)) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1650 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1651 wsetwinpos(wp->w_win, a[0], a[1]); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1652 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1653 return Py_None; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1654 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1655 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1656 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1657 window_setwinsize(wp, args) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1658 windowobject *wp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1659 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1660 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1661 int a[2]; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1662 if (!getpointarg(args, a)) |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1663 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1664 wsetwinsize(wp->w_win, a[0], a[1]); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1665 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1666 return Py_None; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1667 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
1668 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1669 static PyObject * |
| 6 | 1670 window_getdocsize(wp, args) |
| 1671 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1672 PyObject *args; |
| 6 | 1673 { |
| 1674 int width, height; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1675 if (!PyArg_NoArgs(args)) |
| 6 | 1676 return NULL; |
| 1677 wgetdocsize(wp->w_win, &width, &height); | |
| 1678 return makepoint(width, height); | |
| 1679 } | |
| 1680 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1681 static PyObject * |
| 6 | 1682 window_getorigin(wp, args) |
| 1683 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1684 PyObject *args; |
| 6 | 1685 { |
| 1686 int width, height; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1687 if (!PyArg_NoArgs(args)) |
| 6 | 1688 return NULL; |
| 1689 wgetorigin(wp->w_win, &width, &height); | |
| 1690 return makepoint(width, height); | |
| 1691 } | |
| 1692 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1693 static PyObject * |
| 6 | 1694 window_scroll(wp, args) |
| 1695 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1696 PyObject *args; |
| 6 | 1697 { |
| 1698 int a[6]; | |
| 1699 if (!getrectpointarg(args, a)) | |
| 1700 return NULL; | |
| 1701 wscroll(wp->w_win, a[0], a[1], a[2], a[3], a[4], a[5]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1702 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1703 return Py_None; |
| 6 | 1704 } |
| 1705 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1706 static PyObject * |
| 6 | 1707 window_setdocsize(wp, args) |
| 1708 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1709 PyObject *args; |
| 6 | 1710 { |
| 1711 int a[2]; | |
| 1712 if (!getpointarg(args, a)) | |
| 1713 return NULL; | |
| 1714 wsetdocsize(wp->w_win, a[0], a[1]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1715 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1716 return Py_None; |
| 6 | 1717 } |
| 1718 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1719 static PyObject * |
| 6 | 1720 window_setorigin(wp, args) |
| 1721 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1722 PyObject *args; |
| 6 | 1723 { |
| 1724 int a[2]; | |
| 1725 if (!getpointarg(args, a)) | |
| 1726 return NULL; | |
| 1727 wsetorigin(wp->w_win, a[0], a[1]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1728 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1729 return Py_None; |
| 6 | 1730 } |
| 1731 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1732 static PyObject * |
| 6 | 1733 window_settitle(wp, args) |
| 1734 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1735 PyObject *args; |
| 6 | 1736 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1737 PyObject *title; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1738 if (!PyArg_Parse(args, "S", &title)) |
| 6 | 1739 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1740 Py_DECREF(wp->w_title); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1741 Py_INCREF(title); |
| 6 | 1742 wp->w_title = title; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1743 wsettitle(wp->w_win, PyString_AsString(title)); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1744 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1745 return Py_None; |
| 6 | 1746 } |
| 1747 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1748 static PyObject * |
| 6 | 1749 window_show(wp, args) |
| 1750 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1751 PyObject *args; |
| 6 | 1752 { |
| 1753 int a[4]; | |
| 1754 if (!getrectarg(args, a)) | |
| 1755 return NULL; | |
| 1756 wshow(wp->w_win, a[0], a[1], a[2], a[3]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1757 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1758 return Py_None; |
| 6 | 1759 } |
| 1760 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1761 static PyObject * |
| 6 | 1762 window_settimer(wp, args) |
| 1763 windowobject *wp; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1764 PyObject *args; |
| 6 | 1765 { |
| 1766 int a; | |
| 1767 if (!getintarg(args, &a)) | |
| 1768 return NULL; | |
| 1769 wsettimer(wp->w_win, a); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1770 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1771 return Py_None; |
| 6 | 1772 } |
| 1773 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1774 static PyObject * |
| 6 | 1775 window_menucreate(self, args) |
| 1776 windowobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1777 PyObject *args; |
| 6 | 1778 { |
| 1779 menuobject *mp; | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1780 char *title; |
| 6 | 1781 if (!getstrarg(args, &title)) |
| 1782 return NULL; | |
| 1783 wmenusetdeflocal(1); | |
| 1784 mp = newmenuobject(title); | |
| 1785 if (mp == NULL) | |
| 1786 return NULL; | |
| 1787 wmenuattach(self->w_win, mp->m_menu); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1788 return (PyObject *)mp; |
| 6 | 1789 } |
| 1790 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1791 static PyObject * |
| 6 | 1792 window_textcreate(self, args) |
| 1793 windowobject *self; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1794 PyObject *args; |
| 6 | 1795 { |
| 1796 int a[4]; | |
| 1797 if (!getrectarg(args, a)) | |
| 1798 return NULL; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1799 return (PyObject *)newtextobject(self, a[0], a[1], a[2], a[3]); |
| 6 | 1800 } |
| 1801 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1802 static PyObject * |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1803 window_setselection(self, args) |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1804 windowobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1805 PyObject *args; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1806 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1807 int sel, size, ok; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1808 char *text; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1809 if (!PyArg_Parse(args, "(is#)", &sel, &text, &size)) |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1810 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1811 ok = wsetselection(self->w_win, sel, text, size); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1812 return PyInt_FromLong(ok); |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1813 } |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1814 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1815 static PyObject * |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1816 window_setwincursor(self, args) |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1817 windowobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1818 PyObject *args; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1819 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1820 char *name; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1821 CURSOR *c; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1822 if (!PyArg_Parse(args, "z", &name)) |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1823 return NULL; |
|
657
3e626c413bbf
Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
1824 if (name == NULL) |
|
3e626c413bbf
Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
1825 c = NULL; |
|
3e626c413bbf
Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
1826 else { |
|
3e626c413bbf
Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
1827 c = wfetchcursor(name); |
|
3e626c413bbf
Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
1828 if (c == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1829 PyErr_SetString(StdwinError, "no such cursor"); |
|
657
3e626c413bbf
Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
1830 return NULL; |
|
3e626c413bbf
Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
1831 } |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1832 } |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1833 wsetwincursor(self->w_win, c); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1834 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1835 return Py_None; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1836 } |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
1837 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1838 static PyObject * |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1839 window_setactive(self, args) |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1840 windowobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1841 PyObject *args; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1842 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1843 if (!PyArg_NoArgs(args)) |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1844 return NULL; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1845 wsetactive(self->w_win); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1846 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1847 return Py_None; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1848 } |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
1849 |
|
325
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1850 #ifdef CWI_HACKS |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1851 static PyObject * |
|
325
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1852 window_getxwindowid(self, args) |
|
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1853 windowobject *self; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1854 PyObject *args; |
|
325
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1855 { |
|
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1856 long wid = wgetxwindowid(self->w_win); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1857 return PyInt_FromLong(wid); |
|
325
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1858 } |
|
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1859 #endif |
|
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1860 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1861 static PyMethodDef window_methods[] = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1862 {"begindrawing",(PyCFunction)window_begindrawing}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1863 {"change", (PyCFunction)window_change}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1864 {"close", (PyCFunction)window_close}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1865 {"getdocsize", (PyCFunction)window_getdocsize}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1866 {"getorigin", (PyCFunction)window_getorigin}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1867 {"gettitle", (PyCFunction)window_gettitle}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1868 {"getwinpos", (PyCFunction)window_getwinpos}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1869 {"getwinsize", (PyCFunction)window_getwinsize}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1870 {"menucreate", (PyCFunction)window_menucreate}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1871 {"scroll", (PyCFunction)window_scroll}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1872 {"setactive", (PyCFunction)window_setactive}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1873 {"setdocsize", (PyCFunction)window_setdocsize}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1874 {"setorigin", (PyCFunction)window_setorigin}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1875 {"setselection",(PyCFunction)window_setselection}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1876 {"settimer", (PyCFunction)window_settimer}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1877 {"settitle", (PyCFunction)window_settitle}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1878 {"setwincursor",(PyCFunction)window_setwincursor}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1879 {"setwinpos", (PyCFunction)window_setwinpos}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1880 {"setwinsize", (PyCFunction)window_setwinsize}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1881 {"show", (PyCFunction)window_show}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1882 {"textcreate", (PyCFunction)window_textcreate}, |
|
325
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1883 #ifdef CWI_HACKS |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1884 {"getxwindowid",(PyCFunction)window_getxwindowid}, |
|
325
baada20762b0
Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents:
285
diff
changeset
|
1885 #endif |
| 6 | 1886 {NULL, NULL} /* sentinel */ |
| 1887 }; | |
| 1888 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1889 static PyObject * |
| 6 | 1890 window_getattr(wp, name) |
| 1891 windowobject *wp; | |
| 1892 char *name; | |
| 1893 { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1894 PyObject *v = NULL; |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1895 if (wp->w_win == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1896 PyErr_SetString(StdwinError, "window already closed"); |
|
594
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1897 return NULL; |
|
47c42ea67a8b
Added close method for menus.
Guido van Rossum <guido@python.org>
parents:
499
diff
changeset
|
1898 } |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1899 if (strcmp(name, "__dict__") == 0) { |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1900 v = wp->w_attr; |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1901 if (v == NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1902 v = Py_None; |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1903 } |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1904 else if (wp->w_attr != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1905 v = PyDict_GetItemString(wp->w_attr, name); |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1906 } |
|
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1907 if (v != NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1908 Py_INCREF(v); |
|
397
4cdcc16bd080
Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents:
325
diff
changeset
|
1909 return v; |
| 6 | 1910 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1911 return Py_FindMethod(window_methods, (PyObject *)wp, name); |
| 6 | 1912 } |
| 1913 | |
| 1914 static int | |
| 1915 window_setattr(wp, name, v) | |
| 1916 windowobject *wp; | |
| 1917 char *name; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1918 PyObject *v; |
| 6 | 1919 { |
| 1920 if (wp->w_attr == NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1921 wp->w_attr = PyDict_New(); |
| 6 | 1922 if (wp->w_attr == NULL) |
| 1923 return -1; | |
| 1924 } | |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1925 if (v == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1926 int rv = PyDict_DelItemString(wp->w_attr, name); |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1927 if (rv < 0) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1928 PyErr_SetString(PyExc_AttributeError, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1929 "delete non-existing menu object attribute"); |
|
1031
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1930 return rv; |
|
7a11a70f7f44
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents:
926
diff
changeset
|
1931 } |
| 6 | 1932 else |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1933 return PyDict_SetItemString(wp->w_attr, name, v); |
| 6 | 1934 } |
| 1935 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1936 statichere PyTypeObject Windowtype = { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1937 PyObject_HEAD_INIT(&PyType_Type) |
| 6 | 1938 0, /*ob_size*/ |
| 1939 "window", /*tp_name*/ | |
| 1940 sizeof(windowobject), /*tp_size*/ | |
| 1941 0, /*tp_itemsize*/ | |
| 1942 /* methods */ | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1943 (destructor)window_dealloc, /*tp_dealloc*/ |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1031
diff
changeset
|
1944 0, /*tp_print*/ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1945 (getattrfunc)window_getattr, /*tp_getattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
1946 (setattrfunc)window_setattr, /*tp_setattr*/ |
| 6 | 1947 0, /*tp_compare*/ |
| 1948 0, /*tp_repr*/ | |
| 1949 }; | |
| 1950 | |
| 1951 /* Stdwin methods */ | |
| 1952 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1953 static PyObject * |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1954 stdwin_done(sw, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1955 PyObject *sw; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1956 PyObject *args; |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1957 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1958 if (!PyArg_NoArgs(args)) |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1959 return NULL; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1960 wdone(); |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1961 /* XXX There is no protection against continued use of |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1962 XXX stdwin functions or objects after this call is made. |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1963 XXX Use at own risk */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1964 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1965 return Py_None; |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1966 } |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
1967 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1968 static PyObject * |
| 6 | 1969 stdwin_open(sw, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1970 PyObject *sw; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1971 PyObject *args; |
| 6 | 1972 { |
| 1973 int tag; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1974 PyObject *title; |
| 6 | 1975 windowobject *wp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1976 if (!PyArg_Parse(args, "S", &title)) |
| 6 | 1977 return NULL; |
| 1978 for (tag = 0; tag < MAXNWIN; tag++) { | |
| 1979 if (windowlist[tag] == NULL) | |
| 1980 break; | |
| 1981 } | |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
1982 if (tag >= MAXNWIN) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1983 PyErr_SetString(StdwinError, "creating too many windows"); |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
1984 return NULL; |
|
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
1985 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1986 wp = PyObject_NEW(windowobject, &Windowtype); |
| 6 | 1987 if (wp == NULL) |
| 1988 return NULL; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1989 Py_INCREF(title); |
| 6 | 1990 wp->w_title = title; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1991 wp->w_win = wopen(PyString_AsString(title), (void (*)()) NULL); |
| 6 | 1992 wp->w_attr = NULL; |
| 1993 if (wp->w_win == NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1994 Py_DECREF(wp); |
| 6 | 1995 return NULL; |
| 1996 } | |
| 1997 windowlist[tag] = wp; | |
| 1998 wsettag(wp->w_win, tag); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
1999 return (PyObject *)wp; |
| 6 | 2000 } |
| 2001 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2002 static PyObject * |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2003 window2object(win) |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2004 WINDOW *win; |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2005 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2006 PyObject *w; |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2007 if (win == NULL) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2008 w = Py_None; |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2009 else { |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2010 int tag = wgettag(win); |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2011 if (tag < 0 || tag >= MAXNWIN || windowlist[tag] == NULL || |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2012 windowlist[tag]->w_win != win) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2013 w = Py_None; |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2014 else |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2015 w = (PyObject *)windowlist[tag]; |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2016 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2017 Py_INCREF(w); |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2018 return w; |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2019 } |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2020 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2021 static PyObject * |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2022 stdwin_get_poll_event(poll, args) |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2023 int poll; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2024 PyObject *args; |
| 6 | 2025 { |
| 2026 EVENT e; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2027 PyObject *u, *v, *w; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2028 if (!PyArg_NoArgs(args)) |
| 6 | 2029 return NULL; |
| 2030 if (Drawing != NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2031 PyErr_SetString(StdwinError, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2032 "cannot getevent() while drawing"); |
| 6 | 2033 return NULL; |
| 2034 } | |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2035 again: |
| 926 | 2036 BGN_STDWIN |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2037 if (poll) { |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2038 if (!wpollevent(&e)) { |
| 926 | 2039 RET_STDWIN |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2040 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2041 return Py_None; |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2042 } |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2043 } |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2044 else |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2045 wgetevent(&e); |
| 926 | 2046 END_STDWIN |
| 6 | 2047 if (e.type == WE_COMMAND && e.u.command == WC_CANCEL) { |
| 2048 /* Turn keyboard interrupts into exceptions */ | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2049 PyErr_SetNone(PyExc_KeyboardInterrupt); |
| 6 | 2050 return NULL; |
| 2051 } | |
|
65
a72c0a7dc993
Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents:
51
diff
changeset
|
2052 if (e.type == WE_COMMAND && e.u.command == WC_CLOSE) { |
|
a72c0a7dc993
Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents:
51
diff
changeset
|
2053 /* Turn WC_CLOSE commands into WE_CLOSE events */ |
|
a72c0a7dc993
Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents:
51
diff
changeset
|
2054 e.type = WE_CLOSE; |
|
a72c0a7dc993
Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents:
51
diff
changeset
|
2055 } |
|
818
e157c12cd6e7
Use mkvalue() instead of painfully constructing values
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
2056 v = window2object(e.window); |
| 6 | 2057 switch (e.type) { |
| 2058 case WE_CHAR: | |
| 2059 { | |
| 2060 char c[1]; | |
| 2061 c[0] = e.u.character; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2062 w = PyString_FromStringAndSize(c, 1); |
| 6 | 2063 } |
| 2064 break; | |
| 2065 case WE_COMMAND: | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2066 w = PyInt_FromLong((long)e.u.command); |
| 6 | 2067 break; |
| 2068 case WE_DRAW: | |
| 2069 w = makerect(e.u.area.left, e.u.area.top, | |
| 2070 e.u.area.right, e.u.area.bottom); | |
| 2071 break; | |
| 2072 case WE_MOUSE_DOWN: | |
| 2073 case WE_MOUSE_MOVE: | |
| 2074 case WE_MOUSE_UP: | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2075 w = Py_BuildValue("((ii)iii)", |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2076 e.u.where.h, e.u.where.v, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2077 e.u.where.clicks, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2078 e.u.where.button, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2079 e.u.where.mask); |
| 6 | 2080 break; |
| 2081 case WE_MENU: | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2082 if (e.u.m.id >= IDOFFSET && |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2083 e.u.m.id < IDOFFSET+MAXNMENU && |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2084 menulist[e.u.m.id - IDOFFSET] != NULL) |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2085 { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2086 w = Py_BuildValue("(Oi)", |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2087 menulist[e.u.m.id - IDOFFSET], |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2088 e.u.m.item); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2089 } |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2090 else { |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2091 /* Ghost menu event. |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2092 Can occur only on the Mac if another part |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2093 of the aplication has installed a menu; |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2094 like the THINK C console library. */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2095 Py_DECREF(v); |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2096 goto again; |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2097 } |
| 6 | 2098 break; |
|
907
32010d355fb6
added WE_KEY detail format to stdwinmodule.c.
Guido van Rossum <guido@python.org>
parents:
902
diff
changeset
|
2099 case WE_KEY: |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2100 w = Py_BuildValue("(ii)", e.u.key.code, e.u.key.mask); |
|
907
32010d355fb6
added WE_KEY detail format to stdwinmodule.c.
Guido van Rossum <guido@python.org>
parents:
902
diff
changeset
|
2101 break; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2102 case WE_LOST_SEL: |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2103 w = PyInt_FromLong((long)e.u.sel); |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2104 break; |
| 6 | 2105 default: |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2106 w = Py_None; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2107 Py_INCREF(w); |
| 6 | 2108 break; |
| 2109 } | |
| 2110 if (w == NULL) { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2111 Py_DECREF(v); |
| 6 | 2112 return NULL; |
| 2113 } | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2114 u = Py_BuildValue("(iOO)", e.type, v, w); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2115 Py_XDECREF(v); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2116 Py_XDECREF(w); |
|
818
e157c12cd6e7
Use mkvalue() instead of painfully constructing values
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
2117 return u; |
| 6 | 2118 } |
| 2119 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2120 static PyObject * |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2121 stdwin_getevent(sw, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2122 PyObject *sw; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2123 PyObject *args; |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2124 { |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2125 return stdwin_get_poll_event(0, args); |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2126 } |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2127 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2128 static PyObject * |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2129 stdwin_pollevent(sw, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2130 PyObject *sw; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2131 PyObject *args; |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2132 { |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2133 return stdwin_get_poll_event(1, args); |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2134 } |
|
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2135 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2136 static PyObject * |
| 6 | 2137 stdwin_setdefwinpos(sw, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2138 PyObject *sw; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2139 PyObject *args; |
| 6 | 2140 { |
| 2141 int a[2]; | |
| 2142 if (!getpointarg(args, a)) | |
| 2143 return NULL; | |
| 2144 wsetdefwinpos(a[0], a[1]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2145 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2146 return Py_None; |
| 6 | 2147 } |
| 2148 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2149 static PyObject * |
| 6 | 2150 stdwin_setdefwinsize(sw, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2151 PyObject *sw; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2152 PyObject *args; |
| 6 | 2153 { |
| 2154 int a[2]; | |
| 2155 if (!getpointarg(args, a)) | |
| 2156 return NULL; | |
| 2157 wsetdefwinsize(a[0], a[1]); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2158 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2159 return Py_None; |
| 6 | 2160 } |
| 2161 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2162 static PyObject * |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2163 stdwin_setdefscrollbars(sw, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2164 PyObject *sw; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2165 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2166 { |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2167 int a[2]; |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2168 if (!getpointarg(args, a)) |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2169 return NULL; |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2170 wsetdefscrollbars(a[0], a[1]); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2171 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2172 return Py_None; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2173 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2174 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2175 static PyObject * |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2176 stdwin_getdefwinpos(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2177 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2178 PyObject *args; |
|
137
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2179 { |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2180 int h, v; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2181 if (!PyArg_NoArgs(args)) |
|
137
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2182 return NULL; |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2183 wgetdefwinpos(&h, &v); |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2184 return makepoint(h, v); |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2185 } |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2186 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2187 static PyObject * |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2188 stdwin_getdefwinsize(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2189 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2190 PyObject *args; |
|
137
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2191 { |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2192 int width, height; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2193 if (!PyArg_NoArgs(args)) |
|
137
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2194 return NULL; |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2195 wgetdefwinsize(&width, &height); |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2196 return makepoint(width, height); |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2197 } |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2198 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2199 static PyObject * |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2200 stdwin_getdefscrollbars(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2201 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2202 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2203 { |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2204 int h, v; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2205 if (!PyArg_NoArgs(args)) |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2206 return NULL; |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2207 wgetdefscrollbars(&h, &v); |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2208 return makepoint(h, v); |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2209 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2210 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2211 static PyObject * |
| 6 | 2212 stdwin_menucreate(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2213 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2214 PyObject *args; |
| 6 | 2215 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2216 char *title; |
| 6 | 2217 if (!getstrarg(args, &title)) |
| 2218 return NULL; | |
| 2219 wmenusetdeflocal(0); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2220 return (PyObject *)newmenuobject(title); |
| 6 | 2221 } |
| 2222 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2223 static PyObject * |
| 6 | 2224 stdwin_askfile(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2225 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2226 PyObject *args; |
| 6 | 2227 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2228 char *prompt, *dflt; |
| 6 | 2229 int new, ret; |
| 2230 char buf[256]; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2231 if (!PyArg_Parse(args, "(ssi)", &prompt, &dflt, &new)) |
| 6 | 2232 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2233 strncpy(buf, dflt, sizeof buf); |
| 6 | 2234 buf[sizeof buf - 1] = '\0'; |
| 926 | 2235 BGN_STDWIN |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2236 ret = waskfile(prompt, buf, sizeof buf, new); |
| 926 | 2237 END_STDWIN |
| 6 | 2238 if (!ret) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2239 PyErr_SetNone(PyExc_KeyboardInterrupt); |
| 6 | 2240 return NULL; |
| 2241 } | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2242 return PyString_FromString(buf); |
| 6 | 2243 } |
| 2244 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2245 static PyObject * |
| 6 | 2246 stdwin_askync(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2247 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2248 PyObject *args; |
| 6 | 2249 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2250 char *prompt; |
| 6 | 2251 int new, ret; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2252 if (!PyArg_Parse(args, "(si)", &prompt, &new)) |
| 6 | 2253 return NULL; |
| 926 | 2254 BGN_STDWIN |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2255 ret = waskync(prompt, new); |
| 926 | 2256 END_STDWIN |
| 6 | 2257 if (ret < 0) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2258 PyErr_SetNone(PyExc_KeyboardInterrupt); |
| 6 | 2259 return NULL; |
| 2260 } | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2261 return PyInt_FromLong((long)ret); |
| 6 | 2262 } |
| 2263 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2264 static PyObject * |
| 6 | 2265 stdwin_askstr(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2266 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2267 PyObject *args; |
| 6 | 2268 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2269 char *prompt, *dflt; |
| 6 | 2270 int ret; |
| 2271 char buf[256]; | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2272 if (!PyArg_Parse(args, "(ss)", &prompt, &dflt)) |
| 6 | 2273 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2274 strncpy(buf, dflt, sizeof buf); |
| 6 | 2275 buf[sizeof buf - 1] = '\0'; |
| 926 | 2276 BGN_STDWIN |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2277 ret = waskstr(prompt, buf, sizeof buf); |
| 926 | 2278 END_STDWIN |
| 6 | 2279 if (!ret) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2280 PyErr_SetNone(PyExc_KeyboardInterrupt); |
| 6 | 2281 return NULL; |
| 2282 } | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2283 return PyString_FromString(buf); |
| 6 | 2284 } |
| 2285 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2286 static PyObject * |
| 6 | 2287 stdwin_message(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2288 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2289 PyObject *args; |
| 6 | 2290 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2291 char *msg; |
| 6 | 2292 if (!getstrarg(args, &msg)) |
| 2293 return NULL; | |
| 926 | 2294 BGN_STDWIN |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2295 wmessage(msg); |
| 926 | 2296 END_STDWIN |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2297 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2298 return Py_None; |
| 6 | 2299 } |
| 2300 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2301 static PyObject * |
| 6 | 2302 stdwin_fleep(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2303 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2304 PyObject *args; |
| 6 | 2305 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2306 if (!PyArg_NoArgs(args)) |
| 6 | 2307 return NULL; |
| 2308 wfleep(); | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2309 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2310 return Py_None; |
| 6 | 2311 } |
| 2312 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2313 static PyObject * |
| 6 | 2314 stdwin_setcutbuffer(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2315 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2316 PyObject *args; |
| 6 | 2317 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2318 int i, size; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2319 char *str; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2320 if (!PyArg_Parse(args, "(is#)", &i, &str, &size)) |
|
65
a72c0a7dc993
Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents:
51
diff
changeset
|
2321 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2322 wsetcutbuffer(i, str, size); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2323 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2324 return Py_None; |
| 6 | 2325 } |
| 2326 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2327 static PyObject * |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2328 stdwin_getactive(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2329 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2330 PyObject *args; |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2331 { |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2332 return window2object(wgetactive()); |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2333 } |
|
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2334 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2335 static PyObject * |
| 6 | 2336 stdwin_getcutbuffer(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2337 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2338 PyObject *args; |
| 6 | 2339 { |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2340 int i; |
| 6 | 2341 char *str; |
|
50
b94822f54991
Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
2342 int len; |
|
65
a72c0a7dc993
Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents:
51
diff
changeset
|
2343 if (!getintarg(args, &i)) |
| 6 | 2344 return NULL; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2345 str = wgetcutbuffer(i, &len); |
|
50
b94822f54991
Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
2346 if (str == NULL) { |
| 6 | 2347 str = ""; |
|
50
b94822f54991
Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
2348 len = 0; |
|
b94822f54991
Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
2349 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2350 return PyString_FromStringAndSize(str, len); |
| 6 | 2351 } |
| 2352 | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2353 static PyObject * |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2354 stdwin_rotatecutbuffers(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2355 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2356 PyObject *args; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2357 { |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2358 int i; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2359 if (!getintarg(args, &i)) |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2360 return NULL; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2361 wrotatecutbuffers(i); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2362 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2363 return Py_None; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2364 } |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2365 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2366 static PyObject * |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2367 stdwin_getselection(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2368 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2369 PyObject *args; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2370 { |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2371 int sel; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2372 char *data; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2373 int len; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2374 if (!getintarg(args, &sel)) |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2375 return NULL; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2376 data = wgetselection(sel, &len); |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2377 if (data == NULL) { |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2378 data = ""; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2379 len = 0; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2380 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2381 return PyString_FromStringAndSize(data, len); |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2382 } |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2383 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2384 static PyObject * |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2385 stdwin_resetselection(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2386 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2387 PyObject *args; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2388 { |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2389 int sel; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2390 if (!getintarg(args, &sel)) |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2391 return NULL; |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2392 wresetselection(sel); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2393 Py_INCREF(Py_None); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2394 return Py_None; |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2395 } |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2396 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2397 static PyObject * |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2398 stdwin_fetchcolor(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2399 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2400 PyObject *args; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2401 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
629
diff
changeset
|
2402 char *colorname; |
|
1198
2937897a7d8b
* Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents:
1191
diff
changeset
|
2403 COLOR color; |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2404 if (!getstrarg(args, &colorname)) |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2405 return NULL; |
|
1198
2937897a7d8b
* Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents:
1191
diff
changeset
|
2406 color = wfetchcolor(colorname); |
|
2937897a7d8b
* Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents:
1191
diff
changeset
|
2407 #ifdef BADCOLOR |
|
2937897a7d8b
* Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents:
1191
diff
changeset
|
2408 if (color == BADCOLOR) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2409 PyErr_SetString(StdwinError, "color name not found"); |
|
1198
2937897a7d8b
* Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents:
1191
diff
changeset
|
2410 return NULL; |
|
2937897a7d8b
* Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents:
1191
diff
changeset
|
2411 } |
|
2937897a7d8b
* Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents:
1191
diff
changeset
|
2412 #endif |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2413 return PyInt_FromLong((long)color); |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2414 } |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2415 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2416 static PyObject * |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2417 stdwin_getscrsize(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2418 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2419 PyObject *args; |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2420 { |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2421 int width, height; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2422 if (!PyArg_NoArgs(args)) |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2423 return NULL; |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2424 wgetscrsize(&width, &height); |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2425 return makepoint(width, height); |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2426 } |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2427 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2428 static PyObject * |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2429 stdwin_getscrmm(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2430 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2431 PyObject *args; |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2432 { |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2433 int width, height; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2434 if (!PyArg_NoArgs(args)) |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2435 return NULL; |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2436 wgetscrmm(&width, &height); |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2437 return makepoint(width, height); |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2438 } |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2439 |
|
902
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2440 #ifdef unix |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2441 static PyObject * |
|
902
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2442 stdwin_connectionnumber(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2443 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2444 PyObject *args; |
|
902
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2445 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2446 if (!PyArg_NoArgs(args)) |
|
902
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2447 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2448 return PyInt_FromLong((long) wconnectionnumber()); |
|
902
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2449 } |
|
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2450 #endif |
|
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2451 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2452 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2453 stdwin_listfontnames(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2454 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2455 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2456 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2457 char *pattern; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2458 char **fontnames; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2459 int count; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2460 PyObject *list; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2461 if (!PyArg_Parse(args, "z", &pattern)) |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2462 return NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2463 fontnames = wlistfontnames(pattern, &count); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2464 list = PyList_New(count); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2465 if (list != NULL) { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2466 int i; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2467 for (i = 0; i < count; i++) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2468 PyObject *v = PyString_FromString(fontnames[i]); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2469 if (v == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2470 Py_DECREF(list); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2471 list = NULL; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2472 break; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2473 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2474 PyList_SetItem(list, i, v); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2475 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2476 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2477 return list; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2478 } |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2479 |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
2480 #ifdef HAVE_BITMAPS |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2481 static PyObject * |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2482 stdwin_newbitmap(self, args) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2483 PyObject *self; |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2484 PyObject *args; |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2485 { |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2486 int width, height; |
|
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2487 bitmapobject *bp; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2488 if (!PyArg_Parse(args, "(ii)", &width, &height)) |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2489 return NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2490 return (PyObject *)newbitmapobject(width, height); |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2491 } |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
2492 #endif |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2493 |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2494 static PyMethodDef stdwin_methods[] = { |
| 6 | 2495 {"askfile", stdwin_askfile}, |
| 2496 {"askstr", stdwin_askstr}, | |
| 2497 {"askync", stdwin_askync}, | |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2498 {"done", stdwin_done}, |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
2499 {"fetchcolor", stdwin_fetchcolor}, |
|
902
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2500 #ifdef unix |
|
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2501 {"fileno", stdwin_connectionnumber}, |
|
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2502 {"connectionnumber", stdwin_connectionnumber}, |
|
a4793ae26682
Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents:
818
diff
changeset
|
2503 #endif |
| 6 | 2504 {"fleep", stdwin_fleep}, |
|
252
6811912f672d
Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents:
248
diff
changeset
|
2505 {"getactive", stdwin_getactive}, |
| 6 | 2506 {"getcutbuffer", stdwin_getcutbuffer}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2507 {"getdefscrollbars", stdwin_getdefscrollbars}, |
|
137
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2508 {"getdefwinpos", stdwin_getdefwinpos}, |
|
82ef94b8b902
Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents:
114
diff
changeset
|
2509 {"getdefwinsize", stdwin_getdefwinsize}, |
| 6 | 2510 {"getevent", stdwin_getevent}, |
|
233
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2511 {"getscrmm", stdwin_getscrmm}, |
|
8f62a5457319
Added many new functions
Guido van Rossum <guido@python.org>
parents:
207
diff
changeset
|
2512 {"getscrsize", stdwin_getscrsize}, |
|
207
9ab329697dda
Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents:
186
diff
changeset
|
2513 {"getselection", stdwin_getselection}, |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2514 {"listfontnames", stdwin_listfontnames}, |
| 6 | 2515 {"menucreate", stdwin_menucreate}, |
| 2516 {"message", stdwin_message}, | |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
2517 #ifdef HAVE_BITMAPS |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
2518 {"newbitmap", stdwin_newbitmap}, |
|
1332
e5fb9cdbe050
Final touch before release.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
2519 #endif |
| 6 | 2520 {"open", stdwin_open}, |
|
114
1efb8ed6afd3
Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents:
86
diff
changeset
|
2521 {"pollevent", stdwin_pollevent}, |
|
51
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2522 {"resetselection", stdwin_resetselection}, |
|
ebcb626cfddf
Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents:
50
diff
changeset
|
2523 {"rotatecutbuffers", stdwin_rotatecutbuffers}, |
| 6 | 2524 {"setcutbuffer", stdwin_setcutbuffer}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2525 {"setdefscrollbars", stdwin_setdefscrollbars}, |
| 6 | 2526 {"setdefwinpos", stdwin_setdefwinpos}, |
| 2527 {"setdefwinsize", stdwin_setdefwinsize}, | |
| 2528 | |
| 2529 /* Text measuring methods borrow code from drawing objects: */ | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2530 {"baseline", (PyCFunction)drawing_baseline}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2531 {"lineheight", (PyCFunction)drawing_lineheight}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2532 {"textbreak", (PyCFunction)drawing_textbreak}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2533 {"textwidth", (PyCFunction)drawing_textwidth}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2534 |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2535 /* Same for font setting methods: */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2536 {"setfont", (PyCFunction)drawing_setfont}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2537 |
|
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2538 /* Same for color setting/getting methods: */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2539 {"getbgcolor", (PyCFunction)drawing_getbgcolor}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2540 {"getfgcolor", (PyCFunction)drawing_getfgcolor}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2541 {"setbgcolor", (PyCFunction)drawing_setbgcolor}, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2542 {"setfgcolor", (PyCFunction)drawing_setfgcolor}, |
|
171
0cee01b68d9c
Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents:
157
diff
changeset
|
2543 |
| 6 | 2544 {NULL, NULL} /* sentinel */ |
| 2545 }; | |
| 2546 | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
2547 #ifndef macintosh |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2548 static int |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2549 checkstringlist(args, ps, pn) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2550 PyObject *args; |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2551 char ***ps; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2552 int *pn; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2553 { |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2554 int i, n; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2555 char **s; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2556 if (!PyList_Check(args)) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2557 PyErr_SetString(PyExc_TypeError, "list of strings expected"); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2558 return 0; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2559 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2560 n = PyList_Size(args); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2561 s = PyMem_NEW(char *, n+1); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2562 if (s == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2563 PyErr_NoMemory(); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2564 return 0; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2565 } |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2566 for (i = 0; i < n; i++) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2567 PyObject *item = PyList_GetItem(args, i); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2568 if (!PyString_Check(item)) { |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2569 PyErr_SetString(PyExc_TypeError, |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2570 "list of strings expected"); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2571 return 0; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2572 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2573 s[i] = PyString_AsString(item); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2574 } |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2575 s[n] = NULL; /* In case caller wants a NULL-terminated list */ |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2576 *ps = s; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2577 *pn = n; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2578 return 1; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2579 } |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2580 |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2581 static int |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2582 putbackstringlist(list, s, n) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2583 PyObject *list; |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2584 char **s; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2585 int n; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2586 { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2587 int oldsize = PyList_Size(list); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2588 PyObject *newlist; |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2589 int i; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2590 if (n == oldsize) |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2591 return 1; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2592 newlist = PyList_New(n); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2593 for (i = 0; i < n && newlist != NULL; i++) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2594 PyObject *item = PyString_FromString(s[i]); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2595 if (item == NULL) { |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2596 Py_DECREF(newlist); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2597 newlist = NULL; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2598 } |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2599 else |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2600 PyList_SetItem(newlist, i, item); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2601 } |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2602 if (newlist == NULL) |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2603 return 0; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2604 (*list->ob_type->tp_as_sequence->sq_ass_slice) |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2605 (list, 0, oldsize, newlist); |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2606 Py_DECREF(newlist); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2607 return 1; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2608 } |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
2609 #endif /* macintosh */ |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2610 |
| 6 | 2611 void |
| 2612 initstdwin() | |
| 2613 { | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2614 PyObject *m, *d; |
|
499
80e2e5d67b49
Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents:
475
diff
changeset
|
2615 static int inited = 0; |
|
80e2e5d67b49
Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents:
475
diff
changeset
|
2616 |
|
142
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
2617 if (!inited) { |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
2618 #ifdef macintosh |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
2619 winit(); |
|
2263
7895a97313e5
Changed the way mac mainloop event checking is turned off
Jack Jansen <jack.jansen@cwi.nl>
parents:
2253
diff
changeset
|
2620 PyMac_DoYieldEnabled = 0; |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
2621 #else |
| 2235 | 2622 char buf[1000]; |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2623 int argc = 0; |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2624 char **argv = NULL; |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2625 PyObject *sys_argv = PySys_GetObject("argv"); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2626 if (sys_argv != NULL) { |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2627 if (!checkstringlist(sys_argv, &argv, &argc)) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2628 PyErr_Clear(); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2629 } |
|
1410
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2630 if (argc > 0) { |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2631 /* If argv[0] has a ".py" suffix, remove the suffix */ |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2632 char *p = strrchr(argv[0], '.'); |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2633 if (p != NULL && strcmp(p, ".py") == 0) { |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2634 int n = p - argv[0]; |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2635 if (n >= sizeof(buf)) |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2636 n = sizeof(buf)-1; |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2637 strncpy(buf, argv[0], n); |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2638 buf[n] = '\0'; |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2639 argv[0] = buf; |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2640 } |
|
315272ec4d5b
* import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents:
1353
diff
changeset
|
2641 } |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2642 winitargs(&argc, &argv); |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2643 if (argv != NULL) { |
|
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2644 if (!putbackstringlist(sys_argv, argv, argc)) |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2645 PyErr_Clear(); |
|
1353
a6355c83578d
* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents:
1332
diff
changeset
|
2646 } |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
2647 #endif |
|
142
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
2648 inited = 1; |
|
c7ea60491e68
Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents:
137
diff
changeset
|
2649 } |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2650 m = Py_InitModule("stdwin", stdwin_methods); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2651 d = PyModule_GetDict(m); |
|
499
80e2e5d67b49
Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents:
475
diff
changeset
|
2652 |
|
80e2e5d67b49
Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents:
475
diff
changeset
|
2653 /* Initialize stdwin.error exception */ |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2654 StdwinError = PyString_FromString("stdwin.error"); |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2655 if (StdwinError == NULL || |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2656 PyDict_SetItemString(d, "error", StdwinError) != 0) |
|
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2657 Py_FatalError("can't define stdwin.error"); |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1410
diff
changeset
|
2658 #ifdef WITH_THREAD |
| 926 | 2659 StdwinLock = allocate_lock(); |
| 2660 if (StdwinLock == NULL) | |
|
4703
e0bb1dac2dbf
Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents:
4503
diff
changeset
|
2661 Py_FatalError("can't allocate stdwin lock"); |
| 926 | 2662 #endif |
| 6 | 2663 } |
