Revision: 5598
http://skim-app.svn.sourceforge.net/skim-app/?rev=5598&view=rev
Author: hofman
Date: 2009-08-29 16:03:55 +0000 (Sat, 29 Aug 2009)
Log Message:
-----------
use selectionsByLine preferentially to get markup quadpoints
Modified Paths:
--------------
trunk/PDFAnnotationMarkup_SKExtensions.m
Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m 2009-08-29 13:37:57 UTC (rev
5597)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m 2009-08-29 16:03:55 UTC (rev
5598)
@@ -206,13 +206,22 @@
NSMutableArray *quadPoints = [[NSMutableArray alloc] init];
NSRect newBounds = NSZeroRect;
if (selection) {
- NSUInteger i, iMax = [selection safeNumberOfRangesOnPage:page];
+ NSUInteger i, iMax;
NSRect lineRect = NSZeroRect;
- if (iMax > 0) {
+ if ([selection respondsToSelector:@selector(selectionsByLine)]) {
+ NSEnumerator *selEnum = [[selection selectionsByLine]
objectEnumerator];
+ PDFSelection *sel;
+ while (sel = [selEnum nextObject]) {
+ lineRect = [sel boundsForPage:page];
+ if (NSIsEmptyRect(lineRect) == NO && [[sel string]
rangeOfCharacterFromSet:[NSCharacterSet
nonWhitespaceAndNewlineCharacterSet]].length) {
+ CFArrayAppendValue([self lineRects], &lineRect);
+ newBounds = NSUnionRect(lineRect, newBounds);
+ }
+ }
+ } else if (iMax = [selection safeNumberOfRangesOnPage:page]) {
NSString *string = [page string];
NSRect charRect = NSZeroRect;
NSRect lastCharRect = NSZeroRect;
- iMax = [selection safeNumberOfRangesOnPage:page];
for (i = 0; i < iMax; i++) {
NSRange range = [selection safeRangeAtIndex:i onPage:page];
NSUInteger j, jMax = NSMaxRange(range);
@@ -243,16 +252,6 @@
CFArrayAppendValue([self lineRects], &lineRect);
newBounds = NSUnionRect(lineRect, newBounds);
}
- } else if ([selection
respondsToSelector:@selector(selectionsByLine)]) {
- NSEnumerator *selEnum = [[selection selectionsByLine]
objectEnumerator];
- PDFSelection *sel;
- while (sel = [selEnum nextObject]) {
- lineRect = [sel boundsForPage:page];
- if (NSIsEmptyRect(lineRect) == NO && [[sel string]
rangeOfCharacterFromSet:[NSCharacterSet
nonWhitespaceAndNewlineCharacterSet]].length) {
- CFArrayAppendValue([self lineRects], &lineRect);
- newBounds = NSUnionRect(lineRect, newBounds);
- }
- }
}
if (NSIsEmptyRect(newBounds)) {
[self release];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit