Revision: 4881
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4881&view=rev
Author:   hofman
Date:     2008-10-27 17:48:32 +0000 (Mon, 27 Oct 2008)

Log Message:
-----------
Always synchronize zoom factor from main pdfview when the secondary pdfview 
copies zoom.

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_UI.m
    trunk/SKSecondaryPDFView.m
    trunk/SKStringConstants.h
    trunk/SKStringConstants.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-10-27 17:10:45 UTC (rev 4880)
+++ trunk/SKMainWindowController.m      2008-10-27 17:48:32 UTC (rev 4881)
@@ -146,7 +146,6 @@
 NSString *SKRightSidePaneWidthKey = @"SKRightSidePaneWidth";
 
 static NSString *SKUsesDrawersKey = @"SKUsesDrawers";
-static NSString *SKSplitPDFCopiesZoomKey = @"SKSplitPDFCopiesZoom";
 static NSString *SKDisableAnimatedSearchHighlightKey = 
@"SKDisableAnimatedSearchHighlight";
 
 
@@ -2273,10 +2272,10 @@
             // Because of a PDFView bug, display properties can not be changed 
before it is placed in a window
             [secondaryPdfView setBackgroundColor:[pdfView backgroundColor]];
             [secondaryPdfView setDisplaysPageBreaks:NO];
-            if ([pdfView autoScales] || [[NSUserDefaults standardUserDefaults] 
boolForKey:SKSplitPDFCopiesZoomKey] == NO)
-                [secondaryPdfView setAutoScales:YES];
-            else
+            if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKSplitPDFCopiesZoomKey])
                 [secondaryPdfView setScaleFactor:[pdfView scaleFactor]];
+            else
+                [secondaryPdfView setAutoScales:YES];
             [secondaryPdfView setDocument:[pdfView document]];
         } else {
             [secondaryPdfEdgeView setFrame:frame2];

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2008-10-27 17:10:45 UTC (rev 4880)
+++ trunk/SKMainWindowController_UI.m   2008-10-27 17:48:32 UTC (rev 4881)
@@ -1407,6 +1407,9 @@
     [zoomInActualOutButton setEnabled:fabsf([pdfView scaleFactor] - 1.0 ) > 
0.01 forSegment:1];
     [zoomInActualOutButton setEnabled:[pdfView canZoomIn] forSegment:2];
     [zoomActualButton setEnabled:fabsf([pdfView scaleFactor] - 1.0 ) > 0.01];
+    
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKSplitPDFCopiesZoomKey])
+        [secondaryPdfView setScaleFactor:[pdfView scaleFactor]];
 }
 
 - (void)handleToolModeChangedNotification:(NSNotification *)notification {

Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m  2008-10-27 17:10:45 UTC (rev 4880)
+++ trunk/SKSecondaryPDFView.m  2008-10-27 17:48:32 UTC (rev 4881)
@@ -41,6 +41,7 @@
 #import "NSScrollView_SKExtensions.h"
 #import "PDFAnnotation_SKExtensions.h"
 #import "PDFPage_SKExtensions.h"
+#import "SKStringConstants.h"
 
 
 @implementation SKSecondaryPDFView
@@ -166,7 +167,7 @@
     [scrollView setHasHorizontalScroller:YES];
     NSControlSize controlSize = [[scrollView horizontalScroller] controlSize];
     
-    if (scalePopUpButton == nil) {
+    if (scalePopUpButton == nil && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKSplitPDFCopiesZoomKey] == NO) {
 
         // create it        
         scalePopUpButton = [[BDSKHeaderPopUpButton allocWithZone:[self zone]] 
initWithFrame:NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown:NO];
@@ -256,7 +257,10 @@
 }
 
 - (void)setAutoScales:(BOOL)newAuto {
-    [self setAutoScales:newAuto adjustPopup:YES];
+    if (scalePopUpButton)
+        [self setAutoScales:newAuto adjustPopup:YES];
+    else
+        [super setAutoScales:newAuto];
 }
 
 - (void)setAutoScales:(BOOL)newAuto adjustPopup:(BOOL)flag {
@@ -266,7 +270,10 @@
 }
 
 - (void)setScaleFactor:(float)newScaleFactor {
-       [self setScaleFactor:newScaleFactor adjustPopup:YES];
+    if (scalePopUpButton)
+        [self setScaleFactor:newScaleFactor adjustPopup:YES];
+    else
+        [super setScaleFactor:newScaleFactor];
 }
 
 - (void)setScaleFactor:(float)newScaleFactor adjustPopup:(BOOL)flag {
@@ -356,9 +363,7 @@
     if (selectionActions == nil)
         selectionActions = [[NSSet alloc] 
initWithObjects:@"_searchInSpotlight:", @"_searchInGoogle:", 
@"_searchInDictionary:", nil];
     NSMenu *menu = [super menuForEvent:theEvent];
-    int i = [menu indexOfItemWithTarget:self 
andAction:NSSelectorFromString(@"_toggleContinuous:")];
     NSMenuItem *item;
-    PDFDisplayMode displayMode = [self displayMode];
     
     [self setCurrentSelection:nil];
     while ([menu numberOfItems]) {
@@ -369,7 +374,12 @@
             break;
     }
     
+    int i = [menu indexOfItemWithTarget:self 
andAction:NSSelectorFromString(@"_toggleContinuous:")];
+    if (i == -1)
+        i = [menu indexOfItemWithTarget:self 
andAction:NSSelectorFromString(@"_setDoublePageScrolling:")];
     if (i != -1) {
+        PDFDisplayMode displayMode = [self displayMode];
+        [menu insertItem:[NSMenuItem separatorItem] atIndex:++i];
         if (displayMode == kPDFDisplayTwoUp || displayMode == 
kPDFDisplayTwoUpContinuous) { 
             item = [menu insertItemWithTitle:NSLocalizedString(@"Book Mode", 
@"Menu item title") action:@selector(toggleDisplayAsBookFromMenu:) 
keyEquivalent:@"" atIndex:++i];
             [item setTarget:self];

Modified: trunk/SKStringConstants.h
===================================================================
--- trunk/SKStringConstants.h   2008-10-27 17:10:45 UTC (rev 4880)
+++ trunk/SKStringConstants.h   2008-10-27 17:48:32 UTC (rev 4881)
@@ -120,3 +120,4 @@
 extern NSString *SKShouldSetCreatorCodeKey;
 extern NSString *SKTableFontSizeKey;
 extern NSString *SKSequentialPageNumberingKey;
+extern NSString *SKSplitPDFCopiesZoomKey;

Modified: trunk/SKStringConstants.m
===================================================================
--- trunk/SKStringConstants.m   2008-10-27 17:10:45 UTC (rev 4880)
+++ trunk/SKStringConstants.m   2008-10-27 17:48:32 UTC (rev 4881)
@@ -121,3 +121,4 @@
 NSString *SKShouldSetCreatorCodeKey = @"SKShouldSetCreatorCode";
 NSString *SKTableFontSizeKey = @"SKTableFontSize";
 NSString *SKSequentialPageNumberingKey = @"SKSequentialPageNumbering";
+NSString *SKSplitPDFCopiesZoomKey = @"SKSplitPDFCopiesZoom";


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to