3 |
|
* |
4 |
|
* $Id$ |
5 |
|
* |
6 |
< |
* Basilisk II (C) 1997-2001 Christian Bauer |
6 |
> |
* Basilisk II (C) 1997-2005 Christian Bauer |
7 |
|
* |
8 |
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
* it under the terms of the GNU General Public License as published by |
33 |
|
#define DEBUG 0 |
34 |
|
#import <debug.h> |
35 |
|
|
36 |
+ |
#import "misc_macosx.h" |
37 |
|
#import "video_macosx.h" |
38 |
|
|
39 |
|
// |
43 |
|
- (id) init |
44 |
|
{ |
45 |
|
#ifdef ENABLE_MULTIPLE |
46 |
< |
emulators = [[NSMutableArray alloc] init]; |
46 |
> |
emulators = [NSMutableArray new]; |
47 |
|
#endif |
48 |
|
return [super init]; |
49 |
|
} |
67 |
|
|
68 |
|
- (void) sendEvent: (NSEvent *)event; |
69 |
|
{ |
70 |
< |
if ( [self isAnyEmulatorDisplayingSheets] || ! [self isAnyEmulatorRunning] ) |
70 |
> |
if ( [self isAnyEmulatorDisplayingSheets] || |
71 |
> |
[[thePrefsEditor window] isVisible] || ! [self isAnyEmulatorRunning] ) |
72 |
|
[super sendEvent: event]; |
73 |
|
else |
74 |
|
{ |
108 |
|
// |
109 |
|
// switch ( NSRunAlertPanel(title, msg, def, alt, other, nil) ) |
110 |
|
// { |
111 |
< |
// case NSAlertDefault: savePrefs(); |
112 |
< |
// case NSAlertAlternate: return NSTerminateNow; |
113 |
< |
// case NSAlertOther: return NSTerminateCancel; |
111 |
> |
// case NSAlertDefault: savePrefs(); |
112 |
> |
// case NSAlertAlternate: return NSTerminateNow; |
113 |
> |
// case NSAlertOther: return NSTerminateCancel; |
114 |
|
// } |
115 |
|
// } |
116 |
|
|
194 |
|
type: (NSEventType)type |
195 |
|
{ |
196 |
|
EmulatorView *view; |
197 |
+ |
BOOL fullScreen; |
198 |
|
|
199 |
|
#ifdef ENABLE_MULTIPLE |
200 |
|
// We need to work out what window's Emulator should receive these messages |
206 |
|
{ |
207 |
|
theEmulator = [emulators objectAtIndex: tmp]; |
208 |
|
view = [theEmulator screen]; |
209 |
+ |
fullScreen = [view isFullScreen]; |
210 |
|
|
211 |
|
if ( [theEmulator isRunning] && |
212 |
< |
( [[theEmulator window] isMainWindow] || [view isFullScreen] ) ) |
212 |
> |
( fullScreen || [[theEmulator window] isMainWindow] ) ) |
213 |
|
break; |
214 |
|
} |
215 |
|
|
216 |
|
if ( tmp < [emulators count] ) // i.e. if we exited the for loop |
217 |
|
#else |
218 |
|
view = [theEmulator screen]; |
219 |
+ |
fullScreen = [view isFullScreen]; |
220 |
|
|
221 |
|
if ( [theEmulator isRunning] && |
222 |
< |
( [[theEmulator window] isMainWindow] || [view isFullScreen] ) ) |
222 |
> |
( fullScreen || [[theEmulator window] isMainWindow] ) ) |
223 |
|
#endif |
224 |
|
{ |
225 |
< |
if ( [view mouseInView: event] ) |
225 |
> |
if ( fullScreen || [view mouseInView: event] ) |
226 |
|
{ |
227 |
|
switch ( type ) |
228 |
|
{ |
234 |
|
break; |
235 |
|
case NSLeftMouseDragged: |
236 |
|
case NSMouseMoved: |
237 |
< |
[view processMouseMove: event]; |
237 |
> |
if ( fullScreen ) |
238 |
> |
[view fullscreenMouseMove]; |
239 |
> |
else |
240 |
> |
[view processMouseMove: event]; |
241 |
|
break; |
242 |
|
default: |
243 |
|
[super sendEvent: event]; // NSApplication default |
256 |
|
[super sendEvent: event]; |
257 |
|
} |
258 |
|
|
259 |
+ |
|
260 |
+ |
// Methods to display documentation: |
261 |
+ |
|
262 |
+ |
- (IBAction) HelpHowTo: (id)sender |
263 |
+ |
{ |
264 |
+ |
NSString *path = [[NSBundle mainBundle] pathForResource: @"HowTo" |
265 |
+ |
ofType: @"html"]; |
266 |
+ |
|
267 |
+ |
if ( ! path ) |
268 |
+ |
InfoSheet(@"Cannot find HowTo.html", [theEmulator window]); |
269 |
+ |
else |
270 |
+ |
if ( ! [[NSWorkspace sharedWorkspace] openFile: path] ) |
271 |
+ |
InfoSheet(@"Cannot open HowTo.html with default app", [theEmulator window]); |
272 |
+ |
} |
273 |
+ |
|
274 |
+ |
- (IBAction) HelpToDo: (id)sender |
275 |
+ |
{ |
276 |
+ |
NSString *path = [[NSBundle mainBundle] pathForResource: @"ToDo" |
277 |
+ |
ofType: @"html"]; |
278 |
+ |
|
279 |
+ |
if ( ! path ) |
280 |
+ |
InfoSheet(@"Cannot find ToDo.html", [theEmulator window]); |
281 |
+ |
else |
282 |
+ |
if ( ! [[NSWorkspace sharedWorkspace] openFile: path |
283 |
+ |
withApplication: @"TextEdit"] ) |
284 |
+ |
InfoSheet(@"Cannot open ToDo.html with TextEdit", [theEmulator window]); |
285 |
+ |
} |
286 |
+ |
|
287 |
+ |
- (IBAction) HelpVersions: (id)sender |
288 |
+ |
{ |
289 |
+ |
NSString *path = [[NSBundle mainBundle] pathForResource: @"Versions" |
290 |
+ |
ofType: @"html"]; |
291 |
+ |
|
292 |
+ |
if ( ! path ) |
293 |
+ |
InfoSheet(@"Cannot find Versions.html", [theEmulator window]); |
294 |
+ |
else |
295 |
+ |
if ( ! [[NSWorkspace sharedWorkspace] openFile: path |
296 |
+ |
withApplication: @"TextEdit"] ) |
297 |
+ |
InfoSheet(@"Cannot open Versions.html with TextEdit", |
298 |
+ |
[theEmulator window]); |
299 |
+ |
} |
300 |
+ |
|
301 |
+ |
|
302 |
+ |
// Menu items which for managing more than one window |
303 |
+ |
|
304 |
|
#ifdef ENABLE_MULTIPLE |
305 |
|
|
306 |
|
- (IBAction) NewEmulator: (id)sender |
397 |
|
return count; |
398 |
|
} |
399 |
|
|
400 |
< |
@end |
400 |
> |
@end |