Revision: 3883
http://skim-app.svn.sourceforge.net/skim-app/?rev=3883&view=rev
Author: hofman
Date: 2008-05-16 12:40:40 -0700 (Fri, 16 May 2008)
Log Message:
-----------
Set main selection for the page on which the actual selection took place rather
than the current page. Move the main selection to another page by clicking in
it on the other page.
Modified Paths:
--------------
trunk/SKPDFView.h
trunk/SKPDFView.m
Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h 2008-05-14 20:13:48 UTC (rev 3882)
+++ trunk/SKPDFView.h 2008-05-16 19:40:40 UTC (rev 3883)
@@ -117,6 +117,7 @@
NSPoint mouseDownLoc;
NSPoint clickDelta;
NSRect selectionRect;
+ unsigned int selectionPageIndex;
float magnification;
BOOL didSelect;
BOOL mouseDownInAnnotation;
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2008-05-14 20:13:48 UTC (rev 3882)
+++ trunk/SKPDFView.m 2008-05-16 19:40:40 UTC (rev 3883)
@@ -235,6 +235,7 @@
mouseDownLoc = NSZeroPoint;
clickDelta = NSZeroPoint;
selectionRect = NSZeroRect;
+ selectionPageIndex = NSNotFound;
magnification = 0.0;
didSelect = NO;
mouseDownInAnnotation = NO;
@@ -431,7 +432,7 @@
CGContextAddRect(context, *(CGRect *)&selectionRect);
CGContextSetFillColor(context, color);
CGContextEOFillPath(context);
- if ([pdfPage isEqual:[self currentPage]] == NO) {
+ if ([pdfPage pageIndex] != selectionPageIndex) {
color[3] = 0.3;
CGContextSetFillColor(context, color);
CGContextFillRect(context, *(CGRect *)&selectionRect);
@@ -730,10 +731,10 @@
[types addObject:SKSkimNotePboardType];
}
- if (toolMode == SKSelectToolMode && NSIsEmptyRect(selectionRect) == NO) {
+ if (toolMode == SKSelectToolMode && NSIsEmptyRect(selectionRect) == NO &&
selectionPageIndex != NSNotFound) {
NSRect selRect = NSIntegralRect(selectionRect);
NSRect targetRect = selRect;
- PDFPage *page = [self currentPage];
+ PDFPage *page = [[self document] pageAtIndex:selectionPageIndex];
if ([page rotation]) {
NSAffineTransform *transform = [NSAffineTransform transform];
@@ -3216,16 +3217,21 @@
NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
PDFPage *page = [self pageForPoint:mouseLoc nearest:NO];
+ float margin = 4.0 / [self scaleFactor];
if (page == nil) {
selectionRect = NSZeroRect;
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPDFViewSelectionChangedNotification object:self];
[self setNeedsDisplay:YES];
return;
+ } else if ([page pageIndex] != selectionPageIndex && selectionPageIndex !=
NSNotFound) {
+ [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin,
-margin) ofPage:[[self document] pageAtIndex:selectionPageIndex]];
+ [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin,
-margin) ofPage:page];
}
+ selectionPageIndex = [page pageIndex];
+
NSPoint initialPoint = [self convertPoint:mouseLoc toPage:page];
- float margin = 4.0 / [self scaleFactor];
dragMask = 0;
@@ -3329,6 +3335,7 @@
if (NSIsEmptyRect(selectionRect)) {
selectionRect = NSZeroRect;
+ selectionPageIndex = NSNotFound;
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPDFViewSelectionChangedNotification object:self];
[self setNeedsDisplay:YES];
} else if (dragMask) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit