Revision: 3977
http://skim-app.svn.sourceforge.net/skim-app/?rev=3977&view=rev
Author: hofman
Date: 2008-06-07 06:28:27 -0700 (Sat, 07 Jun 2008)
Log Message:
-----------
Add our prefix to functions converting rects and points
Modified Paths:
--------------
trunk/NSGeometry_SKExtensions.h
trunk/PDFAnnotationLine_SKExtensions.m
trunk/PDFAnnotation_SKExtensions.m
trunk/PDFPage_SKExtensions.m
trunk/SKBoundsCommand.m
trunk/SKPDFDocument.m
Modified: trunk/NSGeometry_SKExtensions.h
===================================================================
--- trunk/NSGeometry_SKExtensions.h 2008-06-06 16:47:44 UTC (rev 3976)
+++ trunk/NSGeometry_SKExtensions.h 2008-06-07 13:28:27 UTC (rev 3977)
@@ -123,38 +123,38 @@
#pragma mark -
static inline
-Rect RectFromNSRect(NSRect rect) {
+Rect SKQDRectFromNSRect(NSRect nsRect) {
Rect qdRect;
- qdRect.left = round(NSMinX(rect));
- qdRect.bottom = round(NSMinY(rect));
- qdRect.right = round(NSMaxX(rect));
- qdRect.top = round(NSMaxY(rect));
+ qdRect.left = round(NSMinX(nsRect));
+ qdRect.bottom = round(NSMinY(nsRect));
+ qdRect.right = round(NSMaxX(nsRect));
+ qdRect.top = round(NSMaxY(nsRect));
return qdRect;
}
static inline
-NSRect NSRectFromRect(Rect qdRect) {
- NSRect rect;
- rect.origin.x = (float)qdRect.left;
- rect.origin.y = (float)qdRect.bottom;
- rect.size.width = (float)(qdRect.right - qdRect.left);
- rect.size.height = (float)(qdRect.top - qdRect.bottom);
- return rect;
+NSRect SKNSRectFromQDRect(Rect qdRect) {
+ NSRect nsRect;
+ nsRect.origin.x = (float)qdRect.left;
+ nsRect.origin.y = (float)qdRect.bottom;
+ nsRect.size.width = (float)(qdRect.right - qdRect.left);
+ nsRect.size.height = (float)(qdRect.top - qdRect.bottom);
+ return nsRect;
}
static inline
-Point PointFromNSPoint(NSPoint point) {
+Point SKQDPointFromNSPoint(NSPoint nsPoint) {
Point qdPoint;
- qdPoint.h = round(point.x);
- qdPoint.v = round(point.y);
+ qdPoint.h = round(nsPoint.x);
+ qdPoint.v = round(nsPoint.y);
return qdPoint;
}
static inline
-NSPoint NSPointFromPoint(Point qdPoint) {
- NSPoint point;
- point.x = (float)qdPoint.h;
- point.y = (float)qdPoint.v;
- return point;
+NSPoint SKNSPointFromQDPoint(Point qdPoint) {
+ NSPoint nsPoint;
+ nsPoint.x = (float)qdPoint.h;
+ nsPoint.y = (float)qdPoint.v;
+ return nsPoint;
}
Modified: trunk/PDFAnnotationLine_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLine_SKExtensions.m 2008-06-06 16:47:44 UTC (rev
3976)
+++ trunk/PDFAnnotationLine_SKExtensions.m 2008-06-07 13:28:27 UTC (rev
3977)
@@ -212,7 +212,7 @@
- (void)setStartPointAsQDPoint:(NSData *)inQDPointAsData {
if ([inQDPointAsData length] == sizeof(Point)) {
const Point *qdPoint = (const Point *)[inQDPointAsData bytes];
- NSPoint startPoint = NSPointFromPoint(*qdPoint);
+ NSPoint startPoint = SKNSPointFromQDPoint(*qdPoint);
NSRect bounds = [self bounds];
NSPoint endPoint = SKIntegralPoint(SKAddPoints([self endPoint],
bounds.origin));
@@ -243,14 +243,14 @@
NSPoint startPoint = SKAddPoints([self startPoint], bounds.origin);
startPoint.x = floorf(startPoint.x);
startPoint.y = floorf(startPoint.y);
- Point qdPoint = PointFromNSPoint(startPoint);
+ Point qdPoint = SKQDPointFromNSPoint(startPoint);
return [NSData dataWithBytes:&qdPoint length:sizeof(Point)];
}
- (void)setEndPointAsQDPoint:(NSData *)inQDPointAsData {
if ([inQDPointAsData length] == sizeof(Point)) {
const Point *qdPoint = (const Point *)[inQDPointAsData bytes];
- NSPoint endPoint = NSPointFromPoint(*qdPoint);
+ NSPoint endPoint = SKNSPointFromQDPoint(*qdPoint);
NSRect bounds = [self bounds];
NSPoint startPoint = SKIntegralPoint(SKAddPoints([self startPoint],
bounds.origin));
@@ -281,7 +281,7 @@
NSPoint endPoint = SKAddPoints([self endPoint], bounds.origin);
endPoint.x = floorf(endPoint.x);
endPoint.y = floorf(endPoint.y);
- Point qdPoint = PointFromNSPoint(endPoint);
+ Point qdPoint = SKQDPointFromNSPoint(endPoint);
return [NSData dataWithBytes:&qdPoint length:sizeof(Point)];
}
Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m 2008-06-06 16:47:44 UTC (rev 3976)
+++ trunk/PDFAnnotation_SKExtensions.m 2008-06-07 13:28:27 UTC (rev 3977)
@@ -523,7 +523,7 @@
- (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData {
if ([inQDBoundsAsData length] == sizeof(Rect) && [self isMovable]) {
const Rect *qdBounds = (const Rect *)[inQDBoundsAsData bytes];
- NSRect newBounds = NSRectFromRect(*qdBounds);
+ NSRect newBounds = SKNSRectFromQDRect(*qdBounds);
if ([self isResizable] == NO) {
newBounds.size = [self bounds].size;
} else {
@@ -538,7 +538,7 @@
}
- (NSData *)boundsAsQDRect {
- Rect qdBounds = RectFromNSRect([self bounds]);
+ Rect qdBounds = SKQDRectFromNSRect([self bounds]);
return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)];
}
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2008-06-06 16:47:44 UTC (rev 3976)
+++ trunk/PDFPage_SKExtensions.m 2008-06-07 13:28:27 UTC (rev 3977)
@@ -373,7 +373,7 @@
}
- (NSData *)boundsAsQDRect {
- Rect qdBounds = RectFromNSRect([self boundsForBox:kPDFDisplayBoxCropBox]);
+ Rect qdBounds = SKQDRectFromNSRect([self
boundsForBox:kPDFDisplayBoxCropBox]);
return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)];
}
@@ -386,7 +386,7 @@
// but we cannot undo the document change count because there may be
real changes to the document in the script
const Rect *qdBounds = (const Rect *)[inQDBoundsAsData bytes];
- NSRect newBounds = NSRectFromRect(*qdBounds);
+ NSRect newBounds = SKNSRectFromQDRect(*qdBounds);
if (NSWidth(newBounds) < 0.0)
newBounds.size.width = 0.0;
if (NSHeight(newBounds) < 0.0)
@@ -399,7 +399,7 @@
}
- (NSData *)mediaBoundsAsQDRect {
- Rect qdBounds = RectFromNSRect([self boundsForBox:kPDFDisplayBoxMediaBox]);
+ Rect qdBounds = SKQDRectFromNSRect([self
boundsForBox:kPDFDisplayBoxMediaBox]);
return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)];
}
@@ -412,7 +412,7 @@
// but we cannot undo the document change count because there may be
real changes to the document in the script
const Rect *qdBounds = (const Rect *)[inQDBoundsAsData bytes];
- NSRect newBounds = NSRectFromRect(*qdBounds);
+ NSRect newBounds = SKNSRectFromQDRect(*qdBounds);
if (NSWidth(newBounds) < 0.0)
newBounds.size.width = 0.0;
if (NSHeight(newBounds) < 0.0)
@@ -425,7 +425,7 @@
}
- (NSData *)contentBoundsAsQDRect {
- Rect qdBounds = RectFromNSRect([self foregroundBox]);
+ Rect qdBounds = SKQDRectFromNSRect([self foregroundBox]);
return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)];
}
Modified: trunk/SKBoundsCommand.m
===================================================================
--- trunk/SKBoundsCommand.m 2008-06-06 16:47:44 UTC (rev 3976)
+++ trunk/SKBoundsCommand.m 2008-06-07 13:28:27 UTC (rev 3977)
@@ -80,7 +80,7 @@
bounds = [selection boundsForPage:page];
}
- Rect qdBounds = RectFromNSRect(bounds);
+ Rect qdBounds = SKQDRectFromNSRect(bounds);
return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)];
}
Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m 2008-06-06 16:47:44 UTC (rev 3976)
+++ trunk/SKPDFDocument.m 2008-06-07 13:28:27 UTC (rev 3977)
@@ -1855,14 +1855,14 @@
}
- (NSData *)selectionQDRect {
- Rect qdRect = RectFromNSRect([[self pdfView] currentSelectionRect]);
+ Rect qdRect = SKQDRectFromNSRect([[self pdfView] currentSelectionRect]);
return [NSData dataWithBytes:&qdRect length:sizeof(Rect)];
}
- (void)setSelectionQDRect:(NSData *)inQDRectAsData {
if ([inQDRectAsData length] == sizeof(Rect)) {
const Rect *qdBounds = (const Rect *)[inQDRectAsData bytes];
- NSRect newBounds = NSRectFromRect(*qdBounds);
+ NSRect newBounds = SKNSRectFromQDRect(*qdBounds);
[[self pdfView] setCurrentSelectionRect:newBounds];
if ([[self pdfView] currentSelectionPage] == nil)
[[self pdfView] setCurrentSelectionPage:[[self pdfView]
currentPage]];
@@ -2055,7 +2055,7 @@
page = [[self pdfView] currentPage];
if ([pointData isKindOfClass:[NSDate class]] && [pointData length] !=
sizeof(Point)) {
const Point *qdPoint = (const Point *)[pointData bytes];
- point = NSPointFromPoint(*qdPoint);
+ point = SKNSPointFromQDPoint(*qdPoint);
} else {
NSRect bounds = [page boundsForBox:[[self pdfView] displayBox]];
point = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit