[Python-checkins] CVS: python/dist/src/Mac/Modules/ctl ctledit.py,1.6,1.7 ctlscan.py,1.21,1.22 _Ctlmodule.c,1.7,1.8
Just van Rossum
jvr@users.sourceforge.net
2001年12月13日 13:24:40 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl
In directory usw-pr-cvs1:/tmp/cvs-serv30822
Modified Files:
ctledit.py ctlscan.py _Ctlmodule.c
Log Message:
- "manage" controls created by CreateXxxXxxControl() functions.
- FindControlUnderMouse() returns an existing control, not a new one.
Index: ctledit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctledit.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ctledit.py 2000年03月21日 16:25:23 1.6
--- ctledit.py 2001年12月13日 21:24:37 1.7
***************
*** 1,2 ****
--- 1,11 ----
+ # FindControlUnderMouse() returns an existing control, not a new one,
+ # so create this one by hand.
+ f = Function(ExistingControlHandle, 'FindControlUnderMouse',
+ (Point, 'inWhere', InMode),
+ (WindowRef, 'inWindow', InMode),
+ (SInt16, 'outPart', OutMode),
+ )
+ functions.append(f)
+
f = Function(ControlHandle, 'as_Control',
(Handle, 'h', InMode))
***************
*** 26,27 ****
--- 35,45 ----
methods.append(f)
+
+ # All CreateXxxXxxControl() functions return a new object in an output
+ # parameter; these should however be managed by us (we're creating them
+ # after all), so set the type to ControlRef.
+ for f in functions:
+ if f.name.startswith("Create"):
+ v = f.argumentList[-1]
+ if v.type == ExistingControlHandle:
+ v.type = ControlRef
Index: ctlscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlscan.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** ctlscan.py 2001年12月12日 22:38:27 1.21
--- ctlscan.py 2001年12月13日 21:24:37 1.22
***************
*** 46,49 ****
--- 46,50 ----
def makeblacklistnames(self):
return [
+ 'FindControlUnderMouse', # Generated manually, returns an existing control, not a new one.
'DisposeControl', # Generated manually
'KillControls', # Implied by close of dialog
Index: _Ctlmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** _Ctlmodule.c 2001年12月12日 22:51:37 1.7
--- _Ctlmodule.c 2001年12月13日 21:24:37 1.8
***************
*** 4036,4062 ****
}
- static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- ControlHandle _rv;
- Point inWhere;
- WindowPtr inWindow;
- SInt16 outPart;
- #ifndef FindControlUnderMouse
- PyMac_PRECHECK(FindControlUnderMouse);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &inWhere,
- WinObj_Convert, &inWindow))
- return NULL;
- _rv = FindControlUnderMouse(inWhere,
- inWindow,
- &outPart);
- _res = Py_BuildValue("O&h",
- CtlObj_New, _rv,
- outPart);
- return _res;
- }
-
static PyObject *Ctl_IdleControls(PyObject *_self, PyObject *_args)
{
--- 4036,4039 ----
***************
*** 4138,4142 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4115,4119 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4341,4345 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4318,4322 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4376,4380 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4353,4357 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4411,4415 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4388,4392 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4434,4438 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4411,4415 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4457,4461 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4434,4438 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4486,4490 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4463,4467 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4521,4525 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4498,4502 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4565,4569 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4542,4546 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4594,4598 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4571,4575 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4617,4621 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4594,4598 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4646,4650 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4623,4627 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4672,4676 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4649,4653 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4707,4711 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4684,4688 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4736,4740 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4713,4717 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4762,4766 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4739,4743 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4788,4792 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4765,4769 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4820,4824 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4797,4801 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4852,4856 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4829,4833 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4893,4897 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4870,4874 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4916,4920 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4893,4897 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4954,4958 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4931,4935 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
return _res;
}
***************
*** 4980,4984 ****
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_WhichControl, outControl);
return _res;
}
--- 4957,4984 ----
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
! CtlObj_New, outControl);
! return _res;
! }
!
! static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args)
! {
! PyObject *_res = NULL;
! ControlHandle _rv;
! Point inWhere;
! WindowPtr inWindow;
! SInt16 outPart;
! #ifndef FindControlUnderMouse
! PyMac_PRECHECK(FindControlUnderMouse);
! #endif
! if (!PyArg_ParseTuple(_args, "O&O&",
! PyMac_GetPoint, &inWhere,
! WinObj_Convert, &inWindow))
! return NULL;
! _rv = FindControlUnderMouse(inWhere,
! inWindow,
! &outPart);
! _res = Py_BuildValue("O&h",
! CtlObj_WhichControl, _rv,
! outPart);
return _res;
}
***************
*** 5012,5017 ****
{"FindControl", (PyCFunction)Ctl_FindControl, 1,
"(Point testPoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)"},
- {"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1,
- "(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)"},
{"IdleControls", (PyCFunction)Ctl_IdleControls, 1,
"(WindowPtr inWindow) -> None"},
--- 5012,5015 ----
***************
*** 5091,5094 ****
--- 5089,5094 ----
{"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1,
"(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)"},
+ {"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1,
+ "(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)"},
{"as_Control", (PyCFunction)Ctl_as_Control, 1,
"(Handle h) -> (ControlHandle _rv)"},