зеркало из https://github.com/mozilla/pjs.git
Initial commit of the about box for chimera. NPOB.
This commit is contained in:
Родитель
ac436077ed
Коммит
8b8d63e302
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {showPanel = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {creditsField = id; window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array>
|
||||
<integer>7</integer>
|
||||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q45</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -0,0 +1,35 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface CHAboutBox : NSObject
|
||||
{
|
||||
IBOutlet id creditsField;
|
||||
IBOutlet id window;
|
||||
NSTimer *scrollTimer;
|
||||
float currentPosition;
|
||||
float maxScrollHeight;
|
||||
NSTimeInterval startTime;
|
||||
BOOL restartAtTop;
|
||||
}
|
||||
|
||||
+ (CHAboutBox *)sharedInstance;
|
||||
- (IBAction)showPanel:(id)sender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,124 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Matt Judy.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
* David Hyatt <hyatt@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHAboutBox.h"
|
||||
|
||||
@implementation CHAboutBox
|
||||
|
||||
static CHAboutBox *sharedInstance = nil;
|
||||
|
||||
+ (CHAboutBox *)sharedInstance
|
||||
{
|
||||
return sharedInstance ? sharedInstance : [[self alloc] init];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (sharedInstance) {
|
||||
[self dealloc];
|
||||
} else {
|
||||
sharedInstance = [super init];
|
||||
}
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (IBAction)showPanel:(id)sender
|
||||
{
|
||||
if (!creditsField) {
|
||||
NSString *creditsPath;
|
||||
NSAttributedString *creditsString;
|
||||
float fieldHeight;
|
||||
float containerHeight;
|
||||
|
||||
if (![NSBundle loadNibNamed:@"CHAboutBox" owner:self]) {
|
||||
NSLog( @"Failed to load CHAboutBox.nib" );
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
|
||||
[window setTitle:@"About Navigator"];
|
||||
|
||||
creditsPath = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
|
||||
creditsString = [[NSAttributedString alloc] initWithPath:creditsPath documentAttributes:nil];
|
||||
[creditsField replaceCharactersInRange:NSMakeRange( 0, 0 )
|
||||
withRTF:[creditsString RTFFromRange:
|
||||
NSMakeRange( 0, [creditsString length] )
|
||||
documentAttributes:nil]];
|
||||
|
||||
fieldHeight = [creditsField frame].size.height;
|
||||
|
||||
(void)[[creditsField layoutManager] glyphRangeForTextContainer:[creditsField textContainer]];
|
||||
containerHeight = [[creditsField layoutManager] usedRectForTextContainer:
|
||||
[creditsField textContainer]].size.height;
|
||||
maxScrollHeight = containerHeight - fieldHeight;
|
||||
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setMenu:nil];
|
||||
[window center];
|
||||
}
|
||||
|
||||
if (![window isVisible]) {
|
||||
currentPosition = 0;
|
||||
restartAtTop = NO;
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
}
|
||||
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
scrollTimer = [NSTimer scheduledTimerWithTimeInterval:1/4
|
||||
target:self
|
||||
selector:@selector(scrollCredits:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
[scrollTimer invalidate];
|
||||
}
|
||||
|
||||
- (void)scrollCredits:(NSTimer *)timer
|
||||
{
|
||||
if ([NSDate timeIntervalSinceReferenceDate] >= startTime) {
|
||||
|
||||
if (restartAtTop) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
restartAtTop = NO;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentPosition >= maxScrollHeight) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
currentPosition = 0;
|
||||
restartAtTop = YES;
|
||||
} else {
|
||||
[creditsField scrollPoint:NSMakePoint( 0, currentPosition )];
|
||||
currentPosition += 0.01;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -1940,12 +1940,12 @@
|
|||
};
|
||||
F568C3CF023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.h;
|
||||
path = CHAboutBox.h;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D0023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.m;
|
||||
path = CHAboutBox.m;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D1023A4A5B010001CA = {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {showPanel = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {creditsField = id; window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array>
|
||||
<integer>7</integer>
|
||||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q45</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -1940,12 +1940,12 @@
|
|||
};
|
||||
F568C3CF023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.h;
|
||||
path = CHAboutBox.h;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D0023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.m;
|
||||
path = CHAboutBox.m;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D1023A4A5B010001CA = {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {showPanel = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {creditsField = id; window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array>
|
||||
<integer>7</integer>
|
||||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q45</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичные данные
camino/resources/localized/English.lproj/AboutBox.nib/objects.nib
сгенерированный
Normal file
Двоичные данные
camino/resources/localized/English.lproj/AboutBox.nib/objects.nib
сгенерированный
Normal file
Двоичный файл не отображается.
|
@ -0,0 +1,35 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface CHAboutBox : NSObject
|
||||
{
|
||||
IBOutlet id creditsField;
|
||||
IBOutlet id window;
|
||||
NSTimer *scrollTimer;
|
||||
float currentPosition;
|
||||
float maxScrollHeight;
|
||||
NSTimeInterval startTime;
|
||||
BOOL restartAtTop;
|
||||
}
|
||||
|
||||
+ (CHAboutBox *)sharedInstance;
|
||||
- (IBAction)showPanel:(id)sender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,124 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Matt Judy.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
* David Hyatt <hyatt@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHAboutBox.h"
|
||||
|
||||
@implementation CHAboutBox
|
||||
|
||||
static CHAboutBox *sharedInstance = nil;
|
||||
|
||||
+ (CHAboutBox *)sharedInstance
|
||||
{
|
||||
return sharedInstance ? sharedInstance : [[self alloc] init];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (sharedInstance) {
|
||||
[self dealloc];
|
||||
} else {
|
||||
sharedInstance = [super init];
|
||||
}
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (IBAction)showPanel:(id)sender
|
||||
{
|
||||
if (!creditsField) {
|
||||
NSString *creditsPath;
|
||||
NSAttributedString *creditsString;
|
||||
float fieldHeight;
|
||||
float containerHeight;
|
||||
|
||||
if (![NSBundle loadNibNamed:@"CHAboutBox" owner:self]) {
|
||||
NSLog( @"Failed to load CHAboutBox.nib" );
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
|
||||
[window setTitle:@"About Navigator"];
|
||||
|
||||
creditsPath = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
|
||||
creditsString = [[NSAttributedString alloc] initWithPath:creditsPath documentAttributes:nil];
|
||||
[creditsField replaceCharactersInRange:NSMakeRange( 0, 0 )
|
||||
withRTF:[creditsString RTFFromRange:
|
||||
NSMakeRange( 0, [creditsString length] )
|
||||
documentAttributes:nil]];
|
||||
|
||||
fieldHeight = [creditsField frame].size.height;
|
||||
|
||||
(void)[[creditsField layoutManager] glyphRangeForTextContainer:[creditsField textContainer]];
|
||||
containerHeight = [[creditsField layoutManager] usedRectForTextContainer:
|
||||
[creditsField textContainer]].size.height;
|
||||
maxScrollHeight = containerHeight - fieldHeight;
|
||||
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setMenu:nil];
|
||||
[window center];
|
||||
}
|
||||
|
||||
if (![window isVisible]) {
|
||||
currentPosition = 0;
|
||||
restartAtTop = NO;
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
}
|
||||
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
scrollTimer = [NSTimer scheduledTimerWithTimeInterval:1/4
|
||||
target:self
|
||||
selector:@selector(scrollCredits:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
[scrollTimer invalidate];
|
||||
}
|
||||
|
||||
- (void)scrollCredits:(NSTimer *)timer
|
||||
{
|
||||
if ([NSDate timeIntervalSinceReferenceDate] >= startTime) {
|
||||
|
||||
if (restartAtTop) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
restartAtTop = NO;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentPosition >= maxScrollHeight) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
currentPosition = 0;
|
||||
restartAtTop = YES;
|
||||
} else {
|
||||
[creditsField scrollPoint:NSMakePoint( 0, currentPosition )];
|
||||
currentPosition += 0.01;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {showPanel = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {creditsField = id; window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array>
|
||||
<integer>7</integer>
|
||||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q45</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -0,0 +1,35 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface CHAboutBox : NSObject
|
||||
{
|
||||
IBOutlet id creditsField;
|
||||
IBOutlet id window;
|
||||
NSTimer *scrollTimer;
|
||||
float currentPosition;
|
||||
float maxScrollHeight;
|
||||
NSTimeInterval startTime;
|
||||
BOOL restartAtTop;
|
||||
}
|
||||
|
||||
+ (CHAboutBox *)sharedInstance;
|
||||
- (IBAction)showPanel:(id)sender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,124 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Matt Judy.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
* David Hyatt <hyatt@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHAboutBox.h"
|
||||
|
||||
@implementation CHAboutBox
|
||||
|
||||
static CHAboutBox *sharedInstance = nil;
|
||||
|
||||
+ (CHAboutBox *)sharedInstance
|
||||
{
|
||||
return sharedInstance ? sharedInstance : [[self alloc] init];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (sharedInstance) {
|
||||
[self dealloc];
|
||||
} else {
|
||||
sharedInstance = [super init];
|
||||
}
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (IBAction)showPanel:(id)sender
|
||||
{
|
||||
if (!creditsField) {
|
||||
NSString *creditsPath;
|
||||
NSAttributedString *creditsString;
|
||||
float fieldHeight;
|
||||
float containerHeight;
|
||||
|
||||
if (![NSBundle loadNibNamed:@"CHAboutBox" owner:self]) {
|
||||
NSLog( @"Failed to load CHAboutBox.nib" );
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
|
||||
[window setTitle:@"About Navigator"];
|
||||
|
||||
creditsPath = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
|
||||
creditsString = [[NSAttributedString alloc] initWithPath:creditsPath documentAttributes:nil];
|
||||
[creditsField replaceCharactersInRange:NSMakeRange( 0, 0 )
|
||||
withRTF:[creditsString RTFFromRange:
|
||||
NSMakeRange( 0, [creditsString length] )
|
||||
documentAttributes:nil]];
|
||||
|
||||
fieldHeight = [creditsField frame].size.height;
|
||||
|
||||
(void)[[creditsField layoutManager] glyphRangeForTextContainer:[creditsField textContainer]];
|
||||
containerHeight = [[creditsField layoutManager] usedRectForTextContainer:
|
||||
[creditsField textContainer]].size.height;
|
||||
maxScrollHeight = containerHeight - fieldHeight;
|
||||
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setMenu:nil];
|
||||
[window center];
|
||||
}
|
||||
|
||||
if (![window isVisible]) {
|
||||
currentPosition = 0;
|
||||
restartAtTop = NO;
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
}
|
||||
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
scrollTimer = [NSTimer scheduledTimerWithTimeInterval:1/4
|
||||
target:self
|
||||
selector:@selector(scrollCredits:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
[scrollTimer invalidate];
|
||||
}
|
||||
|
||||
- (void)scrollCredits:(NSTimer *)timer
|
||||
{
|
||||
if ([NSDate timeIntervalSinceReferenceDate] >= startTime) {
|
||||
|
||||
if (restartAtTop) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
restartAtTop = NO;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentPosition >= maxScrollHeight) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
currentPosition = 0;
|
||||
restartAtTop = YES;
|
||||
} else {
|
||||
[creditsField scrollPoint:NSMakePoint( 0, currentPosition )];
|
||||
currentPosition += 0.01;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -1940,12 +1940,12 @@
|
|||
};
|
||||
F568C3CF023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.h;
|
||||
path = CHAboutBox.h;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D0023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.m;
|
||||
path = CHAboutBox.m;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D1023A4A5B010001CA = {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {showPanel = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {creditsField = id; window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array>
|
||||
<integer>7</integer>
|
||||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q45</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
|
@ -1940,12 +1940,12 @@
|
|||
};
|
||||
F568C3CF023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.h;
|
||||
path = CHAboutBox.h;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D0023A4A5A010001CA = {
|
||||
isa = PBXFileReference;
|
||||
path = AboutBox.m;
|
||||
path = CHAboutBox.m;
|
||||
refType = 4;
|
||||
};
|
||||
F568C3D1023A4A5B010001CA = {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {showPanel = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {creditsField = id; window = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array>
|
||||
<integer>7</integer>
|
||||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5Q45</string>
|
||||
</dict>
|
||||
</plist>
|
Двоичные данные
chimera/resources/localized/English.lproj/AboutBox.nib/objects.nib
сгенерированный
Normal file
Двоичные данные
chimera/resources/localized/English.lproj/AboutBox.nib/objects.nib
сгенерированный
Normal file
Двоичный файл не отображается.
|
@ -0,0 +1,35 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface CHAboutBox : NSObject
|
||||
{
|
||||
IBOutlet id creditsField;
|
||||
IBOutlet id window;
|
||||
NSTimer *scrollTimer;
|
||||
float currentPosition;
|
||||
float maxScrollHeight;
|
||||
NSTimeInterval startTime;
|
||||
BOOL restartAtTop;
|
||||
}
|
||||
|
||||
+ (CHAboutBox *)sharedInstance;
|
||||
- (IBAction)showPanel:(id)sender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,124 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Matt Judy.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matt Judy (Original Author)
|
||||
* David Hyatt <hyatt@netscape.com>
|
||||
*/
|
||||
|
||||
#import "CHAboutBox.h"
|
||||
|
||||
@implementation CHAboutBox
|
||||
|
||||
static CHAboutBox *sharedInstance = nil;
|
||||
|
||||
+ (CHAboutBox *)sharedInstance
|
||||
{
|
||||
return sharedInstance ? sharedInstance : [[self alloc] init];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (sharedInstance) {
|
||||
[self dealloc];
|
||||
} else {
|
||||
sharedInstance = [super init];
|
||||
}
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (IBAction)showPanel:(id)sender
|
||||
{
|
||||
if (!creditsField) {
|
||||
NSString *creditsPath;
|
||||
NSAttributedString *creditsString;
|
||||
float fieldHeight;
|
||||
float containerHeight;
|
||||
|
||||
if (![NSBundle loadNibNamed:@"CHAboutBox" owner:self]) {
|
||||
NSLog( @"Failed to load CHAboutBox.nib" );
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
|
||||
[window setTitle:@"About Navigator"];
|
||||
|
||||
creditsPath = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
|
||||
creditsString = [[NSAttributedString alloc] initWithPath:creditsPath documentAttributes:nil];
|
||||
[creditsField replaceCharactersInRange:NSMakeRange( 0, 0 )
|
||||
withRTF:[creditsString RTFFromRange:
|
||||
NSMakeRange( 0, [creditsString length] )
|
||||
documentAttributes:nil]];
|
||||
|
||||
fieldHeight = [creditsField frame].size.height;
|
||||
|
||||
(void)[[creditsField layoutManager] glyphRangeForTextContainer:[creditsField textContainer]];
|
||||
containerHeight = [[creditsField layoutManager] usedRectForTextContainer:
|
||||
[creditsField textContainer]].size.height;
|
||||
maxScrollHeight = containerHeight - fieldHeight;
|
||||
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setMenu:nil];
|
||||
[window center];
|
||||
}
|
||||
|
||||
if (![window isVisible]) {
|
||||
currentPosition = 0;
|
||||
restartAtTop = NO;
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
}
|
||||
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
scrollTimer = [NSTimer scheduledTimerWithTimeInterval:1/4
|
||||
target:self
|
||||
selector:@selector(scrollCredits:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
[scrollTimer invalidate];
|
||||
}
|
||||
|
||||
- (void)scrollCredits:(NSTimer *)timer
|
||||
{
|
||||
if ([NSDate timeIntervalSinceReferenceDate] >= startTime) {
|
||||
|
||||
if (restartAtTop) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
restartAtTop = NO;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentPosition >= maxScrollHeight) {
|
||||
startTime = [NSDate timeIntervalSinceReferenceDate] + 3.0;
|
||||
currentPosition = 0;
|
||||
restartAtTop = YES;
|
||||
} else {
|
||||
[creditsField scrollPoint:NSMakePoint( 0, currentPosition )];
|
||||
currentPosition += 0.01;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
Загрузка…
Ссылка в новой задаче