Revision: 7017
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7017&view=rev
Author:   hofman
Date:     2010-12-28 13:31:06 +0000 (Tue, 28 Dec 2010)

Log Message:
-----------
instantiate bookmark controller in main nib and set it as the delegate of the 
bookmarks menu

Modified Paths:
--------------
    trunk/MainMenu.xib
    trunk/SKApplicationController.h
    trunk/SKApplicationController.m
    trunk/SKBookmarkController.h
    trunk/SKBookmarkController.m

Modified: trunk/MainMenu.xib
===================================================================
--- trunk/MainMenu.xib  2010-12-28 12:29:02 UTC (rev 7016)
+++ trunk/MainMenu.xib  2010-12-28 13:31:06 UTC (rev 7017)
@@ -2,13 +2,13 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
        <data>
                <int key="IBDocument.SystemTarget">1040</int>
-               <string key="IBDocument.SystemVersion">10F569</string>
-               <string key="IBDocument.InterfaceBuilderVersion">788</string>
-               <string key="IBDocument.AppKitVersion">1038.29</string>
+               <string key="IBDocument.SystemVersion">10H574</string>
+               <string key="IBDocument.InterfaceBuilderVersion">823</string>
+               <string key="IBDocument.AppKitVersion">1038.35</string>
                <string key="IBDocument.HIToolboxVersion">461.00</string>
                <object class="NSMutableDictionary" 
key="IBDocument.PluginVersions">
                        <string 
key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                       <string key="NS.object.0">788</string>
+                       <string key="NS.object.0">823</string>
                </object>
                <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -18,13 +18,8 @@
                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                </object>
                <object class="NSMutableDictionary" key="IBDocument.Metadata">
-                       <bool key="EncodedWithXMLCoder">YES</bool>
-                       <object class="NSArray" key="dict.sortedKeys" id="0">
-                               <bool key="EncodedWithXMLCoder">YES</bool>
-                       </object>
-                       <object class="NSMutableArray" key="dict.values">
-                               <bool key="EncodedWithXMLCoder">YES</bool>
-                       </object>
+                       <string 
key="NS.key.0">PluginDependencyRecalculationVersion</string>
+                       <integer value="1" key="NS.object.0"/>
                </object>
                <object class="NSMutableArray" key="IBDocument.RootObjects" 
id="543243327">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -2356,6 +2351,9 @@
                        <object class="NSCustomObject" id="205026170">
                                <string key="NSClassName">SUUpdater</string>
                        </object>
+                       <object class="NSCustomObject" id="1012095061">
+                               <string 
key="NSClassName">SKBookmarkController</string>
+                       </object>
                </object>
                <object class="IBObjectContainer" key="IBDocument.Objects">
                        <object class="NSMutableArray" key="connectionRecords">
@@ -2921,14 +2919,6 @@
                                        <int key="connectionID">698</int>
                                </object>
                                <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" 
key="connection">
-                                               <string 
key="label">delegate</string>
-                                               <reference key="source" 
ref="417000625"/>
-                                               <reference key="destination" 
ref="115281690"/>
-                                       </object>
-                                       <int key="connectionID">704</int>
-                               </object>
-                               <object class="IBConnectionRecord">
                                        <object class="IBActionConnection" 
key="connection">
                                                <string 
key="label">addBookmark:</string>
                                                <reference key="source" 
ref="660174102"/>
@@ -2938,14 +2928,6 @@
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBActionConnection" 
key="connection">
-                                               <string 
key="label">editBookmarks:</string>
-                                               <reference key="source" 
ref="660174102"/>
-                                               <reference key="destination" 
ref="182834414"/>
-                                       </object>
-                                       <int key="connectionID">708</int>
-                               </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBActionConnection" 
key="connection">
                                                <string 
key="label">saveArchive:</string>
                                                <reference key="source" 
ref="660174102"/>
                                                <reference key="destination" 
ref="145817286"/>
@@ -3648,13 +3630,31 @@
                                        </object>
                                        <int key="connectionID">1075</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBActionConnection" 
key="connection">
+                                               <string 
key="label">showWindow:</string>
+                                               <reference key="source" 
ref="1012095061"/>
+                                               <reference key="destination" 
ref="182834414"/>
+                                       </object>
+                                       <int key="connectionID">1087</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" 
key="connection">
+                                               <string 
key="label">delegate</string>
+                                               <reference key="source" 
ref="417000625"/>
+                                               <reference key="destination" 
ref="1012095061"/>
+                                       </object>
+                                       <int key="connectionID">1088</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                        <bool 
key="EncodedWithXMLCoder">YES</bool>
                                        <object class="IBObjectRecord">
                                                <int key="objectID">0</int>
-                                               <reference key="object" 
ref="0"/>
+                                               <object class="NSArray" 
key="object" id="0">
+                                                       <bool 
key="EncodedWithXMLCoder">YES</bool>
+                                               </object>
                                                <reference key="children" 
ref="543243327"/>
                                                <nil key="parent"/>
                                        </object>
@@ -5314,6 +5314,11 @@
                                                <reference key="object" 
ref="982723489"/>
                                                <reference key="parent" 
ref="934112995"/>
                                        </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">1086</int>
+                                               <reference key="object" 
ref="1012095061"/>
+                                               <reference key="parent" 
ref="0"/>
+                                       </object>
                                </object>
                        </object>
                        <object class="NSMutableDictionary" 
key="flattenedProperties">
@@ -5339,6 +5344,7 @@
                                        <string>106.IBPluginDependency</string>
                                        <string>106.ImportedFromIB2</string>
                                        <string>1085.IBPluginDependency</string>
+                                       <string>1086.IBPluginDependency</string>
                                        <string>111.IBPluginDependency</string>
                                        <string>111.ImportedFromIB2</string>
                                        <string>124.IBPluginDependency</string>
@@ -5824,6 +5830,7 @@
                                        <boolean value="YES"/>
                                        
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <boolean value="YES"/>
                                        
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <boolean value="YES"/>
@@ -5908,7 +5915,7 @@
                                        <boolean value="YES"/>
                                        
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <boolean value="YES"/>
-                                       <string>{{674, 589}, {208, 
123}}</string>
+                                       <string>{{528, 652}, {208, 
123}}</string>
                                        
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <boolean value="YES"/>
                                        <string>{{378, 362}, {244, 
413}}</string>
@@ -6303,7 +6310,7 @@
                                </object>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">1085</int>
+                       <int key="maxID">1088</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" 
key="referencedPartialClassDescriptions">
@@ -7039,20 +7046,6 @@
                                        <string 
key="className">NSObject</string>
                                        <object 
class="IBClassDescriptionSource" key="sourceIdentifier">
                                                <string 
key="majorKey">IBProjectSource</string>
-                                               <string 
key="minorKey">vendorsrc/martinkahr/RemoteControlWrapper/MultiClickRemoteBehavior.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string 
key="className">NSObject</string>
-                                       <object 
class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string 
key="majorKey">IBProjectSource</string>
-                                               <string 
key="minorKey">vendorsrc/martinkahr/RemoteControlWrapper/RemoteControl.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string 
key="className">NSObject</string>
-                                       <object 
class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string 
key="majorKey">IBProjectSource</string>
                                                <string 
key="minorKey">vendorsrc/ulikusterer/UKFileWatcher.h</string>
                                        </object>
                                </object>
@@ -8404,6 +8397,9 @@
                                                <bool 
key="EncodedWithXMLCoder">YES</bool>
                                                <object class="NSArray" 
key="dict.sortedKeys">
                                                        <bool 
key="EncodedWithXMLCoder">YES</bool>
+                                                       
<string>alignCenter:</string>
+                                                       
<string>alignLeft:</string>
+                                                       
<string>alignRight:</string>
                                                        
<string>allGoToFirstPage:</string>
                                                        
<string>allGoToLastPage:</string>
                                                        
<string>allGoToNextPage:</string>
@@ -8413,6 +8409,7 @@
                                                        
<string>autoCropAll:</string>
                                                        
<string>autoSelectContent:</string>
                                                        
<string>changeAnnotationMode:</string>
+                                                       
<string>changeAttributes:</string>
                                                        
<string>changeColor:</string>
                                                        
<string>changeDisplayBox:</string>
                                                        
<string>changeDisplayContinuous:</string>
@@ -8553,12 +8550,19 @@
                                                        <string>id</string>
                                                        <string>id</string>
                                                        <string>id</string>
+                                                       <string>id</string>
+                                                       <string>id</string>
+                                                       <string>id</string>
+                                                       <string>id</string>
                                                </object>
                                        </object>
                                        <object class="NSMutableDictionary" 
key="actionInfosByName">
                                                <bool 
key="EncodedWithXMLCoder">YES</bool>
                                                <object class="NSArray" 
key="dict.sortedKeys">
                                                        <bool 
key="EncodedWithXMLCoder">YES</bool>
+                                                       
<string>alignCenter:</string>
+                                                       
<string>alignLeft:</string>
+                                                       
<string>alignRight:</string>
                                                        
<string>allGoToFirstPage:</string>
                                                        
<string>allGoToLastPage:</string>
                                                        
<string>allGoToNextPage:</string>
@@ -8568,6 +8572,7 @@
                                                        
<string>autoCropAll:</string>
                                                        
<string>autoSelectContent:</string>
                                                        
<string>changeAnnotationMode:</string>
+                                                       
<string>changeAttributes:</string>
                                                        
<string>changeColor:</string>
                                                        
<string>changeDisplayBox:</string>
                                                        
<string>changeDisplayContinuous:</string>
@@ -8636,6 +8641,18 @@
                                                <object class="NSMutableArray" 
key="dict.values">
                                                        <bool 
key="EncodedWithXMLCoder">YES</bool>
                                                        <object 
class="IBActionInfo">
+                                                               <string 
key="name">alignCenter:</string>
+                                                               <string 
key="candidateClassName">id</string>
+                                                       </object>
+                                                       <object 
class="IBActionInfo">
+                                                               <string 
key="name">alignLeft:</string>
+                                                               <string 
key="candidateClassName">id</string>
+                                                       </object>
+                                                       <object 
class="IBActionInfo">
+                                                               <string 
key="name">alignRight:</string>
+                                                               <string 
key="candidateClassName">id</string>
+                                                       </object>
+                                                       <object 
class="IBActionInfo">
                                                                <string 
key="name">allGoToFirstPage:</string>
                                                                <string 
key="candidateClassName">id</string>
                                                        </object>
@@ -8672,6 +8689,10 @@
                                                                <string 
key="candidateClassName">id</string>
                                                        </object>
                                                        <object 
class="IBActionInfo">
+                                                               <string 
key="name">changeAttributes:</string>
+                                                               <string 
key="candidateClassName">id</string>
+                                                       </object>
+                                                       <object 
class="IBActionInfo">
                                                                <string 
key="name">changeColor:</string>
                                                                <string 
key="candidateClassName">id</string>
                                                        </object>

Modified: trunk/SKApplicationController.h
===================================================================
--- trunk/SKApplicationController.h     2010-12-28 12:29:02 UTC (rev 7016)
+++ trunk/SKApplicationController.h     2010-12-28 13:31:06 UTC (rev 7017)
@@ -42,7 +42,7 @@
 
 @class SKBookmark;
 
-...@interface SKApplicationController : NSObject <SKApplicationDelegate, 
NSMenuDelegate, HIDRemoteDelegate> {
+...@interface SKApplicationController : NSObject <SKApplicationDelegate, 
HIDRemoteDelegate> {
     BOOL remoteScrolling;
 }
 
@@ -55,9 +55,6 @@
 - (IBAction)showReleaseNotes:(id)sender;
 - (IBAction)showDownloads:(id)sender;
 
-- (IBAction)editBookmarks:(id)sender;
-- (IBAction)openBookmarkAction:(id)sender;
-
 @property (nonatomic, copy) NSDictionary *defaultPdfViewSettings, 
*defaultFullScreenPdfViewSettings;
 @property (nonatomic, copy) NSColor *backgroundColor, 
*fullScreenBackgroundColor, *pageBackgroundColor, *defaultTextNoteFontColor;
 @property (nonatomic, copy) NSDictionary *defaultNoteColors, 
*defaultLineWidths, *defaultLineStyles, *defaultDashPatterns, 
*defaultFontNames, *defaultFontSizes;

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2010-12-28 12:29:02 UTC (rev 7016)
+++ trunk/SKApplicationController.m     2010-12-28 13:31:06 UTC (rev 7017)
@@ -68,7 +68,6 @@
 #import "PDFAnnotationFreeText_SKExtensions.h"
 #import "PDFAnnotationText_SKExtensions.h"
 #import "SKRemoteStateWindow.h"
-#import "NSMenu_SKExtensions.h"
 #import "SKFDFParser.h"
 #import "SKLocalization.h"
 #import "SKScriptMenu.h"
@@ -83,7 +82,6 @@
 #define RESETTABLE_KEYS_KEY             @"ResettableKeys"
 
 #define VIEW_MENU_INDEX      4
-#define BOOKMARKS_MENU_INDEX 8
 
 #define CURRENTDOCUMENTSETUP_KEY @"currentDocumentSetup"
 
@@ -140,8 +138,6 @@
             [menuItem setIndentationLevel:1];
     }
     
