Permalink
Browse files

Importing NicePlayer

  • Loading branch information...
qin
qin committed Feb 13, 2005
0 parents commit 2833eca365572e220856fee8f20729ecefe97384
Showing with 21,095 additions and 0 deletions.
  1. +26 −0 Classes/FadeOut.h
  2. +114 −0 Classes/FadeOut.m
  3. +13 −0 Classes/MainWindowProxy.h
  4. +24 −0 Classes/MainWindowProxy.m
  5. +17 −0 Classes/NPApplication.h
  6. +171 −0 Classes/NPApplication.m
  7. +61 −0 Classes/NiceController.h
  8. +338 −0 Classes/NiceController.m
  9. +77 −0 Classes/NiceDocument.h
  10. +544 −0 Classes/NiceDocument.m
  11. +15 −0 Classes/NiceWindow/NiceDrawer.h
  12. +41 −0 Classes/NiceWindow/NiceDrawer.m
  13. +136 −0 Classes/NiceWindow/NiceWindow.h
  14. +843 −0 Classes/NiceWindow/NiceWindow.m
  15. +16 −0 Classes/NiceWindow/NiceWindowController.h
  16. +35 −0 Classes/NiceWindow/NiceWindowController.m
  17. +16 −0 Classes/Overlay Widgets/BlackWindow.h
  18. +77 −0 Classes/Overlay Widgets/BlackWindow.m
  19. +12 −0 Classes/Overlay Widgets/ClickableTextField.h
  20. +22 −0 Classes/Overlay Widgets/ClickableTextField.m
  21. +21 −0 Classes/Overlay Widgets/Control Buttons/ControlButton.h
  22. +106 −0 Classes/Overlay Widgets/Control Buttons/ControlButton.m
  23. +13 −0 Classes/Overlay Widgets/Control Buttons/ControlFF.h
  24. +45 −0 Classes/Overlay Widgets/Control Buttons/ControlFF.m
  25. +18 −0 Classes/Overlay Widgets/Control Buttons/ControlPlay.h
  26. +74 −0 Classes/Overlay Widgets/Control Buttons/ControlPlay.m
  27. +13 −0 Classes/Overlay Widgets/Control Buttons/ControlRR.h
  28. +45 −0 Classes/Overlay Widgets/Control Buttons/ControlRR.m
  29. +23 −0 Classes/Overlay Widgets/NiceScrubber.h
  30. +159 −0 Classes/Overlay Widgets/NiceScrubber.m
  31. +16 −0 Classes/Overlay Widgets/OverlayControllerWindow.h
  32. +18 −0 Classes/Overlay Widgets/OverlayControllerWindow.m
  33. +13 −0 Classes/Overlay Widgets/OverlayWindow.h
  34. +51 −0 Classes/Overlay Widgets/OverlayWindow.m
  35. +16 −0 Classes/Overlay Widgets/OverlaysControl.h
  36. +122 −0 Classes/Overlay Widgets/OverlaysControl.m
  37. +12 −0 Classes/Overlay Widgets/RoundRect.h
  38. +28 −0 Classes/Overlay Widgets/RoundRect.m
  39. +13 −0 Classes/Overlay Widgets/TimeDisplayField.h
  40. +23 −0 Classes/Overlay Widgets/TimeDisplayField.m
  41. +12 −0 Classes/Overlay Widgets/TimelineControl.h
  42. +25 −0 Classes/Overlay Widgets/TimelineControl.m
  43. +13 −0 Classes/Overlay Widgets/VolumeView.h
  44. +58 −0 Classes/Overlay Widgets/VolumeView.m
  45. +16 −0 Classes/Preferences/PrefPluginConfig.h
  46. +41 −0 Classes/Preferences/PrefPluginConfig.m
  47. +85 −0 Classes/Preferences/Preferences.h
  48. +269 −0 Classes/Preferences/Preferences.m
  49. +65 −0 Classes/Preferences/PreferencesController.h
  50. +253 −0 Classes/Preferences/PreferencesController.m
  51. +26 −0 Classes/Subtitle.h
  52. +208 −0 Classes/Subtitle.m
  53. +58 −0 Classes/Viewer Interface/NPMovieView.h
  54. +607 −0 Classes/Viewer Interface/NPMovieView.m
  55. +13 −0 Classes/Viewer Interface/NPPluginDict.h
  56. +20 −0 Classes/Viewer Interface/NPPluginDict.m
  57. +25 −0 Classes/Viewer Interface/NPPluginReader.h
  58. +117 −0 Classes/Viewer Interface/NPPluginReader.m
  59. +26 −0 Classes/Viewer Interface/Pluggable Players/JTMovieView.h
  60. +307 −0 Classes/Viewer Interface/Pluggable Players/JTMovieView.m
  61. +75 −0 Classes/Viewer Interface/Pluggable Players/NPMovieProtocol.h
  62. +28 −0 Classes/Viewer Interface/Pluggable Players/NPPluginView.h
  63. +78 −0 Classes/Viewer Interface/Pluggable Players/NPPluginView.m
  64. +10 −0 English.lproj/Credits.html
  65. BIN English.lproj/InfoPlist.strings
  66. +89 −0 English.lproj/MainMenu.nib/classes.nib
  67. +21 −0 English.lproj/MainMenu.nib/info.nib
  68. BIN English.lproj/MainMenu.nib/objects.nib
  69. +105 −0 English.lproj/NiceDocument.nib/classes.nib
  70. +26 −0 English.lproj/NiceDocument.nib/info.nib
  71. BIN English.lproj/NiceDocument.nib/objects.nib
  72. BIN English.lproj/NicePlayer Help/chapt1/chp1.htm
  73. +30 −0 English.lproj/NicePlayer Help/chapt2/chp2.htm
  74. +21 −0 English.lproj/NicePlayer Help/chapt3/chp3.htm
  75. BIN English.lproj/NicePlayer Help/gfx/bookIcon.gif
  76. BIN English.lproj/NicePlayer Help/images/niceplayer_icon.png
  77. BIN English.lproj/NicePlayer Help/images/niceplayer_icon32.png
  78. +24 −0 English.lproj/NicePlayer Help/index.htm
  79. +1 −0 English.lproj/NicePlayer Help/rtfmhdy.htm
  80. +1 −0 English.lproj/NicePlayer Help/toctmpl.htm
  81. +62 −0 English.lproj/Preferences.nib/classes.nib
  82. +27 −0 English.lproj/Preferences.nib/info.nib
  83. BIN English.lproj/Preferences.nib/keyedobjects.nib
  84. BIN Graphics/button.png
  85. BIN Graphics/image pngs/3gpp.png
  86. BIN Graphics/image pngs/avi.png
  87. BIN Graphics/image pngs/dv.png
  88. BIN Graphics/image pngs/fli.png
  89. BIN Graphics/image pngs/m2v.png
  90. BIN Graphics/image pngs/mov.png
  91. +9 −0 Graphics/image pngs/movie file extension
  92. BIN Graphics/image pngs/mp4.png
  93. BIN Graphics/image pngs/mpg.png
  94. BIN Graphics/image pngs/sfw.png
  95. BIN Graphics/nice.png
  96. BIN Graphics/niceplayer_icon.png
  97. BIN Graphics/niceplayer_icon32.png
  98. BIN Graphics/niceplayer_screenshot.jpg
  99. BIN Graphics/niceplayerdoc.png
  100. BIN Graphics/repeat.png
  101. BIN Graphics/screenshot.psd
  102. BIN Graphics/scubbar.png
  103. BIN Graphics/shuffle.png
  104. BIN Graphics/triangle.png
  105. BIN Graphics/volume.png
  106. BIN Graphics/widgets.png
  107. BIN IndyKit.framework.zip
  108. +364 −0 Info.plist
  109. +4 −0 LICENSE.txt
  110. +1,461 −0 Languages/Japanese/NicePlayer.app.ad
  111. +1,453 −0 Languages/Simplified Chinese/NicePlayer.app.ad
  112. +2,908 −0 NicePlayer.xcode/project.pbxproj
  113. +1,500 −0 NicePlayer.xcode/tuley.mode1
  114. +4,270 −0 NicePlayer.xcode/tuley.pbxuser
  115. +7 −0 NicePlayer_Prefix.pch
  116. +12 −0 Other Sources/NiceUtilities.h
  117. +25 −0 Other Sources/NiceUtilities.m
  118. +14 −0 Other Sources/main.m
  119. +1 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/DVDPlayback
  120. +1 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/DVDPlayback_debug
  121. +1 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/Headers
  122. +1 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/Resources
  123. BIN Plugin Sources/DVDPlayer/DVDPlayback.framework/Versions/A/DVDPlayback
  124. BIN Plugin Sources/DVDPlayer/DVDPlayback.framework/Versions/A/DVDPlayback_debug
  125. +983 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/Versions/A/Headers/DVDPlayback.h
  126. +26 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/Versions/A/Resources/Info.plist
  127. +16 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/Versions/A/Resources/version.plist
  128. +1 −0 Plugin Sources/DVDPlayer/DVDPlayback.framework/Versions/Current
  129. +518 −0 Plugin Sources/DVDPlayer/DVDPlayer.xcode/project.pbxproj
  130. +28 −0 Plugin Sources/DVDPlayer/DVDPlayerView.h
  131. +686 −0 Plugin Sources/DVDPlayer/DVDPlayerView.m
  132. +8 −0 Plugin Sources/DVDPlayer/DVDPlayer_Prefix.pch
  133. BIN Plugin Sources/DVDPlayer/English.lproj/InfoPlist.strings
  134. +24 −0 Plugin Sources/DVDPlayer/Info.plist
  135. +75 −0 Plugin Sources/DVDPlayer/NPMovieProtocol.h
  136. +28 −0 Plugin Sources/DVDPlayer/NPPluginView.h
  137. +78 −0 Plugin Sources/DVDPlayer/NPPluginView.m
  138. +16 −0 Plugin Sources/DVDPlayer/NiceWindow.h
  139. +3 −0 Plugin Sources/DVDPlayer/main.c
  140. +16 −0 Plugin Sources/DVDPlayer/version.plist
  141. BIN Plugins/DVDPlayer.nicebundle.zip
  142. +7 −0 Plugins/Plugins.rtf
  143. +119 −0 Readme.rtf
  144. BIN Resources/NiceIcon.icns
  145. +68 −0 Resources/NicePlayer.sdef
  146. BIN Resources/ViewerPrefIcon.png
  147. BIN Resources/black.png
  148. BIN Resources/close-highlight.png
  149. BIN Resources/close.png
  150. BIN Resources/doc_icons/3gpp.icns
  151. BIN Resources/doc_icons/avi.icns
  152. BIN Resources/doc_icons/dv.icns
  153. BIN Resources/doc_icons/fli.icns
  154. BIN Resources/doc_icons/m2v.icns
  155. BIN Resources/doc_icons/mov.icns
  156. BIN Resources/doc_icons/mp4.icns
  157. BIN Resources/doc_icons/mpg.icns
  158. BIN Resources/doc_icons/swf.icns
  159. BIN Resources/ff.png
  160. BIN Resources/ffClick.png
  161. BIN Resources/ff_over.png
  162. BIN Resources/minimize-highlight.png
  163. BIN Resources/minimize.png
  164. BIN Resources/musicrecicon.png
  165. BIN Resources/pause.png
  166. BIN Resources/pauseClick.png
  167. BIN Resources/pause_over.png
  168. BIN Resources/play.png
  169. BIN Resources/playClick.png
  170. BIN Resources/play_over.png
  171. BIN Resources/repeat_list.png
  172. BIN Resources/repeat_none.png
  173. BIN Resources/repeat_one.png
  174. BIN Resources/rr.png
  175. BIN Resources/rrClick.png
  176. BIN Resources/rr_over.png
  177. BIN Resources/scrubbar_center.png
  178. BIN Resources/scrubbar_left.png
  179. BIN Resources/scrubbar_right.png
  180. BIN Resources/scrubber.png
  181. BIN Resources/scrubberClick.png
  182. BIN Resources/shuffle_ordered.png
  183. BIN Resources/shuffle_random.png
  184. BIN Resources/volume_muted.png
  185. BIN Resources/volume_with_sound.png
  186. +24 −0 Testing-Info.plist
  187. +47 −0 Versioning/set_version.m
  188. +8 −0 Versioning/version.sh
  189. +16 −0 version.plist
@@ -0,0 +1,26 @@
//
// FadeOut.h
// NicePlayer
//
// Created by Robert Chin on 2/11/05.
// Copyright 2005 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface FadeOut : NSObject {
NSMutableSet *windowList;
NSTimer *faderTimer;
}
+(id)fadeOut;
-(id)init;
-(void)initialFadeForObjects:(id)anArray;
-(void)doInitialFadeForObjects:(id)aTimer;
-(void)addWindow:(id)anObject;
-(void)destroyAndCreateTimer;
-(void)updateAlphaValues;
-(void)testForRemoval;
@end
@@ -0,0 +1,114 @@
//
// FadeOut.m
// NicePlayer
//
// Created by Robert Chin on 2/11/05.
// Copyright 2005 __MyCompanyName__. All rights reserved.
//
#import "FadeOut.h"
#import "Preferences.h"
#define INITIAL_FADE_DURATION 5.0
#define ALPHA_VALUE_DELTA 0.04
#define TIMER_INTERVAL 0.01
static id fadeOutInstance = nil;
@implementation FadeOut
+(id)fadeOut
{
if(!fadeOutInstance)
fadeOutInstance = [FadeOut new];
return fadeOutInstance;
}
-(id)init
{
if(self = [super init]){
windowList = [[NSMutableSet set] retain];
faderTimer = nil;
}
return self;
}
-(void)initialFadeForObjects:(id)anArray
{
if([[Preferences mainPrefs] showInitialOverlays]){
[NSTimer scheduledTimerWithTimeInterval:INITIAL_FADE_DURATION
target:self
selector:@selector(doInitialFadeForObjects:)
userInfo:anArray
repeats:NO];
} else {
id anObject, e = [anArray objectEnumerator];
while(anObject = [e nextObject]){
[anObject setAlphaValue:0.0];
}
}
}
-(void)doInitialFadeForObjects:(NSTimer *)aTimer
{
if([[Preferences mainPrefs] fadeOverlays]){
[windowList addObjectsFromArray:[aTimer userInfo]];
[self destroyAndCreateTimer];
} else {
id anObject, e = [[aTimer userInfo] objectEnumerator];
while(anObject = [e nextObject]){
[anObject setAlphaValue:0.0];
}
}
}
-(void)addWindow:(id)anObject
{
if([[Preferences mainPrefs] fadeOverlays]){
[windowList addObject:anObject];
[self destroyAndCreateTimer];
} else
[anObject setAlphaValue:0.0];
}
-(void)destroyAndCreateTimer
{
if(([windowList count] > 0) && (faderTimer == nil)){
faderTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL
target:self
selector:@selector(updateAlphaValues)
userInfo:nil
repeats:YES];
}
if(([windowList count] == 0) && (faderTimer != nil)){
[faderTimer invalidate];
faderTimer = nil;
}
}
-(void)updateAlphaValues
{
id anObject, e = [windowList objectEnumerator];
while(anObject = [e nextObject]){
float newValue = [anObject alphaValue] - ALPHA_VALUE_DELTA;
newValue = (newValue < 0.0) ? 0.0 : newValue;
[anObject setAlphaValue:newValue];
}
[self testForRemoval];
[self destroyAndCreateTimer];
}
-(void)testForRemoval
{
id newSet = [[NSMutableSet set] retain];
id anObject, e = [windowList objectEnumerator];
while(anObject = [e nextObject]){
if([anObject alphaValue] > 0.0)
[newSet addObject:anObject];
}
[windowList release];
windowList = newSet;
}
@end
@@ -0,0 +1,13 @@
/**
* MainWindowProxy.h
* NicePlayer
*/
#import <Cocoa/Cocoa.h>
@interface MainWindowProxy : NSObject {
}
@end
@@ -0,0 +1,24 @@
/**
* MainWindowProxy.h
* NicePlayer
*/
#import "MainWindowProxy.h"
@implementation MainWindowProxy
- (void)forwardInvocation:(NSInvocation *)invocation
{
id friend = [[NSApp delegate] documentForWindow:[NSApp mainWindow]];
if ([friend respondsToSelector:[invocation selector]])
[invocation invokeWithTarget:friend];
else
[self doesNotRecognizeSelector:[invocation selector]];
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector{
return [NSWindow instanceMethodSignatureForSelector:aSelector];
}
@end
@@ -0,0 +1,17 @@
//
// NPApplication.h
// NicePlayer
//
// Created by Robert Chin on 11/1/04.
// Copyright 2004 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "NiceController.h"
@interface NPApplication : NSApplication {
NSTimer *inactiveTimer;
NSPoint lastPoint;
}
@end
@@ -0,0 +1,171 @@
/**
* NPApplication.m
* NicePlayer
*
* The application subclass that allows for us to detect mouse movement when the application
* is not in focus, allowing us to show and hide movie controls even when other apps are
* active.
*/
#import "NPApplication.h"
@implementation NPApplication
- (void)finishLaunching
{
[super finishLaunching];
lastPoint = [NSEvent mouseLocation];
inactiveTimer = nil;
[NSApp checkForUpdates:nil];
[self setDelegate:self];
}
/**
* This method tests to see if the mouse has moved to a different location. If so, inject the event into
* our applications loop in order to determine of the mouse is in a place where the controls should appear
* for the movie controller or title bar.
*/
-(void)testCursorMovement
{
if(!NSEqualPoints(lastPoint, [NSEvent mouseLocation])){
lastPoint = [NSEvent mouseLocation];
NSEvent *newEvent = [NSEvent mouseEventWithType:NSMouseMoved
location:lastPoint
modifierFlags:0
timestamp:0
windowNumber:0
context:nil
eventNumber:0
clickCount:0
pressure:1.0];
[self sendEvent:newEvent];
}
}
/* Ripped from http://www.cocoabuilder.com/archive/message/cocoa/2004/9/1/116398 */
- (void)sendEvent:(NSEvent *)anEvent
{
// catch first right mouse click, activate app
// and hand the event on to the window for further processing
BOOL done = NO;
NSPoint locationInWindow;
NSWindow *theWindow;
NSView *theView = nil;
if (![self isActive]) {
//NSLog(@"a: event type: %i", [anEvent type]);
// we do NOT get an NSRightMouseDown event
if(([anEvent type] == NSRightMouseUp) || ([anEvent type] == NSMouseMoved)){
// there seems to be no window assigned with this event at the moment;
// but just in case ...
if (theWindow = [anEvent window]) {
theView = [[theWindow contentView] hitTest:[anEvent
locationInWindow]];
locationInWindow = [anEvent locationInWindow];
} else {
// find window
NSEnumerator *enumerator = [[self orderedWindows] objectEnumerator];
while (theWindow = [enumerator nextObject]) {
locationInWindow = [theWindow mouseLocationOutsideOfEventStream];
NSView *contentView = [theWindow contentView];
theView = [contentView hitTest:locationInWindow];
if (theView) {
// we found our view
//NSLog(@"hit view of class: %@", NSStringFromClass([theView class]));
break;
}
}
}
if (theView) {
// create new event with useful window, location and event values
unsigned int flags = [anEvent modifierFlags];
NSTimeInterval timestamp = [anEvent timestamp];
int windowNumber = [theWindow windowNumber];
NSGraphicsContext *context = [anEvent context];
// original event is not a mouse down event so the following values are missing
int eventNumber = 0; // [anEvent eventNumber]
int clickCount = 0; // [anEvent clickCount]
float pressure = 1.0; // [anEvent pressure]
NSEvent *newEvent = [NSEvent mouseEventWithType:[anEvent type]
location:locationInWindow
modifierFlags:flags
timestamp:timestamp
windowNumber:windowNumber
context:context
eventNumber:eventNumber
clickCount:clickCount
pressure:pressure];
if ([theView acceptsFirstMouse:newEvent]) {
// activate app and send event to the window
//[self activateIgnoringOtherApps:YES];
[theWindow sendEvent:newEvent];
done = YES;
}
}
}
}
if (!done) {
// we did not catch this one
[super sendEvent:anEvent];
}
}
-(void)deactivateTimer
{
if(inactiveTimer){
[inactiveTimer invalidate];
inactiveTimer = nil;
}
}
-(void)activateTimer
{
if(!inactiveTimer){
inactiveTimer = [NSTimer scheduledTimerWithTimeInterval:0.01
target:self
selector:@selector(testCursorMovement)
userInfo:nil
repeats:YES];
}
}
#pragma mark -
#pragma mark Delegate Methods
-(void)applicationDidBecomeActive:(NSNotification *)aNotification
{
[self deactivateTimer];
}
-(void)applicationDidResignActive:(NSNotification *)aNotification
{
if(![self isHidden])
[self activateTimer];
}
-(void)applicationDidHide:(NSNotification *)aNotification
{
[self deactivateTimer];
}
-(void)applicationDidUnhide:(NSNotification *)aNotification
{
if(![self isActive])
[self activateTimer];
}
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
if(![self isActive])
[self activateTimer];
}
-(void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
[[NiceController controller] openFiles:filenames];
}
@end
Oops, something went wrong.

0 comments on commit 2833eca

Please sign in to comment.