Revision: 5931
http://skim-app.svn.sourceforge.net/skim-app/?rev=5931&view=rev
Author: hofman
Date: 2009-10-22 13:03:54 +0000 (Thu, 22 Oct 2009)
Log Message:
-----------
modernize some more loops
Modified Paths:
--------------
trunk/NSUserDefaultsController_SKExtensions.m
trunk/PDFPage_SKExtensions.m
trunk/SKMainWindowController.m
trunk/SKMainWindowController_UI.m
trunk/SKNotesDocument.m
trunk/SKPDFView.m
trunk/SKTextFieldSheetController.m
Modified: trunk/NSUserDefaultsController_SKExtensions.m
===================================================================
--- trunk/NSUserDefaultsController_SKExtensions.m 2009-10-22 11:58:51 UTC
(rev 5930)
+++ trunk/NSUserDefaultsController_SKExtensions.m 2009-10-22 13:03:54 UTC
(rev 5931)
@@ -51,15 +51,13 @@
}
- (void)addObserver:(NSObject *)anObserver forKeys:(NSArray *)keys
context:(void *)context {
- NSInteger i, iMax = [keys count];
- for (i = 0; i < iMax; i++)
- [self addObserver:anObserver forKey:[keys objectAtIndex:i]
context:context];
+ for (NSString *key in keys)
+ [self addObserver:anObserver forKey:key context:context];
}
- (void)removeObserver:(NSObject *)anObserver forKeys:(NSArray *)keys {
- NSInteger i, iMax = [keys count];
- for (i = 0; i < iMax; i++)
- [self removeObserver:anObserver forKey:[keys objectAtIndex:i]];
+ for (NSString *key in keys)
+ [self removeObserver:anObserver forKey:key];
}
- (void)revertToInitialValueForKey:(NSString *)key {
@@ -67,11 +65,8 @@
}
- (void)revertToInitialValuesForKeys:(NSArray *)keys {
- NSInteger i, iMax = [keys count];
- for (i = 0; i < iMax; i++) {
- NSString *key = [keys objectAtIndex:i];
+ for (NSString *key in keys)
[[self values] setValue:[[self initialValues] objectForKey:key]
forKey:key];
- }
}
@end
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2009-10-22 11:58:51 UTC (rev 5930)
+++ trunk/PDFPage_SKExtensions.m 2009-10-22 13:03:54 UTC (rev 5931)
@@ -289,12 +289,11 @@
[lines sortUsingSelector:@selector(boundsCompare:)];
- NSUInteger i, iMax = [lines count];
NSPointerArray *fullLines = [NSPointerArray rectPointerArray];
NSRect r1 = NSZeroRect;
- for (i = 0; i < iMax; i++) {
- NSRect r2 = [[lines objectAtIndex:i] rectValue];
+ for (NSValue *line in lines) {
+ NSRect r2 = [line rectValue];
if (NSEqualRects(r1, NSZeroRect)) {
r1 = r2;
} else if ((NSMinY(r1) < NSMidY(r2) && NSMidY(r1) > NSMinY(r2)) ||
(NSMidY(r1) < NSMaxY(r2) && NSMaxY(r1) > NSMidY(r2))) {
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2009-10-22 11:58:51 UTC (rev 5930)
+++ trunk/SKMainWindowController.m 2009-10-22 13:03:54 UTC (rev 5931)
@@ -1793,11 +1793,9 @@
- (void)addAnnotationsForSelection:(PDFSelection *)sel {
NSArray *pages = [sel pages];
- NSInteger i, iMax = [pages count];
NSColor *color = [[NSUserDefaults standardUserDefaults]
colorForKey:SKSearchHighlightColorKey] ?: [NSColor redColor];
- for (i = 0; i < iMax; i++) {
- PDFPage *page = [pages objectAtIndex:i];
+ for (PDFPage *page in pages) {
NSRect bounds = [sel boundsForPage:page];
if (NSIsEmptyRect(bounds) == NO) {
bounds = NSInsetRect(bounds, -4.0, -4.0);
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2009-10-22 11:58:51 UTC (rev 5930)
+++ trunk/SKMainWindowController_UI.m 2009-10-22 13:03:54 UTC (rev 5931)
@@ -939,10 +939,7 @@
[(NSMutableArray *)items addObjectsFromArray:[[self notes]
valueForKeyPath:@"@unionOfArrays.texts"]];
}
- NSInteger i, count = [items count];
-
- for (i = 0; i < count; i++) {
- id item = [items objectAtIndex:i];
+ for (id item in items) {
[cell setObjectValue:[item type] ? (id)[item string] : (id)[item
text]];
NSAttributedString *attrString = [cell attributedStringValue];
NSRect rect = [attrString boundingRectWithSize:[item type] ? size :
smallSize options:NSStringDrawingUsesLineFragmentOrigin];
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2009-10-22 11:58:51 UTC (rev 5930)
+++ trunk/SKNotesDocument.m 2009-10-22 13:03:54 UTC (rev 5931)
@@ -362,10 +362,7 @@
[(NSMutableArray *)items removeObject:[NSNull null]];
}
- NSInteger i, count = [items count];
-
- for (i = 0; i < count; i++) {
- id item = [items objectAtIndex:i];
+ for (id item in items) {
[cell setObjectValue:[item type] ? (id)[item string] : (id)[item
text]];
NSAttributedString *attrString = [cell attributedStringValue];
NSRect rect = [attrString boundingRectWithSize:[item type] ? size :
smallSize options:NSStringDrawingUsesLineFragmentOrigin];
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2009-10-22 11:58:51 UTC (rev 5930)
+++ trunk/SKPDFView.m 2009-10-22 13:03:54 UTC (rev 5931)
@@ -299,9 +299,7 @@
for (i = range.location; i < iMax; i++) {
PDFPage *page = [[self document] pageAtIndex:i];
NSArray *annotations = [page annotations];
- NSUInteger j, jMax = [annotations count];
- for (j = 0; j < jMax; j++) {
- PDFAnnotation *annotation = [annotations objectAtIndex:j];
+ for (PDFAnnotation *annotation in annotations) {
if ([[annotation type] isEqualToString:SKNNoteString] ||
[annotation isLink]) {
NSRect rect = NSIntersectionRect([self
convertRect:[annotation bounds] fromPage:page], visibleRect);
if (NSIsEmptyRect(rect) == NO) {
Modified: trunk/SKTextFieldSheetController.m
===================================================================
--- trunk/SKTextFieldSheetController.m 2009-10-22 11:58:51 UTC (rev 5930)
+++ trunk/SKTextFieldSheetController.m 2009-10-22 13:03:54 UTC (rev 5931)
@@ -89,9 +89,7 @@
- (NSString *)windowNibName { return @"BookmarkSheet"; }
- (void)addMenuItemsForBookmarks:(NSArray *)bookmarks level:(NSInteger)level
toMenu:(NSMenu *)menu {
- NSInteger i, iMax = [bookmarks count];
- for (i = 0; i < iMax; i++) {
- SKBookmark *bm = [bookmarks objectAtIndex:i];
+ for (SKBookmark *bm in bookmarks) {
if ([bm bookmarkType] == SKBookmarkTypeFolder) {
NSString *label = [bm label];
NSMenuItem *item = [menu addItemWithTitle:label ?: @"" action:NULL
keyEquivalent:@""];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit