]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- Fixed handling of InsetRect, OffsetRect, MapRect
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 14 Nov 1995 10:46:01 +0000 (10:46 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 14 Nov 1995 10:46:01 +0000 (10:46 +0000)
- Added support for PatHandle, CursHandle
- Regenerated from new universal headers.

Mac/Lib/toolbox/QuickDraw.py
Mac/Modules/qd/Qdmodule.c
Mac/Modules/qd/qdgen.py
Mac/Modules/qd/qdscan.py
Mac/Modules/qd/qdsupport.py

index 48c89fc451ea192b78e0f53a1166e02e17dd624a..b82621019ed3b0623c76650ecba2d4d063e8e678 100644 (file)
@@ -1,4 +1,4 @@
-# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDraw.h'
+# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
 
 invalColReq = -1
 srcCopy = 0
@@ -58,6 +58,7 @@ clutType = 0
 fixedType = 1
 directType = 2
 gdDevType = 0
+interlacedDevice = 2
 roundedDevice = 5
 hasAuxMenuBar = 6
 burstDevice = 7
@@ -73,6 +74,11 @@ pHiliteBit = 0
 defQDColors = 127
 RGBDirect = 16
 baseAddr32 = 4
+sysPatListID = 0
+iBeamCursor = 1
+crossCursor = 2
+plusCursor = 3
+watchCursor = 4
 singleDevicesBit = 0
 dontMatchSeedsBit = 1
 allDevicesBit = 2
@@ -82,7 +88,9 @@ allDevices = 1 << allDevicesBit
 kNoConstraint = 0
 kVerticalConstraint = 1
 kHorizontalConstraint = 2
-# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDrawText.h'
+kCursorImageMajorVersion = 0x0001
+kCursorImageMinorVersion = 0x0000
+# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
 
 leftCaret = 0
 rightCaret = -1
index 442a628a7d2a1f80ee8b572418b45aa02865273a..eecdd12410dcd642a1011086ff8341038e8f964d 100644 (file)
@@ -518,7 +518,8 @@ static PyObject *Qd_OffsetRect(_self, _args)
        Rect r;
        short dh;
        short dv;
-       if (!PyArg_ParseTuple(_args, "hh",
+       if (!PyArg_ParseTuple(_args, "O&hh",
+                             PyMac_GetRect, &r,
                              &dh,
                              &dv))
                return NULL;
@@ -538,7 +539,8 @@ static PyObject *Qd_InsetRect(_self, _args)
        Rect r;
        short dh;
        short dv;
-       if (!PyArg_ParseTuple(_args, "hh",
+       if (!PyArg_ParseTuple(_args, "O&hh",
+                             PyMac_GetRect, &r,
                              &dh,
                              &dv))
                return NULL;
@@ -1654,7 +1656,8 @@ static PyObject *Qd_MapRect(_self, _args)
        Rect r;
        Rect srcRect;
        Rect dstRect;
-       if (!PyArg_ParseTuple(_args, "O&O&",
+       if (!PyArg_ParseTuple(_args, "O&O&O&",
+                             PyMac_GetRect, &r,
                              PyMac_GetRect, &srcRect,
                              PyMac_GetRect, &dstRect))
                return NULL;
@@ -2208,6 +2211,108 @@ static PyObject *Qd_QDError(_self, _args)
        return _res;
 }
 
+static PyObject *Qd_GetPattern(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       PatHandle _rv;
+       short patternID;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &patternID))
+               return NULL;
+       _rv = GetPattern(patternID);
+       _res = Py_BuildValue("O&",
+                            ResObj_New, _rv);
+       return _res;
+}
+
+static PyObject *Qd_GetCursor(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       CursHandle _rv;
+       short cursorID;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &cursorID))
+               return NULL;
+       _rv = GetCursor(cursorID);
+       _res = Py_BuildValue("O&",
+                            ResObj_New, _rv);
+       return _res;
+}
+
+static PyObject *Qd_GetPicture(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       PicHandle _rv;
+       short pictureID;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &pictureID))
+               return NULL;
+       _rv = GetPicture(pictureID);
+       _res = Py_BuildValue("O&",
+                            ResObj_New, _rv);
+       return _res;
+}
+
+static PyObject *Qd_DeltaPoint(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       long _rv;
+       Point ptA;
+       Point ptB;
+       if (!PyArg_ParseTuple(_args, "O&O&",
+                             PyMac_GetPoint, &ptA,
+                             PyMac_GetPoint, &ptB))
+               return NULL;
+       _rv = DeltaPoint(ptA,
+                        ptB);
+       _res = Py_BuildValue("l",
+                            _rv);
+       return _res;
+}
+
+static PyObject *Qd_ShieldCursor(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       Rect shieldRect;
+       Point offsetPt;
+       if (!PyArg_ParseTuple(_args, "O&O&",
+                             PyMac_GetRect, &shieldRect,
+                             PyMac_GetPoint, &offsetPt))
+               return NULL;
+       ShieldCursor(&shieldRect,
+                    offsetPt);
+       Py_INCREF(Py_None);
+       _res = Py_None;
+       return _res;
+}
+
+static PyObject *Qd_ScreenRes(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       short scrnHRes;
+       short scrnVRes;
+       if (!PyArg_ParseTuple(_args, ""))
+               return NULL;
+       ScreenRes(&scrnHRes,
+                 &scrnVRes);
+       _res = Py_BuildValue("hh",
+                            scrnHRes,
+                            scrnVRes);
+       return _res;
+}
+
 static PyObject *Qd_TextFont(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -2471,9 +2576,9 @@ static PyMethodDef Qd_methods[] = {
        {"SetRect", (PyCFunction)Qd_SetRect, 1,
         "(short left, short top, short right, short bottom) -> (Rect r)"},
        {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
-        "(short dh, short dv) -> (Rect r)"},
+        "(Rect r, short dh, short dv) -> (Rect r)"},
        {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
-        "(short dh, short dv) -> (Rect r)"},
+        "(Rect r, short dh, short dv) -> (Rect r)"},
        {"SectRect", (PyCFunction)Qd_SectRect, 1,
         "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
        {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
@@ -2599,7 +2704,7 @@ static PyMethodDef Qd_methods[] = {
        {"MapPt", (PyCFunction)Qd_MapPt, 1,
         "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
        {"MapRect", (PyCFunction)Qd_MapRect, 1,
-        "(Rect srcRect, Rect dstRect) -> (Rect r)"},
+        "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
        {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
         "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
        {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
@@ -2662,6 +2767,18 @@ static PyMethodDef Qd_methods[] = {
         "(short index, Boolean reserve) -> None"},
        {"QDError", (PyCFunction)Qd_QDError, 1,
         "() -> (short _rv)"},
+       {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
+        "(short patternID) -> (PatHandle _rv)"},
+       {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
+        "(short cursorID) -> (CursHandle _rv)"},
+       {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
+        "(short pictureID) -> (PicHandle _rv)"},
+       {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
+        "(Point ptA, Point ptB) -> (long _rv)"},
+       {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
+        "(Rect shieldRect, Point offsetPt) -> None"},
+       {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
+        "() -> (short scrnHRes, short scrnVRes)"},
        {"TextFont", (PyCFunction)Qd_TextFont, 1,
         "(short font) -> None"},
        {"TextFace", (PyCFunction)Qd_TextFace, 1,
index d7976f15c8d4c3a6086155d53c23e2250a84fe87..19e887dae787fa09230ece17d547b24be6e2ce4a 100644 (file)
@@ -1,4 +1,4 @@
-# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDraw.h'
+# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
 
 f = Function(void, 'OpenPort',
     (GrafPtr, 'port', InMode),
@@ -156,14 +156,14 @@ f = Function(void, 'SetRect',
 functions.append(f)
 
 f = Function(void, 'OffsetRect',
-    (Rect, 'r', OutMode),
+    (Rect, 'r', InOutMode),
     (short, 'dh', InMode),
     (short, 'dv', InMode),
 )
 functions.append(f)
 
 f = Function(void, 'InsetRect',
-    (Rect, 'r', OutMode),
+    (Rect, 'r', InOutMode),
     (short, 'dh', InMode),
     (short, 'dv', InMode),
 )
@@ -530,7 +530,7 @@ f = Function(void, 'MapPt',
 functions.append(f)
 
 f = Function(void, 'MapRect',
-    (Rect, 'r', OutMode),
+    (Rect, 'r', InOutMode),
     (Rect_ptr, 'srcRect', InMode),
     (Rect_ptr, 'dstRect', InMode),
 )
@@ -713,7 +713,40 @@ f = Function(short, 'QDError',
 )
 functions.append(f)
 
-# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDrawText.h'
+f = Function(PatHandle, 'GetPattern',
+    (short, 'patternID', InMode),
+)
+functions.append(f)
+
+f = Function(CursHandle, 'GetCursor',
+    (short, 'cursorID', InMode),
+)
+functions.append(f)
+
+f = Function(PicHandle, 'GetPicture',
+    (short, 'pictureID', InMode),
+)
+functions.append(f)
+
+f = Function(long, 'DeltaPoint',
+    (Point, 'ptA', InMode),
+    (Point, 'ptB', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'ShieldCursor',
+    (Rect_ptr, 'shieldRect', InMode),
+    (Point, 'offsetPt', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'ScreenRes',
+    (short, 'scrnHRes', OutMode),
+    (short, 'scrnVRes', OutMode),
+)
+functions.append(f)
+
+# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
 
 f = Function(void, 'TextFont',
     (short, 'font', InMode),
index 0e03d7714303a042078245eeb975e63876c0c56d..408c9c2eadb7b0334b55dae6ab8fab82a6f31396 100644 (file)
@@ -79,6 +79,7 @@ class MyScanner(Scanner):
                        'ColorSearchUPP',
                        'ConstPatternParam',
                        'Pattern_ptr',
+                       'Pattern',
                        'Cursor_ptr',
                        'DeviceLoopDrawingProcPtr',
                        'DeviceLoopFlags',
@@ -105,6 +106,22 @@ class MyScanner(Scanner):
                        
                        ([('Point', '*', 'OutMode')],
                         [('*', '*', 'InOutMode')]),
+                        
+                        # InsetRect, OffsetRect
+                        ([('Rect', 'r', 'OutMode'),
+                               ('short', 'dh', 'InMode'),
+                               ('short', 'dv', 'InMode')],
+                         [('Rect', 'r', 'InOutMode'),
+                               ('short', 'dh', 'InMode'),
+                               ('short', 'dv', 'InMode')]),
+
+                        # MapRect
+                        ([('Rect', 'r', 'OutMode'),
+                               ('Rect_ptr', 'srcRect', 'InMode'),
+                               ('Rect_ptr', 'dstRect', 'InMode')],
+                         [('Rect', 'r', 'InOutMode'),
+                               ('Rect_ptr', 'srcRect', 'InMode'),
+                               ('Rect_ptr', 'dstRect', 'InMode')]),
                        
                        ]
 
index f3e7a9ae6b04f2dafd896ae54f212605c60b7cba..96d54f16d055db4f7aaf18e690e0a541f4bea4f1 100644 (file)
@@ -40,6 +40,8 @@ PicHandle = OpaqueByValueType("PicHandle", "ResObj")
 PolyHandle = OpaqueByValueType("PolyHandle", "ResObj")
 PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
 PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
+PatHandle = OpaqueByValueType("PatHandle", "ResObj")
+CursHandle = OpaqueByValueType("CursHandle", "ResObj")
 
 includestuff = includestuff + """
 #include <%s>""" % MACHEADERFILE + """