Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/Classes/AboutWindowController.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91 - (show annotations) (download)
Fri Sep 8 15:43:57 2017 UTC (6 years, 7 months ago) by toshinagata1964
File size: 3037 byte(s)
More warnings are removed (semantic and unused warnings)
1 //
2 // AboutWindowController.m
3 // Alchemusica
4 //
5 // Created by Toshi Nagata on 11/09/02.
6 // Copyright 2011-2016 Toshi Nagata. All rights reserved.
7 //
8 /*
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation version 2 of the License.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 */
18
19 #import "AboutWindowController.h"
20 #import "NSWindowControllerAdditions.h"
21 #import "MyAppController.h"
22
23 @implementation AboutWindowController
24
25 static id sSharedAboutWindowController;
26
27 + (id)sharedAboutWindowController
28 {
29 if (sSharedAboutWindowController == nil) {
30 sSharedAboutWindowController = [[AboutWindowController alloc] initWithWindowNibName:@"AboutPanel"];
31 }
32 return sSharedAboutWindowController;
33 }
34
35 + (void)showSplashWindow
36 {
37 id cont = [AboutWindowController sharedAboutWindowController];
38 [[cont window] center];
39 [[cont viewWithTag:1000] setHidden:YES]; /* ok button */
40 [[cont window] makeKeyAndOrderFront:nil];
41 }
42
43 + (void)hideSplashWindow
44 {
45 id cont = [AboutWindowController sharedAboutWindowController];
46 [[cont window] orderOut:nil];
47 }
48
49 + (void)showModalAboutWindow
50 {
51 id cont = [AboutWindowController sharedAboutWindowController];
52 [[cont window] center];
53 [[cont viewWithTag:1001] setStringValue:@""];
54 [[cont viewWithTag:1000] setHidden:NO];
55 [NSApp runModalForWindow:[cont window]];
56 [[cont window] orderOut:nil];
57 }
58
59 + (void)setMessage:(NSString *)message
60 {
61 id cont = [AboutWindowController sharedAboutWindowController];
62 if ([[cont window] isVisible]) {
63 if (message == nil)
64 message = @"";
65 [[cont viewWithTag:1001] setStringValue:message];
66 [[[cont window] contentView] displayIfNeeded];
67 }
68 }
69
70 - (void)windowDidLoad
71 {
72 NSString *str1, *str2, *str3, *str4;
73 int revision;
74
75 [super windowDidLoad];
76
77 // Read version and last build info
78 [(MyAppController *)[NSApp delegate] getVersion:&str1 copyright:&str2 lastBuild:&str3 revision:&revision];
79 str4 = [versionText stringValue];
80 str4 = [NSString stringWithFormat:str4, str1];
81 [versionText setStringValue:str4];
82 str4 = [myCopyrightText stringValue];
83 str4 = [NSString stringWithFormat:str4, str2];
84 [myCopyrightText setStringValue:str4];
85 str4 = [lastBuildText stringValue];
86 str4 = [NSString stringWithFormat:str4, str3];
87 [lastBuildText setStringValue:str4];
88 str4 = [revisionText stringValue];
89 str4 = [NSString stringWithFormat:str4, revision];
90 [revisionText setStringValue:str4];
91 [(MyAppController *)[NSApp delegate] getRubyVersion:&str1 copyright:&str2];
92 str3 = [rubyCopyrightText stringValue];
93 str3 = [NSString stringWithFormat:str3, str1, str2];
94 [rubyCopyrightText setStringValue:str3];
95
96 }
97
98 - (IBAction)okPressed:(id)sender
99 {
100 [NSApp stopModal];
101 }
102
103 - (BOOL)windowShouldClose:(NSWindow *)sender
104 {
105 [NSApp stopModal];
106 return YES;
107 }
108
109 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26