comparison mac/dw.m @ 1902:74f50459c530

Fix some deprecations introduced in Mac OS X Yosemite 10.10... More fixes to come, however some replacements are only available in 10.7 and later, but we target 10.6 for Intel and 10.5 for PPC.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 30 Sep 2014 18:39:03 +0000
parents 8637a32d33d9
children b94b4ad26a05
comparison
equal deleted inserted replaced
1901:6923871d0048 1902:74f50459c530
3385 button2 = @"No"; 3385 button2 = @"No";
3386 button3 = @"Cancel"; 3386 button3 = @"Cancel";
3387 } 3387 }
3388 3388
3389 va_start(args, format); 3389 va_start(args, format);
3390 alert = [NSAlert alertWithMessageText:[ NSString stringWithUTF8String:title ] defaultButton:button1 alternateButton:button2 otherButton:button3 informativeTextWithFormat:@"%@", [[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args] autorelease]]; 3390 alert = [[NSAlert alloc] init];
3391 [alert setMessageText:[NSString stringWithUTF8String:title]];
3392 [alert setInformativeText:[[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args] autorelease]];
3393 [alert addButtonWithTitle:button1];
3394 if(button2)
3395 [alert addButtonWithTitle:button2];
3396 if(button3)
3397 [alert addButtonWithTitle:button3];
3391 va_end(args); 3398 va_end(args);
3392 3399
3393 if(flags & DW_MB_ERROR) 3400 if(flags & DW_MB_ERROR)
3394 [alert setAlertStyle:NSCriticalAlertStyle]; 3401 [alert setAlertStyle:NSCriticalAlertStyle];
3395 else if(flags & DW_MB_INFORMATION) 3402 else if(flags & DW_MB_INFORMATION)
3399 3406
3400 iResponse = [alert runModal]; 3407 iResponse = [alert runModal];
3401 3408
3402 switch(iResponse) 3409 switch(iResponse)
3403 { 3410 {
3404 case NSAlertDefaultReturn: /* user pressed OK */ 3411 case NSAlertFirstButtonReturn: /* user pressed OK */
3405 if(flags & DW_MB_YESNO || flags & DW_MB_YESNOCANCEL) 3412 if(flags & DW_MB_YESNO || flags & DW_MB_YESNOCANCEL)
3406 { 3413 {
3407 return DW_MB_RETURN_YES; 3414 return DW_MB_RETURN_YES;
3408 } 3415 }
3409 return DW_MB_RETURN_OK; 3416 return DW_MB_RETURN_OK;
3410 case NSAlertAlternateReturn: /* user pressed Cancel */ 3417 case NSAlertSecondButtonReturn: /* user pressed Cancel */
3411 if(flags & DW_MB_OKCANCEL) 3418 if(flags & DW_MB_OKCANCEL)
3412 { 3419 {
3413 return DW_MB_RETURN_CANCEL; 3420 return DW_MB_RETURN_CANCEL;
3414 } 3421 }
3415 return DW_MB_RETURN_NO; 3422 return DW_MB_RETURN_NO;
3416 case NSAlertOtherReturn: /* user pressed the third button */ 3423 case NSAlertThirdButtonReturn: /* user pressed the third button */
3417 return DW_MB_RETURN_CANCEL; 3424 return DW_MB_RETURN_CANCEL;
3418 case NSAlertErrorReturn: /* an error occurred */
3419 break;
3420 } 3425 }
3421 return 0; 3426 return 0;
3422 } 3427 }
3423 3428
3424 /* 3429 /*
7502 { 7507 {
7503 int _locked_by_me = FALSE; 7508 int _locked_by_me = FALSE;
7504 DW_MUTEX_LOCK; 7509 DW_MUTEX_LOCK;
7505 NSImageView *bitmap = [[NSImageView alloc] init]; 7510 NSImageView *bitmap = [[NSImageView alloc] init];
7506 [bitmap setImageFrameStyle:NSImageFrameNone]; 7511 [bitmap setImageFrameStyle:NSImageFrameNone];
7507 [bitmap setImageScaling:NSScaleNone]; 7512 [bitmap setImageScaling:NSImageScaleNone];
7508 [bitmap setEditable:NO]; 7513 [bitmap setEditable:NO];
7509 [bitmap setTag:cid]; 7514 [bitmap setTag:cid];
7510 DW_MUTEX_UNLOCK; 7515 DW_MUTEX_UNLOCK;
7511 return bitmap; 7516 return bitmap;
7512 } 7517 }
7899 DWCalendar *calendar = handle; 7904 DWCalendar *calendar = handle;
7900 NSDate *date; 7905 NSDate *date;
7901 char buffer[101]; 7906 char buffer[101];
7902 DW_LOCAL_POOL_IN; 7907 DW_LOCAL_POOL_IN;
7903 7908
7904 snprintf(buffer, 100, "%04d-%02d-%02d 00:00:00 +0600", year, month, day); 7909 snprintf(buffer, 100, "%04d-%02d-%02d", year, month, day);
7905 7910
7906 date = [[NSDate alloc] initWithString:[ NSString stringWithUTF8String:buffer ]]; 7911 NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
7912 dateFormatter.dateFormat = @"yy-mm-dd";
7913
7914 date = [dateFormatter dateFromString:[NSString stringWithUTF8String:buffer]];
7907 [calendar setDateValue:date]; 7915 [calendar setDateValue:date];
7908 [date release]; 7916 [date release];
7909 DW_LOCAL_POOL_OUT; 7917 DW_LOCAL_POOL_OUT;
7910 } 7918 }
7911 7919
11325 pi = [NSPrintInfo sharedPrintInfo]; 11333 pi = [NSPrintInfo sharedPrintInfo];
11326 [pi setHorizontalPagination:NSFitPagination]; 11334 [pi setHorizontalPagination:NSFitPagination];
11327 [pi setHorizontallyCentered:YES]; 11335 [pi setHorizontallyCentered:YES];
11328 [pi setVerticalPagination:NSFitPagination]; 11336 [pi setVerticalPagination:NSFitPagination];
11329 [pi setVerticallyCentered:YES]; 11337 [pi setVerticallyCentered:YES];
11330 [pi setOrientation:NSPortraitOrientation]; 11338 [pi setOrientation:NSPaperOrientationPortrait];
11331 [pi setLeftMargin:0.0]; 11339 [pi setLeftMargin:0.0];
11332 [pi setRightMargin:0.0]; 11340 [pi setRightMargin:0.0];
11333 [pi setTopMargin:0.0]; 11341 [pi setTopMargin:0.0];
11334 [pi setBottomMargin:0.0]; 11342 [pi setBottomMargin:0.0];
11335 11343
11408 image = [[NSImage alloc] initWithSize:[rep size]]; 11416 image = [[NSImage alloc] initWithSize:[rep size]];
11409 flipped = [[NSImage alloc] initWithSize:[rep size]]; 11417 flipped = [[NSImage alloc] initWithSize:[rep size]];
11410 [image addRepresentation:rep]; 11418 [image addRepresentation:rep];
11411 [flipped addRepresentation:rep2]; 11419 [flipped addRepresentation:rep2];
11412 [iv setImage:flipped]; 11420 [iv setImage:flipped];
11413 [iv setImageScaling:NSScaleProportionally]; 11421 [iv setImageScaling:NSImageScaleProportionallyDown];
11414 [iv setFrameOrigin:NSMakePoint(0,0)]; 11422 [iv setFrameOrigin:NSMakePoint(0,0)];
11415 [iv setFrameSize:size]; 11423 [iv setFrameSize:size];
11416 11424
11417 /* Create the print operation using the image view and 11425 /* Create the print operation using the image view and
11418 * print info obtained from the panel in the last call. 11426 * print info obtained from the panel in the last call.