4 |
|
* |
5 |
|
* $Id$ |
6 |
|
* |
7 |
< |
* Basilisk II (C) 1997-2001 Christian Bauer |
7 |
> |
* Basilisk II (C) 1997-2003 Christian Bauer |
8 |
|
* |
9 |
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
* it under the terms of the GNU General Public License as published by |
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] |
281 |
|
edited = YES; |
282 |
|
} |
283 |
|
|
284 |
+ |
|
285 |
+ |
// If we are not using the CGIMAGEREF drawing strategy, |
286 |
+ |
// then source bitmaps must be 32bits deep. |
287 |
+ |
|
288 |
+ |
- (short) testWinDepth: (int) newbpp |
289 |
+ |
{ |
290 |
+ |
#ifdef CGIMAGEREF |
291 |
+ |
return newbpp; |
292 |
+ |
#else |
293 |
+ |
if ( newbpp != 32 ) |
294 |
+ |
WarningSheet(@"Sorry - In windowed mode, depth must be 32", panel); |
295 |
+ |
return 32 |
296 |
+ |
#endif |
297 |
+ |
} |
298 |
+ |
|
299 |
|
// This is called when any of the screen/openGL/window, |
300 |
|
// width, height or depth is clicked. |
301 |
|
// |
324 |
|
if ( newbpp == init_depth && newx == init_width && |
325 |
|
newy == init_height && newtype == display_type ) |
326 |
|
{ |
327 |
< |
NSLog(@"No changed GUI items in ChangeScreen"); |
327 |
> |
D(NSLog(@"No changed GUI items in ChangeScreen")); |
328 |
|
return; |
329 |
|
} |
330 |
|
|
331 |
|
// If we are changing type, supply some sensible defaults |
332 |
+ |
|
333 |
+ |
short screenx = CGDisplayPixelsWide(kCGDirectMainDisplay), |
334 |
+ |
screeny = CGDisplayPixelsHigh(kCGDirectMainDisplay), |
335 |
+ |
screenb = CGDisplayBitsPerPixel(kCGDirectMainDisplay); |
336 |
+ |
|
337 |
|
if ( newtype != display_type ) |
338 |
|
{ |
339 |
< |
NSLog(@"Changing disylay type in ChangeScreen"); |
320 |
< |
if ( newtype == DISPLAY_SCREEN ) // If changing to full screen |
321 |
< |
{ |
322 |
< |
// supply main screen dimensions as a default |
323 |
< |
newx = CGDisplayPixelsWide (kCGDirectMainDisplay); |
324 |
< |
newy = CGDisplayPixelsHigh (kCGDirectMainDisplay); |
325 |
< |
newbpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); |
326 |
< |
} |
339 |
> |
D(NSLog(@"Changing display type in ChangeScreen")); |
340 |
|
|
341 |
< |
if ( display_type == DISPLAY_SCREEN ) // If changing from full screen |
341 |
> |
// If changing to full screen, supply main screen dimensions as a default |
342 |
> |
if ( newtype == DISPLAY_SCREEN ) |
343 |
> |
newx = screenx, newy = screeny, newbpp = screenb; |
344 |
> |
|
345 |
> |
// If changing from full screen, use minimum screen resolutions |
346 |
> |
if ( display_type == DISPLAY_SCREEN ) |
347 |
> |
{ |
348 |
|
newx = MIN_WIDTH, newy = MIN_HEIGHT; |
349 |
< |
|
350 |
< |
[width setIntValue: newx]; |
332 |
< |
[height setIntValue: newy]; |
333 |
< |
[depth setIntValue: newbpp]; |
349 |
> |
newbpp = [self testWinDepth: newbpp]; |
350 |
> |
} |
351 |
|
} |
352 |
|
else |
353 |
|
{ |
354 |
+ |
newbpp = [self testWinDepth: newbpp]; |
355 |
+ |
|
356 |
|
// Check size is within ranges of MIN_WIDTH ... MAX_WIDTH |
357 |
|
// and MIN_HEIGHT ... MAX_HEIGHT |
358 |
|
// ??? |
359 |
|
} |
360 |
|
|
361 |
+ |
[width setIntValue: newx]; |
362 |
+ |
[height setIntValue: newy]; |
363 |
+ |
[depth setIntValue: newbpp]; |
364 |
+ |
|
365 |
|
|
366 |
|
// Store new prefs |
367 |
|
*str = '\0'; |
394 |
|
|
395 |
|
if ( display_type != DISPLAY_SCREEN ) |
396 |
|
{ |
397 |
< |
NSLog(@"Display type is not SCREEN (%d), resizing window", display_type); |
397 |
> |
D(NSLog(@"Display type is not SCREEN (%d), resizing window", |
398 |
> |
display_type)); |
399 |
|
resizeWinTo(newx, newy); |
400 |
|
} |
401 |
|
} |
434 |
|
} |
435 |
|
} |
436 |
|
|
437 |
+ |
- (BOOL) fileManager: (NSFileManager *) manager |
438 |
+ |
shouldProceedAfterError: (NSDictionary *) errorDict |
439 |
+ |
{ |
440 |
+ |
NSRunAlertPanel(@"File operation error", |
441 |
+ |
@"%@ %@, toPath %@", |
442 |
+ |
@"Bugger!", nil, nil, |
443 |
+ |
[errorDict objectForKey:@"Error"], |
444 |
+ |
[errorDict objectForKey:@"Path"], |
445 |
+ |
[errorDict objectForKey:@"ToPath"]); |
446 |
+ |
return NO; |
447 |
+ |
} |
448 |
+ |
|
449 |
|
- (IBAction) DeleteVolume: (id)sender |
450 |
|
{ |
451 |
< |
const char *path = [self RemoveVolumeEntry]; |
452 |
< |
if ( unlink(path) == -1 ) |
451 |
> |
// const char *path = [self RemoveVolumeEntry]; |
452 |
> |
// if ( unlink(path) == -1 ) |
453 |
> |
NSString *Path = [self RemoveVolumeEntry]; |
454 |
> |
|
455 |
> |
if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path |
456 |
> |
handler: self] ) |
457 |
|
{ |
458 |
< |
NSLog(@"%s unlink(%s) failed", __PRETTY_FUNCTION__, path, strerror(errno)); |
458 |
> |
WarningSheet(@"Unable to delete volume", panel); |
459 |
> |
// NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__, path, strerror(errno)); |
460 |
|
} |
461 |
|
} |
462 |
|
|
559 |
|
PrefsRemoveItem(pref,0); |
560 |
|
} |
561 |
|
|
562 |
< |
- (const char *) RemoveVolumeEntry |
562 |
> |
//- (const char *) RemoveVolumeEntry |
563 |
> |
- (NSString *) RemoveVolumeEntry |
564 |
|
{ |
565 |
|
int row = [diskImages selectedRow]; |
566 |
|
|
567 |
|
if ( row != -1 ) |
568 |
|
{ |
569 |
< |
const char *path = [[volsDS pathAtRow: row] cString], |
569 |
> |
NSString *Path = [volsDS pathAtRow: row]; |
570 |
> |
const char *path = [Path cString], |
571 |
|
*str; |
572 |
|
int tmp = 0; |
573 |
|
|
576 |
|
if ( strcmp(str, path) == 0 ) |
577 |
|
{ |
578 |
|
PrefsRemoveItem("disk", tmp); |
579 |
< |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", __PRETTY_FUNCTION__, tmp)); |
579 |
> |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", |
580 |
> |
__PRETTY_FUNCTION__, tmp)); |
581 |
|
edited = YES; |
582 |
|
break; |
583 |
|
} |
586 |
|
|
587 |
|
if ( str == NULL ) |
588 |
|
{ |
589 |
< |
NSLog(@"%s - Couldn't find any disk preference to match %s", __PRETTY_FUNCTION__, path); |
589 |
> |
NSLog(@"%s - Couldn't find any disk preference to match %s", |
590 |
> |
__PRETTY_FUNCTION__, path); |
591 |
|
return NULL; |
592 |
|
} |
593 |
|
|
594 |
|
if ( ! [volsDS deleteRow: row] ) |
595 |
|
NSLog (@"%s - RemoveVolume %d failed", __PRETTY_FUNCTION__, tmp); |
596 |
|
[diskImages reloadData]; |
597 |
< |
return path; |
597 |
> |
// return path; |
598 |
> |
return Path; |
599 |
|
} |
600 |
|
else |
601 |
|
{ |