changeset 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 6923871d0048
children b94b4ad26a05
files mac/dw.m
diffstat 1 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Wed Mar 26 15:10:50 2014 +0000
+++ b/mac/dw.m	Tue Sep 30 18:39:03 2014 +0000
@@ -3387,7 +3387,14 @@
     }
 
     va_start(args, format);
-    alert = [NSAlert alertWithMessageText:[ NSString stringWithUTF8String:title ] defaultButton:button1 alternateButton:button2 otherButton:button3 informativeTextWithFormat:@"%@", [[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args] autorelease]];
+    alert = [[NSAlert alloc] init];
+    [alert setMessageText:[NSString stringWithUTF8String:title]];
+    [alert setInformativeText:[[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args] autorelease]];
+    [alert addButtonWithTitle:button1];
+    if(button2)
+        [alert addButtonWithTitle:button2];
+    if(button3)
+        [alert addButtonWithTitle:button3];
     va_end(args);
     
     if(flags & DW_MB_ERROR)
@@ -3401,22 +3408,20 @@
     
     switch(iResponse)
     {
-        case NSAlertDefaultReturn:    /* user pressed OK */
+        case NSAlertFirstButtonReturn:    /* user pressed OK */
             if(flags & DW_MB_YESNO || flags & DW_MB_YESNOCANCEL)
             {
                 return DW_MB_RETURN_YES;
             }
             return DW_MB_RETURN_OK;
-        case NSAlertAlternateReturn:  /* user pressed Cancel */
+        case NSAlertSecondButtonReturn:  /* user pressed Cancel */
             if(flags & DW_MB_OKCANCEL)
             {
                 return DW_MB_RETURN_CANCEL;
             }
             return DW_MB_RETURN_NO;
-        case NSAlertOtherReturn:      /* user pressed the third button */
+        case NSAlertThirdButtonReturn:      /* user pressed the third button */
             return DW_MB_RETURN_CANCEL;
-        case NSAlertErrorReturn:      /* an error occurred */
-            break;
     }
     return 0;
 }
@@ -7504,7 +7509,7 @@
     DW_MUTEX_LOCK;
     NSImageView *bitmap = [[NSImageView alloc] init];
     [bitmap setImageFrameStyle:NSImageFrameNone];
-    [bitmap setImageScaling:NSScaleNone];
+    [bitmap setImageScaling:NSImageScaleNone];
     [bitmap setEditable:NO];
     [bitmap setTag:cid];
     DW_MUTEX_UNLOCK;
@@ -7901,9 +7906,12 @@
     char buffer[101];
     DW_LOCAL_POOL_IN;
 
-    snprintf(buffer, 100, "%04d-%02d-%02d 00:00:00 +0600", year, month, day);
-
-    date = [[NSDate alloc] initWithString:[ NSString stringWithUTF8String:buffer ]];
+    snprintf(buffer, 100, "%04d-%02d-%02d", year, month, day);
+    
+    NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
+    dateFormatter.dateFormat = @"yy-mm-dd";
+    
+    date = [dateFormatter dateFromString:[NSString stringWithUTF8String:buffer]];
     [calendar setDateValue:date];
     [date release];
     DW_LOCAL_POOL_OUT;
@@ -11327,7 +11335,7 @@
     [pi setHorizontallyCentered:YES];
     [pi setVerticalPagination:NSFitPagination];
     [pi setVerticallyCentered:YES];
-    [pi setOrientation:NSPortraitOrientation];
+    [pi setOrientation:NSPaperOrientationPortrait];
     [pi setLeftMargin:0.0];
     [pi setRightMargin:0.0];
     [pi setTopMargin:0.0];
@@ -11410,7 +11418,7 @@
     [image addRepresentation:rep];
     [flipped addRepresentation:rep2];
     [iv setImage:flipped];
-    [iv setImageScaling:NSScaleProportionally];
+    [iv setImageScaling:NSImageScaleProportionallyDown];
     [iv setFrameOrigin:NSMakePoint(0,0)];
     [iv setFrameSize:size];