[Chlor-commits] SF.net SVN: chlor: [334] trunk/src/core
Status: Pre-Alpha
Brought to you by:
lenny222
From: <chl...@li...> - 2006-04-02 12:15:16
|
Revision: 334 Author: lenny222 Date: 2006-04-02 05:14:56 -0700 (Sun, 02 Apr 2006) ViewCVS: http://svn.sourceforge.net/chlor/?rev=334&view=rev Log Message: ----------- more cleanup Modified Paths: -------------- trunk/src/core/CAffineMap.m trunk/src/core/CFont.h trunk/src/core/CFont.m trunk/src/core/CNode.h trunk/src/core/CNode.m trunk/src/core/CPath.m trunk/src/core/CPoint.h trunk/src/core/CPoint.m trunk/src/core/CSegment.m trunk/src/io/svg/CSvgImport.m Modified: trunk/src/core/CAffineMap.m =================================================================== --- trunk/src/core/CAffineMap.m 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CAffineMap.m 2006-04-02 12:14:56 UTC (rev 334) @@ -51,7 +51,7 @@ { const double x = m_mat[ 0 ][ 0 ] * [point x] + m_mat[ 0 ][ 1 ] * [point y] + m_vec[ 0 ]; const double y = m_mat[ 1 ][ 0 ] * [point x] + m_mat[ 1 ][ 1 ] * [point y] + m_vec[ 1 ]; - return [[[CPoint alloc] initWithX:x Y:y] autorelease]; + return [[[CPoint alloc] initWithX: x y: y] autorelease]; } - (double) determinant Modified: trunk/src/core/CFont.h =================================================================== --- trunk/src/core/CFont.h 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CFont.h 2006-04-02 12:14:56 UTC (rev 334) @@ -44,7 +44,10 @@ /** * Init. */ -- (id) initWithName: (NSString*) theName Size: (double) theSize Margin: (double) theMargin; +- (id) + initWithName: (NSString*) theName + size: (double) theSize + margin: (double) theMargin; /** * Creates a copy of the font with a different margin. Modified: trunk/src/core/CFont.m =================================================================== --- trunk/src/core/CFont.m 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CFont.m 2006-04-02 12:14:56 UTC (rev 334) @@ -36,7 +36,10 @@ return self; } -- (id) initWithName: (NSString*) theName Size: (double) theSize Margin: (double) theMargin +- (id) + initWithName: (NSString*) theName + size: (double) theSize + margin: (double) theMargin { self = [super init]; Modified: trunk/src/core/CNode.h =================================================================== --- trunk/src/core/CNode.h 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CNode.h 2006-04-02 12:14:56 UTC (rev 334) @@ -36,9 +36,8 @@ * @param point Point */ -+ (CNode *) nodeWithPoint:(CPoint *)point; ++ (CNode *) nodeWithPoint: (CPoint*) point; - /** * Factory method * Construct a node with x and y coordinates @@ -46,42 +45,39 @@ * @param x X coordinate * @param y Y coordinate */ -+ (CNode *) nodeWithX:(double)x andY:(double)y; ++ (CNode *) nodeWithX: (double) x y: (double) y; - /** * Initialize the node with a point * * @param point Point */ -- (id) initWithPoint:(CPoint *)point; +- (id) initWithPoint: (CPoint*) point; - /** * Initialize the node with x and y coordinate * * @param x X coordinate * @param y Y coordinate */ -- (id) initWithX: (double)x Y: (double)y; +- (id) initWithX: (double) x y: (double) y; +// Point +- (CPoint*) point; +// Move node to new coordinate +- (void) moveToX: (double) x y: (double) y; + +- (void) moveToPoint:(CPoint *)point; + /** * @return X coordinate of the node */ - (double) x; - /** * @return Y coordinate of the node */ - (double) y; -// Point -- (CPoint *) point; - - -// Move node to new coordinate -- (void) moveToX:(double)x andY:(double)y; -- (void) moveToPoint:(CPoint *)point; @end Modified: trunk/src/core/CNode.m =================================================================== --- trunk/src/core/CNode.m 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CNode.m 2006-04-02 12:14:56 UTC (rev 334) @@ -21,24 +21,8 @@ @implementation CNode -+ (CNode *) nodeWithX:(double)x andY:(double)y +- (id) initWithX: (double) x y: (double) y { - CNode * result = [[CNode alloc] initWithX:x Y:y]; - [result autorelease]; - return result; -} - - -+ (CNode *) nodeWithPoint:(CPoint *)point -{ - CNode* result = [[CNode alloc] initWithPoint:point]; - [result autorelease]; - return result; -} - - -- (id) initWithX: (double)x Y: (double)y -{ if (self = [super init]) { m_selected = NO; @@ -48,8 +32,7 @@ return self; } - -- (id) initWithPoint:(CPoint *)point +- (id) initWithPoint: (CPoint*) point { if (self=[super init]) { @@ -60,18 +43,26 @@ return self; } +- (id) copyWithZone: (NSZone*) zone +{ + CNode* copy = [[CNode allocWithZone:zone] initWithX: m_x y: m_y]; + copy->m_selected = m_selected; + return copy; +} - (void) dealloc { [super dealloc]; } ++ (CNode*) nodeWithX: (double) x y: (double) y +{ + return [[[CNode alloc] initWithX: x y: y] autorelease]; +} -- (id) copyWithZone: (NSZone*) zone ++ (CNode*) nodeWithPoint: (CPoint*) point { - CNode* copy = [[CNode allocWithZone:zone] initWithX:m_x Y:m_y]; - copy->m_selected = m_selected; - return copy; + return [[[CNode alloc] initWithPoint: point] autorelease]; } @@ -80,48 +71,42 @@ m_selected = NO; } - - (BOOL) isSelected { return m_selected; } - - (void) select { m_selected = YES; } - -- (double) x +- (CPoint*) point { - return m_x; + CPoint* point = [[CPoint alloc] initWithX: m_x y: m_y]; + [point autorelease]; + return point; } - -- (double) y +- (void) moveToX: (double) x y: (double) y { - return m_y; + m_x = x; + m_y = y; } - -- (CPoint *) point +- (void) moveToPoint: (CPoint*) point { - CPoint* point = [[CPoint alloc] initWithX:m_x Y:m_y]; - [point autorelease]; - return point; + [self moveToX: [point x] y: [point y]]; } - -- (void) moveToX:(double)x andY:(double)y +- (double) x { - m_x = x; - m_y = y; + return m_x; } - -- (void) moveToPoint:(CPoint *)point +- (double) y { - [self moveToX:[point x] andY:[point y]]; + return m_y; } + @end Modified: trunk/src/core/CPath.m =================================================================== --- trunk/src/core/CPath.m 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CPath.m 2006-04-02 12:14:56 UTC (rev 334) @@ -314,9 +314,9 @@ // Set points. CNode* knotCopy = [[last knot] copy]; [seg addNode: knotCopy]; - [seg addNode: [[[CNode alloc] initWithX: x1 Y: y1] autorelease]]; - [seg addNode: [[[CNode alloc] initWithX: x2 Y: y2] autorelease]]; - [seg addNode: [[[CNode alloc] initWithX: x Y: y] autorelease]]; + [seg addNode: [CNode nodeWithX: x1 y: y1]]; + [seg addNode: [CNode nodeWithX: x2 y: y2]]; + [seg addNode: [CNode nodeWithX: x y: y]]; [knotCopy release]; return YES; @@ -350,7 +350,7 @@ // Set points. CNode* knotCopy = [[last knot] copy]; [seg addNode: knotCopy]; - [seg addNode: [[[CNode alloc] initWithX: x Y: y] autorelease]]; + [seg addNode: [CNode nodeWithX: x y: y]]; [knotCopy release]; return YES; @@ -370,7 +370,7 @@ [self add: seg]; // Set point. - [seg addNode: [[[CNode alloc] initWithX: x Y: y] autorelease]]; + [seg addNode: [CNode nodeWithX: x y: y]]; return YES; } Modified: trunk/src/core/CPoint.h =================================================================== --- trunk/src/core/CPoint.h 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CPoint.h 2006-04-02 12:14:56 UTC (rev 334) @@ -28,8 +28,8 @@ double m_y; } -- (id) initWithX: (double) x Y: (double) y; -+ (CPoint*) pointWithX: (double) x Y: (double) y; +- (id) initWithX: (double) x y: (double) y; ++ (CPoint*) pointWithX: (double) x y: (double) y; /** * Returns the x coordinate. @@ -44,7 +44,7 @@ /** * Changes the node's position. */ -- (void) moveToX: (double) x andY: (double) y; +- (void) moveToX: (double) x y: (double) y; /** * Returns the distance to aPoint. Modified: trunk/src/core/CPoint.m =================================================================== --- trunk/src/core/CPoint.m 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CPoint.m 2006-04-02 12:14:56 UTC (rev 334) @@ -35,7 +35,7 @@ } -- (id) initWithX: (double) x Y: (double) y +- (id) initWithX: (double) x y: (double) y { self = [super init]; @@ -56,9 +56,9 @@ } -+ (CPoint*) pointWithX: (double) x Y: (double) y ++ (CPoint*) pointWithX: (double) x y: (double) y { - return [[[CPoint alloc] initWithX: x Y: y] autorelease]; + return [[[CPoint alloc] initWithX: x y: y] autorelease]; } @@ -71,27 +71,20 @@ aNSPoint->y = m_y; } -/* - * X coordinate - */ -- (double) x { +- (double) x +{ return m_x; } -/* - * Y coordinate - */ -- (double) y { +- (double) y +{ return m_y; } -/* - * Change the position of the node - */ -- (void) moveToX:(double)x andY:(double)y +- (void) moveToX: (double) x y: (double) y { - m_x =x; - m_y=y; + m_x = x; + m_y = y; } Modified: trunk/src/core/CSegment.m =================================================================== --- trunk/src/core/CSegment.m 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/core/CSegment.m 2006-04-02 12:14:56 UTC (rev 334) @@ -239,7 +239,7 @@ CNode* currentPoint = (CNode*) [points objectAtIndex: i]; double x = ( 1.0 - t ) * [currentPoint x] + t * [nextPoint x]; double y = ( 1.0 - t ) * [currentPoint y] + t * [nextPoint y]; - [currentPoint moveToX:x andY:y]; + [currentPoint moveToX: x y: y]; } // Set the points for the first segment. Modified: trunk/src/io/svg/CSvgImport.m =================================================================== --- trunk/src/io/svg/CSvgImport.m 2006-04-02 11:58:48 UTC (rev 333) +++ trunk/src/io/svg/CSvgImport.m 2006-04-02 12:14:56 UTC (rev 334) @@ -1550,7 +1550,7 @@ double y = 0.0; if( ( attribute = [theElement attributeForName: @"y"] ) ) y = [[attribute stringValue] doubleValue]; - CPoint* point = [[CPoint alloc] initWithX:x Y:y]; + CPoint* point = [CPoint pointWithX: x y: y]; [text setOrigin: point]; // Import "dx" . @@ -1581,7 +1581,11 @@ fontSize = [[attribute stringValue] doubleValue]; // Create and set the font. - CFont* font = [[CFont alloc] initWithName: fontName Size: fontSize Margin: 0.0]; + CFont* font = + [[CFont alloc] + initWithName: fontName + size: fontSize + margin: 0.0]; [text setFont: font]; [font release]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |