Revision: 3012
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3012&view=rev
Author:   hofman
Date:     2007-10-03 02:39:31 -0700 (Wed, 03 Oct 2007)

Log Message:
-----------
Use attributes with font rather than trying to get the attributes from the 
attributed title to determine the longest title for scale and page popup 
buttons.

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

Modified: trunk/BDSKZoomablePDFView.m
===================================================================
--- trunk/BDSKZoomablePDFView.m 2007-10-03 00:18:56 UTC (rev 3011)
+++ trunk/BDSKZoomablePDFView.m 2007-10-03 09:39:31 UTC (rev 3012)
@@ -108,22 +108,18 @@
         
         NSControlSize controlSize = [[scrollView horizontalScroller] 
controlSize];
         [[scalePopUpButton cell] setControlSize:controlSize];
+        
+        // set a suitable font, the control size is 0, 1 or 2
+        [scalePopUpButton setFont:[NSFont toolTipsFontOfSize: 
BDSKScaleMenuFontSize - controlSize]];
                
         unsigned cnt, numberOfDefaultItems = 
(sizeof(BDSKDefaultScaleMenuLabels) / sizeof(NSString *));
         id curItem;
         NSString *label;
         float width, maxWidth = 0.0;
         NSSize size = NSMakeSize(1000.0, 1000.0);
-        NSDictionary *attrs = nil;
+        NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[scalePopUpButton font], NSFontAttributeName, nil];
         unsigned maxIndex = 0;
         
-        // set a suitable font, the control size is 0, 1 or 2
-        [scalePopUpButton setFont:[NSFont toolTipsFontOfSize: 
BDSKScaleMenuFontSize - controlSize]];
-        
-        if ([[scalePopUpButton attributedTitle] length] == 0)
-            [scalePopUpButton setTitle:@"0"];
-        attrs = [[scalePopUpButton attributedTitle] attributesAtIndex:0 
effectiveRange:NULL];
-        
         // fill it
         for (cnt = 0; cnt < numberOfDefaultItems; cnt++) {
             label = 
NSLocalizedStringFromTable(BDSKDefaultScaleMenuLabels[cnt], @"ZoomValues", nil);

Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m  2007-10-03 00:18:56 UTC (rev 3011)
+++ trunk/SKSecondaryPDFView.m  2007-10-03 09:39:31 UTC (rev 3012)
@@ -147,12 +147,8 @@
         NSString *label;
         float width, maxWidth = 0.0;
         NSSize size = NSMakeSize(1000.0, 1000.0);
-        NSDictionary *attrs = nil;
+        NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[scalePopUpButton font], NSFontAttributeName, nil];
         unsigned maxIndex = 0;
-               
-        if ([[scalePopUpButton attributedTitle] length] == 0)
-            [scalePopUpButton setTitle:@"0"];
-        attrs = [[scalePopUpButton attributedTitle] attributesAtIndex:0 
effectiveRange:NULL];
         
         // fill it
         for (cnt = 0; cnt < numberOfDefaultItems; cnt++) {
@@ -197,13 +193,9 @@
     NSString *label;
     float width, maxWidth = 0.0;
     NSSize size = NSMakeSize(1000.0, 1000.0);
-    NSDictionary *attrs = nil;
+    NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[pagePopUpButton font], NSFontAttributeName, nil];
     unsigned maxIndex = 0;
     
-    if ([[pagePopUpButton attributedTitle] length] == 0)
-        [pagePopUpButton setTitle:@"0"];
-    attrs = [[pagePopUpButton attributedTitle] attributesAtIndex:0 
effectiveRange:NULL];
-    
     while (count--)
         [pagePopUpButton removeItemAtIndex:count];
     


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 2005.
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

Reply via email to