2001-12-17 14:31:42 +00:00
|
|
|
/** NSGeometry.m - geometry functions
|
1996-03-22 00:36:13 +00:00
|
|
|
* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
2005-02-22 11:22:44 +00:00
|
|
|
*
|
1996-03-22 00:36:13 +00:00
|
|
|
* Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
|
|
|
* Date: Mar 1995
|
2005-02-22 11:22:44 +00:00
|
|
|
*
|
1996-05-12 00:56:10 +00:00
|
|
|
* This file is part of the GNUstep Base Library.
|
2005-02-22 11:22:44 +00:00
|
|
|
*
|
1996-03-22 00:36:13 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
2005-02-22 11:22:44 +00:00
|
|
|
*
|
1996-03-22 00:36:13 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
2005-02-22 11:22:44 +00:00
|
|
|
*
|
1996-03-22 00:36:13 +00:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
2005-05-22 03:32:16 +00:00
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
2001-12-18 16:54:15 +00:00
|
|
|
|
|
|
|
<title>NSGeometry class reference</title>
|
|
|
|
$Date$ $Revision$
|
2005-02-22 11:22:44 +00:00
|
|
|
*/
|
1996-03-22 00:36:13 +00:00
|
|
|
|
1999-02-12 17:03:09 +00:00
|
|
|
/*
|
|
|
|
* Define IN_NSGEOMETRY_M so that the Foundation/NSGeometry.h header can
|
|
|
|
* provide non-inline versions of the function implementations for us.
|
|
|
|
*/
|
|
|
|
#define IN_NSGEOMETRY_M
|
|
|
|
|
2002-10-09 06:07:38 +00:00
|
|
|
|
|
|
|
/**** Included Headers *******************************************************/
|
|
|
|
|
2003-06-07 01:24:41 +00:00
|
|
|
#include "config.h"
|
1995-03-23 03:51:32 +00:00
|
|
|
#include <math.h>
|
2003-07-31 23:49:32 +00:00
|
|
|
#include "GNUstepBase/preface.h"
|
2003-06-07 01:24:41 +00:00
|
|
|
#include "Foundation/NSString.h"
|
|
|
|
#include "Foundation/NSGeometry.h"
|
|
|
|
#include "Foundation/NSScanner.h"
|
|
|
|
#include "Foundation/NSNotification.h"
|
1995-03-23 03:51:32 +00:00
|
|
|
|
2002-11-09 16:40:00 +00:00
|
|
|
extern BOOL GSMacOSXCompatibleGeometry(void); // Compatibility mode
|
2000-09-13 12:32:19 +00:00
|
|
|
|
1999-09-27 19:56:21 +00:00
|
|
|
static Class NSStringClass = 0;
|
|
|
|
static Class NSScannerClass = 0;
|
2000-10-30 18:00:27 +00:00
|
|
|
static SEL scanFloatSel;
|
|
|
|
static SEL scanStringSel;
|
|
|
|
static SEL scannerSel;
|
1999-09-27 19:56:21 +00:00
|
|
|
static BOOL (*scanFloatImp)(NSScanner*, SEL, float*);
|
|
|
|
static BOOL (*scanStringImp)(NSScanner*, SEL, NSString*, NSString**);
|
|
|
|
static id (*scannerImp)(Class, SEL, NSString*);
|
|
|
|
|
|
|
|
static inline void
|
2002-11-09 16:40:00 +00:00
|
|
|
setupCache(void)
|
1999-09-27 19:56:21 +00:00
|
|
|
{
|
|
|
|
if (NSStringClass == 0)
|
|
|
|
{
|
|
|
|
NSStringClass = [NSString class];
|
|
|
|
NSScannerClass = [NSScanner class];
|
2000-10-30 18:00:27 +00:00
|
|
|
scanFloatSel = @selector(scanFloat:);
|
|
|
|
scanStringSel = @selector(scanString:intoString:);
|
|
|
|
scannerSel = @selector(scannerWithString:);
|
1999-09-27 19:56:21 +00:00
|
|
|
scanFloatImp = (BOOL (*)(NSScanner*, SEL, float*))
|
|
|
|
[NSScannerClass instanceMethodForSelector: scanFloatSel];
|
|
|
|
scanStringImp = (BOOL (*)(NSScanner*, SEL, NSString*, NSString**))
|
|
|
|
[NSScannerClass instanceMethodForSelector: scanStringSel];
|
|
|
|
scannerImp = (id (*)(Class, SEL, NSString*))
|
|
|
|
[NSScannerClass methodForSelector: scannerSel];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1996-03-22 00:36:13 +00:00
|
|
|
/**** Function Implementations ***********************************************/
|
1999-02-12 17:03:09 +00:00
|
|
|
/* Most of these are implemented in the header file as inline functkions */
|
1995-03-23 03:51:32 +00:00
|
|
|
|
1999-02-12 17:04:53 +00:00
|
|
|
NSRect
|
|
|
|
NSIntegralRect(NSRect aRect)
|
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
NSRect rect;
|
1999-02-12 17:04:53 +00:00
|
|
|
|
|
|
|
if (NSIsEmptyRect(aRect))
|
|
|
|
return NSMakeRect(0, 0, 0, 0);
|
|
|
|
|
2003-12-23 17:11:14 +00:00
|
|
|
rect.origin.x = floor(NSMinX(aRect));
|
|
|
|
rect.origin.y = floor(NSMinY(aRect));
|
|
|
|
rect.size.width = ceil(NSMaxX(aRect)) - rect.origin.x;
|
|
|
|
rect.size.height = ceil(NSMaxY(aRect)) - rect.origin.y;
|
1999-02-12 17:04:53 +00:00
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
1995-03-23 03:51:32 +00:00
|
|
|
void
|
1996-03-22 00:36:13 +00:00
|
|
|
NSDivideRect(NSRect aRect,
|
|
|
|
NSRect *slice,
|
|
|
|
NSRect *remainder,
|
|
|
|
float amount,
|
|
|
|
NSRectEdge edge)
|
1995-03-23 03:51:32 +00:00
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
static NSRect sRect;
|
|
|
|
static NSRect rRect;
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1996-03-22 00:36:13 +00:00
|
|
|
if (!slice)
|
|
|
|
slice = &sRect;
|
|
|
|
if (!remainder)
|
|
|
|
remainder = &rRect;
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1996-03-22 00:36:13 +00:00
|
|
|
if (NSIsEmptyRect(aRect))
|
1999-09-27 19:56:21 +00:00
|
|
|
{
|
|
|
|
*slice = NSMakeRect(0,0,0,0);
|
|
|
|
*remainder = NSMakeRect(0,0,0,0);
|
|
|
|
return;
|
|
|
|
}
|
1996-03-22 00:36:13 +00:00
|
|
|
|
|
|
|
switch (edge)
|
1999-09-27 19:56:21 +00:00
|
|
|
{
|
|
|
|
case NSMinXEdge:
|
|
|
|
if (amount > aRect.size.width)
|
|
|
|
{
|
|
|
|
*slice = aRect;
|
|
|
|
*remainder = NSMakeRect(NSMaxX(aRect),
|
2005-02-22 11:22:44 +00:00
|
|
|
aRect.origin.y,
|
1999-09-27 19:56:21 +00:00
|
|
|
0,
|
|
|
|
aRect.size.height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1996-03-22 00:36:13 +00:00
|
|
|
*slice = NSMakeRect(aRect.origin.x,
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.origin.y,
|
2005-02-22 11:22:44 +00:00
|
|
|
amount,
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.size.height);
|
|
|
|
*remainder = NSMakeRect(NSMaxX(*slice),
|
2005-02-22 11:22:44 +00:00
|
|
|
aRect.origin.y,
|
1999-09-27 19:56:21 +00:00
|
|
|
NSMaxX(aRect) - NSMaxX(*slice),
|
|
|
|
aRect.size.height);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NSMinYEdge:
|
|
|
|
if (amount > aRect.size.height)
|
|
|
|
{
|
1995-03-23 03:51:32 +00:00
|
|
|
*slice = aRect;
|
1996-03-22 00:36:13 +00:00
|
|
|
*remainder = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
NSMaxY(aRect),
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.size.width, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*slice = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
aRect.origin.y,
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.size.width,
|
|
|
|
amount);
|
|
|
|
*remainder = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
NSMaxY(*slice),
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.size.width,
|
|
|
|
NSMaxY(aRect) - NSMaxY(*slice));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case (NSMaxXEdge):
|
|
|
|
if (amount > aRect.size.width)
|
|
|
|
{
|
|
|
|
*slice = aRect;
|
|
|
|
*remainder = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
aRect.origin.y,
|
1999-09-27 19:56:21 +00:00
|
|
|
0,
|
|
|
|
aRect.size.height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1996-03-22 00:36:13 +00:00
|
|
|
*slice = NSMakeRect(NSMaxX(aRect) - amount,
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.origin.y,
|
|
|
|
amount,
|
|
|
|
aRect.size.height);
|
|
|
|
*remainder = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
aRect.origin.y,
|
1999-09-27 19:56:21 +00:00
|
|
|
NSMinX(*slice) - aRect.origin.x,
|
|
|
|
aRect.size.height);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NSMaxYEdge:
|
|
|
|
if (amount > aRect.size.height)
|
|
|
|
{
|
|
|
|
*slice = aRect;
|
1996-03-22 00:36:13 +00:00
|
|
|
*remainder = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
aRect.origin.y,
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.size.width,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*slice = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
NSMaxY(aRect) - amount,
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.size.width,
|
|
|
|
amount);
|
|
|
|
*remainder = NSMakeRect(aRect.origin.x,
|
2005-02-22 11:22:44 +00:00
|
|
|
aRect.origin.y,
|
1999-09-27 19:56:21 +00:00
|
|
|
aRect.size.width,
|
|
|
|
NSMinY(*slice) - aRect.origin.y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1996-03-22 00:36:13 +00:00
|
|
|
|
|
|
|
return;
|
1995-03-23 03:51:32 +00:00
|
|
|
}
|
|
|
|
|
1996-03-22 00:36:13 +00:00
|
|
|
/** Get a String Representation... **/
|
2005-08-22 22:51:02 +00:00
|
|
|
/* NOTE: Spaces around '=' so that old OpenStep implementations can
|
|
|
|
read our strings (Both GNUstep and Mac OS X can read these as well). */
|
1996-03-22 00:36:13 +00:00
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
NSString*
|
1996-03-22 00:36:13 +00:00
|
|
|
NSStringFromPoint(NSPoint aPoint)
|
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
setupCache();
|
2000-09-13 12:32:19 +00:00
|
|
|
if (GSMacOSXCompatibleGeometry() == YES)
|
2000-09-07 16:42:45 +00:00
|
|
|
return [NSStringClass stringWithFormat:
|
|
|
|
@"{%g, %g}", aPoint.x, aPoint.y];
|
|
|
|
else
|
|
|
|
return [NSStringClass stringWithFormat:
|
2005-08-22 22:51:02 +00:00
|
|
|
@"{x = %g; y = %g}", aPoint.x, aPoint.y];
|
1996-03-22 00:36:13 +00:00
|
|
|
}
|
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
NSString*
|
1996-03-22 00:36:13 +00:00
|
|
|
NSStringFromRect(NSRect aRect)
|
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
setupCache();
|
2000-09-13 12:32:19 +00:00
|
|
|
if (GSMacOSXCompatibleGeometry() == YES)
|
2000-09-07 16:42:45 +00:00
|
|
|
return [NSStringClass stringWithFormat:
|
|
|
|
@"{{%g, %g}, {%g, %g}}",
|
|
|
|
aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height];
|
|
|
|
else
|
|
|
|
return [NSStringClass stringWithFormat:
|
2005-08-22 22:51:02 +00:00
|
|
|
@"{x = %g; y = %g; width = %g; height = %g}",
|
2000-09-07 16:42:45 +00:00
|
|
|
aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height];
|
1996-03-22 00:36:13 +00:00
|
|
|
}
|
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
NSString*
|
1996-03-22 00:36:13 +00:00
|
|
|
NSStringFromSize(NSSize aSize)
|
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
setupCache();
|
2000-09-13 12:32:19 +00:00
|
|
|
if (GSMacOSXCompatibleGeometry() == YES)
|
2000-09-07 16:42:45 +00:00
|
|
|
return [NSStringClass stringWithFormat:
|
|
|
|
@"{%g, %g}", aSize.width, aSize.height];
|
|
|
|
else
|
|
|
|
return [NSStringClass stringWithFormat:
|
2005-08-22 22:51:02 +00:00
|
|
|
@"{width = %g; height = %g}", aSize.width, aSize.height];
|
1995-03-23 03:51:32 +00:00
|
|
|
}
|
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
NSPoint
|
|
|
|
NSPointFromString(NSString* string)
|
1997-12-19 18:13:52 +00:00
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
NSScanner *scanner;
|
|
|
|
NSPoint point;
|
1997-12-19 18:13:52 +00:00
|
|
|
|
1999-09-27 19:56:21 +00:00
|
|
|
setupCache();
|
|
|
|
scanner = (*scannerImp)(NSScannerClass, scannerSel, string);
|
|
|
|
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"x", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &point.x)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"y", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &point.y)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
|
2000-09-07 16:42:45 +00:00
|
|
|
{
|
|
|
|
return point;
|
|
|
|
}
|
1997-12-19 18:13:52 +00:00
|
|
|
else
|
2000-09-07 16:42:45 +00:00
|
|
|
{
|
|
|
|
[scanner setScanLocation: 0];
|
|
|
|
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &point.x)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &point.y)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
|
|
|
|
{
|
|
|
|
return point;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NSMakePoint(0, 0);
|
|
|
|
}
|
|
|
|
}
|
1997-12-19 18:13:52 +00:00
|
|
|
}
|
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
NSSize
|
|
|
|
NSSizeFromString(NSString* string)
|
1997-12-19 18:13:52 +00:00
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
NSScanner *scanner;
|
|
|
|
NSSize size;
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1999-09-27 19:56:21 +00:00
|
|
|
setupCache();
|
|
|
|
scanner = (*scannerImp)(NSScannerClass, scannerSel, string);
|
|
|
|
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"width", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &size.width)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"height", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &size.height)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
|
2000-09-07 16:42:45 +00:00
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
1997-12-19 18:13:52 +00:00
|
|
|
else
|
2000-09-07 16:42:45 +00:00
|
|
|
{
|
|
|
|
[scanner setScanLocation: 0];
|
|
|
|
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &size.width)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &size.height)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
|
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NSMakeSize(0, 0);
|
|
|
|
}
|
|
|
|
}
|
1997-12-19 18:13:52 +00:00
|
|
|
}
|
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
NSRect
|
|
|
|
NSRectFromString(NSString* string)
|
1997-12-19 18:13:52 +00:00
|
|
|
{
|
1999-09-27 19:56:21 +00:00
|
|
|
NSScanner *scanner;
|
|
|
|
NSRect rect;
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1999-09-27 19:56:21 +00:00
|
|
|
setupCache();
|
|
|
|
scanner = (*scannerImp)(NSScannerClass, scannerSel, string);
|
|
|
|
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"x", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.origin.x)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
|
|
|
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"y", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.origin.y)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1999-09-27 19:56:21 +00:00
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"width", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.width)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1999-09-27 19:56:21 +00:00
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"height", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.height)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
|
2000-09-07 16:42:45 +00:00
|
|
|
{
|
|
|
|
return rect;
|
|
|
|
}
|
1997-12-19 18:13:52 +00:00
|
|
|
else
|
2000-09-07 16:42:45 +00:00
|
|
|
{
|
|
|
|
[scanner setScanLocation: 0];
|
|
|
|
if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.origin.x)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
|
|
|
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.origin.y)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
2005-02-22 11:22:44 +00:00
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"{", NULL)
|
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.width)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
2005-02-22 11:22:44 +00:00
|
|
|
|
2000-09-07 16:42:45 +00:00
|
|
|
&& (*scanFloatImp)(scanner, scanFloatSel, &rect.size.height)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL)
|
|
|
|
&& (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
|
|
|
|
{
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NSMakeRect(0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
1997-12-19 18:13:52 +00:00
|
|
|
}
|
|
|
|
|