| 1 |
#import "SettingDlgControl.h" |
| 2 |
|
| 3 |
@implementation SettingDlgControl |
| 4 |
|
| 5 |
- (IBAction)buttonCancel:(id)sender |
| 6 |
{ |
| 7 |
[NSApp stopModalWithCode: RET_ABORT]; |
| 8 |
} |
| 9 |
|
| 10 |
- (IBAction)buttonStart:(id)sender |
| 11 |
{ |
| 12 |
[NSApp stopModalWithCode: RET_OK]; |
| 13 |
} |
| 14 |
|
| 15 |
- (int)openSettingDialog:(OPTIONS *)option |
| 16 |
{ |
| 17 |
int ret; |
| 18 |
|
| 19 |
[checkTestWrite setState : (option->test_write ? NSOnState:NSOffState)]; |
| 20 |
[checkBUFE setState : (option->bufe ? NSOnState:NSOffState)]; |
| 21 |
[checkOnTheFly setState : (option->on_the_fly ? NSOnState:NSOffState)]; |
| 22 |
[checkDiscAtOnce setState : (option->dao ? NSOnState:NSOffState)]; |
| 23 |
[checkOutSide setState : (option->outside ? NSOnState:NSOffState)]; |
| 24 |
|
| 25 |
[checkTestWrite setEnabled : ((option->flags & OPFLG_TESTWRITE) ? YES:NO)]; |
| 26 |
[checkBUFE setEnabled : ((option->flags & OPFLG_BUFE) ? YES:NO)]; |
| 27 |
[checkOnTheFly setEnabled : ((option->flags & OPFLG_ONTHEFLY) ? YES:NO)]; |
| 28 |
[checkDiscAtOnce setEnabled : ((option->flags & OPFLG_DAO) ? YES:NO)]; |
| 29 |
[checkOutSide setEnabled : ((option->flags & OPFLG_OUTSIDE) ? YES:NO)]; |
| 30 |
|
| 31 |
[textTempDirectory setStringValue : |
| 32 |
[NSString stringWithCString : option->temppath]]; |
| 33 |
[textTempDirectory setEnabled : ((option->flags & OPFLG_TEMPPATH) ? YES:NO)]; |
| 34 |
|
| 35 |
[self setSpeedItems: readSpeedSel |
| 36 |
defValue: option->read_speed |
| 37 |
isdvd: (option->flags & OPFLG_DVD) |
| 38 |
speedList: option->readable_speed |
| 39 |
numSpeed: option->num_readable_speed]; |
| 40 |
[self setSpeedItems: writeSpeedSel |
| 41 |
defValue: option->write_speed |
| 42 |
isdvd: (option->flags & OPFLG_DVD) |
| 43 |
speedList: option->writable_speed |
| 44 |
numSpeed: option->num_writable_speed]; |
| 45 |
/* �_�C�A���O�\�� */ |
| 46 |
ret = [NSApp runModalForWindow: settingPanel]; |
| 47 |
[settingPanel orderOut: self]; |
| 48 |
if(ret!=RET_OK) |
| 49 |
return ret; |
| 50 |
|
| 51 |
option->test_write = [checkTestWrite state]==NSOnState; |
| 52 |
option->bufe = [checkBUFE state]==NSOnState; |
| 53 |
option->on_the_fly = [checkOnTheFly state]==NSOnState; |
| 54 |
option->dao = [checkDiscAtOnce state]==NSOnState; |
| 55 |
option->outside = [checkOutSide state]==NSOnState; |
| 56 |
|
| 57 |
option->read_speed = atoi([[readSpeedSel titleOfSelectedItem] cString]); |
| 58 |
option->write_speed = atoi([[writeSpeedSel titleOfSelectedItem] cString]); |
| 59 |
|
| 60 |
const char *tempPath = [[textTempDirectory stringValue] cString]; |
| 61 |
strncpy(option->temppath, tempPath, _MAX_PATH-1); |
| 62 |
option->temppath[_MAX_PATH-1] = '\0'; |
| 63 |
return RET_OK; |
| 64 |
} |
| 65 |
|
| 66 |
- (void)setSpeedItems:(id)target |
| 67 |
defValue:(int)defaultSpeed |
| 68 |
isdvd:(BOOL)dvd |
| 69 |
speedList:(BYTE *)speeds |
| 70 |
numSpeed:(int)num_speed |
| 71 |
{ |
| 72 |
int i; |
| 73 |
char buf[32]; |
| 74 |
|
| 75 |
[target removeAllItems]; |
| 76 |
[target addItemWithTitle: |
| 77 |
[NSString stringWithCString: (dvd ? "�W����":"������")]]; |
| 78 |
|
| 79 |
for(i=0; i<num_speed; i++){ |
| 80 |
snprintf(buf, sizeof(buf), "%d�{��", speeds[i]); |
| 81 |
[target addItemWithTitle: |
| 82 |
[NSString stringWithCString: buf]]; |
| 83 |
if(speeds[i]==defaultSpeed){ |
| 84 |
[target selectItemAtIndex: i+1]; |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
@end |