UniqueWindowController.m
changeset 2 3d3dcc3116d5
parent 1 e55a17cdabd2
child 3 8fad19466c59
     1.1 --- a/UniqueWindowController.m	Thu Mar 20 09:05:58 2008 -0700
     1.2 +++ b/UniqueWindowController.m	Wed Apr 02 14:45:33 2008 -0700
     1.3 @@ -7,6 +7,7 @@
     1.4  //
     1.5  
     1.6  #import "UniqueWindowController.h"
     1.7 +#import "GraphicsUtils.h"
     1.8  
     1.9  
    1.10  @implementation UniqueWindowController
    1.11 @@ -14,13 +15,10 @@
    1.12  
    1.13  + (UniqueWindowController*) instanceWith: (id)model
    1.14  {
    1.15 -    for( NSWindow *window in [NSApp windows] ) {
    1.16 -        id delegate = window.delegate;
    1.17 -        if( window.isVisible && [delegate isKindOfClass: [self class]] ) {
    1.18 -            UniqueWindowController *c = delegate;
    1.19 -            if( c.model == model )
    1.20 -                return c;
    1.21 -        }
    1.22 +    for( NSWindow *window in OpenWindowsWithDelegateClass(self) ) {
    1.23 +        UniqueWindowController *c = window.delegate;
    1.24 +        if( c.model == model )
    1.25 +            return c;
    1.26      }
    1.27      return nil;
    1.28  }