New splash screen by ElChristou.

This commit is contained in:
Da Woon Jung 2005-12-23 11:05:49 +00:00
parent 119f522662
commit e8d80e3001
5 changed files with 84 additions and 10 deletions

View file

@ -12,6 +12,8 @@
#import "RenderPanelController.h"
#import "BrowserWindowController.h"
@class SplashWindow;
@interface CelestiaController : NSWindowController
{
CelestiaSettings* settings;
@ -19,13 +21,12 @@
BOOL ready;
BOOL isDirty;
BOOL isFullScreen;
IBOutlet NSPanel *loadingPanel;
IBOutlet NSProgressIndicator *loadingIndicator;
IBOutlet SplashWindow *loadingPanel;
IBOutlet NSTextField *loadingIndicator;
IBOutlet NSTextView *glInfo;
IBOutlet NSPanel *glInfoPanel;
IBOutlet NSOpenGLView *glView;
IBOutlet NSWindow *mainWindow;
IBOutlet NSWindow *gotoWindow;
IBOutlet FavoritesDrawerController *favoritesDrawerController;
IBOutlet RenderPanelController *renderPanelController;
BrowserWindowController* browserWindowController;

View file

@ -11,6 +11,7 @@
#import "FavoritesDrawerController.h"
#import "CelestiaOpenGLView.h"
#import "FullScreenWindow.h"
#import "SplashScreen.h"
#import <Carbon/Carbon.h>
#import "CGLInfo.h"
@ -138,8 +139,8 @@ NSString* fatalErrorMessage;
#ifndef USE_THREADEDLOAD
[loadingPanel makeKeyAndOrderFront: nil];
[loadingPanel displayIfNeeded];
[loadingIndicator setUsesThreadedAnimation: YES];
[loadingIndicator startAnimation: nil];
// [loadingIndicator setUsesThreadedAnimation: YES];
// [loadingIndicator startAnimation: nil];
#endif
// initialize simulator in separate thread to allow loading indicator window while waiting
#ifdef DEBUG
@ -150,7 +151,7 @@ NSString* fatalErrorMessage;
[startupCondition lock];
[startupCondition unlockWithCondition: 99];
#ifndef USE_THREADEDLOAD
[loadingPanel orderOut: nil];
[loadingPanel close];
#endif
#ifdef DEBUG
[pool release];
@ -167,7 +168,7 @@ NSString* fatalErrorMessage;
[startupCondition lock];
[startupCondition unlockWithCondition: 1];
#ifndef USE_THREADEDLOAD
[loadingPanel orderOut: nil];
[loadingPanel close];
// complete startup
[self fatalError: nil];
[self finishInitialization];
@ -185,7 +186,7 @@ NSString* fatalErrorMessage;
if ( msg == nil )
{
if (fatalErrorMessage == nil) return;
[loadingPanel orderOut: nil ];
[loadingPanel close];
NSRunAlertPanel(@"Fatal Error", fatalErrorMessage, nil, nil, nil);
[NSApp terminate:self];
return;
@ -203,7 +204,7 @@ NSString* fatalErrorMessage;
{
if ( session != nil )
return;
[loadingIndicator startAnimation: nil];
// [loadingIndicator startAnimation: nil];
// begin modal session for loading panel
session = [NSApp beginModalSessionForWindow:loadingPanel];
// modal session runloop
@ -222,7 +223,7 @@ NSString* fatalErrorMessage;
// check for fatal error in loading thread
[self fatalError: nil];
// complete startup
[loadingPanel orderOut: nil ];
[loadingPanel close];
[self finishInitialization];
}

17
macosx/SplashScreen.h Normal file
View file

@ -0,0 +1,17 @@
//
// SplashScreen.h
// celestia
//
// Created by Da Woon Jung on 2005-12-18.
// Copyright 2005 Chris Laurel. All rights reserved.
//
@interface SplashImageView : NSImageView
- (BOOL)mouseDownCanMoveWindow;
@end
@interface SplashWindow : NSWindow
{
// SplashContentView *splashContentView;
}
@end

55
macosx/SplashScreen.m Normal file
View file

@ -0,0 +1,55 @@
//
// SplashScreen.m
// celestia
//
// Created by Da Woon Jung on 2005-12-18.
// Copyright 2005 Chris Laurel. All rights reserved.
//
#import "SplashScreen.h"
@implementation SplashImageView
- (BOOL)mouseDownCanMoveWindow
{
return YES;
}
@end
@implementation SplashWindow
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
{
if (self = [super initWithContentRect: contentRect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer:YES])
{
[self setBackgroundColor: [NSColor clearColor]];
[self setAlphaValue: 1.0f];
[self setOpaque: NO];
[self setHasShadow: NO]; // image already has drop shadow
if ([self respondsToSelector: @selector(setMovableByWindowBackground:)])
[self setMovableByWindowBackground: YES];
// [self center]; // does not center exactly so don't use
NSScreen *screen = [self screen];
NSRect screenFrame = [screen frame];
[self setFrameOrigin:
NSMakePoint((NSWidth(screenFrame) - NSWidth(contentRect))/2,
(NSHeight(screenFrame) - NSHeight(contentRect))/2)];
}
return self;
}
- (BOOL)canBecomeKeyWindow
{
return YES;
}
@end

BIN
macosx/splash.tiff Normal file

Binary file not shown.