[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[702] trunk/fuse
Brought to you by:
fredm
From: <fr...@us...> - 2012-11-02 12:03:53
|
Revision: 702 http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=702&view=rev Author: fredm Date: 2012-11-02 12:03:41 +0000 (Fri, 02 Nov 2012) Log Message: ----------- Migrate to modern Objective-C syntax. Modified Paths: -------------- trunk/fuse/fusepb/content_arrays/CAMachines.m trunk/fuse/fusepb/content_arrays/HIDJoysticks.m trunk/fuse/fusepb/content_arrays/Joysticks.m trunk/fuse/fusepb/controllers/DebuggerController.m trunk/fuse/fusepb/controllers/FuseController.m trunk/fuse/fusepb/controllers/JoystickConfigurationController.m trunk/fuse/fusepb/controllers/LoadBinaryController.m trunk/fuse/fusepb/controllers/MemoryBrowserController.m trunk/fuse/fusepb/controllers/PokeFinderController.m trunk/fuse/fusepb/controllers/PreferencesController.m trunk/fuse/fusepb/controllers/RollbackController.m trunk/fuse/fusepb/controllers/TapeBrowserController.m trunk/fuse/fusepb/models/Emulator.m trunk/fuse/fusepb/transformers/MachineNameToIdTransformer.m trunk/fuse/fusepb/transformers/MachineScalerIsEnabled.m trunk/fuse/fusepb/transformers/ScalerNameToIdTransformer.m trunk/fuse/fusepb/transformers/VolumeSliderToPrefTransformer.m trunk/fuse/fusepb/views/DisplayOpenGLView.m trunk/fuse/settings.pl trunk/fuse/ui/cocoa/cocoaerror.m trunk/fuse/ui/cocoa/cocoascreenshot.m trunk/fuse/ui/cocoa/cocoaui.m Modified: trunk/fuse/fusepb/content_arrays/CAMachines.m =================================================================== --- trunk/fuse/fusepb/content_arrays/CAMachines.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/content_arrays/CAMachines.m 2012-11-02 12:03:41 UTC (rev 702) @@ -43,8 +43,7 @@ for( i=0; i<machine_count; i++ ) { [machines addObject: - [Machine machineWithName:[NSString stringWithUTF8String: - libspectrum_machine_name( machine_types[i]->machine )] + [Machine machineWithName:@(libspectrum_machine_name( machine_types[i]->machine )) andType:machine_types[i]->machine] ]; } Modified: trunk/fuse/fusepb/content_arrays/HIDJoysticks.m =================================================================== --- trunk/fuse/fusepb/content_arrays/HIDJoysticks.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/content_arrays/HIDJoysticks.m 2012-11-02 12:03:41 UTC (rev 702) @@ -46,8 +46,7 @@ if( joysticks_supported > 0 ){ for( i=0; i<joysticks_supported; i++ ) { [joysticks addObject: - [HIDJoystick joystickWithName:[NSString stringWithUTF8String: - SDL_SYS_JoystickName(i)] + [HIDJoystick joystickWithName:@(SDL_SYS_JoystickName(i)) andType:i+1] ]; } Modified: trunk/fuse/fusepb/content_arrays/Joysticks.m =================================================================== --- trunk/fuse/fusepb/content_arrays/Joysticks.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/content_arrays/Joysticks.m 2012-11-02 12:03:41 UTC (rev 702) @@ -43,9 +43,7 @@ for( i=0; i<JOYSTICK_TYPE_COUNT; i++ ) { [joysticks addObject: - [Joystick joystickWithName:[NSString stringWithUTF8String: - joystick_name[i]] - andType:i] + [Joystick joystickWithName:@(joystick_name[i]) andType:i] ]; } } Modified: trunk/fuse/fusepb/controllers/DebuggerController.m =================================================================== --- trunk/fuse/fusepb/controllers/DebuggerController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/DebuggerController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -130,7 +130,7 @@ if( row < 0 || row >= [eventsContents count] ) return; - record = [eventsContents objectAtIndex:row]; + record = eventsContents[row]; value = [record valueForKey:@"time"]; error = debugger_breakpoint_add_time( DEBUGGER_BREAKPOINT_TYPE_TIME, @@ -197,11 +197,11 @@ libspectrum_word address; if( debugger_output_base == 10 ) { - format_16_bit = [NSString stringWithUTF8String:"%5d"]; - format_8_bit = [NSString stringWithUTF8String:"%3d"]; + format_16_bit = @"%5d"; + format_8_bit = @"%3d"; } else { - format_16_bit = [NSString stringWithUTF8String:"0x%04X"]; - format_8_bit = [NSString stringWithUTF8String:"0x%02X"]; + format_16_bit = @"0x%04X"; + format_8_bit = @"0x%02X"; } [PCText setStringValue:[NSString stringWithFormat:format_16_bit, PC ]]; @@ -226,7 +226,7 @@ for( i = 0; i < 8; i++ ) buffer[i] = ( F & ( 0x80 >> i ) ) ? '1' : '0'; buffer[8] = '\0'; - [flags setStringValue:[NSString stringWithUTF8String:buffer]]; + [flags setStringValue:@(buffer)]; capabilities = libspectrum_machine_capabilities( machine_current->machine ); @@ -336,20 +336,18 @@ if( bp->condition ) { char condition_cstring[80]; debugger_expression_deparse( condition_cstring, 80, bp->condition ); - condition = [NSString stringWithUTF8String:condition_cstring]; + condition = @(condition_cstring); } else { condition = @""; } [breakpointsContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - id, @"id", - type, @"type", - value, @"value", - ignore, @"ignore", - life, @"life", - condition, @"condition", - nil] + @{@"id": id, + @"type": type, + @"value": value, + @"ignore": ignore, + @"life": life, + @"condition": condition} ]; } @@ -371,14 +369,12 @@ disassembly_address = [NSString stringWithFormat:format_16_bit, address ]; debugger_disassemble( buffer, 40, &length, address ); - instruction = [NSString stringWithUTF8String:buffer]; + instruction = @(buffer); address += length; [dissasemblyContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - disassembly_address, @"address", - instruction, @"instruction", - nil] + @{@"address": disassembly_address, + @"instruction": instruction} ]; } @@ -403,10 +399,8 @@ stack_value = [NSString stringWithFormat:format_16_bit, contents ]; [stackContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - stack_address, @"address", - stack_value, @"value", - nil] + @{@"address": stack_address, + @"value": stack_value} ]; } @@ -440,18 +434,16 @@ NSString *memory_map_address = [NSString stringWithFormat:format_16_bit, i*MEMORY_PAGE_SIZE ]; NSString *memory_map_type = [NSString stringWithFormat:@"%s", memory_source_description( memory_map_read[i].source )]; - NSNumber *memory_map_page = [ NSNumber numberWithInt:memory_map_read[i].page_num ]; + NSNumber *memory_map_page = @(memory_map_read[i].page_num); NSString *memory_map_writeable = [NSString stringWithFormat:@"%s", memory_map_read[i].writable ? "Y" : "N" ]; NSString *memory_map_contended = [NSString stringWithFormat:@"%s", memory_map_read[i].contended ? "Y" : "N" ]; [memoryMapContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - memory_map_address, @"address", - memory_map_type, @"type", - memory_map_page, @"page", - memory_map_writeable, @"writeable", - memory_map_contended, @"contended", - nil] + @{@"address": memory_map_address, + @"type": memory_map_type, + @"page": memory_map_page, + @"writeable": memory_map_writeable, + @"contended": memory_map_contended} ]; } @@ -463,15 +455,10 @@ /* Skip events which have been removed */ if( ptr->type == event_type_null ) return; - NSNumber *event_time = [ NSNumber numberWithUnsignedLong:ptr->tstates ]; - NSString *event_type = [ NSString stringWithUTF8String:event_name( ptr->type ) ]; + NSNumber *event_time = @(ptr->tstates); + NSString *event_type = @(event_name( ptr->type )); - [eventsContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - event_time, @"time", - event_type, @"type", - nil] - ]; + [eventsContents addObject:@{@"time": event_time, @"type": event_type}]; } - (void)debugger_disassemble:(libspectrum_word)address @@ -538,31 +525,31 @@ switch( [table tag] ) { case 0: if(row < 0 || row > [dissasemblyContents count]) return nil; - record = [dissasemblyContents objectAtIndex:row]; + record = dissasemblyContents[row]; value = [record valueForKey:[col identifier]]; return value; break; case 1: if(row < 0 || row > [stackContents count]) return nil; - record = [stackContents objectAtIndex:row]; + record = stackContents[row]; value = [record valueForKey:[col identifier]]; return value; break; case 2: if(row < 0 || row > [breakpointsContents count]) return nil; - record = [breakpointsContents objectAtIndex:row]; + record = breakpointsContents[row]; value = [record valueForKey:[col identifier]]; return value; break; case 3: if(row < 0 || row > [eventsContents count]) return nil; - record = [eventsContents objectAtIndex:row]; + record = eventsContents[row]; value = [record valueForKey:[col identifier]]; return value; break; case 4: if(row < 0 || row > [memoryMapContents count]) return nil; - record = [memoryMapContents objectAtIndex:row]; + record = memoryMapContents[row]; value = [record valueForKey:[col identifier]]; return value; break; Modified: trunk/fuse/fusepb/controllers/FuseController.m =================================================================== --- trunk/fuse/fusepb/controllers/FuseController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/FuseController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -201,8 +201,7 @@ [super init]; singleton = self; - NSArray *compressedFileTypes = [NSArray arrayWithObjects:@"gz", @"GZ", - @"bz2", @"BZ2", nil]; + NSArray *compressedFileTypes = @[@"gz", @"GZ", @"bz2", @"BZ2"]; snapFileTypes = [NSMutableArray arrayWithObjects:@"mgtsnp", @"MGTSNP", @"slt", @"SLT", @"sna", @"SNA", @"sp", @"SP", @"szx", @@ -678,7 +677,7 @@ [[DisplayOpenGLView instance] pause]; - recording = cocoaui_savepanel_get_filename( @"Start Recording", [NSArray arrayWithObjects:@"rzx", nil] ); + recording = cocoaui_savepanel_get_filename( @"Start Recording", @[@"rzx"] ); if( !recording ) { [[DisplayOpenGLView instance] unpause]; return; } [[DisplayOpenGLView instance] rzxStartRecording:recording embedSnapshot:1]; @@ -701,7 +700,7 @@ snap = cocoaui_openpanel_get_filename( @"Load Snapshot", snapFileTypes ); if( !snap ) { [[DisplayOpenGLView instance] unpause]; return; } - recording = cocoaui_savepanel_get_filename( @"Start Recording", [NSArray arrayWithObjects:@"rzx", nil] ); + recording = cocoaui_savepanel_get_filename( @"Start Recording", @[@"rzx"] ); if( !recording ) { free( snap ); [[DisplayOpenGLView instance] unpause]; return; } if( snapshot_read( snap ) ) { @@ -735,7 +734,7 @@ [[DisplayOpenGLView instance] pause]; - psgfile = cocoaui_savepanel_get_filename( @"Start AY Sound Recording", [NSArray arrayWithObjects:@"psg", nil] ); + psgfile = cocoaui_savepanel_get_filename( @"Start AY Sound Recording", @[@"psg"] ); if( !psgfile ) { [[DisplayOpenGLView instance] unpause]; return; } [[DisplayOpenGLView instance] psgStart:psgfile]; @@ -764,7 +763,7 @@ if( !settings_current.full_screen ) { [[DisplayOpenGLView instance] pause]; - filename = cocoaui_savepanel_get_filename( @"Save Snapshot As", [NSArray arrayWithObjects:@"szx", @"z80", @"sna", nil] ); + filename = cocoaui_savepanel_get_filename( @"Save Snapshot As", @[@"szx", @"z80", @"sna"] ); if( !filename ) goto save_as_exit; @@ -837,7 +836,7 @@ [[DisplayOpenGLView instance] pause]; - filename = cocoaui_savepanel_get_filename( @"Save Profile Data As", [NSArray arrayWithObjects:@"profile", nil] ); + filename = cocoaui_savepanel_get_filename( @"Save Profile Data As", @[@"profile"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } [[DisplayOpenGLView instance] profileFinish:filename]; @@ -853,7 +852,7 @@ [[DisplayOpenGLView instance] pause]; - filename = cocoaui_savepanel_get_filename( @"Save Screenshot As", [NSArray arrayWithObjects:@"scr", nil] ); + filename = cocoaui_savepanel_get_filename( @"Save Screenshot As", @[@"scr"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } @@ -872,7 +871,7 @@ [[DisplayOpenGLView instance] pause]; - filename = cocoaui_savepanel_get_filename( @"Export Screenshot", [NSArray arrayWithObjects:@"png", @"tiff", @"bmp", @"jpg", @"gif", nil] ); + filename = cocoaui_savepanel_get_filename( @"Export Screenshot", @[@"png", @"tiff", @"bmp", @"jpg", @"gif"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } @@ -1058,7 +1057,7 @@ - (IBAction)saveFileTypeClicked:(id)sender; { - [sPanel setAllowedFileTypes:[NSArray arrayWithObject:[saveFileType titleOfSelectedItem]]]; + [sPanel setAllowedFileTypes:@[[saveFileType titleOfSelectedItem]]]; } - savePanelAccessoryView @@ -1798,8 +1797,7 @@ - (void)openRecent:(id)fileMenu { - NSString *file = [settings_current.cocoa->recent_snapshots - objectAtIndex:[recentSnaps indexOfItem:fileMenu]]; + NSString *file = settings_current.cocoa->recent_snapshots[[recentSnaps indexOfItem:fileMenu]]; char *filename = strdup([file UTF8String]); if( filename == NULL ) return; @@ -1822,17 +1820,15 @@ while( (object = [enumerator nextObject]) ) { if( [object isEqualToString:filename] ) { - NSNumber *index = [NSNumber - numberWithInt:[recentSnapFileNames indexOfObjectIdenticalTo:object]]; + NSNumber *index = @([recentSnapFileNames indexOfObjectIdenticalTo:object]); NSString *file = [NSString stringWithString:filename]; - NSArray *match = [NSArray arrayWithObjects:index, file, nil]; + NSArray *match = @[index, file]; [matches addObject:match]; } } NSMutableString *commonPrefix = [NSMutableString - stringWithString:[settings_current.cocoa->recent_snapshots - objectAtIndex:[[[matches lastObject] objectAtIndex:1] intValue]]]; + stringWithString:settings_current.cocoa->recent_snapshots[[[matches lastObject][1] intValue]]]; /* Iterate through matches to find shortest common string as found by commonPrefixWithString */ @@ -1841,14 +1837,12 @@ /* Compare all strings with commonPrefixWithString and find the shortest prefix */ id object2; - NSString *file = [settings_current.cocoa->recent_snapshots - objectAtIndex:[[object objectAtIndex:1] intValue]]; + NSString *file = settings_current.cocoa->recent_snapshots[[object[1] intValue]]; NSEnumerator *enumerator2 = [matches objectEnumerator]; while( (object2 = [enumerator2 nextObject]) ) { if([object isEqual:object2]) continue; - NSString *file2 = [settings_current.cocoa->recent_snapshots - objectAtIndex:[[object2 objectAtIndex:0] intValue]]; + NSString *file2 = settings_current.cocoa->recent_snapshots[[object2[0] intValue]]; NSString *prefix = [file commonPrefixWithString:file2 options:NSLiteralSearch]; if( [prefix length] < [commonPrefix length] ) { @@ -1862,9 +1856,8 @@ the full path with commonPrefix removed, and with snap name - .../ prepended */ for( object in matches ) { - unsigned index = [[object objectAtIndex:0] intValue]; - NSString *file = [settings_current.cocoa->recent_snapshots - objectAtIndex:[[object objectAtIndex:0] intValue]]; + unsigned index = [object[0] intValue]; + NSString *file = settings_current.cocoa->recent_snapshots[[object[0] intValue]]; NSMutableString *label = [NSMutableString stringWithString:file]; @@ -1925,8 +1918,7 @@ - (void)addRecentSnapshot:(const char *)filename { - NSString *file = [NSString stringWithUTF8String:filename]; - [self addRecentSnapshotWithString:file]; + [self addRecentSnapshotWithString:@(filename)]; } - (void)clearRecentSnapshots @@ -2082,7 +2074,7 @@ [[DisplayOpenGLView instance] pause]; - filename = cocoaui_savepanel_get_filename( @"Write Tape As", [NSArray arrayWithObjects:@"tzx", @"tap", @"csw", nil] ); + filename = cocoaui_savepanel_get_filename( @"Write Tape As", @[@"tzx", @"tap", @"csw"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } @@ -2090,7 +2082,7 @@ paused */ tape_write( filename ); - [self addRecentSnapshotWithString:[NSString stringWithUTF8String:filename]]; + [self addRecentSnapshotWithString:@(filename)]; free( filename ); @@ -2110,7 +2102,7 @@ if( saveas == YES ) { NSString *title = [NSString stringWithFormat:@"Write +3 Disk %c: As", drive]; - filename = cocoaui_savepanel_get_filename( title, [NSArray arrayWithObjects:@"dsk", nil] ); + filename = cocoaui_savepanel_get_filename( title, @[@"dsk"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } } @@ -2118,7 +2110,7 @@ /* We will be calling this from the Emulator thread */ err = specplus3_disk_write( which, filename ); - [self addRecentSnapshotWithString:[NSString stringWithUTF8String:filename]]; + [self addRecentSnapshotWithString:@(filename)]; if( saveas == YES ) free( filename ); @@ -2145,9 +2137,7 @@ if( saveas == YES ) { NSString *title = [NSString stringWithFormat:@"Write Beta Disk %c: As", drive]; filename = - cocoaui_savepanel_get_filename( title, - [NSArray arrayWithObjects:@"trd", @"scl", - @"udi", @"fdi", nil] ); + cocoaui_savepanel_get_filename( title, @[@"trd", @"scl", @"udi", @"fdi"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } } @@ -2155,7 +2145,7 @@ /* We will be calling this from the main thread with emulator paused */ err = beta_disk_write( which, filename ); - [self addRecentSnapshotWithString:[NSString stringWithUTF8String:filename]]; + [self addRecentSnapshotWithString:@(filename)]; if( saveas == YES ) free( filename ); @@ -2180,9 +2170,7 @@ if( saveas == YES ) { NSString *title = [NSString stringWithFormat:@"Write Opus Discovery Disk %c: As", drive]; filename = - cocoaui_savepanel_get_filename( title, - [NSArray arrayWithObjects:@"opd", @"opu", - @"dsk", nil] ); + cocoaui_savepanel_get_filename( title, @[@"opd", @"opu", @"dsk"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } } @@ -2190,7 +2178,7 @@ /* We will be calling this from the main thread with emulator paused */ err = opus_disk_write( which, filename ); - [self addRecentSnapshotWithString:[NSString stringWithUTF8String:filename]]; + [self addRecentSnapshotWithString:@(filename)]; if( saveas == YES ) free( filename ); @@ -2214,10 +2202,7 @@ if( saveas == YES ) { NSString *title = [NSString stringWithFormat:@"Write +D Disk %c: As", drive]; - filename = - cocoaui_savepanel_get_filename( title, - [NSArray arrayWithObjects:@"mgt", @"img", - nil] ); + filename = cocoaui_savepanel_get_filename( title, @[@"mgt", @"img"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } } @@ -2225,7 +2210,7 @@ /* We will be calling this from the main thread with emulator paused */ err = plusd_disk_write( which, filename ); - [self addRecentSnapshotWithString:[NSString stringWithUTF8String:filename]]; + [self addRecentSnapshotWithString:@(filename)]; free( filename ); @@ -2249,10 +2234,7 @@ if( saveas == YES ) { NSString *title = [NSString stringWithFormat:@"Write DISCiPLE Disk %c: As", drive]; - filename = - cocoaui_savepanel_get_filename( title, - [NSArray arrayWithObjects:@"mgt", @"img", - nil] ); + filename = cocoaui_savepanel_get_filename( title, @[@"mgt", @"img"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } } @@ -2260,7 +2242,7 @@ /* We will be calling this from the main thread with emulator paused */ err = disciple_disk_write( which, filename ); - [self addRecentSnapshotWithString:[NSString stringWithUTF8String:filename]]; + [self addRecentSnapshotWithString:@(filename)]; free( filename ); @@ -2278,7 +2260,7 @@ if( saveas == YES ) { NSString *title = [NSString stringWithFormat:@"Write Microdrive Cartridge %i As", which]; - filename = cocoaui_savepanel_get_filename( title, [NSArray arrayWithObjects:@"mdr", nil] ); + filename = cocoaui_savepanel_get_filename( title, @[@"mdr"] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } } @@ -2286,7 +2268,7 @@ /* We will be calling this from the main thread with emulator paused */ err = if1_mdr_write( which, filename ); - [self addRecentSnapshotWithString:[NSString stringWithUTF8String:filename]]; + [self addRecentSnapshotWithString:@(filename)]; if( saveas == YES ) free( filename ); @@ -2488,7 +2470,7 @@ result = [oPanel runModal]; if (result == NSOKButton) { NSArray *filesToOpen = [oPanel URLs]; - NSString *aFile = [[filesToOpen objectAtIndex:0] path]; + NSString *aFile = [filesToOpen[0] path]; [aFile getFileSystemRepresentation:buffer maxLength:PATH_MAX]; filename = strdup ( buffer ); } @@ -2506,7 +2488,7 @@ sPanel = [NSSavePanel savePanel]; [sPanel setTitle:title]; - [sPanel setAllowedFileTypes:[NSArray arrayWithObject:[fileTypes objectAtIndex:0]]]; + [sPanel setAllowedFileTypes:@[fileTypes[0]]]; [sPanel setCanSelectHiddenExtension:YES]; if( [fileTypes count] > 1 ) { @@ -2641,7 +2623,8 @@ int ui_menu_activate( ui_menu_item item, int active ) { - NSNumber* activeBool = [NSNumber numberWithBool:active ? YES : NO]; + BOOL value = active ? YES : NO; + NSNumber* activeBool = @(value); SEL method = nil; switch( item ) { @@ -3038,8 +3021,7 @@ [[DisplayOpenGLView instance] pause]; - NSString *m = [NSString stringWithUTF8String:message]; - result = NSRunAlertPanel(@"Confirm", m, @"OK", @"Cancel", nil); + result = NSRunAlertPanel(@"Confirm", @(message), @"OK", @"Cancel", nil); if( result == NSAlertDefaultReturn ) confirm = 1; Modified: trunk/fuse/fusepb/controllers/JoystickConfigurationController.m =================================================================== --- trunk/fuse/fusepb/controllers/JoystickConfigurationController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/JoystickConfigurationController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -109,32 +109,32 @@ switch(joyNum) { case 1: - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire1 selectedItem] tag]] forKey:@"joystick1fire1"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire2 selectedItem] tag]] forKey:@"joystick1fire2"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire3 selectedItem] tag]] forKey:@"joystick1fire3"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire4 selectedItem] tag]] forKey:@"joystick1fire4"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire5 selectedItem] tag]] forKey:@"joystick1fire5"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire6 selectedItem] tag]] forKey:@"joystick1fire6"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire7 selectedItem] tag]] forKey:@"joystick1fire7"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire8 selectedItem] tag]] forKey:@"joystick1fire8"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire9 selectedItem] tag]] forKey:@"joystick1fire9"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire10 selectedItem] tag]] forKey:@"joystick1fire10"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyXAxis selectedItem] tag]] forKey:@"joy1x"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyYAxis selectedItem] tag]] forKey:@"joy1y"]; + [currentValues setObject:@([[joyFire1 selectedItem] tag]) forKey:@"joystick1fire1"]; + [currentValues setObject:@([[joyFire2 selectedItem] tag]) forKey:@"joystick1fire2"]; + [currentValues setObject:@([[joyFire3 selectedItem] tag]) forKey:@"joystick1fire3"]; + [currentValues setObject:@([[joyFire4 selectedItem] tag]) forKey:@"joystick1fire4"]; + [currentValues setObject:@([[joyFire5 selectedItem] tag]) forKey:@"joystick1fire5"]; + [currentValues setObject:@([[joyFire6 selectedItem] tag]) forKey:@"joystick1fire6"]; + [currentValues setObject:@([[joyFire7 selectedItem] tag]) forKey:@"joystick1fire7"]; + [currentValues setObject:@([[joyFire8 selectedItem] tag]) forKey:@"joystick1fire8"]; + [currentValues setObject:@([[joyFire9 selectedItem] tag]) forKey:@"joystick1fire9"]; + [currentValues setObject:@([[joyFire10 selectedItem] tag]) forKey:@"joystick1fire10"]; + [currentValues setObject:@([[joyXAxis selectedItem] tag]) forKey:@"joy1x"]; + [currentValues setObject:@([[joyYAxis selectedItem] tag]) forKey:@"joy1y"]; break; case 2: - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire1 selectedItem] tag]] forKey:@"joystick2fire1"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire2 selectedItem] tag]] forKey:@"joystick2fire2"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire3 selectedItem] tag]] forKey:@"joystick2fire3"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire4 selectedItem] tag]] forKey:@"joystick2fire4"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire5 selectedItem] tag]] forKey:@"joystick2fire5"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire6 selectedItem] tag]] forKey:@"joystick2fire6"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire7 selectedItem] tag]] forKey:@"joystick2fire7"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire8 selectedItem] tag]] forKey:@"joystick2fire8"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire9 selectedItem] tag]] forKey:@"joystick2fire9"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyFire10 selectedItem] tag]] forKey:@"joystick2fire10"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyXAxis selectedItem] tag]] forKey:@"joy2x"]; - [currentValues setObject:[NSNumber numberWithInteger:[[joyYAxis selectedItem] tag]] forKey:@"joy2y"]; + [currentValues setObject:@([[joyFire1 selectedItem] tag]) forKey:@"joystick2fire1"]; + [currentValues setObject:@([[joyFire2 selectedItem] tag]) forKey:@"joystick2fire2"]; + [currentValues setObject:@([[joyFire3 selectedItem] tag]) forKey:@"joystick2fire3"]; + [currentValues setObject:@([[joyFire4 selectedItem] tag]) forKey:@"joystick2fire4"]; + [currentValues setObject:@([[joyFire5 selectedItem] tag]) forKey:@"joystick2fire5"]; + [currentValues setObject:@([[joyFire6 selectedItem] tag]) forKey:@"joystick2fire6"]; + [currentValues setObject:@([[joyFire7 selectedItem] tag]) forKey:@"joystick2fire7"]; + [currentValues setObject:@([[joyFire8 selectedItem] tag]) forKey:@"joystick2fire8"]; + [currentValues setObject:@([[joyFire9 selectedItem] tag]) forKey:@"joystick2fire9"]; + [currentValues setObject:@([[joyFire10 selectedItem] tag]) forKey:@"joystick2fire10"]; + [currentValues setObject:@([[joyXAxis selectedItem] tag]) forKey:@"joy2x"]; + [currentValues setObject:@([[joyYAxis selectedItem] tag]) forKey:@"joy2y"]; break; default: assert(0); @@ -241,35 +241,25 @@ [joyFire10 removeAllItems]; for( i = 0; i < key_menu_count; i++ ) { - [joyFire1 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire1 addItemWithTitle:@(key_menu[i].key)]; [[joyFire1 lastItem] setTag:key_menu[i].value]; - [joyFire2 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire2 addItemWithTitle:@(key_menu[i].key)]; [[joyFire2 lastItem] setTag:key_menu[i].value]; - [joyFire3 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire3 addItemWithTitle:@(key_menu[i].key)]; [[joyFire3 lastItem] setTag:key_menu[i].value]; - [joyFire4 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire4 addItemWithTitle:@(key_menu[i].key)]; [[joyFire4 lastItem] setTag:key_menu[i].value]; - [joyFire5 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire5 addItemWithTitle:@(key_menu[i].key)]; [[joyFire5 lastItem] setTag:key_menu[i].value]; - [joyFire6 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire6 addItemWithTitle:@(key_menu[i].key)]; [[joyFire6 lastItem] setTag:key_menu[i].value]; - [joyFire7 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire7 addItemWithTitle:@(key_menu[i].key)]; [[joyFire7 lastItem] setTag:key_menu[i].value]; - [joyFire8 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire8 addItemWithTitle:@(key_menu[i].key)]; [[joyFire8 lastItem] setTag:key_menu[i].value]; - [joyFire9 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire9 addItemWithTitle:@(key_menu[i].key)]; [[joyFire9 lastItem] setTag:key_menu[i].value]; - [joyFire10 addItemWithTitle:[NSString - stringWithUTF8String:key_menu[i].key]]; + [joyFire10 addItemWithTitle:@(key_menu[i].key)]; [[joyFire10 lastItem] setTag:key_menu[i].value]; } Modified: trunk/fuse/fusepb/controllers/LoadBinaryController.m =================================================================== --- trunk/fuse/fusepb/controllers/LoadBinaryController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/LoadBinaryController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -136,7 +136,7 @@ u_file = new_file; - [file setStringValue:[NSString stringWithUTF8String:buffer]]; + [file setStringValue:@(buffer)]; [start setIntValue:0]; [length setIntValue:new_file.length]; Modified: trunk/fuse/fusepb/controllers/MemoryBrowserController.m =================================================================== --- trunk/fuse/fusepb/controllers/MemoryBrowserController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/MemoryBrowserController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -97,11 +97,7 @@ } [tableContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - address, @"address", - data, @"data", - hex, @"hex", - nil] + @{@"address": address, @"data": data, @"hex": hex} ]; } @@ -125,7 +121,7 @@ id record, value; NSParameterAssert(row >= 0 && row < [tableContents count]); - record = [tableContents objectAtIndex:row]; + record = tableContents[row]; value = [record valueForKey:[col identifier]]; return value; } Modified: trunk/fuse/fusepb/controllers/PokeFinderController.m =================================================================== --- trunk/fuse/fusepb/controllers/PokeFinderController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/PokeFinderController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -80,7 +80,7 @@ if( row < 0 || row >= [tableContents count] ) return; - record = [tableContents objectAtIndex:row]; + record = tableContents[row]; value = [record valueForKey:@"page"]; page = [value unsignedLongValue]; value = [record valueForKey:@"offset_number"]; @@ -169,7 +169,7 @@ id record, value; if( row < 0 || row >= [tableContents count] ) return nil; - record = [tableContents objectAtIndex:row]; + record = tableContents[row]; value = [record valueForKey:[col identifier]]; return value; } @@ -185,16 +185,10 @@ for( page = 0; page < 2 * SPECTRUM_RAM_PAGES; page++ ) for( offset = 0; offset < 0x2000; offset++ ) if( !(pokefinder_impossible[page][offset/8] & 1 << (offset & 7)) ) { - NSNumber *p = [NSNumber numberWithUnsignedLong:page/2]; + NSNumber *p = @(page/2); NSString *o = [NSString stringWithFormat:@"0x%04lX", offset + 8192 * (page & 1)]; - NSNumber *on = [NSNumber numberWithUnsignedLong:offset + 8192 * (page & 1)]; - [tableContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - p, @"page", - o, @"offset", - on, @"offset_number", - nil] - ]; + NSNumber *on = @(offset + 8192 * (page & 1)); + [tableContents addObject: @{@"page": p, @"offset": o, @"offset_number": on}]; } } else { [tableContents release]; Modified: trunk/fuse/fusepb/controllers/PreferencesController.m =================================================================== --- trunk/fuse/fusepb/controllers/PreferencesController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/PreferencesController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -117,7 +117,7 @@ - (void)awakeFromNib { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSToolbarItem *item = [[toolbar items] objectAtIndex:[defaults integerForKey:@"preferencestab"]]; + NSToolbarItem *item = [toolbar items][[defaults integerForKey:@"preferencestab"]]; [toolbar setSelectedItemIdentifier:[item itemIdentifier]]; [self selectPrefPanel:item]; } @@ -190,10 +190,10 @@ switch( [sender tag] ) { case 0: /* graphic */ - [sPanel setAllowedFileTypes:[NSArray arrayWithObject:@"pbm"]]; + [sPanel setAllowedFileTypes:@[@"pbm"]]; break; case 1: /* text */ - [sPanel setAllowedFileTypes:[NSArray arrayWithObject:@"txt"]]; + [sPanel setAllowedFileTypes:@[@"txt"]]; break; } @@ -204,10 +204,10 @@ switch( [sender tag] ) { case 0: /* graphic */ - [defaults setObject:[NSString stringWithUTF8String:buffer] forKey:@"graphicsfile"]; + [defaults setObject:@(buffer) forKey:@"graphicsfile"]; break; case 1: /* text */ - [defaults setObject:[NSString stringWithUTF8String:buffer] forKey:@"textfile"]; + [defaults setObject:@(buffer) forKey:@"textfile"]; break; } @@ -246,7 +246,7 @@ char buffer[PATH_MAX+1]; int result; NSOpenPanel *oPanel = [NSOpenPanel openPanel]; - NSArray *romFileTypes = [NSArray arrayWithObjects:@"rom", @"ROM", nil]; + NSArray *romFileTypes = @[@"rom", @"ROM"]; NSString *romString; [oPanel setAllowedFileTypes:romFileTypes]; @@ -256,7 +256,7 @@ NSString *oFile = [[oPanel URL] path]; [oFile getFileSystemRepresentation:buffer maxLength:PATH_MAX]; - romString = [NSString stringWithUTF8String:buffer]; + romString = @(buffer); switch( [sender tag] ) { case 0: @@ -326,10 +326,16 @@ newMachineRoms = settings_set_rom_array( &settings_current ); for( i=0; i<[newMachineRoms count]; i++ ) { - [self replaceObjectInMachineRomsAtIndex:i withObject:[newMachineRoms objectAtIndex:i]]; + [self replaceObjectInMachineRomsAtIndex:i withObject:newMachineRoms[i]]; } } +- (void)setCurrentValue:(int)value forKey:(NSString *)key inValues:(NSUserDefaults *)currentValues +{ + BOOL val = value ? YES : NO; + [currentValues setObject:@(val) forKey:key]; +} + - (IBAction)massStorageTypeClicked:(id)sender { NSUserDefaults *currentValues = [NSUserDefaults standardUserDefaults]; @@ -379,14 +385,14 @@ break; } - [currentValues setObject:[NSNumber numberWithBool:settings_current.interface1 ? YES : NO] forKey:@"interface1"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.simpleide_active ? YES : NO] forKey:@"simpleide"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.zxatasp_active ? YES : NO] forKey:@"zxatasp"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.zxcf_active ? YES : NO] forKey:@"zxcf"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.divide_enabled ? YES : NO] forKey:@"divide"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.plusd ? YES : NO] forKey:@"plusd"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.beta128 ? YES : NO] forKey:@"beta128"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.opus ? YES : NO] forKey:@"opus"]; + [self setCurrentValue:settings_current.interface1 forKey:@"interface1" inValues:currentValues]; + [self setCurrentValue:settings_current.simpleide_active forKey:@"simpleide" inValues:currentValues]; + [self setCurrentValue:settings_current.zxatasp_active forKey:@"zxatasp" inValues:currentValues]; + [self setCurrentValue:settings_current.zxcf_active forKey:@"zxcf" inValues:currentValues]; + [self setCurrentValue:settings_current.divide_enabled forKey:@"divide" inValues:currentValues]; + [self setCurrentValue:settings_current.plusd forKey:@"plusd" inValues:currentValues]; + [self setCurrentValue:settings_current.beta128 forKey:@"beta128" inValues:currentValues]; + [self setCurrentValue:settings_current.opus forKey:@"opus" inValues:currentValues]; [currentValues synchronize]; } @@ -416,9 +422,9 @@ break; } - [currentValues setObject:[NSNumber numberWithBool:settings_current.fuller ? YES : NO] forKey:@"fuller"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.melodik ? YES : NO] forKey:@"melodik"]; - [currentValues setObject:[NSNumber numberWithBool:settings_current.specdrum ? YES : NO] forKey:@"specdrum"]; + [self setCurrentValue:settings_current.fuller forKey:@"fuller" inValues:currentValues]; + [self setCurrentValue:settings_current.melodik forKey:@"melodik" inValues:currentValues]; + [self setCurrentValue:settings_current.specdrum forKey:@"specdrum" inValues:currentValues]; [currentValues synchronize]; } @@ -477,7 +483,7 @@ [window setContentView:prefsView]; [[NSUserDefaults standardUserDefaults] - setObject:[NSNumber numberWithInteger:[item tag]] forKey:@"preferencestab"]; + setObject:@([item tag]) forKey:@"preferencestab"]; } // NSToolbar delegate method @@ -534,7 +540,7 @@ - (id)objectInMachineRomsAtIndex:(unsigned int)index { - return [machineRoms objectAtIndex:index]; + return machineRoms[index]; } - (void)insertObject:(id)anObject inMachineRomsAtIndex:(unsigned int)index @@ -549,7 +555,7 @@ - (void)replaceObjectInMachineRomsAtIndex:(unsigned int)index withObject:(id)anObject { - [machineRoms replaceObjectAtIndex:index withObject:anObject]; + machineRoms[index] = anObject; } @end Modified: trunk/fuse/fusepb/controllers/RollbackController.m =================================================================== --- trunk/fuse/fusepb/controllers/RollbackController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/RollbackController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -121,7 +121,7 @@ id record, value; NSParameterAssert(row >= 0 && row < [tableContents count]); - record = [tableContents objectAtIndex:row]; + record = tableContents[row]; value = [record valueForKey:[col identifier]]; return value; } @@ -176,9 +176,6 @@ seconds = [NSString stringWithFormat:@"%.2f", GPOINTER_TO_INT( point ) / 50.0 ]; - [tableContents addObject: - [NSDictionary dictionaryWithObjectsAndKeys: - seconds, @"seconds", - nil] + [tableContents addObject:@{@"seconds": seconds} ]; } Modified: trunk/fuse/fusepb/controllers/TapeBrowserController.m =================================================================== --- trunk/fuse/fusepb/controllers/TapeBrowserController.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/controllers/TapeBrowserController.m 2012-11-02 12:03:41 UTC (rev 702) @@ -139,14 +139,14 @@ TapeBrowserController *tapeBrowserController = (TapeBrowserController*)user_data; NSString *type, *data; char buffer[256]; - NSArray *keys = [NSArray arrayWithObjects: @"type", @"data", nil]; + NSArray *keys = @[@"type", @"data"]; NSArray *values; libspectrum_tape_block_description( buffer, 256, block ); - type = [NSString stringWithUTF8String:buffer]; + type = @(buffer); tape_block_details( buffer, 256, block ); - data = [NSString stringWithUTF8String:buffer]; - values = [NSArray arrayWithObjects: type, data, nil]; + data = @(buffer); + values = @[type, data]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToTapeContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -160,12 +160,12 @@ switch( libspectrum_tape_block_ids( block, i ) ) { case 0: - values = [NSArray arrayWithObjects: @"Title", + values = @[@"Title", [NSString stringWithCString:(const char *)libspectrum_tape_block_texts( block, i ) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 encoding:NSWindowsCP1252StringEncoding #endif - ], nil]; + ]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -179,8 +179,8 @@ encoding:NSWindowsCP1252StringEncoding #endif ]; - values = [NSArray arrayWithObjects: @"Publishers", - [[info componentsSeparatedByString:@"\n"] componentsJoinedByString:@", "], nil]; + values = @[@"Publishers", + [[info componentsSeparatedByString:@"\n"] componentsJoinedByString:@", "]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -194,8 +194,8 @@ encoding:NSWindowsCP1252StringEncoding #endif ]; - values = [NSArray arrayWithObjects: @"Authors", - [[info componentsSeparatedByString:@"\n"] componentsJoinedByString:@", "], nil]; + values = @[@"Authors", + [[info componentsSeparatedByString:@"\n"] componentsJoinedByString:@", "]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -203,14 +203,13 @@ ]; break; case 3: - values = [NSArray arrayWithObjects: @"Year", - [NSNumber numberWithInt: - [[NSString stringWithCString: + values = @[@"Year", + @([[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 encoding:NSWindowsCP1252StringEncoding #endif - ] intValue]], nil]; + ] intValue])]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -224,8 +223,8 @@ encoding:NSWindowsCP1252StringEncoding #endif ]; - values = [NSArray arrayWithObjects: @"Languages", - [[info componentsSeparatedByString:@"\n"] componentsJoinedByString:@", "], nil]; + values = @[@"Languages", + [[info componentsSeparatedByString:@"\n"] componentsJoinedByString:@", "]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -233,12 +232,12 @@ ]; break; case 5: - values = [NSArray arrayWithObjects: @"Category", + values = @[@"Category", [NSString stringWithCString:(const char *)libspectrum_tape_block_texts( block, i ) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 encoding:NSWindowsCP1252StringEncoding #endif - ], nil]; + ]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -267,7 +266,7 @@ withString:@"€" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [priceString length])]; - values = [NSArray arrayWithObjects: @"Price", priceString, nil]; + values = @[@"Price", priceString]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -276,12 +275,12 @@ } break; case 7: - values = [NSArray arrayWithObjects: @"Loader", + values = @[@"Loader", [NSString stringWithCString:(const char *)libspectrum_tape_block_texts( block, i ) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 encoding:NSWindowsCP1252StringEncoding #endif - ], nil]; + ]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -289,12 +288,12 @@ ]; break; case 8: - values = [NSArray arrayWithObjects: @"Origin", + values = @[@"Origin", [NSString stringWithCString:(const char *)libspectrum_tape_block_texts( block, i ) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 encoding:NSWindowsCP1252StringEncoding #endif - ], nil]; + ]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -302,12 +301,12 @@ ]; break; case 255: - values = [NSArray arrayWithObjects: @"Comment", + values = @[@"Comment", [NSString stringWithCString:(const char *)libspectrum_tape_block_texts( block, i ) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 encoding:NSWindowsCP1252StringEncoding #endif - ], nil]; + ]]; [tapeBrowserController performSelectorOnMainThread:@selector(addObjectToInfoContents:) withObject:[NSDictionary dictionaryWithObjects:values forKeys:keys] @@ -344,13 +343,13 @@ [tapeBrowserController performSelectorOnMainThread:@selector(setInitialising:) - withObject:[NSNumber numberWithBool:YES] + withObject:@YES waitUntilDone:NO ]; error = tape_foreach( add_block_details, tapeBrowserController ); [tapeBrowserController performSelectorOnMainThread:@selector(setInitialising:) - withObject:[NSNumber numberWithBool:NO] + withObject:@NO waitUntilDone:NO ]; if( error ) return error; @@ -362,7 +361,7 @@ if(current_block >= 0) { [tapeBrowserController performSelectorOnMainThread:@selector(setTapeIndex:) - withObject:[NSNumber numberWithUnsignedInt:current_block] + withObject:@((unsigned int)current_block) waitUntilDone:NO ]; } Modified: trunk/fuse/fusepb/models/Emulator.m =================================================================== --- trunk/fuse/fusepb/models/Emulator.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/models/Emulator.m 2012-11-02 12:03:41 UTC (rev 702) @@ -76,8 +76,8 @@ pool = [[NSAutoreleasePool alloc] init]; serverConnection = [NSConnection - connectionWithReceivePort:[portArray objectAtIndex:0] - sendPort:[portArray objectAtIndex:1]]; + connectionWithReceivePort:portArray[0] + sendPort:portArray[1]]; [serverConnection setRootObject:self]; proxy_view = (id)[serverConnection rootProxy]; [proxy_view setServer:self]; Modified: trunk/fuse/fusepb/transformers/MachineNameToIdTransformer.m =================================================================== --- trunk/fuse/fusepb/transformers/MachineNameToIdTransformer.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/transformers/MachineNameToIdTransformer.m 2012-11-02 12:03:41 UTC (rev 702) @@ -77,7 +77,7 @@ [value class]]; } - return [NSString stringWithUTF8String:machine_types[machineInputValue]->id]; + return @(machine_types[machineInputValue]->id); } @end Modified: trunk/fuse/fusepb/transformers/MachineScalerIsEnabled.m =================================================================== --- trunk/fuse/fusepb/transformers/MachineScalerIsEnabled.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/transformers/MachineScalerIsEnabled.m 2012-11-02 12:03:41 UTC (rev 702) @@ -60,10 +60,11 @@ machine_get_machine_info([[defaults stringForKey:@"machine"] UTF8String]); if( fmi ) { - return [NSNumber numberWithBool:fmi->timex == timex ? YES : NO]; + BOOL retval = fmi->timex == timex ? YES : NO; + return @(retval); } - return NO; + return @NO; } @end Modified: trunk/fuse/fusepb/transformers/ScalerNameToIdTransformer.m =================================================================== --- trunk/fuse/fusepb/transformers/ScalerNameToIdTransformer.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/transformers/ScalerNameToIdTransformer.m 2012-11-02 12:03:41 UTC (rev 702) @@ -77,7 +77,7 @@ [value class]]; } - return [NSString stringWithUTF8String:scaler_id(scalerInputValue)]; + return @(scaler_id(scalerInputValue)); } @end Modified: trunk/fuse/fusepb/transformers/VolumeSliderToPrefTransformer.m =================================================================== --- trunk/fuse/fusepb/transformers/VolumeSliderToPrefTransformer.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/transformers/VolumeSliderToPrefTransformer.m 2012-11-02 12:03:41 UTC (rev 702) @@ -55,7 +55,7 @@ [value class]]; } - return [NSNumber numberWithInt:8-volumeInputValue]; + return @(8-volumeInputValue); } - (id)reverseTransformedValue:(id)value @@ -75,7 +75,7 @@ [value class]]; } - return [NSNumber numberWithInt:8-volumeInputValue]; + return @(8-volumeInputValue); } @end Modified: trunk/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- trunk/fuse/fusepb/views/DisplayOpenGLView.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/fusepb/views/DisplayOpenGLView.m 2012-11-02 12:03:41 UTC (rev 702) @@ -248,7 +248,7 @@ [kitConnection enableMultipleThreads]; /* Ports switched here */ - portArray = [NSArray arrayWithObjects:port2, port1, nil]; + portArray = @[port2, port1]; [NSThread detachNewThreadSelector:@selector(connectWithPorts:) toTarget:real_emulator withObject:portArray]; @@ -1412,8 +1412,8 @@ -(void) windowChangedScreen:(NSNotification*)inNotification { NSWindow *window = [self window]; - CGDirectDisplayID displayID = (CGDirectDisplayID)[[[[window screen] - deviceDescription] objectForKey:@"NSScreenNumber"] intValue]; + CGDirectDisplayID displayID = (CGDirectDisplayID)[[[window screen] + deviceDescription][@"NSScreenNumber"] intValue]; if((displayID != 0) && (mainViewDisplayID != displayID)) { CVDisplayLinkSetCurrentCGDisplay(displayLink, displayID); Modified: trunk/fuse/settings.pl =================================================================== --- trunk/fuse/settings.pl 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/settings.pl 2012-11-02 12:03:41 UTC (rev 702) @@ -144,6 +144,7 @@ int settings_defaults( settings_info *settings ) { int retval; + BOOL value; NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary]; @@ -159,25 +160,26 @@ if( $type eq 'boolean' ) { print << "CODE"; - [defaultValues setObject:[NSNumber numberWithBool:settings->$name ? YES : NO] forKey:@"$options{$name}->{configfile}"]; + value = settings->$name ? YES : NO; + defaultValues[@"$options{$name}->{configfile}"] = @(value); CODE } elsif( $type eq 'string' ) { print << "CODE"; if( settings->$name ) - [defaultValues setObject:[NSString stringWithUTF8String:settings->$name] forKey:@"$options{$name}->{configfile}"]; + defaultValues[@"$options{$name}->{configfile}"] = @(settings->$name); else - [defaultValues setObject:@"" forKey:@"$options{$name}->{configfile}"]; + defaultValues[@"$options{$name}->{configfile}"] = @""; CODE } elsif( $type eq 'numeric' ) { print << "CODE"; - [defaultValues setObject:[NSNumber numberWithInt:settings->$name] forKey:@"$options{$name}->{configfile}"]; + defaultValues[@"$options{$name}->{configfile}"] = @(settings->$name); CODE } elsif( $type eq 'nsarray' ) { print << "CODE"; if( settings->cocoa && settings->cocoa->$name ) - [defaultValues setObject:settings->cocoa->$name forKey:@"$options{$name}->{configfile}"]; + defaultValues[@"$options{$name}->{configfile}"] = settings->cocoa->$name; else - [defaultValues setObject:[NSArray array] forKey:@"$options{$name}->{configfile}"]; + defaultValues[@"$options{$name}->{configfile}"] = @[]; CODE } elsif( $type eq 'nsdictionary' ) { # Do nothing @@ -284,6 +286,7 @@ settings_write_config( settings_info *settings ) { NSUserDefaults *currentValues = [NSUserDefaults standardUserDefaults]; + BOOL value; CODE @@ -293,20 +296,21 @@ if( $type eq 'boolean' ) { print << "CODE"; - [currentValues setObject:[NSNumber numberWithBool:settings->$name ? YES : NO] forKey:@"$options{$name}->{configfile}"]; + value = settings->$name ? YES : NO; + [currentValues setObject:@(value) forKey:@"$options{$name}->{configfile}"]; CODE } elsif( $type eq 'string' ) { if( !defined $fileAssoc{$name} ) { print << "CODE"; if( settings->$name ) - [currentValues setObject:[NSString stringWithUTF8String:settings->$name] forKey:@"$options{$name}->{configfile}"]; + [currentValues setObject:@(settings->$name) forKey:@"$options{$name}->{configfile}"]; else [currentValues setObject:@"" forKey:@"$options{$name}->{configfile}"]; CODE } } elsif( $type eq 'numeric' ) { print << "CODE"; - [currentValues setObject:[NSNumber numberWithInt:settings->$name] forKey:@"$options{$name}->{configfile}"]; + [currentValues setObject:@(settings->$name) forKey:@"$options{$name}->{configfile}"]; CODE } elsif( $type eq 'nsarray' ) { print << "CODE"; @@ -669,8 +673,8 @@ print " roms = [NSMutableDictionary dictionaryWithObjectsAndKeys:\n"; print ' [Machine machineForType:machine_get_type("'.$machine.'")], @"machine",'."\n"; for( my $i = 0; $i <= $#{ $machineRoms{$machine} }; $i++ ) { - print ' [NSString stringWithUTF8String:settings->rom_'.$machine."_".$i.'], @"rom'.$i."\",\n"; - print ' [NSString stringWithUTF8String:settings_default.rom_'.$machine."_".$i.'], @"default_rom'.$i."\",\n"; + print ' @(settings->rom_'.$machine."_".$i.'), @"rom'.$i."\",\n"; + print ' @(settings_default.rom_'.$machine."_".$i.'), @"default_rom'.$i."\",\n"; } print " NULL];\n"; print " [machineroms addObject:roms];\n"; Modified: trunk/fuse/ui/cocoa/cocoaerror.m =================================================================== --- trunk/fuse/ui/cocoa/cocoaerror.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/ui/cocoa/cocoaerror.m 2012-11-02 12:03:41 UTC (rev 702) @@ -42,7 +42,7 @@ int aqua_verror( ui_error_level severity, const char *message ) { - NSString *alertString = [NSString stringWithUTF8String:message]; + NSString *alertString = @(message); switch( severity ) { case UI_ERROR_INFO: Modified: trunk/fuse/ui/cocoa/cocoascreenshot.m =================================================================== --- trunk/fuse/ui/cocoa/cocoascreenshot.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/ui/cocoa/cocoascreenshot.m 2012-11-02 12:03:41 UTC (rev 702) @@ -156,7 +156,7 @@ if( error ) goto freePool; NSData *data = [ bits representationUsingType:type properties:nil ]; - [ data writeToFile:[NSString stringWithUTF8String:filename] atomically:NO ]; + [ data writeToFile:@(filename) atomically:NO ]; freePool: Modified: trunk/fuse/ui/cocoa/cocoaui.m =================================================================== --- trunk/fuse/ui/cocoa/cocoaui.m 2012-11-02 10:27:50 UTC (rev 701) +++ trunk/fuse/ui/cocoa/cocoaui.m 2012-11-02 12:03:41 UTC (rev 702) @@ -112,15 +112,13 @@ ui_confirm_save_t ui_confirm_save_specific( const char *message ) { - return [[Emulator instance] - confirmSave:[NSString stringWithUTF8String:message]]; + return [[Emulator instance] confirmSave:@(message)]; } int ui_query( const char *message ) { - return [[Emulator instance] - confirm:[NSString stringWithUTF8String:message]]; + return [[Emulator instance] confirm:@(message)]; } int This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |