@@ -140,7 +140,7 @@ static int wait_for_stdin(void)
140
140
NSEvent * event;
141
141
while (true ) {
142
142
while (true ) {
143
- event = [NSApp nextEventMatchingMask: NSAnyEventMask
143
+ event = [NSApp nextEventMatchingMask: NSEventMaskAny
144
144
untilDate: [NSDate distantPast ]
145
145
inMode: NSDefaultRunLoopMode
146
146
dequeue: YES ];
@@ -486,11 +486,11 @@ static CGFloat _get_device_scale(CGContextRef cr)
486
486
(timeout > 0.0 ) ? [NSDate dateWithTimeIntervalSinceNow: timeout]
487
487
: [NSDate distantFuture ];
488
488
while (true )
489
- { NSEvent * event = [NSApp nextEventMatchingMask: NSAnyEventMask
489
+ { NSEvent * event = [NSApp nextEventMatchingMask: NSEventMaskAny
490
490
untilDate: date
491
491
inMode: NSDefaultRunLoopMode
492
492
dequeue: YES ];
493
- if (!event || [event type ]==NSApplicationDefined ) break ;
493
+ if (!event || [event type ]==NSEventTypeApplicationDefined ) break ;
494
494
[NSApp sendEvent: event];
495
495
}
496
496
@@ -506,7 +506,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
506
506
static PyObject*
507
507
FigureCanvas_stop_event_loop (FigureCanvas* self)
508
508
{
509
- NSEvent * event = [NSEvent otherEventWithType: NSApplicationDefined
509
+ NSEvent * event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
510
510
location: NSZeroPoint
511
511
modifierFlags: 0
512
512
timestamp: 0.0
@@ -666,10 +666,10 @@ static CGFloat _get_device_scale(CGContextRef cr)
666
666
rect.size .width = width;
667
667
668
668
self->window = [self ->window initWithContentRect: rect
669
- styleMask: NSTitledWindowMask
670
- | NSClosableWindowMask
671
- | NSResizableWindowMask
672
- | NSMiniaturizableWindowMask
669
+ styleMask: NSWindowStyleMaskTitled
670
+ | NSWindowStyleMaskClosable
671
+ | NSWindowStyleMaskResizable
672
+ | NSWindowStyleMaskMiniaturizable
673
673
backing: NSBackingStoreBuffered
674
674
defer: YES
675
675
withManager: (PyObject*)self ];
@@ -1132,13 +1132,13 @@ -(void)save_figure:(id)sender
1132
1132
@selector (zoom: ),
1133
1133
@selector (configure_subplots: ),
1134
1134
@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 };
1142
1142
1143
1143
rect.origin .x = 0 ;
1144
1144
rect.origin .y = 0 ;
@@ -1164,7 +1164,7 @@ -(void)save_figure:(id)sender
1164
1164
NSImage * image = [[NSImage alloc ] initWithContentsOfFile: filename];
1165
1165
buttons[i] = [[NSButton alloc ] initWithFrame: rect];
1166
1166
[image setSize: size];
1167
- [buttons[i] setBezelStyle: NSShadowlessSquareBezelStyle ];
1167
+ [buttons[i] setBezelStyle: NSBezelStyleShadowlessSquare ];
1168
1168
[buttons[i] setButtonType: buttontypes[i]];
1169
1169
[buttons[i] setImage: image];
1170
1170
[buttons[i] scaleUnitSquareToSize: scale];
@@ -1494,10 +1494,10 @@ @implementation ToolWindow
1494
1494
- (ToolWindow*)initWithContentRect : (NSRect )rect master : (NSWindow *)window
1495
1495
{
1496
1496
[self initWithContentRect: rect
1497
- styleMask: NSTitledWindowMask
1498
- | NSClosableWindowMask
1499
- | NSResizableWindowMask
1500
- | NSMiniaturizableWindowMask
1497
+ styleMask: NSWindowStyleMaskTitled
1498
+ | NSWindowStyleMaskClosable
1499
+ | NSWindowStyleMaskResizable
1500
+ | NSWindowStyleMaskMiniaturizable
1501
1501
backing: NSBackingStoreBuffered
1502
1502
defer: YES ];
1503
1503
[self setTitle: @" Subplot Configuration Tool" ];
@@ -1624,7 +1624,7 @@ -(void)drawRect:(NSRect)rect
1624
1624
1625
1625
PyGILState_STATE gstate = PyGILState_Ensure ();
1626
1626
1627
- CGContextRef cr = [[NSGraphicsContext currentContext ] graphicsPort ];
1627
+ CGContextRef cr = [[NSGraphicsContext currentContext ] CGContext ];
1628
1628
1629
1629
double new_device_scale = _get_device_scale (cr);
1630
1630
@@ -1694,7 +1694,7 @@ - (void)windowWillClose:(NSNotification*)notification
1694
1694
- (BOOL )windowShouldClose : (NSNotification *)notification
1695
1695
{
1696
1696
NSWindow * window = [self window ];
1697
- NSEvent * event = [NSEvent otherEventWithType: NSApplicationDefined
1697
+ NSEvent * event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
1698
1698
location: NSZeroPoint
1699
1699
modifierFlags: 0
1700
1700
timestamp: 0.0
@@ -1760,12 +1760,12 @@ - (void)mouseDown:(NSEvent *)event
1760
1760
x = location.x * device_scale;
1761
1761
y = location.y * device_scale;
1762
1762
switch ([event type ])
1763
- { case NSLeftMouseDown :
1763
+ { case NSEventTypeLeftMouseDown :
1764
1764
{ unsigned int modifier = [event modifierFlags ];
1765
- if (modifier & NSControlKeyMask )
1765
+ if (modifier & NSEventModifierFlagControl )
1766
1766
/* emulate a right-button click */
1767
1767
num = 3 ;
1768
- else if (modifier & NSAlternateKeyMask )
1768
+ else if (modifier & NSEventModifierFlagOption )
1769
1769
/* emulate a middle-button click */
1770
1770
num = 2 ;
1771
1771
else
@@ -1776,8 +1776,8 @@ - (void)mouseDown:(NSEvent *)event
1776
1776
}
1777
1777
break ;
1778
1778
}
1779
- case NSOtherMouseDown : num = 2 ; break ;
1780
- case NSRightMouseDown : num = 3 ; break ;
1779
+ case NSEventTypeOtherMouseDown : num = 2 ; break ;
1780
+ case NSEventTypeRightMouseDown : num = 3 ; break ;
1781
1781
default : return ; /* Unknown mouse event */
1782
1782
}
1783
1783
if ([event clickCount ] == 2 ) {
@@ -1804,13 +1804,13 @@ - (void)mouseUp:(NSEvent *)event
1804
1804
x = location.x * device_scale;
1805
1805
y = location.y * device_scale;
1806
1806
switch ([event type ])
1807
- { case NSLeftMouseUp :
1807
+ { case NSEventTypeLeftMouseUp :
1808
1808
num = 1 ;
1809
1809
if ([NSCursor currentCursor ]==[NSCursor closedHandCursor ])
1810
1810
[[NSCursor openHandCursor ] set ];
1811
1811
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 ;
1814
1814
default : return ; /* Unknown mouse event */
1815
1815
}
1816
1816
gstate = PyGILState_Ensure ();
@@ -2039,17 +2039,17 @@ - (const char*)convertKeyEvent:(NSEvent*)event
2039
2039
];
2040
2040
2041
2041
NSMutableString * returnkey = [NSMutableString string ];
2042
- if ([event modifierFlags ] & NSControlKeyMask )
2042
+ if ([event modifierFlags ] & NSEventModifierFlagControl )
2043
2043
[returnkey appendString: @" ctrl+" ];
2044
- if ([event modifierFlags ] & NSAlternateKeyMask )
2044
+ if ([event modifierFlags ] & NSEventModifierFlagOption )
2045
2045
[returnkey appendString: @" alt+" ];
2046
- if ([event modifierFlags ] & NSCommandKeyMask )
2046
+ if ([event modifierFlags ] & NSEventModifierFlagCommand )
2047
2047
[returnkey appendString: @" cmd+" ];
2048
2048
2049
2049
unichar uc = [[event charactersIgnoringModifiers ] characterAtIndex: 0 ];
2050
2050
NSString * specialchar = [specialkeymappings objectForKey: [NSNumber numberWithUnsignedLong: uc]];
2051
2051
if (specialchar){
2052
- if ([event modifierFlags ] & NSShiftKeyMask )
2052
+ if ([event modifierFlags ] & NSEventModifierFlagShift )
2053
2053
[returnkey appendString: @" shift+" ];
2054
2054
[returnkey appendString: specialchar];
2055
2055
}
0 commit comments