Revision: 6711
http://skim-app.svn.sourceforge.net/skim-app/?rev=6711&view=rev
Author: hofman
Date: 2010-08-18 13:49:00 +0000 (Wed, 18 Aug 2010)
Log Message:
-----------
Workaround for lots of spurious and wrong page changes during zoom changes and
fullscreen switches, ignore page change notifications during these operations.
The current page should never change during these operations anyway, and for
zooming they are corrected with a delay.
Modified Paths:
--------------
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
trunk/SKMainWindowController_UI.m
trunk/SKPDFView.h
trunk/SKPDFView.m
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2010-08-18 13:20:57 UTC (rev 6710)
+++ trunk/SKMainWindowController.h 2010-08-18 13:49:00 UTC (rev 6711)
@@ -176,6 +176,7 @@
unsigned int usesDrawers:1;
unsigned int isEditingPDF:1;
unsigned int isEditingTable:1;
+ unsigned int isSwitchingFullScreen:1;
} mwcFlags;
}
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2010-08-18 13:20:57 UTC (rev 6710)
+++ trunk/SKMainWindowController.m 2010-08-18 13:49:00 UTC (rev 6711)
@@ -1426,6 +1426,8 @@
NSDictionary *fullScreenSetup = [[NSUserDefaults standardUserDefaults]
dictionaryForKey:SKDefaultFullScreenPDFDisplaySettingsKey];
PDFPage *page = [[self pdfView] currentPage];
+ mwcFlags.isSwitchingFullScreen = 1;
+
interactionMode = SKFullScreenMode;
if (wasInteractionMode == SKPresentationMode) {
@@ -1459,6 +1461,8 @@
if ([[[self pdfView] currentPage] isEqual:page] == NO)
[[self pdfView] goToPage:page];
+ mwcFlags.isSwitchingFullScreen = 0;
+
[self forceSubwindowsOnTop:YES];
[pdfView setInteractionMode:SKFullScreenMode];
@@ -1477,6 +1481,8 @@
NSInteger level = [[NSUserDefaults standardUserDefaults]
boolForKey:SKUseNormalLevelForPresentationKey] ? NSNormalWindowLevel :
NSPopUpMenuWindowLevel;
PDFPage *page = [[self pdfView] currentPage];
+ mwcFlags.isSwitchingFullScreen = 1;
+
interactionMode = SKPresentationMode;
if (wasInteractionMode == SKFullScreenMode) {
@@ -1510,6 +1516,8 @@
if ([[[self pdfView] currentPage] isEqual:page] == NO)
[[self pdfView] goToPage:page];
+ mwcFlags.isSwitchingFullScreen = 0;
+
[pdfView setInteractionMode:SKPresentationMode];
}
@@ -1523,6 +1531,8 @@
NSView *contentView;
PDFPage *page = [[self pdfView] currentPage];
+ mwcFlags.isSwitchingFullScreen = 1;
+
if (wasInteractionMode == SKFullScreenMode) {
view = pdfSplitView;
contentView = centerContentView;
@@ -1555,6 +1565,8 @@
if ([[[self pdfView] currentPage] isEqual:page] == NO)
[[self pdfView] goToPage:page];
+ mwcFlags.isSwitchingFullScreen = 0;
+
[self forceSubwindowsOnTop:NO];
interactionMode = SKNormalMode;
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2010-08-18 13:20:57 UTC (rev 6710)
+++ trunk/SKMainWindowController_UI.m 2010-08-18 13:49:00 UTC (rev 6711)
@@ -1492,6 +1492,12 @@
- (void)handlePageChangedNotification:(NSNotification *)notification {
+ // When the PDFView is changing scale, or when view settings change when
switching fullscreen modes,
+ // a lot of wrong page change notifications may be send, which we better
ignore.
+ // Full screen switching and zooming should not change the current page
anyway.
+ if ([pdfView isZooming] || mwcFlags.isSwitchingFullScreen)
+ return;
+
PDFPage *page = [pdfView currentPage];
NSNumber *number = [NSNumber numberWithUnsignedInteger:[page pageIndex]];
Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h 2010-08-18 13:20:57 UTC (rev 6710)
+++ trunk/SKPDFView.h 2010-08-18 13:49:00 UTC (rev 6711)
@@ -118,6 +118,7 @@
NSColor *pathColor;
CGFloat gestureRotation;
NSUInteger gesturePageIndex;
+ BOOL isZooming;
NSTrackingArea *trackingArea;
@@ -128,7 +129,7 @@
@property (nonatomic) SKNoteType annotationMode;
@property (nonatomic, readonly) SKInteractionMode interactionMode;
@property (nonatomic, retain) PDFAnnotation *activeAnnotation;
-...@property (nonatomic, readonly) BOOL isEditing;
+...@property (nonatomic, readonly) BOOL isEditing, isZooming;
@property (nonatomic) NSRect currentSelectionRect;
@property (nonatomic, retain) PDFPage *currentSelectionPage;
@property (nonatomic, readonly) CGFloat currentMagnification;
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2010-08-18 13:20:57 UTC (rev 6710)
+++ trunk/SKPDFView.m 2010-08-18 13:49:00 UTC (rev 6711)
@@ -174,7 +174,7 @@
@implementation SKPDFView
@synthesize toolMode, annotationMode, interactionMode, activeAnnotation,
hideNotes, readingBar, transitionController, typeSelectHelper;
-...@synthesize currentMagnification=magnification;
+...@synthesize currentMagnification=magnification, isZooming;
@dynamic isEditing, hasReadingBar, currentSelectionPage, currentSelectionRect,
undoManager;
+ (void)initialize {
@@ -926,6 +926,24 @@
[[NSFontManager sharedFontManager] orderFrontFontPanel:sender];
}
+- (void)zoomIn:(id)sender {
+ isZooming = YES;
+ [super zoomIn:sender];
+ isZooming = NO;
+}
+
+- (void)zoomOut:(id)sender {
+ isZooming = YES;
+ [super zoomOut:sender];
+ isZooming = NO;
+}
+
+- (void)setScaleFactor:(CGFloat)scale {
+ isZooming = YES;
+ [super setScaleFactor:scale];
+ isZooming = NO;
+}
+
#pragma mark Event Handling
// PDFView has duplicated key equivalents for Cmd-+/- as well as Opt-Cmd-+/-,
which is totoally unnecessary and harmful
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
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit