Revision: 3297
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3297&view=rev
Author:   hofman
Date:     2007-12-02 06:28:13 -0800 (Sun, 02 Dec 2007)

Log Message:
-----------
Don't explicitly change content in info window when showing. Instead handle 
this in windowDidLoad. Rename methods.

Modified Paths:
--------------
    trunk/SKInfoWindowController.h
    trunk/SKInfoWindowController.m
    trunk/SKMainWindowController.m

Modified: trunk/SKInfoWindowController.h
===================================================================
--- trunk/SKInfoWindowController.h      2007-12-02 14:02:05 UTC (rev 3296)
+++ trunk/SKInfoWindowController.h      2007-12-02 14:28:13 UTC (rev 3297)
@@ -49,10 +49,9 @@
 - (void)setInfo:(NSDictionary *)newInfo;
 
 - (NSDictionary *)infoForDocument:(NSDocument *)doc;
-- (void)fillInfoForDocument:(NSDocument *)doc;
 
-- (void)handleWindowDidBecomeKeyNotification:(NSNotification *)notification;
-- (void)handleWindowDidResignKeyNotification:(NSNotification *)notification;
+- (void)handleWindowDidBecomeMainNotification:(NSNotification *)notification;
+- (void)handleWindowDidResignMainNotification:(NSNotification *)notification;
 
 @end
 

Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m      2007-12-02 14:02:05 UTC (rev 3296)
+++ trunk/SKInfoWindowController.m      2007-12-02 14:28:13 UTC (rev 3297)
@@ -64,15 +64,12 @@
 - (id)init {
     if (self = [super init]) {
         info = [[NSMutableDictionary alloc] init];
-        [[NSNotificationCenter defaultCenter] addObserver: self selector: 
@selector(handleWindowDidBecomeKeyNotification:) 
-                                                     name: 
NSWindowDidBecomeMainNotification object: nil];
-        [[NSNotificationCenter defaultCenter] addObserver: self selector: 
@selector(handleWindowDidResignKeyNotification:) 
-                                                     name: 
NSWindowDidResignMainNotification object: nil];
     }
     return self;
 }
 
 - (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
     [info release];
     [super dealloc];
 }
@@ -83,6 +80,13 @@
 
 - (void)windowDidLoad {
     [self setWindowFrameAutosaveName:SKInfoWindowFrameAutosaveName];
+    
+    [self setInfo:[self infoForDocument:[[[NSApp mainWindow] windowController] 
document]]];
+    
+    [[NSNotificationCenter defaultCenter] addObserver: self selector: 
@selector(handleWindowDidBecomeMainNotification:) 
+                                                 name: 
NSWindowDidBecomeMainNotification object: nil];
+    [[NSNotificationCenter defaultCenter] addObserver: self selector: 
@selector(handleWindowDidResignMainNotification:) 
+                                                 name: 
NSWindowDidResignMainNotification object: nil];
 }
 
 static NSString *SKFileSizeStringForFileURL(NSURL *fileURL, unsigned long long 
*physicalSizePtr, unsigned long long *logicalSizePtr) {
@@ -208,10 +212,6 @@
     return dictionary;
 }
 
-- (void)fillInfoForDocument:(NSDocument *)doc {
-    [self setInfo:[self infoForDocument:doc]];
-}
-
 - (NSDictionary *)info {
     return info;
 }
@@ -220,12 +220,12 @@
     [info setDictionary:newInfo];
 }
 
-- (void)handleWindowDidBecomeKeyNotification:(NSNotification *)notification {
+- (void)handleWindowDidBecomeMainNotification:(NSNotification *)notification {
     NSDocument *doc = [[[notification object] windowController] document];
     [self setInfo:[self infoForDocument:doc]];
 }
 
-- (void)handleWindowDidResignKeyNotification:(NSNotification *)notification {
+- (void)handleWindowDidResignMainNotification:(NSNotification *)notification {
     [self setInfo:nil];
 }
 

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-12-02 14:02:05 UTC (rev 3296)
+++ trunk/SKMainWindowController.m      2007-12-02 14:28:13 UTC (rev 3297)
@@ -1881,9 +1881,7 @@
 }
 
 - (IBAction)getInfo:(id)sender {
-    SKInfoWindowController *infoController = [SKInfoWindowController 
sharedInstance];
-    [infoController fillInfoForDocument:[self document]];
-    [infoController showWindow:self];
+    [[SKInfoWindowController sharedInstance] showWindow:self];
 }
 
 - (IBAction)changeScaleFactor:(id)sender {


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

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to