-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWNAppController.m
91 lines (67 loc) · 3.18 KB
/
WNAppController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//---------------------------------------------------------------------------------------
// WNAppController.m created by erik on Fri 18-Sep-1998
// This code is part of the WordNet frontend by Erik Doernenburg. For copyright details
// see GNU public license version 2 or above. No warranties implied. Use at own risk.
// More information can be found at http://www.mulle-kybernetik.com/software/WordNet/.
//---------------------------------------------------------------------------------------
#import <AppKit/AppKit.h>
#import "WordNetAccess.h"
#import "WNSearchWindowController.h"
#import "WNAppController.h"
//=======================================================================================
@implementation WNAppController
//=======================================================================================
//---------------------------------------------------------------------------------------
// APP CONFIGURATION
//---------------------------------------------------------------------------------------
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
WNSearchWindowController *swController;
[WNController setupWithDatabasePath:[[NSBundle mainBundle] pathForResource:@"Database" ofType:@""]];
wnController = [[WNController alloc] init];
swController = [[WNSearchWindowController alloc] initWithAccessController:wnController];
[swController showWindow:self];
[[NSApplication sharedApplication] setServicesProvider:swController];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
return YES;
}
//---------------------------------------------------------------------------------------
// INFO, LICENSE, ETC.
//---------------------------------------------------------------------------------------
- (void)showAboutPanel:(id)sender
{
extern double WordNetVersionNumber;
NSDictionary *options;
options = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%g", WordNetVersionNumber] forKey:@"Version"];
[[NSApplication sharedApplication] orderFrontStandardAboutPanelWithOptions:options];
}
- (void)showLicense:(id)sender
{
if(licensePanel == nil)
{
if([NSBundle loadNibNamed:@"License" owner:self] == NO)
[NSException raise:NSGenericException format:@"-[%@ %@]: Could not load License NIB file.", NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
[licenseView setString:[NSString stringWithFormat:@"\nWordNet Database and Software Library License:\n\n%@", [WNController license]]];
[licensePanel center];
}
[licensePanel makeKeyAndOrderFront:self];
}
- (void)windowWillClose:(NSNotification *)aNotification;
{
NSWindow *window = [aNotification object];
if(window == licensePanel)
{
[licensePanel autorelease];
licensePanel = nil;
}
}
- (void)gotoWordNetHomepage:(id)sender
{
if([[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://wordnet.princeton.edu/"]] == NO)
NSBeep();
}
//=======================================================================================
@end
//=======================================================================================