Revision: 6473
http://skim-app.svn.sourceforge.net/skim-app/?rev=6473&view=rev
Author: hofman
Date: 2010-04-20 17:03:24 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
use immutable dictionary for toolbar items
Modified Paths:
--------------
trunk/SKBookmarkController.h
trunk/SKBookmarkController.m
trunk/SKNotesDocument.h
trunk/SKNotesDocument.m
Modified: trunk/SKBookmarkController.h
===================================================================
--- trunk/SKBookmarkController.h 2010-04-19 12:08:51 UTC (rev 6472)
+++ trunk/SKBookmarkController.h 2010-04-20 17:03:24 UTC (rev 6473)
@@ -49,7 +49,7 @@
NSMutableArray *recentDocuments;
NSUndoManager *undoManager;
NSArray *draggedBookmarks;
- NSMutableDictionary *toolbarItems;
+ NSDictionary *toolbarItems;
}
+ (id)sharedBookmarkController;
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2010-04-19 12:08:51 UTC (rev 6472)
+++ trunk/SKBookmarkController.m 2010-04-20 17:03:24 UTC (rev 6473)
@@ -739,9 +739,8 @@
// Create a new toolbar instance, and attach it to our document window
NSToolbar *toolbar = [[[NSToolbar alloc]
initWithIdentifier:SKBookmarksToolbarIdentifier] autorelease];
SKToolbarItem *item;
+ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:3];
- toolbarItems = [[NSMutableDictionary alloc] initWithCapacity:3];
-
// Set up toolbar properties: Allow customization, give a default display
mode, and remember state in user defaults
[toolbar setAllowsUserCustomization: YES];
[toolbar setAutosavesConfiguration: YES];
@@ -758,7 +757,7 @@
[item setImageNamed:SKImageNameToolbarNewFolder];
[item setTarget:self];
[item setAction:@selector(insertBookmarkFolder:)];
- [toolbarItems setObject:item
forKey:SKBookmarksNewFolderToolbarItemIdentifier];
+ [dict setObject:item forKey:SKBookmarksNewFolderToolbarItemIdentifier];
[item release];
item = [[SKToolbarItem alloc]
initWithItemIdentifier:SKBookmarksNewSeparatorToolbarItemIdentifier];
@@ -767,7 +766,7 @@
[item setImageNamed:SKImageNameToolbarNewSeparator];
[item setTarget:self];
[item setAction:@selector(insertBookmarkSeparator:)];
- [toolbarItems setObject:item
forKey:SKBookmarksNewSeparatorToolbarItemIdentifier];
+ [dict setObject:item forKey:SKBookmarksNewSeparatorToolbarItemIdentifier];
[item release];
item = [[SKToolbarItem alloc]
initWithItemIdentifier:SKBookmarksDeleteToolbarItemIdentifier];
@@ -776,9 +775,11 @@
[item setImage:[[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kToolbarDeleteIcon)]];
[item setTarget:self];
[item setAction:@selector(deleteBookmark:)];
- [toolbarItems setObject:item
forKey:SKBookmarksDeleteToolbarItemIdentifier];
+ [dict setObject:item forKey:SKBookmarksDeleteToolbarItemIdentifier];
[item release];
+ toolbarItems = [dict mutableCopy];
+
// Attach the toolbar to the window
[[self window] setToolbar:toolbar];
}
Modified: trunk/SKNotesDocument.h
===================================================================
--- trunk/SKNotesDocument.h 2010-04-19 12:08:51 UTC (rev 6472)
+++ trunk/SKNotesDocument.h 2010-04-20 17:03:24 UTC (rev 6473)
@@ -48,7 +48,7 @@
NSArrayController *arrayController;
NSSearchField *searchField;
SKStatusBar *statusBar;
- NSMutableDictionary *toolbarItems;
+ NSDictionary *toolbarItems;
NSArray *notes;
PDFDocument *pdfDocument;
SKFloatMapTable *rowHeights;
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2010-04-19 12:08:51 UTC (rev 6472)
+++ trunk/SKNotesDocument.m 2010-04-20 17:03:24 UTC (rev 6473)
@@ -647,9 +647,8 @@
// Create a new toolbar instance, and attach it to our document window
NSToolbar *toolbar = [[[NSToolbar alloc]
initWithIdentifier:SKNotesDocumentToolbarIdentifier] autorelease];
SKToolbarItem *item;
+ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:1];
- toolbarItems = [[NSMutableDictionary alloc] initWithCapacity:1];
-
// Set up toolbar properties: Allow customization, give a default display
mode, and remember state in user defaults
[toolbar setAllowsUserCustomization:YES];
[toolbar setAutosavesConfiguration:YES];
@@ -668,7 +667,7 @@
[item setMinSize:size];
size.width = 1000.0;
[item setMaxSize:size];
- [toolbarItems setObject:item
forKey:SKNotesDocumentSearchToolbarItemIdentifier];
+ [dict setObject:item forKey:SKNotesDocumentSearchToolbarItemIdentifier];
[item release];
item = [[SKToolbarItem alloc]
initWithItemIdentifier:SKNotesDocumentOpenPDFToolbarItemIdentifier];
@@ -677,9 +676,11 @@
[item setImageNamed:@"PDFDocument"];
[item setTarget:self];
[item setAction:@selector(openPDF:)];
- [toolbarItems setObject:item
forKey:SKNotesDocumentOpenPDFToolbarItemIdentifier];
+ [dict setObject:item forKey:SKNotesDocumentOpenPDFToolbarItemIdentifier];
[item release];
+ toolbarItems = [dict mutableCopy];
+
// Attach the toolbar to the window
[aWindow setToolbar:toolbar];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit