Revision: 7447 http://skim-app.svn.sourceforge.net/skim-app/?rev=7447&view=rev Author: hofman Date: 2011-08-27 12:38:08 +0000 (Sat, 27 Aug 2011) Log Message: ----------- use more convenience method for menu creation
Modified Paths: -------------- trunk/SKDragImageView.m trunk/SKFindController.m trunk/SKLeftSideViewController.m trunk/SKNotesDocument.m trunk/SKPDFView.m trunk/SKRightSideViewController.m trunk/SKScriptMenu.m Modified: trunk/SKDragImageView.m =================================================================== --- trunk/SKDragImageView.m 2011-08-27 11:33:02 UTC (rev 7446) +++ trunk/SKDragImageView.m 2011-08-27 12:38:08 UTC (rev 7447) @@ -79,13 +79,12 @@ - (NSMenu *)menuForEvent:(NSEvent *)theEvent { NSMenu *menu = [self menu]; if (menu == nil) { - menu = [[NSMenu allocWithZone:[NSMenu menuZone]] init]; + menu = [NSMenu menu]; [menu addItemWithTitle:NSLocalizedString(@"Copy", @"Menu item title") action:@selector(copy:) target:self]; [menu addItemWithTitle:NSLocalizedString(@"Paste", @"Menu item title") action:@selector(paste:) target:self]; [menu addItemWithTitle:NSLocalizedString(@"Delete", @"Menu item title") action:@selector(delete:) target:self]; [menu addItemWithTitle:NSLocalizedString(@"Show", @"Menu item title") action:@selector(show:) target:self]; [self setMenu:menu]; - [menu release]; } menu = [[menu copy] autorelease]; NSInteger i = [menu numberOfItems]; Modified: trunk/SKFindController.m =================================================================== --- trunk/SKFindController.m 2011-08-27 11:33:02 UTC (rev 7446) +++ trunk/SKFindController.m 2011-08-27 12:38:08 UTC (rev 7447) @@ -92,7 +92,7 @@ [gradientView setGradient:[[[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.82 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.914 alpha:1.0]] autorelease]]; [gradientView setAlternateGradient:nil]; - NSMenu *menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; + NSMenu *menu = [NSMenu menu]; [menu addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleCaseInsensitiveFind:) target:self]; [[findField cell] setSearchMenuTemplate:menu]; } Modified: trunk/SKLeftSideViewController.m =================================================================== --- trunk/SKLeftSideViewController.m 2011-08-27 11:33:02 UTC (rev 7446) +++ trunk/SKLeftSideViewController.m 2011-08-27 12:38:08 UTC (rev 7447) @@ -79,7 +79,7 @@ [alternateButton setToolTip:NSLocalizedString(@"Separate search results", @"Tool tip message") forSegment:SKSingularFindPaneState]; [alternateButton setToolTip:NSLocalizedString(@"Group search results by page", @"Tool tip message") forSegment:SKGroupedFindPaneState]; - NSMenu *menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; + NSMenu *menu = [NSMenu menu]; [menu addItemWithTitle:NSLocalizedString(@"Whole Words Only", @"Menu item title") action:@selector(toggleWholeWordSearch:) target:mainController]; [menu addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleCaseInsensitiveSearch:) target:mainController]; [[searchField cell] setSearchMenuTemplate:menu]; Modified: trunk/SKNotesDocument.m =================================================================== --- trunk/SKNotesDocument.m 2011-08-27 11:33:02 UTC (rev 7446) +++ trunk/SKNotesDocument.m 2011-08-27 12:38:08 UTC (rev 7447) @@ -169,7 +169,7 @@ if (NSEqualRects(windowRect, NSZeroRect) == NO) [[aController window] setFrame:windowRect display:NO]; - NSMenu *menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; + NSMenu *menu = [NSMenu menu]; [menu addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleCaseInsensitiveSearch:) target:self]; [[searchField cell] setSearchMenuTemplate:menu]; [[searchField cell] setPlaceholderString:NSLocalizedString(@"Search", @"placeholder")]; Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2011-08-27 11:33:02 UTC (rev 7446) +++ trunk/SKPDFView.m 2011-08-27 12:38:08 UTC (rev 7447) @@ -68,6 +68,7 @@ #import "NSEvent_SKExtensions.h" #import "SKLineInspector.h" #import "PDFView_SKExtensions.h" +#import "NSMenu_SKExtensions.h" #define ANNOTATION_MODE_COUNT 9 #define TOOL_MODE_COUNT 5 @@ -1286,7 +1287,8 @@ [menu insertItem:[NSMenuItem separatorItem] atIndex:0]; - submenu = [[NSMenu allocWithZone:[menu zone]] init]; + item = [menu insertItemWithSubmenuAndTitle:NSLocalizedString(@"New Note or Highlight", @"Menu item title") atIndex:0]; + submenu = [item submenu]; item = [submenu addItemWithTitle:NSLocalizedString(@"Text", @"Menu item title") action:@selector(changeToolMode:) keyEquivalent:@""]; [item setTag:SKTextToolMode]; @@ -1342,10 +1344,6 @@ [item setTag:SKInkNote]; [item setTarget:self]; - item = [menu insertItemWithTitle:NSLocalizedString(@"Tools", @"Menu item title") action:NULL keyEquivalent:@"" atIndex:0]; - [item setSubmenu:submenu]; - [submenu release]; - [menu insertItem:[NSMenuItem separatorItem] atIndex:0]; item = [menu insertItemWithTitle:NSLocalizedString(@"Take Snapshot", @"Menu item title") action:@selector(takeSnapshot:) keyEquivalent:@"" atIndex:0]; @@ -1355,7 +1353,8 @@ [menu insertItem:[NSMenuItem separatorItem] atIndex:0]; - submenu = [[NSMenu allocWithZone:[menu zone]] init]; + item = [menu insertItemWithSubmenuAndTitle:NSLocalizedString(@"New Note or Highlight", @"Menu item title") atIndex:0]; + submenu = [item submenu]; item = [submenu addItemWithTitle:NSLocalizedString(@"Text Note", @"Menu item title") action:@selector(addAnnotation:) keyEquivalent:@""]; [item setTag:SKFreeTextNote]; @@ -1391,10 +1390,6 @@ [item setTag:SKLineNote]; [item setTarget:self]; - item = [menu insertItemWithTitle:NSLocalizedString(@"New Note or Highlight", @"Menu item title") action:NULL keyEquivalent:@"" atIndex:0]; - [item setSubmenu:submenu]; - [submenu release]; - [menu insertItem:[NSMenuItem separatorItem] atIndex:0]; NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil]; Modified: trunk/SKRightSideViewController.m =================================================================== --- trunk/SKRightSideViewController.m 2011-08-27 11:33:02 UTC (rev 7446) +++ trunk/SKRightSideViewController.m 2011-08-27 12:38:08 UTC (rev 7447) @@ -74,7 +74,7 @@ [button setToolTip:NSLocalizedString(@"View Notes", @"Tool tip message") forSegment:SKNoteSidePaneState]; [button setToolTip:NSLocalizedString(@"View Snapshots", @"Tool tip message") forSegment:SKSnapshotSidePaneState]; - NSMenu *menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; + NSMenu *menu = [NSMenu menu]; [menu addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleCaseInsensitiveNoteSearch:) target:mainController]; [[searchField cell] setSearchMenuTemplate:menu]; [[searchField cell] setPlaceholderString:NSLocalizedString(@"Search", @"placeholder")]; Modified: trunk/SKScriptMenu.m =================================================================== --- trunk/SKScriptMenu.m 2011-08-27 11:33:02 UTC (rev 7446) +++ trunk/SKScriptMenu.m 2011-08-27 12:38:08 UTC (rev 7447) @@ -98,13 +98,12 @@ if (itemIndex > 0 && [folders count]) { - scriptMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:SCRIPTS_MENU_TITLE]; - NSMenuItem *menuItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:SCRIPTS_MENU_TITLE action:NULL keyEquivalent:@""]; + NSMenuItem *menuItem = [NSMenuItem menuItemWithSubmenuAndTitle:SCRIPTS_MENU_TITLE]; [menuItem setImage:[NSImage imageNamed:@"ScriptMenu"]]; - [menuItem setSubmenu:scriptMenu]; [[NSApp mainMenu] insertItem:menuItem atIndex:itemIndex]; - [menuItem release]; + scriptMenu = [[menuItem submenu] retain]; + sortDescriptors = [[NSArray alloc] initWithObjects:[[[NSSortDescriptor alloc] initWithKey:FILENAME_KEY ascending:YES selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease], nil]; scriptFolders = [folders copy]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit