Revision: 7465
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7465&view=rev
Author:   hofman
Date:     2011-09-01 09:39:45 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
remove convenience method to add new bookmark and just create a new bookmark 
and add it in the action method

Modified Paths:
--------------
    trunk/NSDocument_SKExtensions.m
    trunk/SKBookmarkController.h
    trunk/SKBookmarkController.m

Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m     2011-08-31 15:15:56 UTC (rev 7464)
+++ trunk/NSDocument_SKExtensions.m     2011-09-01 09:39:45 UTC (rev 7465)
@@ -48,6 +48,7 @@
 #import "NSString_SKExtensions.h"
 #import "SKTextFieldSheetController.h"
 #import "SKBookmarkController.h"
+#import "SKBookmark.h"
 #import "NSWindowController_SKExtensions.h"
 #import "PDFPage_SKExtensions.h"
 #import "SKTemplateManager.h"
@@ -90,33 +91,35 @@
 
 - (void)bookmarkSheetDidEnd:(SKBookmarkSheetController *)controller 
returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
     if (returnCode == NSAlertDefaultReturn) {
-        SKBookmarkController *bmController = [SKBookmarkController 
sharedBookmarkController];
         NSString *label = [controller stringValue];
-        SKBookmark *folder = [controller selectedFolder];
+        SKBookmark *folder = [controller selectedFolder] ?: 
[[SKBookmarkController sharedBookmarkController] bookmarkRoot];
+        SKBookmark *bookmark = nil;
         switch ((NSInteger)contextInfo) {
             case SKAddBookmarkTypeBookmark:
             {
                 NSString *path = [[self fileURL] path];
                 PDFPage *page = [self currentPage];
                 NSUInteger pageIndex = page ? [page pageIndex] : NSNotFound;
-                [bmController addBookmarkForPath:path pageIndex:pageIndex 
label:label toFolder:folder];
+                bookmark = [SKBookmark bookmarkWithPath:path 
pageIndex:pageIndex label:label];
                 break;
             }
             case SKAddBookmarkTypeSetup:
             {
                 NSDictionary *setup = [self currentDocumentSetup];
-                [bmController addBookmarkForSetup:setup label:label 
toFolder:folder];
+                bookmark = [SKBookmark bookmarkWithSetup:setup label:label];
                 break;
             }
             case SKAddBookmarkTypeSession:
             {
                 NSArray *setups = [[NSApp orderedDocuments] 
valueForKey:@"currentDocumentSetup"];
-                [bmController addBookmarkForSetups:setups label:label 
toFolder:folder];
+                bookmark = [SKBookmark bookmarkSessionWithSetups:setups 
label:label];
                 break;
             }
             default:
                 break;
         }
+        if (bookmark)
+            [[folder mutableArrayValueForKey:@"children"] addObject:bookmark];
     }
 }
 

Modified: trunk/SKBookmarkController.h
===================================================================
--- trunk/SKBookmarkController.h        2011-08-31 15:15:56 UTC (rev 7464)
+++ trunk/SKBookmarkController.h        2011-09-01 09:39:45 UTC (rev 7465)
@@ -60,10 +60,6 @@
 @property (nonatomic, readonly) NSArray *recentDocuments;
 @property (nonatomic, readonly) NSUndoManager *undoManager;
 
-- (void)addBookmarkForPath:(NSString *)path pageIndex:(NSUInteger)pageIndex 
label:(NSString *)label toFolder:(SKBookmark *)folder;
-- (void)addBookmarkForSetup:(NSDictionary *)setupDict label:(NSString *)label 
toFolder:(SKBookmark *)folder;
-- (void)addBookmarkForSetups:(NSArray *)setupDicts label:(NSString *)label 
toFolder:(SKBookmark *)folder;
-
 - (IBAction)openBookmark:(id)sender;
 
 - (IBAction)doubleClickBookmark:(id)sender;

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2011-08-31 15:15:56 UTC (rev 7464)
+++ trunk/SKBookmarkController.m        2011-09-01 09:39:45 UTC (rev 7465)
@@ -222,27 +222,6 @@
     return minimalCover;
 }
 
-- (void)addBookmarkForPath:(NSString *)path pageIndex:(NSUInteger)pageIndex 
label:(NSString *)label toFolder:(SKBookmark *)folder {
-    if (folder == nil) folder = bookmarkRoot;
-    SKBookmark *bookmark = [SKBookmark bookmarkWithPath:path 
pageIndex:pageIndex label:label];
-    if (bookmark)
-        [folder insertObject:bookmark inChildrenAtIndex:[folder 
countOfChildren]];
-}
-
-- (void)addBookmarkForSetup:(NSDictionary *)setupDict label:(NSString *)label 
toFolder:(SKBookmark *)folder {
-    if (folder == nil) folder = bookmarkRoot;
-    SKBookmark *bookmark = [SKBookmark bookmarkWithSetup:setupDict 
label:label];
-    if (bookmark)
-        [folder insertObject:bookmark inChildrenAtIndex:[folder 
countOfChildren]];
-}
-
-- (void)addBookmarkForSetups:(NSArray *)setupDicts label:(NSString *)label 
toFolder:(SKBookmark *)folder {
-    if (folder == nil) folder = bookmarkRoot;
-    SKBookmark *bookmark = [SKBookmark bookmarkSessionWithSetups:setupDicts 
label:label];
-    if (bookmark)
-        [folder insertObject:bookmark inChildrenAtIndex:[folder 
countOfChildren]];
-}
-
 - (NSArray *)draggedBookmarks {
     return draggedBookmarks;
 }

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


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to