30 |
|
self = [super init]; |
31 |
|
|
32 |
|
numItems = 0; |
33 |
< |
col1 = [[NSMutableArray alloc] init]; |
34 |
< |
col2 = [[NSMutableArray alloc] init]; |
33 |
> |
col1 = [NSMutableArray new]; |
34 |
> |
col2 = [NSMutableArray new]; |
35 |
|
|
36 |
|
return self; |
37 |
|
} |
126 |
|
|
127 |
|
devs = @"/dev"; |
128 |
|
home = NSHomeDirectory(); |
129 |
< |
volsDS = [[TableDS alloc] init]; |
130 |
< |
SCSIds = [[TableDS alloc] init]; |
129 |
> |
volsDS = [TableDS new]; |
130 |
> |
SCSIds = [TableDS new]; |
131 |
|
|
132 |
< |
lockCell = [[NSImageCell alloc] init]; |
132 |
> |
lockCell = [NSImageCell new]; |
133 |
|
if ( lockCell == nil ) |
134 |
|
NSLog (@"%s - Can't create NSImageCell?", __PRETTY_FUNCTION__); |
135 |
|
|
136 |
< |
blank = [[NSImage alloc] init]; |
136 |
> |
blank = [NSImage new]; |
137 |
|
locked = [NSImage alloc]; |
138 |
|
if ( [locked initWithContentsOfFile: |
139 |
|
[[NSBundle mainBundle] |
260 |
|
|
261 |
|
- (IBAction) ChangeDisableSound: (NSButton *)sender |
262 |
|
{ |
263 |
< |
PrefsReplaceBool("nosound", [disableSound state]); |
263 |
> |
BOOL noSound = [disableSound state]; |
264 |
> |
|
265 |
> |
if ( ! noSound ) |
266 |
> |
WarningSheet(@"Sound is currently unimplemented", panel); |
267 |
> |
|
268 |
> |
PrefsReplaceBool("nosound", noSound); |
269 |
|
edited = YES; |
270 |
|
} |
271 |
|
|
281 |
|
edited = YES; |
282 |
|
} |
283 |
|
|
284 |
< |
// Screen/window changing stuff |
285 |
< |
|
286 |
< |
// This is called when any of the screen/window, width, height or depth is changed |
284 |
> |
// This is called when any of the screen/openGL/window, |
285 |
> |
// width, height or depth is clicked. |
286 |
> |
// |
287 |
> |
// Note that sender may not actually be an NSMatrix. |
288 |
|
|
289 |
|
- (IBAction) ChangeScreen: (NSMatrix *)sender |
290 |
|
{ |
291 |
+ |
NSButton *cell = [sender selectedCell]; |
292 |
+ |
|
293 |
|
short newx = [width intValue]; |
294 |
|
short newy = [height intValue]; |
295 |
|
short newbpp = [depth intValue]; |
296 |
< |
short newtype = DISPLAY_WINDOW; |
296 |
> |
short newtype; |
297 |
|
char str[20]; |
298 |
|
|
299 |
< |
if ( [sender selectedCell] == openGL ) |
299 |
> |
if ( cell == openGL ) |
300 |
|
newtype = DISPLAY_OPENGL; |
301 |
< |
if ( [sender selectedCell] == screen ) |
301 |
> |
else if ( cell == screen ) |
302 |
|
newtype = DISPLAY_SCREEN; |
303 |
+ |
else if ( cell == window ) |
304 |
+ |
newtype = DISPLAY_WINDOW; |
305 |
+ |
else |
306 |
+ |
newtype = display_type; |
307 |
|
|
308 |
|
// Check that a field actually changed |
309 |
|
if ( newbpp == init_depth && newx == init_width && |
310 |
|
newy == init_height && newtype == display_type ) |
311 |
+ |
{ |
312 |
+ |
D(NSLog(@"No changed GUI items in ChangeScreen")); |
313 |
|
return; |
314 |
< |
|
314 |
> |
} |
315 |
|
|
316 |
|
// If we are changing type, supply some sensible defaults |
317 |
|
if ( newtype != display_type ) |
318 |
|
{ |
319 |
+ |
D(NSLog(@"Changing display type in ChangeScreen")); |
320 |
|
if ( newtype == DISPLAY_SCREEN ) // If changing to full screen |
321 |
|
{ |
322 |
|
// supply main screen dimensions as a default |
323 |
< |
NSScreen *s = [NSScreen mainScreen]; |
324 |
< |
NSRect sr = [s frame]; |
310 |
< |
|
311 |
< |
newx = (short) sr.size.width; |
312 |
< |
newy = (short) sr.size.height; |
313 |
< |
// This always returns 24, despite the mode |
314 |
< |
//newbpp = NSBitsPerPixelFromDepth([s depth]); |
323 |
> |
newx = CGDisplayPixelsWide (kCGDirectMainDisplay); |
324 |
> |
newy = CGDisplayPixelsHigh (kCGDirectMainDisplay); |
325 |
|
newbpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); |
326 |
|
} |
327 |
|
|
370 |
|
edited = YES; |
371 |
|
|
372 |
|
if ( display_type != DISPLAY_SCREEN ) |
373 |
+ |
{ |
374 |
+ |
D(NSLog(@"Display type is not SCREEN (%d), resizing window", |
375 |
+ |
display_type)); |
376 |
|
resizeWinTo(newx, newy); |
377 |
+ |
} |
378 |
|
} |
379 |
|
|
380 |
|
- (IBAction) CreateVolume: (id)sender |
399 |
|
NSString *details = [NSString stringWithFormat: |
400 |
|
@"The dd command failed.\nReturn status %d (%s)", |
401 |
|
retVal, strerror(errno)]; |
402 |
< |
WarningSheet(@"Unable to create volume", details, @"OK", panel); |
402 |
> |
WarningSheet(@"Unable to create volume", details, nil, panel); |
403 |
|
} |
404 |
|
else |
405 |
|
{ |
411 |
|
} |
412 |
|
} |
413 |
|
|
414 |
+ |
- (BOOL) fileManager: (NSFileManager *) manager |
415 |
+ |
shouldProceedAfterError: (NSDictionary *) errorDict |
416 |
+ |
{ |
417 |
+ |
NSRunAlertPanel(@"File operation error", |
418 |
+ |
@"%@ %@, toPath %@", |
419 |
+ |
@"Bugger!", nil, nil, |
420 |
+ |
[errorDict objectForKey:@"Error"], |
421 |
+ |
[errorDict objectForKey:@"Path"], |
422 |
+ |
[errorDict objectForKey:@"ToPath"]); |
423 |
+ |
return NO; |
424 |
+ |
} |
425 |
+ |
|
426 |
|
- (IBAction) DeleteVolume: (id)sender |
427 |
|
{ |
428 |
< |
const char *path = [self RemoveVolumeEntry]; |
429 |
< |
if ( unlink(path) == -1 ) |
428 |
> |
// const char *path = [self RemoveVolumeEntry]; |
429 |
> |
// if ( unlink(path) == -1 ) |
430 |
> |
NSString *Path = [self RemoveVolumeEntry]; |
431 |
> |
|
432 |
> |
if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path |
433 |
> |
handler: self] ) |
434 |
|
{ |
435 |
< |
NSLog(@"%s unlink(%s) failed", __PRETTY_FUNCTION__, path, strerror(errno)); |
435 |
> |
WarningSheet(@"Unable to delete volume", panel); |
436 |
> |
// NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__, path, strerror(errno)); |
437 |
|
} |
438 |
|
} |
439 |
|
|
458 |
|
int B = (int) [bytes floatValue]; |
459 |
|
float M = B / 1024 / 1024; |
460 |
|
|
461 |
< |
NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B); |
461 |
> |
D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B)); |
462 |
|
PrefsReplaceInt32("ramsize", B); |
463 |
|
[MB setFloatValue: M]; |
464 |
|
edited = YES; |
502 |
|
float M = [MB floatValue]; |
503 |
|
int B = (int) (M * 1024 * 1024); |
504 |
|
|
505 |
< |
NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B); |
505 |
> |
D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B)); |
506 |
|
PrefsReplaceInt32("ramsize", B); |
507 |
|
[bytes setIntValue: B]; |
508 |
|
edited = YES; |
516 |
|
edited = YES; |
517 |
|
} |
518 |
|
|
488 |
– |
- (IBAction) EditRAMsize: (NSTextField *)sender |
489 |
– |
{ |
490 |
– |
int B = [bytes intValue]; |
491 |
– |
float M = B / (1024.0 * 1024.0); |
492 |
– |
|
493 |
– |
NSLog(@"%s = %d %f", __PRETTY_FUNCTION__, B, M); |
494 |
– |
PrefsReplaceInt32("ramsize", B); |
495 |
– |
[MB setFloatValue: M]; |
496 |
– |
edited = YES; |
497 |
– |
} |
498 |
– |
|
519 |
|
- (IBAction) EditROMpath: (NSTextField *)sender |
520 |
|
{ |
521 |
|
NSString *path = [ROMfile stringValue]; |
536 |
|
PrefsRemoveItem(pref,0); |
537 |
|
} |
538 |
|
|
539 |
< |
- (const char *) RemoveVolumeEntry |
539 |
> |
//- (const char *) RemoveVolumeEntry |
540 |
> |
- (NSString *) RemoveVolumeEntry |
541 |
|
{ |
542 |
|
int row = [diskImages selectedRow]; |
543 |
|
|
544 |
|
if ( row != -1 ) |
545 |
|
{ |
546 |
< |
const char *path = [[volsDS pathAtRow: row] cString], |
546 |
> |
NSString *Path = [volsDS pathAtRow: row]; |
547 |
> |
const char *path = [Path cString], |
548 |
|
*str; |
549 |
|
int tmp = 0; |
550 |
|
|
553 |
|
if ( strcmp(str, path) == 0 ) |
554 |
|
{ |
555 |
|
PrefsRemoveItem("disk", tmp); |
556 |
< |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", __PRETTY_FUNCTION__, tmp)); |
556 |
> |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", |
557 |
> |
__PRETTY_FUNCTION__, tmp)); |
558 |
|
edited = YES; |
559 |
|
break; |
560 |
|
} |
563 |
|
|
564 |
|
if ( str == NULL ) |
565 |
|
{ |
566 |
< |
NSLog(@"%s - Couldn't find any disk preference to match %s", __PRETTY_FUNCTION__, path); |
566 |
> |
NSLog(@"%s - Couldn't find any disk preference to match %s", |
567 |
> |
__PRETTY_FUNCTION__, path); |
568 |
|
return NULL; |
569 |
|
} |
570 |
|
|
571 |
|
if ( ! [volsDS deleteRow: row] ) |
572 |
|
NSLog (@"%s - RemoveVolume %d failed", __PRETTY_FUNCTION__, tmp); |
573 |
|
[diskImages reloadData]; |
574 |
< |
return path; |
574 |
> |
// return path; |
575 |
> |
return Path; |
576 |
|
} |
577 |
|
else |
578 |
|
{ |
579 |
< |
WarningSheet(@"Please select a volume first", @"", @"OK", panel); |
579 |
> |
WarningSheet(@"Please select a volume first", panel); |
580 |
|
return NULL; |
581 |
|
} |
582 |
|
} |
684 |
|
// Window already created by NIB file, just display |
685 |
|
[panel makeKeyAndOrderFront:self]; |
686 |
|
WarningSheet(@"Compiled-in memory model does not support 24bit", |
687 |
< |
@"Disabling Mac Classic emulation", @"OK", panel); |
687 |
> |
@"Disabling Mac Classic emulation", nil, panel); |
688 |
|
cpu = [CPU68030 tag]; |
689 |
|
PrefsReplaceInt32("cpu", cpu); |
690 |
|
tmp = [IIci tag]; |