X-Git-Url: http://git.ithinksw.org/ITKit.git/blobdiff_plain/f7665c2fca31bcea0750b3de74e0aedba934b153..HEAD:/ITSplashScreen.m diff --git a/ITSplashScreen.m b/ITSplashScreen.m index ce7a8cd..f41ddb6 100644 --- a/ITSplashScreen.m +++ b/ITSplashScreen.m @@ -2,21 +2,19 @@ #import "ITSplashWindow.h" #import "ITSplashView.h" -static ITSplashScreen *_sharedController; +static ITSplashScreen *_sharedScreen; @implementation ITSplashScreen -+ (ITSplashScreen *)sharedController -{ - if (!_sharedController) { - _sharedController = [[ITSplashScreen alloc] init]; ++ (ITSplashScreen *)sharedController { + if (!_sharedScreen) { + _sharedScreen = [[ITSplashScreen alloc] init]; } - return _sharedController; + return _sharedScreen; } -- (id)init -{ - if ( (self = [super init]) ) { +- (id)init { + if ((self = [super init])) { _window = [[ITSplashWindow alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; _view = [[ITSplashView alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)]; [_window setLevel:NSStatusWindowLevel]; @@ -25,19 +23,16 @@ static ITSplashScreen *_sharedController; return self; } -- (void)dealloc -{ +- (void)dealloc { [_window release]; [super dealloc]; } -- (double)progressValue -{ +- (double)progressValue { return ([[_view progressIndicator] doubleValue] / 100.0); } -- (void)setProgressValue:(double)progress -{ +- (void)setProgressValue:(double)progress { if (progress >= 1.0) { [[_view progressIndicator] setIndeterminate:YES]; } else { @@ -45,13 +40,11 @@ static ITSplashScreen *_sharedController; } } -- (NSImage *)image -{ +- (NSImage *)image { return [_view image]; } -- (void)setImage:(NSImage *)image -{ +- (void)setImage:(NSImage *)image { NSRect rect = NSZeroRect, newRect = [_window frame]; rect.size = [image size]; newRect.size = rect.size; @@ -63,48 +56,41 @@ static ITSplashScreen *_sharedController; [_window center]; } -- (NSString *)string -{ +- (NSString *)string { return [_view string]; } -- (void)setString:(NSString *)string -{ +- (void)setString:(NSString *)string { [_view setString:string]; } -- (void)setSettingsPath:(NSString *)path -{ +- (void)setSettingsPath:(NSString *)path { [_view loadControlsFromPath:path]; } -- (void)showSplashWindow -{ +- (void)showSplashWindow { //[_window setAlphaValue:0.0]; [_window makeKeyAndOrderFront:nil]; //_fadeTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(showStep:) userInfo:nil repeats:YES]; } -- (void)showStep:(NSTimer *)timer -{ - [_window setAlphaValue:[_window alphaValue] + 0.05]; +- (void)showStep:(NSTimer *)timer { + [_window setAlphaValue:([_window alphaValue] + 0.05)]; if ([_window alphaValue] >= 1.0) { [timer invalidate]; _fadeTimer = nil; } } -- (void)closeSplashWindow -{ +- (void)closeSplashWindow { if (_fadeTimer) { [_fadeTimer invalidate]; } _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(closeStep:) userInfo:nil repeats:YES]; } -- (void)closeStep:(NSTimer *)timer -{ - [_window setAlphaValue:[_window alphaValue] - 0.05]; +- (void)closeStep:(NSTimer *)timer { + [_window setAlphaValue:([_window alphaValue] - 0.05)]; if ([_window alphaValue] <= 0.0) { [timer invalidate]; _fadeTimer = nil;