Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 723ad8a

Browse files
committed
More toolbox modules adapted to Universal Headers 3.3.2.
1 parent 8ed8130 commit 723ad8a

20 files changed

Lines changed: 2284 additions & 535 deletions

Mac/Modules/ctl/Ctlmodule.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,53 @@ static PyObject *CtlObj_GetControlDataSize(_self, _args)
11841184

11851185
#if TARGET_API_MAC_CARBON
11861186

1187+
static PyObject *CtlObj_HandleControlDragTracking(_self, _args)
1188+
ControlObject *_self;
1189+
PyObject *_args;
1190+
{
1191+
PyObject *_res = NULL;
1192+
OSStatus _err;
1193+
DragTrackingMessage inMessage;
1194+
DragReference inDrag;
1195+
Boolean outLikesDrag;
1196+
if (!PyArg_ParseTuple(_args, "hO&",
1197+
&inMessage,
1198+
DragObj_Convert, &inDrag))
1199+
return NULL;
1200+
_err = HandleControlDragTracking(_self->ob_itself,
1201+
inMessage,
1202+
inDrag,
1203+
&outLikesDrag);
1204+
if (_err != noErr) return PyMac_Error(_err);
1205+
_res = Py_BuildValue("b",
1206+
outLikesDrag);
1207+
return _res;
1208+
}
1209+
#endif
1210+
1211+
#if TARGET_API_MAC_CARBON
1212+
1213+
static PyObject *CtlObj_HandleControlDragReceive(_self, _args)
1214+
ControlObject *_self;
1215+
PyObject *_args;
1216+
{
1217+
PyObject *_res = NULL;
1218+
OSStatus _err;
1219+
DragReference inDrag;
1220+
if (!PyArg_ParseTuple(_args, "O&",
1221+
DragObj_Convert, &inDrag))
1222+
return NULL;
1223+
_err = HandleControlDragReceive(_self->ob_itself,
1224+
inDrag);
1225+
if (_err != noErr) return PyMac_Error(_err);
1226+
Py_INCREF(Py_None);
1227+
_res = Py_None;
1228+
return _res;
1229+
}
1230+
#endif
1231+
1232+
#if TARGET_API_MAC_CARBON
1233+
11871234
static PyObject *CtlObj_SetControlDragTrackingEnabled(_self, _args)
11881235
ControlObject *_self;
11891236
PyObject *_args;
@@ -2064,6 +2111,16 @@ static PyMethodDef CtlObj_methods[] = {
20642111
{"GetControlDataSize", (PyCFunction)CtlObj_GetControlDataSize, 1,
20652112
"(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)"},
20662113

2114+
#if TARGET_API_MAC_CARBON
2115+
{"HandleControlDragTracking", (PyCFunction)CtlObj_HandleControlDragTracking, 1,
2116+
"(DragTrackingMessage inMessage, DragReference inDrag) -> (Boolean outLikesDrag)"},
2117+
#endif
2118+
2119+
#if TARGET_API_MAC_CARBON
2120+
{"HandleControlDragReceive", (PyCFunction)CtlObj_HandleControlDragReceive, 1,
2121+
"(DragReference inDrag) -> None"},
2122+
#endif
2123+
20672124
#if TARGET_API_MAC_CARBON
20682125
{"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1,
20692126
"(Boolean tracks) -> None"},

Mac/Modules/ctl/ctlscan.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def writeinitialdefs(self):
3535
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
3636
self.defsfile.write("from TextEdit import *\n")
3737
self.defsfile.write("from QuickDraw import *\n")
38+
self.defsfile.write("from Dragconst import *\n")
3839
self.defsfile.write("\n")
3940

4041
def makeblacklistnames(self):
@@ -98,6 +99,8 @@ def makegreylist(self):
9899
('#if TARGET_API_MAC_CARBON', [
99100
'IsAutomaticControlDragTrackingEnabledForWindow',
100101
'SetAutomaticControlDragTrackingEnabledForWindow',
102+
'HandleControlDragReceive',
103+
'HandleControlDragTracking',
101104
'GetControlByID',
102105
'IsControlDragTrackingEnabled',
103106
'SetControlDragTrackingEnabled',
@@ -134,8 +137,6 @@ def makeblacklisttypes(self):
134137
'ControlDefSpec', # Don't know how to do this yet
135138
'ControlDefSpec_ptr', # ditto
136139
'Collection', # Ditto
137-
'DragTrackingMessage', # Needs Drag module, must implement later
138-
'DragReference', # ditto
139140
]
140141

141142
def makerepairinstructions(self):

Mac/Modules/ctl/ctlsupport.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
ControlID = OpaqueType('ControlID', 'PyControlID')
4646
ControlID_ptr = ControlID
4747

48+
DragTrackingMessage = Type("DragTrackingMessage", "h")
49+
DragReference = OpaqueByValueType("DragReference", "DragObj")
50+
4851
includestuff = includestuff + """
4952
#include <%s>""" % MACHEADERFILE + """
5053
#ifndef kControlCheckBoxUncheckedValue

Mac/Modules/qd/qdscan.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,32 +100,38 @@ def makeblacklistnames(self):
100100
'GetPortHWND',
101101
'GetHWNDPort',
102102
'GetPICTFromDIB',
103-
103+
'GetPortBitMapForCopyBits', # Something funny in the declaration
104104

105105
]
106106

107+
def makegreylist(self):
108+
return [
109+
('#if !TARGET_API_MAC_CARBON', [
110+
]),
111+
('#if TARGET_API_MAC_CARBON', [
112+
])]
113+
114+
107115
def makeblacklisttypes(self):
108116
return [
109-
## 'CCrsrHandle',
110117
'CIconHandle', # Obsolete
111118
'CQDProcs',
119+
'CQDProcsPtr',
112120
'CSpecArray',
113-
## 'CTabHandle',
114121
'ColorComplementProcPtr',
115122
'ColorComplementUPP',
116123
'ColorSearchProcPtr',
117124
'ColorSearchUPP',
118125
'ConstPatternParam',
119126
'DeviceLoopDrawingProcPtr',
120127
'DeviceLoopFlags',
121-
## 'FontInfo',
122-
## 'GDHandle',
123128
'GrafVerb',
124129
'OpenCPicParams_ptr',
125130
'Ptr',
126131
'QDProcs',
127132
'ReqListRec',
128133
'void_ptr',
134+
'CustomXFerProcPtr',
129135
]
130136

131137
def makerepairinstructions(self):

Mac/Modules/qd/qdsupport.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ def getargsCheck(self, name):
4545
CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
4646
GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
4747
BitMap_ptr = OpaqueByValueType("BitMapPtr", "BMObj")
48+
BitMap = BitMap_ptr
4849
RGBColor = OpaqueType('RGBColor', 'QdRGB')
4950
RGBColor_ptr = RGBColor
5051
FontInfo = OpaqueType('FontInfo', 'QdFI')
52+
Component = OpaqueByValueType('Component', 'CmpObj')
53+
ComponentInstance = OpaqueByValueType('ComponentInstance', 'CmpInstObj')
5154

5255
Cursor_ptr = StructInputBufferType('Cursor')
5356
Pattern = StructOutputBufferType('Pattern')
@@ -58,6 +61,47 @@ def getargsCheck(self, name):
5861
includestuff = includestuff + """
5962
#include <%s>""" % MACHEADERFILE + """
6063
64+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
65+
#define GetPortBitMapForCopyBits(port) (((GrafPort)(port))->portBits)
66+
#define GetPortBounds(port, bounds) (*(bounds) = (port)->portRect, (bounds))
67+
#define GetPortForeColor(port, color) (*(color) = (port)->rgbFgColor, (color))
68+
#define GetPortBackColor(port, color) (*(color) = (port)->rgbBkColor, (color))
69+
#define GetPortOpColor(port, color) (*(color) = (*((port)->grafVars))->rgbOpColor, (color))
70+
#define GetPortHiliteColor(port, color) (*(color) = (*((port)->grafVars))->rgbHiliteColor, (color))
71+
#define GetPortTextFont(port) ((port)->txFont)
72+
#define GetPortTextFace(port) ((port)->txFace)
73+
#define GetPortTextMode(port) ((port)->txMode)
74+
#define GetPortTextSize(port) ((port)->txSize)
75+
#define GetPortChExtra(port) ((port)->chExtra)
76+
#define GetPortFracHPenLocation(port) ((port)->pnLocHFrac)
77+
#define GetPortSpExtra(port) ((port)->spExtra)
78+
#define GetPortPenVisibility(port) ((port)->pnVis)
79+
#define GetPortVisibleRegion(port, rgn) ((rgn) = (port)->visRgn, (rgn))
80+
#define GetPortClipRegion(port, rgn) ((rgn) = (port)->clipRgn, (rgn))
81+
#define GetPortBackPixPat(port, pat) ((pat) = (port)->bkPixPat, (pat))
82+
#define GetPortPenPixPat(port, pat) ((pat) = (port)->pnPixPat, (pat))
83+
#define GetPortFillPixPat(port, pat) ((pat) = (port)->fillPixPat, (pat))
84+
#define GetPortPenSize(port, pensize) (*(pensize) = (port)->pnSize, (pensize))
85+
#define GetPortPenMode(port) ((port)->pnMode)
86+
#define GetPortPenLocation(port, location) ((*location) = (port)->pnLoc, (location))
87+
#define IsPortRegionBeingDefined(port) ((port)->rgnSave)
88+
#define IsPortPictureBeingDefined(port) ((port)->picSave)
89+
/* #define IsPortOffscreen(port) */
90+
/* #define IsPortColor(port) */
91+
92+
#define SetPortBounds(port, bounds) ((port)->portRect = *(bounds))
93+
#define SetPortOpColor(port, color) ((*((port)->grafVars))->rgbOpColor = *(color))
94+
#define SetPortVisibleRegion(port, rgn) ((port)->visRgn = (rgn))
95+
#define SetPortClipRegion(port, rgn) ((port)->clipRgn = (rgn))
96+
#define SetPortBackPixPat(port, pat) ((port)->bkPixPat = (pat))
97+
#define SetPortPenPixPat(port, pat) ((port)->pnPixPat = (pat))
98+
#define GetPortFillPixPat(port, pat) ((port)->fillPixPat = (pat))
99+
#define SetPortPenSize(port, pensize) ((port)->pnSize = (pensize))
100+
#define SetPortPenMode(port, mode) ((port)->pnMode = (mode))
101+
#define SetPortFracHPenLocation(port, frac) ((port)->pnLocHFrac = (frac))
102+
103+
#endif
104+
61105
/*
62106
** Parse/generate RGB records
63107
*/

Mac/Modules/qdoffs/Qdoffsmodule.c

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -147,37 +147,6 @@ PyTypeObject GWorld_Type = {
147147
/* --------------------- End object type GWorld --------------------- */
148148

149149

150-
static PyObject *Qdoffs_NewGWorld(_self, _args)
151-
PyObject *_self;
152-
PyObject *_args;
153-
{
154-
PyObject *_res = NULL;
155-
QDErr _err;
156-
GWorldPtr offscreenGWorld;
157-
short PixelDepth;
158-
Rect boundsRect;
159-
CTabHandle cTable;
160-
GDHandle aGDevice;
161-
GWorldFlags flags;
162-
if (!PyArg_ParseTuple(_args, "hO&O&O&l",
163-
&PixelDepth,
164-
PyMac_GetRect, &boundsRect,
165-
OptResObj_Convert, &cTable,
166-
OptResObj_Convert, &aGDevice,
167-
&flags))
168-
return NULL;
169-
_err = NewGWorld(&offscreenGWorld,
170-
PixelDepth,
171-
&boundsRect,
172-
cTable,
173-
aGDevice,
174-
flags);
175-
if (_err != noErr) return PyMac_Error(_err);
176-
_res = Py_BuildValue("O&",
177-
GWorldObj_New, offscreenGWorld);
178-
return _res;
179-
}
180-
181150
static PyObject *Qdoffs_LockPixels(_self, _args)
182151
PyObject *_self;
183152
PyObject *_args;
@@ -209,37 +178,6 @@ static PyObject *Qdoffs_UnlockPixels(_self, _args)
209178
return _res;
210179
}
211180

212-
static PyObject *Qdoffs_UpdateGWorld(_self, _args)
213-
PyObject *_self;
214-
PyObject *_args;
215-
{
216-
PyObject *_res = NULL;
217-
GWorldFlags _rv;
218-
GWorldPtr offscreenGWorld;
219-
short pixelDepth;
220-
Rect boundsRect;
221-
CTabHandle cTable;
222-
GDHandle aGDevice;
223-
GWorldFlags flags;
224-
if (!PyArg_ParseTuple(_args, "hO&O&O&l",
225-
&pixelDepth,
226-
PyMac_GetRect, &boundsRect,
227-
OptResObj_Convert, &cTable,
228-
OptResObj_Convert, &aGDevice,
229-
&flags))
230-
return NULL;
231-
_rv = UpdateGWorld(&offscreenGWorld,
232-
pixelDepth,
233-
&boundsRect,
234-
cTable,
235-
aGDevice,
236-
flags);
237-
_res = Py_BuildValue("lO&",
238-
_rv,
239-
GWorldObj_New, offscreenGWorld);
240-
return _res;
241-
}
242-
243181
static PyObject *Qdoffs_GetGWorld(_self, _args)
244182
PyObject *_self;
245183
PyObject *_args;
@@ -563,14 +501,10 @@ static PyObject *Qdoffs_PutPixMapBytes(_self, _args)
563501
}
564502

565503
static PyMethodDef Qdoffs_methods[] = {
566-
{"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1,
567-
"(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)"},
568504
{"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1,
569505
"(PixMapHandle pm) -> (Boolean _rv)"},
570506
{"UnlockPixels", (PyCFunction)Qdoffs_UnlockPixels, 1,
571507
"(PixMapHandle pm) -> None"},
572-
{"UpdateGWorld", (PyCFunction)Qdoffs_UpdateGWorld, 1,
573-
"(short pixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldFlags _rv, GWorldPtr offscreenGWorld)"},
574508
{"GetGWorld", (PyCFunction)Qdoffs_GetGWorld, 1,
575509
"() -> (CGrafPtr port, GDHandle gdh)"},
576510
{"SetGWorld", (PyCFunction)Qdoffs_SetGWorld, 1,
@@ -628,7 +562,7 @@ void initQdoffs()
628562
Qdoffs_Error = PyMac_GetOSErrException();
629563
if (Qdoffs_Error == NULL ||
630564
PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0)
631-
Py_FatalError("can't initialize Qdoffs.Error");
565+
return;
632566
GWorld_Type.ob_type = &PyType_Type;
633567
Py_INCREF(&GWorld_Type);
634568
if (PyDict_SetItemString(d, "GWorldType", (PyObject *)&GWorld_Type) != 0)

0 commit comments

Comments
 (0)