Revision: 3000
http://skim-app.svn.sourceforge.net/skim-app/?rev=3000&view=rev
Author: hofman
Date: 2007-10-01 04:14:29 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
Make sure there is a title in the scale popup so we can get it's attributes to
determine the length.
Modified Paths:
--------------
trunk/BDSKZoomablePDFView.m
trunk/SKSecondaryPDFView.m
Modified: trunk/BDSKZoomablePDFView.m
===================================================================
--- trunk/BDSKZoomablePDFView.m 2007-09-30 19:11:45 UTC (rev 2999)
+++ trunk/BDSKZoomablePDFView.m 2007-10-01 11:14:29 UTC (rev 3000)
@@ -102,7 +102,7 @@
NSScrollView *scrollView = [self scrollView];
[scrollView setAlwaysHasHorizontalScroller:YES];
-
+
// create it
scalePopUpButton = [[BDSKHeaderPopUpButton allocWithZone:[self zone]]
initWithFrame:NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown:NO];
@@ -114,12 +114,16 @@
NSString *label;
float width, maxWidth = 0.0;
NSSize size = NSMakeSize(1000.0, 1000.0);
- NSDictionary *attrs = [[scalePopUpButton attributedTitle]
attributesAtIndex:0 effectiveRange:NULL];
+ NSDictionary *attrs = 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);
@@ -137,20 +141,20 @@
[self setScaleFactor:0.0 adjustPopup:YES];
else
[self setScaleFactor:[self scaleFactor] adjustPopup:YES];
-
+
// hook it up
[scalePopUpButton setTarget:self];
[scalePopUpButton setAction:@selector(scalePopUpAction:)];
-
+
// don't let it become first responder
[scalePopUpButton setRefusesFirstResponder:YES];
-
+
// Make sure the popup is big enough to fit the largest cell
cnt = [scalePopUpButton indexOfSelectedItem];
[scalePopUpButton selectItemAtIndex:maxIndex];
[scalePopUpButton sizeToFit];
[scalePopUpButton selectItemAtIndex:cnt];
-
+
// put it in the scrollview
[scrollView addSubview:scalePopUpButton];
[scalePopUpButton release];
Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m 2007-09-30 19:11:45 UTC (rev 2999)
+++ trunk/SKSecondaryPDFView.m 2007-10-01 11:14:29 UTC (rev 3000)
@@ -147,9 +147,13 @@
NSString *label;
float width, maxWidth = 0.0;
NSSize size = NSMakeSize(1000.0, 1000.0);
- NSDictionary *attrs = [[scalePopUpButton attributedTitle]
attributesAtIndex:0 effectiveRange:NULL];
+ NSDictionary *attrs = 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++) {
label = NSLocalizedStringFromTable(SKDefaultScaleMenuLabels[cnt],
@"ZoomValues", nil);
@@ -193,9 +197,13 @@
NSString *label;
float width, maxWidth = 0.0;
NSSize size = NSMakeSize(1000.0, 1000.0);
- NSDictionary *attrs = [[pagePopUpButton attributedTitle]
attributesAtIndex:0 effectiveRange:NULL];
+ NSDictionary *attrs = 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