comparison mac/dw.m @ 1770:2396655d43f1

Fix some warnings with Mac 10.8 and Xcode 4.5. The Carbon Gestalt() function is now deprecated, switched to NSProcessInfo. Fix some format mismatches... NSPointerArray pointerArrayWithWeakObjects is also deprecated but I am not sure what to replace it with yet.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 12 Jul 2012 20:29:12 +0000
parents d81bebc5c8cc
children bed4320cb0ce
comparison
equal deleted inserted replaced
1769:d81bebc5c8cc 1770:2396655d43f1
124 #if !defined(GARBAGE_COLLECT) 124 #if !defined(GARBAGE_COLLECT)
125 pthread_key_t _dw_pool_key; 125 pthread_key_t _dw_pool_key;
126 #endif 126 #endif
127 pthread_key_t _dw_fg_color_key; 127 pthread_key_t _dw_fg_color_key;
128 pthread_key_t _dw_bg_color_key; 128 pthread_key_t _dw_bg_color_key;
129 SInt32 DWOSMajor, DWOSMinor, DWOSBuild; 129 int DWOSMajor, DWOSMinor, DWOSBuild;
130 static char _dw_bundle_path[PATH_MAX+1] = { 0 }; 130 static char _dw_bundle_path[PATH_MAX+1] = { 0 };
131 131
132 /* Create a default colors for a thread */ 132 /* Create a default colors for a thread */
133 void _init_colors(void) 133 void _init_colors(void)
134 { 134 {
4202 */ 4202 */
4203 HWND API dw_bitmapbutton_new(char *text, ULONG resid) 4203 HWND API dw_bitmapbutton_new(char *text, ULONG resid)
4204 { 4204 {
4205 NSBundle *bundle = [NSBundle mainBundle]; 4205 NSBundle *bundle = [NSBundle mainBundle];
4206 NSString *respath = [bundle resourcePath]; 4206 NSString *respath = [bundle resourcePath];
4207 NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; 4207 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid];
4208 NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath]; 4208 NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
4209 DWButton *button = _button_new("", resid); 4209 DWButton *button = _button_new("", resid);
4210 if(image) 4210 if(image)
4211 { 4211 {
4212 [button setImage:image]; 4212 [button setImage:image];
6883 /* Internal version that does not resize the image */ 6883 /* Internal version that does not resize the image */
6884 HICN _dw_icon_load(unsigned long resid) 6884 HICN _dw_icon_load(unsigned long resid)
6885 { 6885 {
6886 NSBundle *bundle = [NSBundle mainBundle]; 6886 NSBundle *bundle = [NSBundle mainBundle];
6887 NSString *respath = [bundle resourcePath]; 6887 NSString *respath = [bundle resourcePath];
6888 NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; 6888 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid];
6889 NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath]; 6889 NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
6890 return image; 6890 return image;
6891 } 6891 }
6892 6892
6893 /* 6893 /*
7305 return NULL; 7305 return NULL;
7306 } 7306 }
7307 7307
7308 NSBundle *bundle = [NSBundle mainBundle]; 7308 NSBundle *bundle = [NSBundle mainBundle];
7309 NSString *respath = [bundle resourcePath]; 7309 NSString *respath = [bundle resourcePath];
7310 NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; 7310 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid];
7311 NSImage *temp = [[NSImage alloc] initWithContentsOfFile:filepath]; 7311 NSImage *temp = [[NSImage alloc] initWithContentsOfFile:filepath];
7312 7312
7313 if(temp) 7313 if(temp)
7314 { 7314 {
7315 NSSize size = [temp size]; 7315 NSSize size = [temp size];
10501 /* Just in case we can't obtain a path */ 10501 /* Just in case we can't obtain a path */
10502 if(!_dw_bundle_path[0]) 10502 if(!_dw_bundle_path[0])
10503 getcwd(_dw_bundle_path, PATH_MAX); 10503 getcwd(_dw_bundle_path, PATH_MAX);
10504 10504
10505 /* Get the operating system version */ 10505 /* Get the operating system version */
10506 Gestalt(gestaltSystemVersionMajor, &DWOSMajor); 10506 NSString *version = [[NSProcessInfo processInfo] operatingSystemVersionString];
10507 Gestalt(gestaltSystemVersionMinor, &DWOSMinor); 10507 const char *versionstr = [version UTF8String];
10508 Gestalt(gestaltSystemVersionBugFix, &DWOSBuild); 10508 sscanf(versionstr, "Version %d.%d.%d", &DWOSMajor, &DWOSMinor, &DWOSBuild);
10509 /* Create the application object */ 10509 /* Create the application object */
10510 DWApp = [NSApplication sharedApplication]; 10510 DWApp = [NSApplication sharedApplication];
10511 /* Create object for handling timers */ 10511 /* Create object for handling timers */
10512 DWHandler = [[DWTimerHandler alloc] init]; 10512 DWHandler = [[DWTimerHandler alloc] init];
10513 /* If we aren't using garbage collection we need autorelease pools */ 10513 /* If we aren't using garbage collection we need autorelease pools */