[Python-checkins] CVS: python/dist/src/Mac/Modules/fm _Fmmodule.c,1.4,1.5 fmscan.py,1.9,1.10 fmsupport.py,1.4,1.5

Just van Rossum jvr@users.sourceforge.net
Mon, 07 Jan 2002 06:15:04 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/fm
In directory usw-pr-cvs1:/tmp/cvs-serv4836

Modified Files:
	_Fmmodule.c fmscan.py fmsupport.py 
Log Message:
Today's Carbon Toolbox addition: QDTextBounds()

Index: _Fmmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/_Fmmodule.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** _Fmmodule.c	2001/12/18 15:37:47	1.4
--- _Fmmodule.c	2002/01/07 14:15:02	1.5
***************
*** 294,297 ****
--- 294,315 ----
  }
  
+ static PyObject *Fm_QDTextBounds(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	char *inText__in__;
+ 	int inText__len__;
+ 	int inText__in_len__;
+ 	Rect bounds;
+ 	if (!PyArg_ParseTuple(_args, "s#",
+ 	                      &inText__in__, &inText__in_len__))
+ 		return NULL;
+ 	inText__len__ = inText__in_len__;
+ 	QDTextBounds(inText__len__, inText__in__,
+ 	             &bounds);
+ 	_res = Py_BuildValue("O&",
+ 	                     PyMac_BuildRect, &bounds);
+ 	return _res;
+ }
+ 
  static PyMethodDef Fm_methods[] = {
  
***************
*** 338,341 ****
--- 356,361 ----
  	{"GetAppFont", (PyCFunction)Fm_GetAppFont, 1,
  	 "() -> (short _rv)"},
+ 	{"QDTextBounds", (PyCFunction)Fm_QDTextBounds, 1,
+ 	 "(Buffer inText) -> (Rect bounds)"},
  	{NULL, NULL, 0}
  };

Index: fmscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/fmscan.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** fmscan.py	2001/06/20 21:29:19	1.9
--- fmscan.py	2002/01/07 14:15:02	1.10
***************
*** 55,59 ****
  			"FMInput_ptr",	# Not needed for now
  			"FMOutPtr",		# Ditto
! 			"void_ptr",		# Don't know how to do this right now
  			"FontInfo",		# Ditto
  			]
--- 55,59 ----
  			"FMInput_ptr",	# Not needed for now
  			"FMOutPtr",		# Ditto
! ##			"void_ptr",		# Don't know how to do this right now
  			"FontInfo",		# Ditto
  			]
***************
*** 63,66 ****
--- 63,68 ----
  			([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
  			([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
+ 			([('short', 'byteCount', 'InMode'), ('void_ptr', 'textAddr', 'InMode'),],
+ 			 [('TextBuffer', 'inText', 'InMode')]),
  			]
  			

Index: fmsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/fmsupport.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fmsupport.py	2001/08/23 13:48:38	1.4
--- fmsupport.py	2002/01/07 14:15:02	1.5
***************
*** 19,22 ****
--- 19,29 ----
  # Create the type objects
  
+ class RevVarInputBufferType(VarInputBufferType):
+ 	def passInput(self, name):
+ 		return "%s__len__, %s__in__" % (name, name)
+ 
+ TextBuffer = RevVarInputBufferType()
+ 
+ 
  includestuff = includestuff + """
  #ifdef WITHOUT_FRAMEWORKS