I've been highlighting a multi-column paper, and I agree with other users that
it's annoying to either have the highlight bounds extend outside what I
actually want to highlight, or have multiple short highlights for each line
(which shows up as multiple lines in the outline view).
For my own use, I thought I could merge markups together by creating a new
annotation in SKPDFView.m, but if I merge three separate highlights (top,
middle, bottom), I lose the middle line. Am I missing something obvious? The
only thing I can think of is some restriction on ordering of quad points.
- (void)mergeAnnotationsInSelection:(id)sender {
NSArray *annotations = [[self currentPage] annotations];
NSMutableArray *quadPoints = [NSMutableArray array];
NSRect bounds = NSZeroRect;
unsigned i, iMax = [annotations count];
int markupType = -1;
SKPDFAnnotationMarkup *ann = nil;
// don't remove while enumerating the current annotations
NSMutableArray *annotationsToRemove = [NSMutableArray array];
for (i = 0; i < iMax; i++) {
ann = [annotations objectAtIndex:i];
if (NSIntersectsRect([ann bounds], selectionRect) && [ann
isMarkupAnnotation]) {
if (-1 == markupType) {
bounds = [ann bounds];
markupType = [ann markupType];
}
else if ([ann markupType] == markupType) {
bounds = NSUnionRect(bounds, [ann bounds]);
[quadPoints addObjectsFromArray:[ann quadrilateralPoints]];
[annotationsToRemove addObject:ann];
}
}
}
iMax = [annotationsToRemove count];
for (i = 0; i < iMax; i++)
[self removeAnnotation:[annotationsToRemove objectAtIndex:i]];
NSMutableArray *quadStrings = [NSMutableArray arrayWithCapacity:[quadPoints
count]];
iMax = [quadPoints count];
for (i = 0; i < iMax; i++)
[quadStrings addObject:NSStringFromPoint([[quadPoints objectAtIndex:i]
pointValue])];
ann = [[SKPDFAnnotationMarkup alloc] initWithBounds:bounds
markupType:markupType quadrilateralPointsAsStrings:quadStrings];
[self addAnnotation:ann toPage:[self currentPage]];
[ann release];
[self setNeedsDisplayInRect:selectionRect ofPage:[self currentPage]];
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
skim-app-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-develop