Revision: 18376
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18376&view=rev
Author: hofman
Date: 2012-01-07 18:41:15 +0000 (Sat, 07 Jan 2012)
Log Message:
-----------
set width of line number view immediately on loading
Modified Paths:
--------------
trunk/bibdesk/BDSKErrorEditor.m
trunk/bibdesk/BDSKLineNumberView.h
trunk/bibdesk/BDSKLineNumberView.m
Modified: trunk/bibdesk/BDSKErrorEditor.m
===================================================================
--- trunk/bibdesk/BDSKErrorEditor.m 2012-01-07 15:46:51 UTC (rev 18375)
+++ trunk/bibdesk/BDSKErrorEditor.m 2012-01-07 18:41:15 UTC (rev 18376)
@@ -125,6 +125,8 @@
[self updateErrorMarkers];
+ [lineNumberView setRuleThickness:[lineNumberView requiredRuleThickness]];
+
NSString *prefix = (isPasteDrag) ? NSLocalizedString(@"Paste/Drag Data",
@"Partial window title") : NSLocalizedString(@"Source Data", @"Partial window
title");
BDSKASSERT(fileName);
Modified: trunk/bibdesk/BDSKLineNumberView.h
===================================================================
--- trunk/bibdesk/BDSKLineNumberView.h 2012-01-07 15:46:51 UTC (rev 18375)
+++ trunk/bibdesk/BDSKLineNumberView.h 2012-01-07 18:41:15 UTC (rev 18376)
@@ -43,4 +43,5 @@
NSPointerArray *lineCharacterIndexes;
NSMapTable *errorMarkers;
}
+- (CGFloat)requiredRuleThickness;
@end
Modified: trunk/bibdesk/BDSKLineNumberView.m
===================================================================
--- trunk/bibdesk/BDSKLineNumberView.m 2012-01-07 15:46:51 UTC (rev 18375)
+++ trunk/bibdesk/BDSKLineNumberView.m 2012-01-07 18:41:15 UTC (rev 18376)
@@ -131,13 +131,6 @@
}
}
-static inline CGFloat ruleThicknessForLineCount(NSUInteger count) {
- NSUInteger i = (NSUInteger)log10(count) + 1;
- NSMutableString *string = [NSMutableString string];
- while (i-- > 0) [string appendString:@"0"];
- return ceilf(fmax(DEFAULT_THICKNESS, [string
sizeWithAttributes:lineNumberAttributes].width + RULER_MARGIN +
MARKER_THICKNESS));
-}
-
static NSPointerArray *createLineCharacterIndexesForString(NSString *string) {
NSUInteger idx = 0, stringLength = [string length], lineEnd, contentsEnd;
NSPointerArray *lineCharacterIndexes = [[NSPointerArray alloc]
initWithOptions:NSPointerFunctionsOpaqueMemory |
NSPointerFunctionsIntegerPersonality];
@@ -162,7 +155,7 @@
lineCharacterIndexes = createLineCharacterIndexesForString([view
string]);
CGFloat oldThickness = [self ruleThickness];
- CGFloat newThickness =
ruleThicknessForLineCount([lineCharacterIndexes count]);
+ CGFloat newThickness = [self requiredRuleThickness];
if (fabs(oldThickness - newThickness) >= 1.0) {
NSInvocation *invocation = [NSInvocation
invocationWithTarget:self selector:@selector(setRuleThickness:)];
[invocation setArgument:&newThickness atIndex:2];
@@ -190,6 +183,13 @@
return left;
}
+- (CGFloat)requiredRuleThickness {
+ NSUInteger i = (NSUInteger)log10([[self lineCharacterIndexes] count]) + 1;
+ NSMutableString *string = [NSMutableString string];
+ while (i-- > 0) [string appendString:@"0"];
+ return ceilf(fmax(DEFAULT_THICKNESS, [string
sizeWithAttributes:lineNumberAttributes].width + RULER_MARGIN +
MARKER_THICKNESS));
+}
+
- (void)drawHashMarksAndLabelsInRect:(NSRect)aRect {
id view = [self clientView];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit