Revision: 4751
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4751&view=rev
Author:   hofman
Date:     2008-10-07 16:45:46 +0000 (Tue, 07 Oct 2008)

Log Message:
-----------
Add Open PDF button as toolbar item and allow toggling the status bar in the 
notes document

Modified Paths:
--------------
    trunk/English.lproj/NotesDocument.nib/info.nib
    trunk/English.lproj/NotesDocument.nib/keyedobjects.nib
    trunk/InitialUserDefaults.plist
    trunk/SKNotesDocument.h
    trunk/SKNotesDocument.m
    trunk/SKStringConstants.h
    trunk/SKStringConstants.m

Modified: trunk/English.lproj/NotesDocument.nib/info.nib
===================================================================
--- trunk/English.lproj/NotesDocument.nib/info.nib      2008-10-07 16:17:12 UTC 
(rev 4750)
+++ trunk/English.lproj/NotesDocument.nib/info.nib      2008-10-07 16:45:46 UTC 
(rev 4751)
@@ -11,6 +11,7 @@
        <key>IBOpenObjects</key>
        <array>
                <integer>89</integer>
+               <integer>5</integer>
        </array>
        <key>IBSystem Version</key>
        <string>9F33</string>

Modified: trunk/InitialUserDefaults.plist
===================================================================
--- trunk/InitialUserDefaults.plist     2008-10-07 16:17:12 UTC (rev 4750)
+++ trunk/InitialUserDefaults.plist     2008-10-07 16:45:46 UTC (rev 4751)
@@ -276,6 +276,8 @@
         <true/>
         <key>SKShowBookmarkStatusBar</key>
         <true/>
+        <key>SKShowNotesStatusBar</key>
+        <true/>
         <key>SKAutoRotatePrintedPages</key>
         <true/>
     </dict>

Modified: trunk/SKNotesDocument.h
===================================================================
--- trunk/SKNotesDocument.h     2008-10-07 16:17:12 UTC (rev 4750)
+++ trunk/SKNotesDocument.h     2008-10-07 16:45:46 UTC (rev 4751)
@@ -52,7 +52,8 @@
 
 - (IBAction)openPDF:(id)sender;
 - (IBAction)searchNotes:(id)sender;
-
+- (IBAction)toggleStatusBar:(id)sender;
+ 
 - (NSArray *)notes;
 - (unsigned int)countOfNotes;
 - (NSDictionary *)objectInNotesAtIndex:(unsigned int)index;

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2008-10-07 16:17:12 UTC (rev 4750)
+++ trunk/SKNotesDocument.m     2008-10-07 16:45:46 UTC (rev 4751)
@@ -62,6 +62,7 @@
 
 static NSString *SKNotesDocumentToolbarIdentifier = 
@"SKNotesDocumentToolbarIdentifier";
 static NSString *SKNotesDocumentSearchToolbarItemIdentifier = 
@"SKNotesDocumentSearchToolbarItemIdentifier";
+static NSString *SKNotesDocumentOpenPDFToolbarItemIdentifier = 
@"SKNotesDocumentOpenPDFToolbarItemIdentifier";
 
 static NSString *SKLastExportedNotesTypeKey = @"SKLastExportedNotesType";
 
@@ -86,6 +87,7 @@
 - (void)dealloc {
     [notes release];
     [toolbarItems release];
+    [statusBar release];
     [super dealloc];
 }
 
@@ -105,6 +107,12 @@
     
     [aController 
setWindowFrameAutosaveNameOrCascade:SKNotesDocumentWindowFrameAutosaveName];
     
+    [statusBar retain];
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKShowNotesStatusBarKey] == NO)
+        [self toggleStatusBar:nil];
+    
+    [[searchField cell] setPlaceholderString:NSLocalizedString(@"Search", 
@"placeholder")];
+    
     [outlineView setAutoresizesOutlineColumn: NO];
     
     NSSortDescriptor *indexSortDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES] autorelease];
@@ -372,6 +380,11 @@
     }
 }
 
