Revision: 2793
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2793&view=rev
Author:   hofman
Date:     2007-08-31 04:33:28 -0700 (Fri, 31 Aug 2007)

Log Message:
-----------
Fix a binding-to-owner bug. For the records, this happens when binding to the 
nib-owner for displayPatternValue#. We now observe the relevant changes in the 
windowController.

Modified Paths:
--------------
    trunk/Dutch.lproj/Localizable.strings
    trunk/Dutch.lproj/MainMenu.nib/info.nib
    trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib
    trunk/Dutch.lproj/NoteWindow.nib/classes.nib
    trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib
    trunk/English.lproj/MainMenu.nib/keyedobjects.nib
    trunk/English.lproj/NoteWindow.nib/classes.nib
    trunk/English.lproj/NoteWindow.nib/keyedobjects.nib
    trunk/French.lproj/Localizable.strings
    trunk/French.lproj/NoteWindow.nib/classes.nib
    trunk/French.lproj/NoteWindow.nib/keyedobjects.nib
    trunk/Italian.lproj/Localizable.strings
    trunk/Italian.lproj/NoteWindow.nib/classes.nib
    trunk/Italian.lproj/NoteWindow.nib/info.nib
    trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib
    trunk/SKNoteWindowController.h
    trunk/SKNoteWindowController.m

Modified: trunk/Dutch.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/Dutch.lproj/MainMenu.nib/info.nib
===================================================================
--- trunk/Dutch.lproj/MainMenu.nib/info.nib     2007-08-31 09:59:52 UTC (rev 
2792)
+++ trunk/Dutch.lproj/MainMenu.nib/info.nib     2007-08-31 11:33:28 UTC (rev 
2793)
@@ -7,14 +7,10 @@
        <key>IBEditorPositions</key>
        <dict>
                <key>29</key>
-               <string>140 614 635 44 0 0 1440 938 </string>
+               <string>140 614 542 44 0 0 1440 938 </string>
        </dict>
        <key>IBFramework Version</key>
        <string>446.1</string>
-       <key>IBOpenObjects</key>
-       <array>
-               <integer>29</integer>
-       </array>
        <key>IBSystem Version</key>
        <string>8R218</string>
 </dict>

