Vuo 2.4.4
Loading...
Searching...
No Matches
VuoEditorCocoa.mm
Go to the documentation of this file.
1
10#include "VuoEditorCocoa.hh"
11
12#include "VuoEditor.hh"
13
15#include <AppKit/AppKit.h>
16#include <Carbon/Carbon.h>
17
23{
24 VuoEditor *editor = (VuoEditor *)qApp;
25
26 [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent *event) {
27 // Cmd+Shift+O (Open Most Recent File)
28 if ((event.modifierFlags & NSEventModifierFlagCommand) && (event.modifierFlags & NSEventModifierFlagShift)
29 && (event.keyCode == kVK_ANSI_O))
30 {
31 editor->openMostRecentFile();
32 return (NSEvent *)nil; // event was handled by this monitor (avoids the system beep)
33 }
34 // Cmd+Option+O (Open Random Example)
35 else if ((event.modifierFlags & NSEventModifierFlagCommand) && (event.modifierFlags & NSEventModifierFlagOption)
36 && (event.keyCode == kVK_ANSI_O))
37 {
38 editor->openRandomExample();
39 return (NSEvent *)nil; // event was handled by this monitor (avoids the system beep)
40 }
41
42 // event was not handled by this monitor; pass it on.
43 return event;
44 }];
45}
46
53{
54 return [[NSProcessInfo processInfo] systemUptime];
55}
56
60@interface VuoEditorCocoaNotifications : NSObject
61@end
62@implementation VuoEditorCocoaNotifications
63+ (void)load
64{
66 [[NSNotificationCenter defaultCenter] addObserver:n selector:@selector(applicationWillHide) name:NSApplicationWillHideNotification object:nil];
67 [[NSNotificationCenter defaultCenter] addObserver:n selector:@selector(applicationDidUnhide) name:NSApplicationDidUnhideNotification object:nil];
68}
69- (void)applicationWillHide
70{
71 VuoEditor *editor = (VuoEditor *)qApp;
72 emit editor->applicationWillHide();
73}
74- (void)applicationDidUnhide
75{
76 VuoEditor *editor = (VuoEditor *)qApp;
77 emit editor->applicationDidUnhide();
78}
79@end