Revision: 4511
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4511&view=rev
Author:   hofman
Date:     2008-09-01 18:54:21 +0000 (Mon, 01 Sep 2008)

Log Message:
-----------
Add convenience methods to find out the type of a window controller.

Modified Paths:
--------------
    trunk/NSWindowController_SKExtensions.h
    trunk/NSWindowController_SKExtensions.m
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_UI.m
    trunk/SKNoteWindowController.m
    trunk/SKSnapshotWindowController.m

Modified: trunk/NSWindowController_SKExtensions.h
===================================================================
--- trunk/NSWindowController_SKExtensions.h     2008-09-01 18:40:35 UTC (rev 
4510)
+++ trunk/NSWindowController_SKExtensions.h     2008-09-01 18:54:21 UTC (rev 
4511)
@@ -43,4 +43,7 @@
 
 - (void)setWindowFrameAutosaveNameOrCascade:(NSString *)name;
 
+- (BOOL)isNoteWindowController;
+- (BOOL)isSnapshotWindowController;
+
 @end

Modified: trunk/NSWindowController_SKExtensions.m
===================================================================
--- trunk/NSWindowController_SKExtensions.m     2008-09-01 18:40:35 UTC (rev 
4510)
+++ trunk/NSWindowController_SKExtensions.m     2008-09-01 18:54:21 UTC (rev 
4511)
@@ -59,4 +59,9 @@
     [nextWindowLocations setObject:[NSValue valueWithPoint:point] forKey:name];
 }
 
+
+- (BOOL)isNoteWindowController { return NO; }
+
+- (BOOL)isSnapshotWindowController { return NO; }
+
 @end

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-09-01 18:40:35 UTC (rev 4510)
+++ trunk/SKMainWindowController.m      2008-09-01 18:54:21 UTC (rev 4511)
@@ -1005,7 +1005,7 @@
     NSWindowController *wc = [wcEnum nextObject];
     
     while (wc = [wcEnum nextObject]) {
-        if ([wc isKindOfClass:[SKNoteWindowController class]] && 
[[(SKNoteWindowController *)wc note] isEqual:note]) {
+        if ([wc isNoteWindowController] && [[(SKNoteWindowController *)wc 
note] isEqual:note]) {
             [[wc window] orderOut:self];
             break;
         }
@@ -1029,7 +1029,7 @@
         NSEnumerator *wcEnum = [[[self document] windowControllers] 
objectEnumerator];
         NSWindowController *wc = [wcEnum nextObject];
         while (wc = [wcEnum nextObject]) {
-            if ([wc isKindOfClass:[SKNoteWindowController class]])
+            if ([wc isNoteWindowController])
                 [[wc window] orderOut:self];
         }
         
@@ -2407,7 +2407,7 @@
     NSWindowController *wc = [wcEnum nextObject];
     
     while (wc = [wcEnum nextObject]) {
-        if ([wc isKindOfClass:[SKNoteWindowController class]] || [wc 
isKindOfClass:[SKSnapshotWindowController class]])
+        if ([wc isNoteWindowController] || [wc isSnapshotWindowController])
             [(id)wc setForceOnTop:YES];
     }
         
@@ -2450,7 +2450,7 @@
     NSWindowController *wc = [wcEnum nextObject];
     
     while (wc = [wcEnum nextObject]) {
-        if ([wc isKindOfClass:[SKNoteWindowController class]] || [wc 
isKindOfClass:[SKSnapshotWindowController class]])
+        if ([wc isNoteWindowController] || [wc isSnapshotWindowController])
             [(id)wc setForceOnTop:NO];
     }
     
@@ -3241,7 +3241,7 @@
     NSEnumerator *wcEnum = [[[self document] windowControllers] 
objectEnumerator];
     
     while (wc = [wcEnum nextObject]) {
-        if ([wc isKindOfClass:[SKNoteWindowController class]] && 
[(SKNoteWindowController *)wc note] == annotation)
+        if ([wc isNoteWindowController] && [(SKNoteWindowController *)wc note] 
== annotation)
             break;
     }
     if (wc == nil) {

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2008-09-01 18:40:35 UTC (rev 4510)
+++ trunk/SKMainWindowController_UI.m   2008-09-01 18:54:21 UTC (rev 4511)
@@ -46,6 +46,7 @@
 #import "SKStatusBar.h"
 #import "SKSnapshotWindowController.h"
 #import "SKNoteWindowController.h"
+#import "SKWindowController_SKExtensions.h"
 #import "SKSideWindow.h"
 #import "SKProgressController.h"
 #import "SKAnnotationTypeImageCell.h"
@@ -1538,7 +1539,7 @@
         NSEnumerator *wcEnum = [[[self document] windowControllers] 
objectEnumerator];
         
         while (wc = [wcEnum nextObject]) {
-            if ([wc isKindOfClass:[SKNoteWindowController class]] && 
[(SKNoteWindowController *)wc note] == annotation) {
+            if ([wc isNoteWindowController] && [(SKNoteWindowController *)wc 
note] == annotation) {
                 [wc close];
                 break;
             }

Modified: trunk/SKNoteWindowController.m
===================================================================
--- trunk/SKNoteWindowController.m      2008-09-01 18:40:35 UTC (rev 4510)
+++ trunk/SKNoteWindowController.m      2008-09-01 18:54:21 UTC (rev 4511)
@@ -216,6 +216,8 @@
     return [NSString stringWithFormat:@"%@ %C %@", [[[self note] type] 
typeName], EM_DASH_CHARACTER, [[self note] string]];
 }
 
+- (BOOL)isNoteWindowController { return YES; }
+
 - (PDFAnnotation *)note {
     return note;
 }

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2008-09-01 18:40:35 UTC (rev 4510)
+++ trunk/SKSnapshotWindowController.m  2008-09-01 18:54:21 UTC (rev 4511)
@@ -110,6 +110,8 @@
     return [NSString stringWithFormat:NSLocalizedString(@"%@ %C Page %@", 
@"Window title format: [filename] - Page [number]"), displayName, 
EM_DASH_CHARACTER, [self pageLabel]];
 }
 
+- (BOOL)isSnapshotWindowController { return YES; }
+
 - (void)setNeedsDisplayInRect:(NSRect)rect ofPage:(PDFPage *)page {
     NSRect aRect = [pdfView convertRect:rect fromPage:page];
     float scale = [pdfView scaleFactor];


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