-    [[[NSApp mainMenu] itemAtIndex:BOOKMARKS_MENU_INDEX] 
setRepresentedObject:[[SKBookmarkController sharedBookmarkController] 
bookmarkRoot]];
-    
     // this creates the script menu if needed
     (void)[NSApp scriptMenu];
     
@@ -301,14 +297,6 @@
     [[SKDownloadController sharedDownloadController] showWindow:self];
 }
 
-- (IBAction)editBookmarks:(id)sender {
-    [[SKBookmarkController sharedBookmarkController] showWindow:self];
-}
-
-- (IBAction)openBookmarkAction:(id)sender {
-    [[SKBookmarkController sharedBookmarkController] openBookmark:[sender 
representedObject]];
-}
-
 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
     SEL action = [menuItem action];
     if (action == @selector(orderFrontLineInspector:)) {
@@ -327,50 +315,6 @@
     return YES;
 }
 
-#pragma mark Support
-
-- (void)menuNeedsUpdate:(NSMenu *)menu {
-    NSMenu *supermenu = [menu supermenu];
-    NSInteger idx = [supermenu indexOfItemWithSubmenu:menu]; 
-    SKBookmark *bm = idx == -1 ? nil : [[supermenu itemAtIndex:idx] 
representedObject];
-    NSMenuItem *item;
-    
-    if ([bm isKindOfClass:[SKBookmark class]]) {
-        NSArray *bookmarks = [bm children];
-        NSInteger i = [menu numberOfItems];
-        while (i-- > 0 && ([[menu itemAtIndex:i] isSeparatorItem] || [[menu 
itemAtIndex:i] representedObject]))
-            [menu removeItemAtIndex:i];
-        if ([menu numberOfItems] > 0 && [bookmarks count] > 0)
-            [menu addItem:[NSMenuItem separatorItem]];
-        for (bm in bookmarks) {
-            switch ([bm bookmarkType]) {
-                case SKBookmarkTypeFolder:
-                    item = [menu addItemWithTitle:[bm label] submenu:[[[NSMenu 
allocWithZone:[NSMenu menuZone]] initWithTitle:[bm label]] autorelease]];
-                    [item setRepresentedObject:bm];
-                    [item setImageAndSize:[bm icon]];
-                    [[item submenu] setDelegate:self];
-                    item = [menu addItemWithTitle:[bm label] 
action:@selector(openBookmarkAction:) target:self];
-                    [item setRepresentedObject:bm];
-                    [item setKeyEquivalentModifierMask:NSAlternateKeyMask];
-                    [item setAlternate:YES];
-                    [item setImageAndSize:[bm alternateIcon]];
-                    break;
-                case SKBookmarkTypeSeparator:
-                    [menu addItem:[NSMenuItem separatorItem]];
-                    break;
-                default:
-                    item = [menu addItemWithTitle:[bm label] 
action:@selector(openBookmarkAction:) target:self];
-                    [item setRepresentedObject:bm];
-                    [item setImageAndSize:[bm icon]];
-                    break;
-            }
-        }
-    }
-}
-
-// avoid rebuilding the bookmarks menu on every key event
-- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event 
target:(id *)target action:(SEL *)action { return NO; }
-
 - (void)hidRemote:(HIDRemote *)hidRemote 