Modified: trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/Dutch.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/Dutch.lproj/NoteWindow.nib/classes.nib        2007-08-31 09:59:52 UTC 
(rev 2792)
+++ trunk/Dutch.lproj/NoteWindow.nib/classes.nib        2007-08-31 11:33:28 UTC 
(rev 2793)
@@ -13,7 +13,11 @@
         {
             CLASS = SKNoteWindowController; 
             LANGUAGE = ObjC; 
-            OUTLETS = {imageView = BDSKDragImageView; textView = NSTextView; 
}; 
+            OUTLETS = {
+                imageView = BDSKDragImageView; 
+                statusBar = SKStatusBar; 
+                textView = NSTextView; 
+            }; 
             SUPERCLASS = NSWindowController; 
         }, 
         {

Modified: trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/English.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/English.lproj/NoteWindow.nib/classes.nib      2007-08-31 09:59:52 UTC 
(rev 2792)
+++ trunk/English.lproj/NoteWindow.nib/classes.nib      2007-08-31 11:33:28 UTC 
(rev 2793)
@@ -13,7 +13,11 @@
         {
             CLASS = SKNoteWindowController; 
             LANGUAGE = ObjC; 
-            OUTLETS = {imageView = BDSKDragImageView; textView = NSTextView; 
}; 
+            OUTLETS = {
+                imageView = BDSKDragImageView; 
+                statusBar = SKStatusBar; 
+                textView = NSTextView; 
+            }; 
             SUPERCLASS = NSWindowController; 
         }, 
         {

Modified: trunk/English.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/French.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/French.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/French.lproj/NoteWindow.nib/classes.nib       2007-08-31 09:59:52 UTC 
(rev 2792)
+++ trunk/French.lproj/NoteWindow.nib/classes.nib       2007-08-31 11:33:28 UTC 
(rev 2793)
@@ -13,7 +13,11 @@
         {
             CLASS = SKNoteWindowController; 
             LANGUAGE = ObjC; 
-            OUTLETS = {imageView = BDSKDragImageView; textView = NSTextView; 
}; 
+            OUTLETS = {
+                imageView = BDSKDragImageView; 
+                statusBar = SKStatusBar; 
+                textView = NSTextView; 
+            }; 
             SUPERCLASS = NSWindowController; 
         }, 
         {

Modified: trunk/French.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/Italian.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/Italian.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/Italian.lproj/NoteWindow.nib/classes.nib      2007-08-31 09:59:52 UTC 
(rev 2792)
+++ trunk/Italian.lproj/NoteWindow.nib/classes.nib      2007-08-31 11:33:28 UTC 
(rev 2793)
@@ -13,7 +13,11 @@
         {
             CLASS = SKNoteWindowController; 
             LANGUAGE = ObjC; 
-            OUTLETS = {imageView = BDSKDragImageView; textView = NSTextView; 
}; 
+            OUTLETS = {
+                imageView = BDSKDragImageView; 
+                statusBar = SKStatusBar; 
+                textView = NSTextView; 
+            }; 
             SUPERCLASS = NSWindowController; 
         }, 
         {

Modified: trunk/Italian.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/Italian.lproj/NoteWindow.nib/info.nib 2007-08-31 09:59:52 UTC (rev 
2792)
+++ trunk/Italian.lproj/NoteWindow.nib/info.nib 2007-08-31 11:33:28 UTC (rev 
2793)
@@ -13,8 +13,8 @@
        <string>446.1</string>
        <key>IBOpenObjects</key>
        <array>
+               <integer>7</integer>
                <integer>114</integer>
-               <integer>7</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8R218</string>

Modified: trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/SKNoteWindowController.h
===================================================================
--- trunk/SKNoteWindowController.h      2007-08-31 09:59:52 UTC (rev 2792)
+++ trunk/SKNoteWindowController.h      2007-08-31 11:33:28 UTC (rev 2793)
@@ -39,11 +39,12 @@
 #import <Cocoa/Cocoa.h>
 
 
[EMAIL PROTECTED] PDFAnnotation, BDSKDragImageView;
[EMAIL PROTECTED] PDFAnnotation, BDSKDragImageView, SKStatusBar;
 
 @interface SKNoteWindowController : NSWindowController {
     IBOutlet NSTextView *textView;
     IBOutlet BDSKDragImageView *imageView;
+    IBOutlet SKStatusBar *statusBar;
     
     PDFAnnotation *note;
     

Modified: trunk/SKNoteWindowController.m
===================================================================
--- trunk/SKNoteWindowController.m      2007-08-31 09:59:52 UTC (rev 2792)
+++ trunk/SKNoteWindowController.m      2007-08-31 11:33:28 UTC (rev 2793)
@@ -40,23 +40,15 @@
 #import <Quartz/Quartz.h>
 #import "BDSKDragImageView.h"
 #import "SKPDFAnnotationNote.h"
+#import "SKStatusBar.h"
 #import "SKDocument.h"
 #import "NSWindowController_SKExtensions.h"
 #import "SKStringConstants.h"
 
 static NSString *SKNoteWindowFrameAutosaveName = @"SKNoteWindow";
 
[EMAIL PROTECTED] SKRectStringTransformer : NSValueTransformer
[EMAIL PROTECTED]
-
 @implementation SKNoteWindowController
 
-+ (void)initialize {
-    SKRectStringTransformer *transformer = [[SKRectStringTransformer alloc] 
init];
-    [NSValueTransformer setValueTransformer:transformer 
forName:@"SKRectStringTransformer"];
-    [transformer release];
-}
-
 - (id)init {
     return self = [self initWithNote:nil];
 }
@@ -68,11 +60,16 @@
         
         keepOnTop = [[NSUserDefaults standardUserDefaults] 
boolForKey:@"SKKeepNoteWindowsOnTop"];
         forceOnTop = NO;
+        
+        [note addObserver:self forKeyPath:@"page" options:0 context:NULL];
+        [note addObserver:self forKeyPath:@"bounds" options:0 context:NULL];
     }
     return self;
 }
 
 - (void)dealloc {
+    [note removeObserver:self forKeyPath:@"page"];
+    [note removeObserver:self forKeyPath:@"bounds"];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     CFRelease(editors);
     [note release];
@@ -83,6 +80,11 @@
     return @"NoteWindow";
 }
 
+- (void)updateStatusMessage {
+    NSRect bounds = [note bounds];
+    [statusBar setLeftStringValue:[NSString 
stringWithFormat:NSLocalizedString(@"Page %@ at (%i, %i)", @"Status message"), 
[[note page] label], (int)NSMidX(bounds), (int)NSMidY(bounds)]];
+}
+
 - (void)windowDidLoad {
     [[self window] setBackgroundColor:[NSColor colorWithCalibratedWhite:0.9 
alpha:1.0]];
     [[self window] setLevel:keepOnTop || forceOnTop ? NSFloatingWindowLevel : 
NSNormalWindowLevel];
@@ -94,6 +96,8 @@
         [textView setFont:font];
     }
     
+    [self updateStatusMessage];
+    
     [self setWindowFrameAutosaveNameOrCascade:SKNoteWindowFrameAutosaveName];
     
     [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleDocumentWillSaveNotification:) 
@@ -122,8 +126,12 @@
 
 - (void)setNote:(PDFAnnotation *)newNote {
     if (note != newNote) {
+        [note removeObserver:self forKeyPath:@"page"];
+        [note removeObserver:self forKeyPath:@"bounds"];
         [note release];
         note = [newNote retain];
+        [note addObserver:self forKeyPath:@"page" options:0 context:NULL];
+        [note addObserver:self forKeyPath:@"bounds" options:0 context:NULL];
     }
 }
 
@@ -240,27 +248,11 @@
                                            size:[[NSUserDefaults 
standardUserDefaults] floatForKey:SKAnchoredNoteFontSizeKey]];
             [textView setFont:font];
         }
+    } else if (object == note) {
+        if ([keyPath isEqualToString:@"page"] || [keyPath 
isEqualToString:@"bounds"])
+            [self updateStatusMessage];
     } else {
         [super observeValueForKeyPath:keyPath ofObject:object change:change 
context:context];
     }
 }
 @end
-
-
[EMAIL PROTECTED] SKRectStringTransformer
-
-+ (Class)transformedValueClass {
-    return [NSString class];
-}
-
-+ (BOOL)allowsReverseTransformation {
-    return NO;
-}
-
-- (id)transformedValue:(id)value {
-    NSRect rect = [value rectValue];
-       return [NSString stringWithFormat:@"(%i, %i)", (int)NSMidX(rect), 
(int)NSMidY(rect)];
-}
-
[EMAIL PROTECTED]
-


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to