--- BasiliskII/src/MacOSX/Controller.mm 2003/03/11 11:31:01 1.7 +++ BasiliskII/src/MacOSX/Controller.mm 2006/03/10 08:16:56 1.14 @@ -1,9 +1,9 @@ /* * Controller.m - Simple application window management. * - * $Id: Controller.mm,v 1.7 2003/03/11 11:31:01 nigel Exp $ + * $Id: Controller.mm,v 1.14 2006/03/10 08:16:56 nigel Exp $ * - * Basilisk II (C) 1997-2001 Christian Bauer + * Basilisk II (C) 1997-2006 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,6 @@ #import "Controller.h" #import "Emulator.h" -@implementation Controller - #import "sysdeps.h" // Types used in Basilisk C++ code #import @@ -36,6 +34,8 @@ #import "misc_macosx.h" #import "video_macosx.h" +@implementation Controller + // // Standard NSApplication methods that we override // @@ -67,8 +67,19 @@ - (void) sendEvent: (NSEvent *)event; { - if ( [self isAnyEmulatorDisplayingSheets] || ! [self isAnyEmulatorRunning] ) - [super sendEvent: event]; + // We can either process the event ourselves, + // or pass it to our superclass for the other UI objects to process + bool passToSuper = false; + + if ( [self isAnyEmulatorDisplayingSheets] || + [[thePrefsEditor window] isVisible] || ! [self isAnyEmulatorRunning] ) + passToSuper = true; + + if ( [[theEmulator screen] isFullScreen] ) + passToSuper = false; + + if ( passToSuper ) + [super sendEvent: event]; // NSApplication default else { NSEventType type = [event type]; @@ -107,9 +118,9 @@ // // switch ( NSRunAlertPanel(title, msg, def, alt, other, nil) ) // { -// case NSAlertDefault: savePrefs(); -// case NSAlertAlternate: return NSTerminateNow; -// case NSAlertOther: return NSTerminateCancel; +// case NSAlertDefault: savePrefs(); +// case NSAlertAlternate: return NSTerminateNow; +// case NSAlertOther: return NSTerminateCancel; // } // } @@ -258,30 +269,43 @@ // Methods to display documentation: +- (IBAction) HelpHowTo: (id)sender +{ + NSString *path = [[NSBundle mainBundle] pathForResource: @"HowTo" + ofType: @"html"]; + + if ( ! path ) + InfoSheet(@"Cannot find HowTo.html", [theEmulator window]); + else + if ( ! [[NSWorkspace sharedWorkspace] openFile: path] ) + InfoSheet(@"Cannot open HowTo.html with default app", [theEmulator window]); +} + - (IBAction) HelpToDo: (id)sender { - NSString *path = [[NSBundle mainBundle] pathForResource: @"ToDo" - ofType: @"html"]; + NSString *path = [[NSBundle mainBundle] pathForResource: @"ToDo" + ofType: @"html"]; - if ( ! path ) - InfoSheet(@"Cannot find ToDo.html", [theEmulator window]); - else - if ( ! [[NSWorkspace sharedWorkspace] openFile: path - withApplication: @"TextEdit"] ) - InfoSheet(@"Cannot open ToDo.html with TextEdit", [theEmulator window]); + if ( ! path ) + InfoSheet(@"Cannot find ToDo.html", [theEmulator window]); + else + if ( ! [[NSWorkspace sharedWorkspace] openFile: path + withApplication: @"TextEdit"] ) + InfoSheet(@"Cannot open ToDo.html with TextEdit", [theEmulator window]); } - (IBAction) HelpVersions: (id)sender { - NSString *path = [[NSBundle mainBundle] pathForResource: @"Versions" - ofType: @"html"]; + NSString *path = [[NSBundle mainBundle] pathForResource: @"Versions" + ofType: @"html"]; - if ( ! path ) - InfoSheet(@"Cannot find Versions.html", [theEmulator window]); - else - if ( ! [[NSWorkspace sharedWorkspace] openFile: path - withApplication: @"TextEdit"] ) - InfoSheet(@"Cannot open Versions.html with TextEdit", [theEmulator window]); + if ( ! path ) + InfoSheet(@"Cannot find Versions.html", [theEmulator window]); + else + if ( ! [[NSWorkspace sharedWorkspace] openFile: path + withApplication: @"TextEdit"] ) + InfoSheet(@"Cannot open Versions.html with TextEdit", + [theEmulator window]); } @@ -383,4 +407,4 @@ return count; } -@end \ No newline at end of file +@end