@@ -140,7 +140,7 @@ static int wait_for_stdin(void)
140140 NSEvent * event;
141141 while (true ) {
142142 while (true ) {
143- event = [NSApp nextEventMatchingMask: NSAnyEventMask
143+ event = [NSApp nextEventMatchingMask: NSEventMaskAny
144144 untilDate: [NSDate distantPast ]
145145 inMode: NSDefaultRunLoopMode
146146 dequeue: YES ];
@@ -486,11 +486,11 @@ static CGFloat _get_device_scale(CGContextRef cr)
486486 (timeout > 0.0 ) ? [NSDate dateWithTimeIntervalSinceNow: timeout]
487487 : [NSDate distantFuture ];
488488 while (true )
489- { NSEvent * event = [NSApp nextEventMatchingMask: NSAnyEventMask
489+ { NSEvent * event = [NSApp nextEventMatchingMask: NSEventMaskAny
490490 untilDate: date
491491 inMode: NSDefaultRunLoopMode
492492 dequeue: YES ];
493- if (!event || [event type ]==NSApplicationDefined ) break ;
493+ if (!event || [event type ]==NSEventTypeApplicationDefined ) break ;
494494 [NSApp sendEvent: event];
495495 }
496496
@@ -506,7 +506,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
506506static PyObject*
507507FigureCanvas_stop_event_loop (FigureCanvas* self)
508508{
509- NSEvent * event = [NSEvent otherEventWithType: NSApplicationDefined
509+ NSEvent * event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
510510 location: NSZeroPoint
511511 modifierFlags: 0
512512 timestamp: 0.0
@@ -666,10 +666,10 @@ static CGFloat _get_device_scale(CGContextRef cr)
666666 rect.size .width = width;
667667
668668 self->window = [self ->window initWithContentRect: rect
669- styleMask: NSTitledWindowMask
670- | NSClosableWindowMask
671- | NSResizableWindowMask
672- | NSMiniaturizableWindowMask
669+ styleMask: NSWindowStyleMaskTitled
670+ | NSWindowStyleMaskClosable
671+ | NSWindowStyleMaskResizable
672+ | NSWindowStyleMaskMiniaturizable
673673 backing: NSBackingStoreBuffered
674674 defer: YES
675675 withManager: (PyObject*)self ];
@@ -1132,13 +1132,13 @@ -(void)save_figure:(id)sender
11321132 @selector (zoom: ),
11331133 @selector (configure_subplots: ),
11341134 @selector (save_figure: )};
1135- NSButtonType buttontypes[7 ] = {NSMomentaryLightButton ,
1136- NSMomentaryLightButton ,
1137- NSMomentaryLightButton ,
1138- NSPushOnPushOffButton ,
1139- NSPushOnPushOffButton ,
1140- NSMomentaryLightButton ,
1141- NSMomentaryLightButton };
1135+ NSButtonType buttontypes[7 ] = {NSButtonTypeMomentaryLight ,
1136+ NSButtonTypeMomentaryLight ,
1137+ NSButtonTypeMomentaryLight ,
1138+ NSButtonTypePushOnPushOff ,
1139+ NSButtonTypePushOnPushOff ,
1140+ NSButtonTypeMomentaryLight ,
1141+ NSButtonTypeMomentaryLight };
11421142
11431143 rect.origin .x = 0 ;
11441144 rect.origin .y = 0 ;
@@ -1164,7 +1164,7 @@ -(void)save_figure:(id)sender
11641164 NSImage * image = [[NSImage alloc ] initWithContentsOfFile: filename];
11651165 buttons[i] = [[NSButton alloc ] initWithFrame: rect];
11661166 [image setSize: size];
1167- [buttons[i] setBezelStyle: NSShadowlessSquareBezelStyle ];
1167+ [buttons[i] setBezelStyle: NSBezelStyleShadowlessSquare ];
11681168 [buttons[i] setButtonType: buttontypes[i]];
11691169 [buttons[i] setImage: image];
11701170 [buttons[i] scaleUnitSquareToSize: scale];
@@ -1494,10 +1494,10 @@ @implementation ToolWindow
14941494- (ToolWindow*)initWithContentRect : (NSRect )rect master : (NSWindow *)window
14951495{
14961496 [self initWithContentRect: rect
1497- styleMask: NSTitledWindowMask
1498- | NSClosableWindowMask
1499- | NSResizableWindowMask
1500- | NSMiniaturizableWindowMask
1497+ styleMask: NSWindowStyleMaskTitled
1498+ | NSWindowStyleMaskClosable
1499+ | NSWindowStyleMaskResizable
1500+ | NSWindowStyleMaskMiniaturizable
15011501 backing: NSBackingStoreBuffered
15021502 defer: YES ];
15031503 [self setTitle: @" Subplot Configuration Tool" ];
@@ -1624,7 +1624,7 @@ -(void)drawRect:(NSRect)rect
16241624
16251625 PyGILState_STATE gstate = PyGILState_Ensure ();
16261626
1627- CGContextRef cr = [[NSGraphicsContext currentContext ] graphicsPort ];
1627+ CGContextRef cr = [[NSGraphicsContext currentContext ] CGContext ];
16281628
16291629 double new_device_scale = _get_device_scale (cr);
16301630
@@ -1694,7 +1694,7 @@ - (void)windowWillClose:(NSNotification*)notification
16941694- (BOOL )windowShouldClose : (NSNotification *)notification
16951695{
16961696 NSWindow * window = [self window ];
1697- NSEvent * event = [NSEvent otherEventWithType: NSApplicationDefined
1697+ NSEvent * event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
16981698 location: NSZeroPoint
16991699 modifierFlags: 0
17001700 timestamp: 0.0
@@ -1760,12 +1760,12 @@ - (void)mouseDown:(NSEvent *)event
17601760 x = location.x * device_scale;
17611761 y = location.y * device_scale;
17621762 switch ([event type ])
1763- { case NSLeftMouseDown :
1763+ { case NSEventTypeLeftMouseDown :
17641764 { unsigned int modifier = [event modifierFlags ];
1765- if (modifier & NSControlKeyMask )
1765+ if (modifier & NSEventModifierFlagControl )
17661766 /* emulate a right-button click */
17671767 num = 3 ;
1768- else if (modifier & NSAlternateKeyMask )
1768+ else if (modifier & NSEventModifierFlagOption )
17691769 /* emulate a middle-button click */
17701770 num = 2 ;
17711771 else
@@ -1776,8 +1776,8 @@ - (void)mouseDown:(NSEvent *)event
17761776 }
17771777 break ;
17781778 }
1779- case NSOtherMouseDown : num = 2 ; break ;
1780- case NSRightMouseDown : num = 3 ; break ;
1779+ case NSEventTypeOtherMouseDown : num = 2 ; break ;
1780+ case NSEventTypeRightMouseDown : num = 3 ; break ;
17811781 default : return ; /* Unknown mouse event */
17821782 }
17831783 if ([event clickCount ] == 2 ) {
@@ -1804,13 +1804,13 @@ - (void)mouseUp:(NSEvent *)event
18041804 x = location.x * device_scale;
18051805 y = location.y * device_scale;
18061806 switch ([event type ])
1807- { case NSLeftMouseUp :
1807+ { case NSEventTypeLeftMouseUp :
18081808 num = 1 ;
18091809 if ([NSCursor currentCursor ]==[NSCursor closedHandCursor ])
18101810 [[NSCursor openHandCursor ] set ];
18111811 break ;
1812- case NSOtherMouseUp : num = 2 ; break ;
1813- case NSRightMouseUp : num = 3 ; break ;
1812+ case NSEventTypeOtherMouseUp : num = 2 ; break ;
1813+ case NSEventTypeRightMouseUp : num = 3 ; break ;
18141814 default : return ; /* Unknown mouse event */
18151815 }
18161816 gstate = PyGILState_Ensure ();
@@ -2039,17 +2039,17 @@ - (const char*)convertKeyEvent:(NSEvent*)event
20392039 ];
20402040
20412041 NSMutableString * returnkey = [NSMutableString string ];
2042- if ([event modifierFlags ] & NSControlKeyMask )
2042+ if ([event modifierFlags ] & NSEventModifierFlagControl )
20432043 [returnkey appendString: @" ctrl+" ];
2044- if ([event modifierFlags ] & NSAlternateKeyMask )
2044+ if ([event modifierFlags ] & NSEventModifierFlagOption )
20452045 [returnkey appendString: @" alt+" ];
2046- if ([event modifierFlags ] & NSCommandKeyMask )
2046+ if ([event modifierFlags ] & NSEventModifierFlagCommand )
20472047 [returnkey appendString: @" cmd+" ];
20482048
20492049 unichar uc = [[event charactersIgnoringModifiers ] characterAtIndex: 0 ];
20502050 NSString * specialchar = [specialkeymappings objectForKey: [NSNumber numberWithUnsignedLong: uc]];
20512051 if (specialchar){
2052- if ([event modifierFlags ] & NSShiftKeyMask )
2052+ if ([event modifierFlags ] & NSEventModifierFlagShift )
20532053 [returnkey appendString: @" shift+" ];
20542054 [returnkey appendString: specialchar];
20552055 }
0 commit comments