Revision: 4416
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4416&view=rev
Author:   hofman
Date:     2008-08-16 10:56:20 +0000 (Sat, 16 Aug 2008)

Log Message:
-----------
Set note window title to note type and note string. Avoids empty titles. Don't 
use bindings for it, as it doesn't work anyway.

Modified Paths:
--------------
    trunk/English.lproj/NoteWindow.nib/info.nib
    trunk/English.lproj/NoteWindow.nib/keyedobjects.nib
    trunk/Italian.lproj/NoteWindow.nib/info.nib
    trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib
    trunk/SKNoteWindowController.m

Modified: trunk/English.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/English.lproj/NoteWindow.nib/info.nib 2008-08-15 17:46:16 UTC (rev 
4415)
+++ trunk/English.lproj/NoteWindow.nib/info.nib 2008-08-16 10:56:20 UTC (rev 
4416)
@@ -10,7 +10,7 @@
        <integer>4</integer>
        <key>IBOpenObjects</key>
        <array>
-               <integer>113</integer>
+               <integer>7</integer>
                <integer>114</integer>
        </array>
        <key>IBSystem Version</key>

Modified: trunk/Italian.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/Italian.lproj/NoteWindow.nib/info.nib 2008-08-15 17:46:16 UTC (rev 
4415)
+++ trunk/Italian.lproj/NoteWindow.nib/info.nib 2008-08-16 10:56:20 UTC (rev 
4416)
@@ -10,7 +10,7 @@
        <integer>4</integer>
        <key>IBOpenObjects</key>
        <array>
-               <integer>8</integer>
+               <integer>113</integer>
                <integer>114</integer>
        </array>
        <key>IBSystem Version</key>

Modified: trunk/SKNoteWindowController.m
===================================================================
--- trunk/SKNoteWindowController.m      2008-08-15 17:46:16 UTC (rev 4415)
+++ trunk/SKNoteWindowController.m      2008-08-16 10:56:20 UTC (rev 4416)
@@ -51,8 +51,10 @@
 #import "SKRuntime.h"
 #import "PDFPage_SKExtensions.h"
 #import "SKAnnotationTypeImageCell.h"
+#import "NSString_SKExtensions.h"
 
 #define SIZE_OFFSET 32.0
+#define EM_DASH_CHARACTER 0x2014
 
 static NSString *SKNoteWindowFrameAutosaveName = @"SKNoteWindow";
 static NSString *SKGenericNoteWindowFrameAutosaveName = @"SKGenericNoteWindow";
@@ -62,6 +64,7 @@
 static void *SKNoteWindowPageObservationContext = (void 
*)@"SKNoteWindowPageObservationContext";
 static void *SKNoteWindowBoundsObservationContext = (void 
*)@"SKNoteWindowBoundsObservationContext";
 static void *SKNoteWindowDefaultsObservationContext = (void 
*)@"SKNoteWindowDefaultsObservationContext";
+static void *SKNoteWindowStringObservationContext = (void 
*)@"SKNoteWindowStringObservationContext";
 
 @implementation SKNoteWindowController
 
@@ -106,6 +109,7 @@
         
         [note addObserver:self forKeyPath:SKNPDFAnnotationPageKey options:0 
context:SKNoteWindowPageObservationContext];
         [note addObserver:self forKeyPath:SKNPDFAnnotationBoundsKey options:0 
context:SKNoteWindowBoundsObservationContext];
+        [note addObserver:self forKeyPath:SKNPDFAnnotationStringKey options:0 
context:SKNoteWindowStringObservationContext];
         if ([self isNoteType])
             [[NSUserDefaultsController sharedUserDefaultsController] 
addObserver:self forKeys:[NSArray arrayWithObjects:SKAnchoredNoteFontNameKey, 
SKAnchoredNoteFontSizeKey, nil] context:SKNoteWindowDefaultsObservationContext];
     }
@@ -115,6 +119,7 @@
 - (void)dealloc {
     [note removeObserver:self forKeyPath:SKNPDFAnnotationPageKey];
     [note removeObserver:self forKeyPath:SKNPDFAnnotationBoundsKey];
+    [note removeObserver:self forKeyPath:SKNPDFAnnotationStringKey];
     if ([self isNoteType])
         [[NSUserDefaultsController sharedUserDefaultsController] 
removeObserver:self forKeys:[NSArray 
arrayWithObjects:SKAnchoredNoteFontNameKey, SKAnchoredNoteFontSizeKey, nil]];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -213,7 +218,7 @@
 }
 
 - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName {
-    return [[self note] string];
+    return [NSString stringWithFormat:@"%@ %C %@", [[[self note] type] 
typeName], EM_DASH_CHARACTER, [[self note] string]];
 }
 
 - (PDFAnnotation *)note {
@@ -337,6 +342,8 @@
         }
     } else if (context == SKNoteWindowBoundsObservationContext || context == 
SKNoteWindowPageObservationContext) {
         [self updateStatusMessage];
+    } else if (context == SKNoteWindowStringObservationContext) {
+        [self synchronizeWindowTitleWithDocumentName];
     } else {
         [super observeValueForKeyPath:keyPath ofObject:object change:change 
context:context];
     }


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