Diff for /chimera/SplashScreenWindow.m between versions 1.3 and 1.4

version 1.3, 2002/04/05 00:28:47 version 1.4, 2002/04/18 15:40:04
Line 8 Line 8
   
 #import "SplashScreenWindow.h"  #import "SplashScreenWindow.h"
   
 @interface SplashScreenWindow (Private)  
 -(void)fadeIn;  
 -(void)fadeInThread;  
 -(void)fadeOut;  
 -(void)fadeOutThread;  
 @end  
   
 @implementation SplashScreenWindow  @implementation SplashScreenWindow
   
-(id)splashImage:(NSImage *)splashImage withFade:(BOOL)shouldFade withStatusRect:(NSRect)statusRect-(id)splashImage:(NSImage *)splashImage withStatusRect:(NSRect)statusRect
 {  {
     NSRect               splashRect;      NSRect               splashRect;
     NSRect               statusFieldRect;      NSRect               statusFieldRect;
     NSImageView *contentImageView;      NSImageView *contentImageView;
   
     _fadeDelay = (0.5 / 60.0);  
   
     if ( ! splashImage ) {      if ( ! splashImage ) {
         if ( [NSImage imageNamed:@"splash"] ) {          if ( [NSImage imageNamed:@"splash"] ) {
             splashImage = [NSImage imageNamed:@"splash"];              splashImage = [NSImage imageNamed:@"splash"];
Line 44 Line 36
                         defer:NO];                          defer:NO];
                   
     [contentImageView setImage:splashImage];      [contentImageView setImage:splashImage];
     _fadeThreadLock = nil;  
   
     [_statusField setDrawsBackground:NO];      [_statusField setDrawsBackground:NO];
     [_statusField setEditable:NO];      [_statusField setEditable:NO];
Line 63 Line 54
     [self setReleasedWhenClosed:YES];      [self setReleasedWhenClosed:YES];
     [self center];      [self center];
           
    if ( shouldFade ) {    [self makeKeyAndOrderFront:self];
        [self fadeIn]; 
    } else { 
        [self makeKeyAndOrderFront:self]; 
    } 
    __didFadeIn = shouldFade; 
   
     return self;      return self;
 }  }
Line 84 Line 70
     [_statusField display];      [_statusField display];
 }  }
   
 -(void)fadeIn  
 {  
     [self setAlphaValue:0.0];  
     [self makeKeyAndOrderFront:self];  
       
     if (_fadeThreadLock == nil) {  
         _fadeThreadLock = [[NSLock allocWithZone:[self zone]] init];  
     }  
       
     [NSThread detachNewThreadSelector:@selector(fadeInThread) toTarget:self withObject:nil];  
 }  
   
 -(void)fadeInThread  
 {  
     float fadeLevel = 0.0;  
     NSAutoreleasePool *threadMainPool = [[NSAutoreleasePool alloc] init];  
   
     [_fadeThreadLock lock];  
   
     while ( fadeLevel < 1.0 ) {  
         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  
         fadeLevel += 0.20;  
         [self setAlphaValue:fadeLevel];  
         [self flushWindow];  
         [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:_fadeDelay]];  
         [pool release];  
     }  
   
     [_fadeThreadLock unlock];  
     [threadMainPool release];  
 }  
   
 -(void)fadeOut  
 {  
     if (_fadeThreadLock == nil) {  
         _fadeThreadLock = [[NSLock allocWithZone:[self zone]] init];  
     }  
   
     [NSThread detachNewThreadSelector:@selector(fadeOutThread) toTarget:self withObject:nil];  
 }  
   
 -(void)fadeOutThread  
 {  
     float fadeLevel = 1.0;  
     NSAutoreleasePool *threadMainPool = [[NSAutoreleasePool alloc] init];  
   
     [_fadeThreadLock lock];  
   
     while ( fadeLevel > 0.0 ) {  
         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  
         fadeLevel -= 0.1;  
         [self setAlphaValue:fadeLevel];  
         [self flushWindow];  
         [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:_fadeDelay]];  
         [pool release];  
     }  
   
     [_fadeThreadLock unlock];  
     [threadMainPool release];  
 }  
   
 -(void)close  
 {  
 //  if ( __didFadeIn ) {  
     if (      NO     ) { //Fade out is still problematic...  
         [self fadeOut];  
     }  
     [super close];  
 }  
   
 -(void)dealloc  -(void)dealloc
 {  {
    if (_splashImage) {    if (_splashImage) 
         [_splashImage release];          [_splashImage release];
     }  
   
     [_fadeThreadLock release];  
   
     [super dealloc];      [super dealloc];
 }  }

Removed from v.1.3  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>