eventWithButton:(HIDRemoteButtonCode)buttonCode isPressed:(BOOL)isPressed 
fromHardwareWithAttributes:(NSMutableDictionary *)attributes {
     if (isPressed) {
         if (buttonCode == kHIDRemoteButtonCodeMenu) {

Modified: trunk/SKBookmarkController.h
===================================================================
--- trunk/SKBookmarkController.h        2010-12-28 12:29:02 UTC (rev 7016)
+++ trunk/SKBookmarkController.h        2010-12-28 13:31:06 UTC (rev 7017)
@@ -66,6 +66,8 @@
 
 - (void)openBookmark:(SKBookmark *)bookmark;
 
+- (IBAction)openBookmarkAction:(id)sender;
+
 - (IBAction)doubleClickBookmark:(id)sender;
 - (IBAction)insertBookmarkFolder:(id)sender;
 - (IBAction)insertBookmarkSeparator:(id)sender;

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2010-12-28 12:29:02 UTC (rev 7016)
+++ trunk/SKBookmarkController.m        2010-12-28 13:31:06 UTC (rev 7017)
@@ -50,6 +50,7 @@
 #import "SKStringConstants.h"
 #import "SKDocumentController.h"
 #import "SKSeparatorCell.h"
+#import "NSMenu_SKExtensions.h"
 
 #define SKBookmarkRowsPboardType @"SKBookmarkRowsPboardType"
 
@@ -375,6 +376,10 @@
     }
 }
 
+- (IBAction)openBookmarkAction:(id)sender {
+    [self openBookmark:[sender representedObject]];
+}
+
 - (IBAction)doubleClickBookmark:(id)sender {
     NSInteger row = [outlineView clickedRow];
     if (row == -1)
@@ -418,6 +423,53 @@
     [statusBar toggleBelowView:[outlineView enclosingScrollView] 
animate:sender != nil];
 }
 
+- (void)menuNeedsUpdate:(NSMenu *)menu {
+    NSMenu *supermenu = [menu supermenu];
+    NSInteger idx = [supermenu indexOfItemWithSubmenu:menu]; 
+    SKBookmark *bm = nil;
+    NSMenuItem *item;
+    
+    if (supermenu == [NSApp mainMenu])
+        bm = [self bookmarkRoot];
+    else if (idx >= 0)
+        bm = [[supermenu itemAtIndex:idx] representedObject];
+    
+    if ([bm isKindOfClass:[SKBookmark class]]) {
+        NSArray *bookmarks = [bm children];
+        NSInteger i = [menu numberOfItems];
+        while (i-- > 0 && ([[menu itemAtIndex:i] isSeparatorItem] || [[menu 
itemAtIndex:i] representedObject]))
+            [menu removeItemAtIndex:i];
+        if ([menu numberOfItems] > 0 && [bookmarks count] > 0)
+            [menu addItem:[NSMenuItem separatorItem]];
+        for (bm in bookmarks) {
+            switch ([bm bookmarkType]) {
+                case SKBookmarkTypeFolder:
+                    item = [menu addItemWithTitle:[bm label] submenu:[[[NSMenu 
allocWithZone:[NSMenu menuZone]] initWithTitle:[bm label]] autorelease]];
+                    [item setRepresentedObject:bm];
+                    [item setImageAndSize:[bm icon]];
+                    [[item submenu] setDelegate:self];
+                    item = [menu addItemWithTitle:[bm label] 
action:@selector(openBookmarkAction:) target:self];
+                    [item setRepresentedObject:bm];
+                    [item setKeyEquivalentModifierMask:NSAlternateKeyMask];
+                    [item setAlternate:YES];
+                    [item setImageAndSize:[bm alternateIcon]];
+                    break;
+                case SKBookmarkTypeSeparator:
+                    [menu addItem:[NSMenuItem separatorItem]];
+                    break;
+                default:
+                    item = [menu addItemWithTitle:[bm label] 
action:@selector(openBookmarkAction:) target:self];
+                    [item setRepresentedObject:bm];
+                    [item setImageAndSize:[bm icon]];
+                    break;
+            }
+        }
+    }
+}
+
+// avoid rebuilding the bookmarks menu on every key event
+- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event 
target:(id *)target action:(SEL *)action { return NO; }
+
 #pragma mark Undo support
 
 - (NSUndoManager *)undoManager {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to