Revision: 2550
http://skim-app.svn.sourceforge.net/skim-app/?rev=2550&view=rev
Author: amaxwell
Date: 2007-07-23 09:28:42 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
add implementation of localizedCaseInsensitiveNumericCompare: from BibDesk,
since caseInsensitiveNumericCompare: didn't seem to be implemented anywhere
Modified Paths:
--------------
trunk/NSArray_SKExtensions.m
trunk/NSString_SKExtensions.h
trunk/NSString_SKExtensions.m
trunk/SKMainWindowController.m
trunk/SKNotesDocument.m
Modified: trunk/NSArray_SKExtensions.m
===================================================================
--- trunk/NSArray_SKExtensions.m 2007-07-23 16:26:24 UTC (rev 2549)
+++ trunk/NSArray_SKExtensions.m 2007-07-23 16:28:42 UTC (rev 2550)
@@ -38,8 +38,8 @@
#import "NSArray_SKExtensions.h"
#import "NSValue_SKExtensions.h"
+#import "NSString_SKExtensions.h"
-
@implementation NSArray (SKExtensions)
- (NSArray *)arraySortedByPageIndex {
@@ -59,7 +59,7 @@
}
- (NSArray *)arraySortedByContents {
- return [self sortedArrayUsingDescriptors:[NSArray
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"contents"
ascending:YES selector:@selector(caseInsensitiveNumericCompare:)]
autorelease]]];
+ return [self sortedArrayUsingDescriptors:[NSArray
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"contents"
ascending:YES selector:@selector(localizedCaseInsensitiveNumericCompare:)]
autorelease]]];
}
- (NSArray *)arraySortedByTypeAndContents {
Modified: trunk/NSString_SKExtensions.h
===================================================================
--- trunk/NSString_SKExtensions.h 2007-07-23 16:26:24 UTC (rev 2549)
+++ trunk/NSString_SKExtensions.h 2007-07-23 16:28:42 UTC (rev 2550)
@@ -49,6 +49,7 @@
- (NSString *)stringByEscapingShellChars;
- (NSArray *)shellScriptArgumentsArray;
+- (NSComparisonResult)localizedCaseInsensitiveNumericCompare:(NSString *)aStr;
- (NSRange)rangeOfLeadingEmptyLine;
- (NSRange)rangeOfLeadingEmptyLineInRange:(NSRange)range;
Modified: trunk/NSString_SKExtensions.m
===================================================================
--- trunk/NSString_SKExtensions.m 2007-07-23 16:26:24 UTC (rev 2549)
+++ trunk/NSString_SKExtensions.m 2007-07-23 16:28:42 UTC (rev 2550)
@@ -192,6 +192,13 @@
return arguments;
}
+- (NSComparisonResult)localizedCaseInsensitiveNumericCompare:(NSString *)aStr{
+ return [self compare:aStr
+ options:NSCaseInsensitiveSearch | NSNumericSearch
+ range:NSMakeRange(0, [self length])
+ locale:[[NSUserDefaults standardUserDefaults]
dictionaryRepresentation]];
+}
+
#pragma mark Empty lines
// whitespace at the beginning of the string up to the end or until (and
including) a newline
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2007-07-23 16:26:24 UTC (rev 2549)
+++ trunk/SKMainWindowController.m 2007-07-23 16:28:42 UTC (rev 2550)
@@ -1245,7 +1245,7 @@
- (IBAction)doZoomToPhysicalSize:(id)sender {
float scaleFactor = 1.0;
NSScreen *screen = [[self window] screen];
- CGDirectDisplayID displayID = [[[screen deviceDescription]
objectForKey:@"NSScreenNumber"] pointerValue];
+ CGDirectDisplayID displayID = [[[screen deviceDescription]
objectForKey:@"NSScreenNumber"] unsignedIntValue];
CGSize physicalSize = CGDisplayScreenSize(displayID);
NSSize resolution = [[[screen deviceDescription]
objectForKey:NSDeviceResolution] sizeValue];
@@ -3152,7 +3152,7 @@
if ([tcID isEqualToString:@"type"]) {
[sds insertObject:[[[NSSortDescriptor alloc]
initWithKey:@"noteType" ascending:YES
selector:@selector(caseInsensitiveCompare:)] autorelease] atIndex:0];
} else if ([tcID isEqualToString:@"note"]) {
- [sds insertObject:[[[NSSortDescriptor alloc]
initWithKey:@"contents" ascending:YES
selector:@selector(caseInsensitiveNumericCompare:)] autorelease] atIndex:0];
+ [sds insertObject:[[[NSSortDescriptor alloc]
initWithKey:@"contents" ascending:YES
selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease]
atIndex:0];
} else if ([tcID isEqualToString:@"page"]) {
if (oldTableColumn == nil)
ascending = NO;
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2007-07-23 16:26:24 UTC (rev 2549)
+++ trunk/SKNotesDocument.m 2007-07-23 16:28:42 UTC (rev 2550)
@@ -68,7 +68,7 @@
[aController setShouldCloseDocument:YES];
NSSortDescriptor *indexSortDescriptor = [[[NSSortDescriptor alloc]
initWithKey:@"pageIndex" ascending:YES] autorelease];
- NSSortDescriptor *contentsSortDescriptor = [[[NSSortDescriptor alloc]
initWithKey:@"contents" ascending:YES
selector:@selector(caseInsensitiveNumericCompare:)] autorelease];
+ NSSortDescriptor *contentsSortDescriptor = [[[NSSortDescriptor alloc]
initWithKey:@"contents" ascending:YES
selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease];
[arrayController setSortDescriptors:[NSArray
arrayWithObjects:indexSortDescriptor, contentsSortDescriptor, nil]];
[outlineView reloadData];
}
@@ -255,7 +255,7 @@
if ([tcID isEqualToString:@"type"]) {
[sds insertObject:[[[NSSortDescriptor alloc]
initWithKey:@"noteType" ascending:YES
selector:@selector(caseInsensitiveCompare:)] autorelease] atIndex:0];
} else if ([tcID isEqualToString:@"note"]) {
- [sds insertObject:[[[NSSortDescriptor alloc]
initWithKey:@"contents" ascending:YES
selector:@selector(caseInsensitiveNumericCompare:)] autorelease] atIndex:0];
+ [sds insertObject:[[[NSSortDescriptor alloc]
initWithKey:@"contents" ascending:YES
selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease]
atIndex:0];
} else if ([tcID isEqualToString:@"page"]) {
if (oldTableColumn == nil)
ascending = NO;
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