From: <jo...@us...> - 2009-08-22 04:19:52
|
Revision: 7518 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7518&view=rev Author: jouni Date: 2009-08-22 04:19:45 +0000 (Sat, 22 Aug 2009) Log Message: ----------- Changed the way the target OS X version is determined in _macosx.m. Modified Paths: -------------- trunk/matplotlib/src/_macosx.m Modified: trunk/matplotlib/src/_macosx.m =================================================================== --- trunk/matplotlib/src/_macosx.m 2009-08-22 00:02:15 UTC (rev 7517) +++ trunk/matplotlib/src/_macosx.m 2009-08-22 04:19:45 UTC (rev 7518) @@ -5,11 +5,16 @@ #include "numpy/arrayobject.h" #include "path_cleanup.h" +/* Proper way to check for the OS X version we are compiling for, from + http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */ +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 +#define COMPILING_FOR_10_5 +#endif static int nwin = 0; /* The number of open windows */ /* Use Atsui for Mac OS X 10.4, CoreText for Mac OS X 10.5 */ -#ifndef MAC_OS_X_VERSION_10_5 +#ifndef COMPILING_FOR_10_5 static int ngc = 0; /* The number of graphics contexts in use */ @@ -175,7 +180,7 @@ return 1; } -#ifndef MAC_OS_X_VERSION_10_5 +#ifndef COMPILING_FOR_10_5 static int _init_atsui(void) { OSStatus status; @@ -451,7 +456,7 @@ self->cr = NULL; self->level = 0; -#ifndef MAC_OS_X_VERSION_10_5 +#ifndef COMPILING_FOR_10_5 if (ngc==0) { int ok = _init_atsui(); @@ -466,7 +471,7 @@ return (PyObject*) self; } -#ifndef MAC_OS_X_VERSION_10_5 +#ifndef COMPILING_FOR_10_5 static void GraphicsContext_dealloc(GraphicsContext *self) { @@ -1877,7 +1882,7 @@ } -#ifdef MAC_OS_X_VERSION_10_5 +#ifdef COMPILING_FOR_10_5 static CTFontRef #else static ATSFontRef @@ -1891,7 +1896,7 @@ const char* temp; const char* name = "Times-Roman"; CFStringRef string; -#ifdef MAC_OS_X_VERSION_10_5 +#ifdef COMPILING_FOR_10_5 CTFontRef font = 0; #else ATSFontRef font = 0; @@ -2091,7 +2096,7 @@ string = CFStringCreateWithCString(kCFAllocatorDefault, temp, kCFStringEncodingMacRoman); -#ifdef MAC_OS_X_VERSION_10_5 +#ifdef COMPILING_FOR_10_5 font = CTFontCreateWithName(string, size, NULL); #else font = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault); @@ -2109,20 +2114,20 @@ { string = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman); -#ifdef MAC_OS_X_VERSION_10_5 +#ifdef COMPILING_FOR_10_5 font = CTFontCreateWithName(string, size, NULL); #else font = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault); #endif CFRelease(string); } -#ifndef MAC_OS_X_VERSION_10_5 +#ifndef COMPILING_FOR_10_5 CGContextSelectFont(cr, name, size, kCGEncodingMacRoman); #endif return font; } -#ifdef MAC_OS_X_VERSION_10_5 +#ifdef COMPILING_FOR_10_5 static PyObject* GraphicsContext_draw_text (GraphicsContext* self, PyObject* args) { @@ -2821,7 +2826,7 @@ "_macosx.GraphicsContext", /*tp_name*/ sizeof(GraphicsContext), /*tp_basicsize*/ 0, /*tp_itemsize*/ -#ifdef MAC_OS_X_VERSION_10_5 +#ifdef COMPILING_FOR_10_5 0, /*tp_dealloc*/ #else (destructor)GraphicsContext_dealloc, /*tp_dealloc*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |