Revision: 3112
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3112&view=rev
Author:   hofman
Date:     2007-10-31 11:28:35 -0700 (Wed, 31 Oct 2007)

Log Message:
-----------
Let the scrollview layout any controls in the scrollers for zoomable pdfviews. 
This also should work on Leopard, as it does not rely on private PDFView 
methods to layout the scrollview.

Modified Paths:
--------------
    trunk/BDSKZoomablePDFView.h
    trunk/BDSKZoomablePDFView.m
    trunk/NSScrollView_SKExtensions.h
    trunk/NSScrollView_SKExtensions.m
    trunk/SKSecondaryPDFView.h
    trunk/SKSecondaryPDFView.m

Modified: trunk/BDSKZoomablePDFView.h
===================================================================
--- trunk/BDSKZoomablePDFView.h 2007-10-31 13:30:18 UTC (rev 3111)
+++ trunk/BDSKZoomablePDFView.h 2007-10-31 18:28:35 UTC (rev 3112)
@@ -53,10 +53,10 @@
 - (void)setScaleFactor:(float)factor adjustPopup:(BOOL)flag;
 - (void)scalePopUpAction:(id)sender;
 - (NSScrollView *)scrollView;
-- (void)layoutScrollView;
 - (void)setScrollerSize:(NSControlSize)controlSize;
 - (void)dragWithEvent:(NSEvent *)theEvent;
 - (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification;
 - (void)resetAutoFitRectIfNeeded;
+- (void)makeScalePopUpButton;
 
 @end

Modified: trunk/BDSKZoomablePDFView.m
===================================================================
--- trunk/BDSKZoomablePDFView.m 2007-10-31 13:30:18 UTC (rev 3111)
+++ trunk/BDSKZoomablePDFView.m 2007-10-31 18:28:35 UTC (rev 3112)
@@ -41,10 +41,6 @@
 #import "NSScrollView_SKExtensions.h"
 
 
[EMAIL PROTECTED] PDFView (BDSKApplePrivateOverride)
-- (void)adjustScrollbars:(id)obj;
[EMAIL PROTECTED]
-
 @implementation BDSKZoomablePDFView
 
 /* For genstrings:
@@ -70,6 +66,9 @@
         scalePopUpButton = nil;
         autoFitPage = nil;
         autoFitRect = NSZeroRect;
+        
+        [self makeScalePopUpButton];
+        
         [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handlePDFViewFrameChangedNotification:) 
                                                      
name:NSViewFrameDidChangeNotification object:self];
         [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handlePDFViewFrameChangedNotification:) 
@@ -87,6 +86,7 @@
                                                      
name:NSViewFrameDidChangeNotification object:self];
         [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handlePDFViewFrameChangedNotification:) 
                                                      
name:NSViewBoundsDidChangeNotification object:self];
+        [self makeScalePopUpButton];
     }
     return self;
 }
@@ -152,29 +152,11 @@
         [scalePopUpButton selectItemAtIndex:cnt];
         
         // put it in the scrollview
-        [scrollView addSubview:scalePopUpButton];
+        [scrollView setSubcontrols:[NSArray arrayWithObject:scalePopUpButton]];
         [scalePopUpButton release];
     }
 }
 
-- (void)drawRect:(NSRect)rect {
-    [self layoutScrollView];
-    [super drawRect:rect];
-
-    if ([scalePopUpButton superview]) {
-        NSRect shadowRect = [scalePopUpButton frame];
-        shadowRect.origin.x -= 1.0;
-        shadowRect.origin.y -= 1.0;
-        shadowRect.size.width += 1.0;
-        shadowRect.size.height += 1.0;
-               shadowRect = [self convertRect:shadowRect 
fromView:[scalePopUpButton superview]];
-        if (NSIntersectsRect(rect, shadowRect)) {
-            [[NSColor colorWithCalibratedWhite:0.75 alpha:1.0] set];
-            NSRectFill(shadowRect);
-        }
-    }
-}
-
 - (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification {
     if ([self autoFits]) {
         NSView *clipView = [[[self documentView] enclosingScrollView] 
contentView];
@@ -369,58 +351,6 @@
        }
 }
 
-- (void)adjustScrollbars:(id)obj;
-{
-    // this private method is only called by PDFView, so super must implement 
it if it's called
-    [super adjustScrollbars:obj];
-    [self layoutScrollView];
-    // be careful here; check the comment in -layoutScrollView before changing 
anything
-}
-
-- (void)layoutScrollView;
-{
-    NSScrollView *scrollView = [self scrollView];
-    
-    // Don't force scroller display on the scrollview; PDFView apparently uses 
a timer to call adjustScrollbars:, and preventing autohide will cause an 
endless loop if you zoom so that the vertical scroller is not displayed 
(regardless of whether we swizzle -[NSScrollView tile] or override -[PDFView 
adjustScrollbars:]).  Therefore, we always display the button,  even though it 
looks stupid without the scrollers.  Since it's not really readable anyway at 
25%, this probably isn't a big deal, since this isn't supposed to be a 
thumbnail view.
-    
-    NSControlSize controlSize = NSRegularControlSize;
-    
-    if ([scrollView hasHorizontalScroller])
-        controlSize = [[scrollView horizontalScroller] controlSize];
-    else if ([scrollView hasVerticalScroller])
-        controlSize = [[scrollView verticalScroller] controlSize];
-    
-    float scrollerWidth = [NSScroller scrollerWidthForControlSize:controlSize];
-    
-    if (!scalePopUpButton) [self makeScalePopUpButton];
-    
-    NSRect horizScrollerFrame, buttonFrame;
-    buttonFrame = [scalePopUpButton frame];
-    
-    NSScroller *horizScroller = [scrollView horizontalScroller];
-    
-    if (horizScroller) {
-        horizScrollerFrame = [horizScroller frame];
-        
-        // Now we'll just adjust the horizontal scroller size and set the 
button size and location.
-        // Set it based on our frame, not the scroller's frame, since this 
gets called repeatedly.
-        horizScrollerFrame.size.width = NSWidth([scrollView frame]) - 
NSWidth(buttonFrame) - scrollerWidth - 1.0;
-        [horizScroller setFrameSize:horizScrollerFrame.size];
-    }
-    buttonFrame.size.height = scrollerWidth - 1.0;
-
-    // @@ resolution independence: 2.0 may not work
-    if ([scrollView isFlipped]) {
-        buttonFrame.origin.x = NSMaxX([scrollView frame]) - scrollerWidth - 
NSWidth(buttonFrame);
-        buttonFrame.origin.y = NSMaxY([scrollView frame]) - 
NSHeight(buttonFrame);            
-    }
-    else {
-        buttonFrame.origin.x = NSMaxX([scrollView frame]) - scrollerWidth - 
NSWidth(buttonFrame);
-        buttonFrame.origin.y = NSMinY([scrollView frame]);
-    }
-    [scalePopUpButton setFrame:buttonFrame];
-}
-
 #pragma mark Dragging
 
 - (void)mouseDown:(NSEvent *)theEvent{

Modified: trunk/NSScrollView_SKExtensions.h
===================================================================
--- trunk/NSScrollView_SKExtensions.h   2007-10-31 13:30:18 UTC (rev 3111)
+++ trunk/NSScrollView_SKExtensions.h   2007-10-31 18:28:35 UTC (rev 3112)
@@ -46,7 +46,11 @@
 - (BOOL)replacementHasVerticalScroller;
 - (void)replacementSetHasHorizontalScroller:(BOOL)flag;
 - (void)replacementSetHasVerticalScroller:(BOOL)flag;
+- (void)replacementTile;
 
+- (NSArray *)subcontrols;
+- (void)setSubcontrols:(NSArray *)newSubcontrols;
+
 // new API allows ignoring PDFView's attempts to remove the horizontal scroller
 - (void)setAlwaysHasHorizontalScroller:(BOOL)flag;
 - (void)setNeverHasHorizontalScroller:(BOOL)flag;

Modified: trunk/NSScrollView_SKExtensions.m
===================================================================
--- trunk/NSScrollView_SKExtensions.m   2007-10-31 13:30:18 UTC (rev 3111)
+++ trunk/NSScrollView_SKExtensions.m   2007-10-31 18:28:35 UTC (rev 3112)
@@ -38,6 +38,7 @@
 
 #import "NSScrollView_SKExtensions.h"
 #import "OBUtilities.h"
+#import "BDSKEdgeView.h"
 
 
 @implementation NSScrollView (BDSKZoomablePDFViewExtensions)
@@ -47,11 +48,13 @@
 static BOOL (*originalHasHorizontalScroller)(id, SEL) = NULL;
 static BOOL (*originalHasVerticalScroller)(id, SEL) = NULL;
 static IMP originalDealloc = NULL;
+static IMP originalTile = NULL;
 
 static CFMutableSetRef scrollViewsWithHorizontalScrollers = NULL;
 static CFMutableSetRef scrollViewsWithoutHorizontalScrollers = NULL;
 static CFMutableSetRef scrollViewsWithVerticalScrollers = NULL;
 static CFMutableSetRef scrollViewsWithoutVerticalScrollers = NULL;
+static CFMutableDictionaryRef scrollViewSubcontrols = NULL;
 
 + (void)load{
     originalSetHasHorizontalScroller = 
OBReplaceMethodImplementationWithSelector(self, 
@selector(setHasHorizontalScroller:), 
@selector(replacementSetHasHorizontalScroller:));
@@ -59,12 +62,14 @@
     originalHasHorizontalScroller = 
(typeof(originalHasHorizontalScroller))OBReplaceMethodImplementationWithSelector(self,
 @selector(hasHorizontalScroller), @selector(replacementHasHorizontalScroller));
     originalHasVerticalScroller = 
(typeof(originalHasVerticalScroller))OBReplaceMethodImplementationWithSelector(self,
 @selector(hasVerticalScroller), @selector(replacementHasVerticalScroller));
     originalDealloc = OBReplaceMethodImplementationWithSelector(self, 
@selector(dealloc), @selector(replacementDealloc));
+    originalTile = OBReplaceMethodImplementationWithSelector(self, 
@selector(tile), @selector(replacementTile));
     
     // set doesn't retain, so no retain cycles; pointer equality used to 
compare views
     scrollViewsWithHorizontalScrollers = 
CFSetCreateMutable(CFAllocatorGetDefault(), 0, NULL);
     scrollViewsWithoutHorizontalScrollers = 
CFSetCreateMutable(CFAllocatorGetDefault(), 0, NULL);
     scrollViewsWithVerticalScrollers = 
CFSetCreateMutable(CFAllocatorGetDefault(), 0, NULL);
     scrollViewsWithoutVerticalScrollers = 
CFSetCreateMutable(CFAllocatorGetDefault(), 0, NULL);
+    scrollViewSubcontrols = CFDictionaryCreateMutable(CFAllocatorGetDefault(), 
0, NULL, &kCFTypeDictionaryValueCallBacks);
 }
 
 - (void)replacementDealloc;
@@ -73,6 +78,7 @@
     CFSetRemoveValue(scrollViewsWithoutHorizontalScrollers, self);
     CFSetRemoveValue(scrollViewsWithVerticalScrollers, self);
     CFSetRemoveValue(scrollViewsWithoutVerticalScrollers, self);
+    CFDictionaryRemoveValue(scrollViewSubcontrols, self);
     originalDealloc(self, _cmd);
 }
 
@@ -158,4 +164,68 @@
     return flag;
 }
 
+- (void)replacementTile {
+    originalTile(self, _cmd);
+    
+    NSArray *subcontrols = [self subcontrols];
+    
+    if ([subcontrols count]) {
+        NSEnumerator *viewEnum = [subcontrols objectEnumerator];
+        NSView *view;
+        NSScroller *horizScroller = [self horizontalScroller];
+        NSRect viewFrame, horizScrollerFrame = [horizScroller frame];
+        float height = NSHeight(horizScrollerFrame) - 1.0, totalWidth = 0.0;
+        BDSKEdgeView *edgeView = (BDSKEdgeView *)[[[subcontrols lastObject] 
superview] superview];
+        
+        if (edgeView == nil) {
+            edgeView = [[[BDSKEdgeView alloc] init] autorelease];
+            [edgeView setEdgeColor:[NSColor colorWithCalibratedWhite:0.75 
alpha:1.0]];
+            [edgeView setEdges:BDSKMinXEdgeMask | BDSKMaxYEdgeMask];
+            [self addSubview:edgeView];
+        }
+        
+        while (view = [viewEnum nextObject]) {
+            viewFrame = NSMakeRect(totalWidth, 0.0, NSWidth([view frame]), 
height);
+            totalWidth += NSWidth(viewFrame);
+            [view setFrame:viewFrame];
+            if ([view isDescendantOf:edgeView] == NO)
+                [edgeView addSubview:view];
+        }
+        
+        NSDivideRect(horizScrollerFrame, &viewFrame, &horizScrollerFrame, 
totalWidth + 1.0, NSMaxXEdge);
+        [horizScroller setFrame:horizScrollerFrame];
+        [edgeView setFrame:viewFrame];
+    }
+}
+
+
+- (NSArray *)subcontrols {
+    return (NSArray *)CFDictionaryGetValue(scrollViewSubcontrols, self);
+}
+
+- (void)setSubcontrols:(NSArray *)newSubControls {
+    BDSKEdgeView *edgeView = nil;
+    NSMutableArray *subcontrols = (NSMutableArray 
*)CFDictionaryGetValue(scrollViewSubcontrols, self);
+    if (subcontrols == nil && [newSubControls count]) {
+        subcontrols = [NSMutableArray array];
+        CFDictionarySetValue(scrollViewSubcontrols, self, subcontrols);
+    }
+    
+    if ([subcontrols count])
+        edgeView = (BDSKEdgeView *)[[[subcontrols lastObject] superview] 
superview];
+    
+    [subcontrols makeObjectsPerformSelector:@selector(removeFromSuperview)];
+    [subcontrols setArray:newSubControls];
+    
+    if ([subcontrols count] == 0 && subcontrols) {
+        [edgeView removeFromSuperview];
+        CFDictionaryRemoveValue(scrollViewSubcontrols, self);
+        subcontrols = nil;
+    }
+    
+    [self setAlwaysHasHorizontalScroller:[subcontrols count] != 0];
+    
+    [self tile];
+}
+
 @end

Modified: trunk/SKSecondaryPDFView.h
===================================================================
--- trunk/SKSecondaryPDFView.h  2007-10-31 13:30:18 UTC (rev 3111)
+++ trunk/SKSecondaryPDFView.h  2007-10-31 18:28:35 UTC (rev 3112)
@@ -50,7 +50,6 @@
 - (void)scalePopUpAction:(id)sender;
 - (void)pagePopUpAction:(id)sender;
 - (NSScrollView *)scrollView;
-- (void)layoutScrollView;
 - (void)setScrollerSize:(NSControlSize)controlSize;
 - (void)dragWithEvent:(NSEvent *)theEvent;
 - (void)reloadPagePopUpButton;
@@ -58,4 +57,7 @@
 - (void)handleDocumentDidUnlockNotification:(NSNotification *)notification;
 - (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation 
onPage:(PDFPage *)page;
 
+- (void)makePopUpButtons;
+- (void)reloadPagePopUpButton;
+
 @end

Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m  2007-10-31 13:30:18 UTC (rev 3111)
+++ trunk/SKSecondaryPDFView.m  2007-10-31 18:28:35 UTC (rev 3112)
@@ -41,10 +41,6 @@
 #import "NSScrollView_SKExtensions.h"
 
 
[EMAIL PROTECTED] PDFView (SKApplePrivateOverride)
-- (void)adjustScrollbars:(id)obj;
[EMAIL PROTECTED]
-
 @implementation SKSecondaryPDFView
 
 /* For genstrings:
@@ -68,6 +64,9 @@
     if (self = [super initWithFrame:frameRect]) {
         scalePopUpButton = nil;
         pagePopUpButton = nil;
+        
+        [self makePopUpButtons];
+        
         [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handlePageChangedNotification:) 
                                                      
name:PDFViewPageChangedNotification object:self];
     }
@@ -78,6 +77,9 @@
     if (self = [super initWithCoder:decoder]) {
         scalePopUpButton = nil;
         pagePopUpButton = nil;
+        
+        [self makePopUpButtons];
+        
         [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handlePageChangedNotification:) 
                                                      
name:PDFViewPageChangedNotification object:self];
     }
@@ -94,24 +96,6 @@
                                                      
name:PDFDocumentDidUnlockNotification object:document];
 }
 
-- (void)drawRect:(NSRect)rect {
-    [self layoutScrollView];
-    [super drawRect:rect];
-
-    if ([scalePopUpButton superview]) {
-        NSRect shadowRect = NSUnionRect([scalePopUpButton frame], 
[pagePopUpButton frame]);
-        shadowRect.origin.x -= 1.0;
-        shadowRect.origin.y -= 1.0;
-        shadowRect.size.width += 1.0;
-        shadowRect.size.height += 1.0;
-               shadowRect = [self convertRect:shadowRect 
fromView:[scalePopUpButton superview]];
-        if (NSIntersectsRect(rect, shadowRect)) {
-            [[NSColor colorWithCalibratedWhite:0.75 alpha:1.0] set];
-            NSRectFill(shadowRect);
-        }
-    }
-}
-
 - (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation 
onPage:(PDFPage *)page {
     NSRect rect = [self convertRect:[page boundsForBox:kPDFDisplayBoxCropBox] 
fromPage:page];
     float scale = [self scaleFactor];
@@ -126,17 +110,54 @@
 
 #pragma mark Popup buttons
 
-- (void)makeScalePopUpButton {
+- (void)reloadPagePopUpButton {
+    PDFDocument *pdfDoc = [self document];
+    unsigned i, count = [pagePopUpButton numberOfItems];
+    NSString *label;
+    float width, maxWidth = 0.0;
+    NSSize size = NSMakeSize(1000.0, 1000.0);
+    NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[pagePopUpButton font], NSFontAttributeName, nil];
+    unsigned maxIndex = 0;
     
-    if (scalePopUpButton == nil) {
+    while (count--)
+        [pagePopUpButton removeItemAtIndex:count];
+    
+    if (count = [pdfDoc pageCount]) {
+        for (i = 0; i < count; i++) {
+            label = [[pdfDoc pageAtIndex:i] label];
+            if (label == nil)
+                label = [NSString stringWithFormat:@"%i", i + 1];
+            width = NSWidth([label boundingRectWithSize:size options:0 
attributes:attrs]);
+            if (width > maxWidth) {
+                maxWidth = width;
+                maxIndex = i;
+            }
+            [pagePopUpButton addItemWithTitle:label];
+        }
         
-        NSScrollView *scrollView = [self scrollView];
-        [scrollView setAlwaysHasHorizontalScroller:YES];
+        i = [pagePopUpButton indexOfSelectedItem];
+        [pagePopUpButton selectItemAtIndex:maxIndex];
+        [pagePopUpButton sizeToFit];
+        [pagePopUpButton selectItemAtIndex:i];
+        
+        [pagePopUpButton selectItemAtIndex:[pdfDoc indexForPage:[self 
currentPage]]];
+    }
+}
 
+
+- (void)makePopUpButtons {
+    if (scalePopUpButton && pagePopUpButton)
+        return;
+    
+    NSScrollView *scrollView = [self scrollView];
+    [scrollView setAlwaysHasHorizontalScroller:YES];
+    NSControlSize controlSize = [[scrollView horizontalScroller] controlSize];
+    
+    if (scalePopUpButton == nil) {
+
         // create it        
         scalePopUpButton = [[BDSKHeaderPopUpButton allocWithZone:[self zone]] 
initWithFrame:NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown:NO];
         
-        NSControlSize controlSize = [[scrollView horizontalScroller] 
controlSize];
         [[scalePopUpButton cell] setControlSize:controlSize];
 
         // set a suitable font, the control size is 0, 1 or 2
@@ -180,57 +201,14 @@
         // hook it up
         [scalePopUpButton setTarget:self];
         [scalePopUpButton setAction:@selector(scalePopUpAction:)];
-
-        // put it in the scrollview
-        [scrollView addSubview:scalePopUpButton];
-        [scalePopUpButton release];
+        
     }
-}
-
-- (void)reloadPagePopUpButton {
-    PDFDocument *pdfDoc = [self document];
-    unsigned i, count = [pagePopUpButton numberOfItems];
-    NSString *label;
-    float width, maxWidth = 0.0;
-    NSSize size = NSMakeSize(1000.0, 1000.0);
-    NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[pagePopUpButton font], NSFontAttributeName, nil];
-    unsigned maxIndex = 0;
     
-    while (count--)
-        [pagePopUpButton removeItemAtIndex:count];
-    
-    count = [pdfDoc pageCount];
-    for (i = 0; i < count; i++) {
-        label = [[pdfDoc pageAtIndex:i] label];
-        if (label == nil)
-            label = [NSString stringWithFormat:@"%i", i + 1];
-        width = NSWidth([label boundingRectWithSize:size options:0 
attributes:attrs]);
-        if (width > maxWidth) {
-            maxWidth = width;
-            maxIndex = i;
-        }
-        [pagePopUpButton addItemWithTitle:label];
-    }
-    
-    i = [pagePopUpButton indexOfSelectedItem];
-    [pagePopUpButton selectItemAtIndex:maxIndex];
-    [pagePopUpButton sizeToFit];
-    [pagePopUpButton selectItemAtIndex:i];
-    
-    [pagePopUpButton selectItemAtIndex:[pdfDoc indexForPage:[self 
currentPage]]];
-}
-
-- (void)makePagePopUpButton {
-    
     if (pagePopUpButton == nil) {
         
-        NSScrollView *scrollView = [self scrollView];
-        [scrollView setAlwaysHasHorizontalScroller:YES];
-        
         // create it        
         pagePopUpButton = [[BDSKHeaderPopUpButton allocWithZone:[self zone]] 
initWithFrame:NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown:NO];
         
-        NSControlSize controlSize = [[scrollView horizontalScroller] 
controlSize];
         [[pagePopUpButton cell] setControlSize:controlSize];
 
         // set a suitable font, the control size is 0, 1 or 2
@@ -246,7 +224,8 @@
         [pagePopUpButton setAction:@selector(pagePopUpAction:)];
 
         // put it in the scrollview
-        [scrollView addSubview:pagePopUpButton];
+        [scrollView setSubcontrols:[NSArray arrayWithObjects:pagePopUpButton, 
scalePopUpButton, nil]];
+        [scalePopUpButton release];
         [pagePopUpButton release];
     }
 }
@@ -406,67 +385,6 @@
        }
 }
 
-- (void)adjustScrollbars:(id)obj;
-{
-    // this private method is only called by PDFView, so super must implement 
it if it's called
-    [super adjustScrollbars:obj];
-    [self layoutScrollView];
-    // be careful here; check the comment in -layoutScrollView before changing 
anything
-}
-
-- (void)layoutScrollView;
-{
-    NSScrollView *scrollView = [self scrollView];
-    
-    // Don't force scroller display on the scrollview; PDFView apparently uses 
a timer to call adjustScrollbars:, and preventing autohide will cause an 
endless loop if you zoom so that the vertical scroller is not displayed 
(regardless of whether we swizzle -[NSScrollView tile] or override -[PDFView 
adjustScrollbars:]).  Therefore, we always display the button,  even though it 
looks stupid without the scrollers.  Since it's not really readable anyway at 
25%, this probably isn't a big deal, since this isn't supposed to be a 
thumbnail view.
-    
-    NSControlSize controlSize = NSRegularControlSize;
-    
-    if ([scrollView hasHorizontalScroller])
-        controlSize = [[scrollView horizontalScroller] controlSize];
-    else if ([scrollView hasVerticalScroller])
-        controlSize = [[scrollView verticalScroller] controlSize];
-    
-    float scrollerWidth = [NSScroller scrollerWidthForControlSize:controlSize];
-    
-    if (scalePopUpButton == nil)
-        [self makeScalePopUpButton];
-    if (pagePopUpButton == nil)
-        [self makePagePopUpButton];
-    
-    NSRect horizScrollerFrame, scaleButtonFrame, pageButtonFrame;
-    scaleButtonFrame = [scalePopUpButton frame];
-    pageButtonFrame = [pagePopUpButton frame];
-    
-    NSScroller *horizScroller = [scrollView horizontalScroller];
-    
-    if (horizScroller) {
-        horizScrollerFrame = [horizScroller frame];
-        
-        // Now we'll just adjust the horizontal scroller size and set the 
button size and location.
-        // Set it based on our frame, not the scroller's frame, since this 
gets called repeatedly.
-        horizScrollerFrame.size.width = NSWidth([scrollView frame]) - 
NSWidth(scaleButtonFrame) - NSWidth(pageButtonFrame) - scrollerWidth - 1.0;
-        [horizScroller setFrameSize:horizScrollerFrame.size];
-    }
-    scaleButtonFrame.size.height = scrollerWidth - 1.0;
-    pageButtonFrame.size.height = scrollerWidth - 1.0;
-
-    if ([scrollView isFlipped]) {
-        scaleButtonFrame.origin.x = NSMaxX([scrollView frame]) - scrollerWidth 
- NSWidth(scaleButtonFrame);
-        scaleButtonFrame.origin.y = NSMaxY([scrollView frame]) - 
NSHeight(scaleButtonFrame);            
-        pageButtonFrame.origin.x = NSMinX(scaleButtonFrame) - 
NSWidth(pageButtonFrame);
-        pageButtonFrame.origin.y = NSMaxY([scrollView frame]) - 
NSHeight(pageButtonFrame);            
-    }
-    else {
-        scaleButtonFrame.origin.x = NSMaxX([scrollView frame]) - scrollerWidth 
- NSWidth(scaleButtonFrame);
-        scaleButtonFrame.origin.y = NSMinY([scrollView frame]);
-        pageButtonFrame.origin.x = NSMinX(scaleButtonFrame) - 
NSWidth(pageButtonFrame);
-        pageButtonFrame.origin.y = NSMinY([scrollView frame]);
-    }
-    [scalePopUpButton setFrame:scaleButtonFrame];
-    [pagePopUpButton setFrame:pageButtonFrame];
-}
-
 #pragma mark Dragging
 
 - (void)mouseDown:(NSEvent *)theEvent{
@@ -536,7 +454,7 @@
 
 - (void)handleDocumentDidUnlockNotification:(NSNotification *)notification {
     [self reloadPagePopUpButton];
-    [self layoutScrollView];
+    [[self scrollView] tile];
 }
 
 @end


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: 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-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to