+- (IBAction)toggleStatusBar:(id)sender {
+    [statusBar toggleBelowView:[outlineView enclosingScrollView] offset:1.0];
+    [[NSUserDefaults standardUserDefaults] setBool:[statusBar isVisible] 
forKey:SKShowNotesStatusBarKey];
+}
+
 - (void)copyNote:(id)sender {
     NSDictionary *item = [sender representedObject];
     [self outlineView:outlineView copyItems:[NSArray arrayWithObjects:item, 
nil]];
@@ -413,6 +426,18 @@
     [outlineView noteHeightOfRowsWithIndexesChanged:rowIndexes];
 }
 
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
+    SEL action = [menuItem action];
+    if (action == @selector(toggleStatusBar:)) {
+        if ([statusBar isVisible])
+            [menuItem setTitle:NSLocalizedString(@"Hide Status Bar", @"Menu 
item title")];
+        else
+            [menuItem setTitle:NSLocalizedString(@"Show Status Bar", @"Menu 
item title")];
+        return YES;
+    }
+    return YES;
+}
+
 #pragma mark Accessors
 
 - (NSArray *)notes {
@@ -645,6 +670,15 @@
     [toolbarItems setObject:item 
forKey:SKNotesDocumentSearchToolbarItemIdentifier];
     [item release];
     
+    item = [[SKToolbarItem alloc] 
initWithItemIdentifier:SKNotesDocumentOpenPDFToolbarItemIdentifier];
+    [item setLabels:NSLocalizedString(@"Open PDF", @"Toolbar item label")];
+    [item setToolTip:NSLocalizedString(@"Open Associated PDF File", @"Tool tip 
message")];
+    [item setImageNamed:@"PDFDocument"];
+    [item setTarget:self];
+    [item setAction:@selector(openPDF:)];
+    [toolbarItems setObject:item 
forKey:SKNotesDocumentOpenPDFToolbarItemIdentifier];
+    [item release];
+    
     // Attach the toolbar to the window
     [[aController window] setToolbar:toolbar];
 }
@@ -658,17 +692,25 @@
 
 - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar {
     return [NSArray arrayWithObjects:
-        SKNotesDocumentSearchToolbarItemIdentifier,
-        NSToolbarFlexibleSpaceItemIdentifier, nil];
+        SKNotesDocumentSearchToolbarItemIdentifier, 
+        NSToolbarFlexibleSpaceItemIdentifier, 
+        SKNotesDocumentOpenPDFToolbarItemIdentifier, nil];
 }
 
 - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar {
     return [NSArray arrayWithObjects: 
         SKNotesDocumentSearchToolbarItemIdentifier, 
+        SKNotesDocumentOpenPDFToolbarItemIdentifier, 
         NSToolbarFlexibleSpaceItemIdentifier, 
                NSToolbarSpaceItemIdentifier, 
                NSToolbarSeparatorItemIdentifier, 
                NSToolbarCustomizeToolbarItemIdentifier, nil];
 }
 
+- (BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem {
+    if ([[toolbarItem itemIdentifier] 
isEqualToString:SKNotesDocumentOpenPDFToolbarItemIdentifier])
+        return [[NSFileManager defaultManager] fileExistsAtPath:[[self 
fileName] stringByReplacingPathExtension:@"pdf"]];
+    return YES;
+}
+
 @end

Modified: trunk/SKStringConstants.h
===================================================================
--- trunk/SKStringConstants.h   2008-10-07 16:17:12 UTC (rev 4750)
+++ trunk/SKStringConstants.h   2008-10-07 16:45:46 UTC (rev 4751)
@@ -103,6 +103,7 @@
 extern NSString *SKDefaultFullScreenPDFDisplaySettingsKey;
 extern NSString *SKShowStatusBarKey;
 extern NSString *SKShowBookmarkStatusBarKey;
+extern NSString *SKShowNotesStatusBarKey;
 extern NSString *SKEnableAppleRemoteKey;
 extern NSString *SKEnableKeyspanFrontRowControlKey;
 extern NSString *SKEnableKeyboardRemoteSimulationKey;

Modified: trunk/SKStringConstants.m
===================================================================
--- trunk/SKStringConstants.m   2008-10-07 16:17:12 UTC (rev 4750)
+++ trunk/SKStringConstants.m   2008-10-07 16:45:46 UTC (rev 4751)
@@ -104,6 +104,7 @@
 NSString *SKDefaultFullScreenPDFDisplaySettingsKey = 
@"SKDefaultFullScreenPDFDisplaySettings";
 NSString *SKShowStatusBarKey = @"SKShowStatusBar";
 NSString *SKShowBookmarkStatusBarKey = @"SKShowBookmarkStatusBar";
+NSString *SKShowNotesStatusBarKey = @"SKShowNotesStatusBar";
 NSString *SKEnableAppleRemoteKey = @"SKEnableAppleRemote";
 NSString *SKEnableKeyspanFrontRowControlKey = 
@"SKEnableKeyspanFrontRowControl";
 NSString *SKEnableKeyboardRemoteSimulationKey = 
@"SKEnableKeyboardRemoteSimulation";


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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to