Changeset 543 for trunk/Cocoa/Pester/Source
- Timestamp:
- 06/15/09 06:16:52 (15 years ago)
- Location:
- trunk/Cocoa/Pester/Source
- Files:
-
- 1 added
- 3 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/English.lproj/Movie alert.nib/classes.nib
r59 r543 1 { 2 IBClasses = ( 3 {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 {CLASS = NJRCenteringMovieView; LANGUAGE = ObjC; SUPERCLASS = NSMovieView; }, 5 { 6 ACTIONS = {close = id; }; 7 CLASS = PSMovieAlertController; 8 LANGUAGE = ObjC; 9 OUTLETS = {movieView = NSMovieView; }; 10 SUPERCLASS = NSWindowController; 11 }, 12 {CLASS = "java.lang.Object"; LANGUAGE = Java; } 13 ); 14 IBVersion = 1; 15 } 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 <plist version="1.0"> 4 <dict> 5 <key>IBClasses</key> 6 <array> 7 <dict> 8 <key>CLASS</key> 9 <string>NSObject</string> 10 <key>LANGUAGE</key> 11 <string>ObjC</string> 12 </dict> 13 <dict> 14 <key>CLASS</key> 15 <string>FirstResponder</string> 16 <key>LANGUAGE</key> 17 <string>ObjC</string> 18 <key>SUPERCLASS</key> 19 <string>NSObject</string> 20 </dict> 21 <dict> 22 <key>ACTIONS</key> 23 <dict> 24 <key>close</key> 25 <string>id</string> 26 </dict> 27 <key>CLASS</key> 28 <string>PSMovieAlertController</string> 29 <key>LANGUAGE</key> 30 <string>ObjC</string> 31 <key>OUTLETS</key> 32 <dict> 33 <key>movieView</key> 34 <string>QTMovieView</string> 35 </dict> 36 <key>SUPERCLASS</key> 37 <string>NSWindowController</string> 38 </dict> 39 <dict> 40 <key>CLASS</key> 41 <string>NSWindow</string> 42 <key>LANGUAGE</key> 43 <string>ObjC</string> 44 <key>SUPERCLASS</key> 45 <string>NSResponder</string> 46 </dict> 47 </array> 48 <key>IBVersion</key> 49 <string>1</string> 50 </dict> 51 </plist> -
trunk/Cocoa/Pester/Source/English.lproj/Movie alert.nib/info.nib
r59 r543 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 3 <plist version="1.0"> 4 4 <dict> 5 <key>IBDocumentLocation</key>6 <string>36 16 356 240 0 0 1280 832 </string>7 5 <key>IBFramework Version</key> 8 <string>291.0</string> 6 <string>677</string> 7 <key>IBLastKnownRelativeProjectPath</key> 8 <string>../Pester.xcodeproj</string> 9 <key>IBOldestOS</key> 10 <integer>4</integer> 9 11 <key>IBOpenObjects</key> 10 12 <array> 11 <integer> 10</integer>13 <integer>51</integer> 12 14 </array> 13 15 <key>IBSystem Version</key> 14 <string>6G30</string> 16 <string>9J61</string> 17 <key>targetFramework</key> 18 <string>IBCocoaFramework</string> 15 19 </dict> 16 20 </plist> -
trunk/Cocoa/Pester/Source/PSMediaAlert.m
r364 r543 10 10 #import "NSDictionary-NJRExtensions.h" 11 11 #import "NJRSoundManager.h" 12 #import <QuickTime/Movies.h>13 12 14 13 // property list keys 15 14 static NSString * const PLAlertRepetitions = @"times"; // NSString 16 15 static NSString * const PLAlertOutputVolume = @"volume"; // NSNumber 16 17 static const float PSMediaAlertNoVolume = 0; 17 18 18 19 @implementation PSMediaAlert … … 50 51 outputVolume = volume; 51 52 else 52 outputVolume = kNoVolume;53 outputVolume = PSMediaAlertNoVolume; 53 54 } 54 55 … … 59 60 NSMutableDictionary *plAlert = [[super propertyListRepresentation] mutableCopy]; 60 61 [plAlert setObject: [NSNumber numberWithUnsignedShort: repetitions] forKey: PLAlertRepetitions]; 61 if (outputVolume != kNoVolume) {62 if (outputVolume != PSMediaAlertNoVolume) { 62 63 [plAlert setObject: [NSNumber numberWithFloat: outputVolume] forKey: PLAlertOutputVolume]; 63 64 } -
trunk/Cocoa/Pester/Source/PSMovieAlert.h
r133 r543 8 8 9 9 #import <AppKit/AppKit.h> 10 #import <QTKit/QTKit.h> 10 11 #import "PSMediaAlert.h" 11 12 … … 14 15 @interface PSMovieAlert : PSMediaAlert { 15 16 BDAlias *alias; 16 NSMovie *movie;17 QTMovie *movie; 17 18 BOOL hasAudio; 18 19 BOOL hasVideo; … … 24 25 25 26 - (BOOL)hasVideo; 26 - ( NSMovie *)movie;27 - (QTMovie *)movie; 27 28 - (BDAlias *)movieFileAlias; 28 29 -
trunk/Cocoa/Pester/Source/PSMovieAlert.m
r133 r543 11 11 #import "PSMovieAlertController.h" 12 12 #import "NSDictionary-NJRExtensions.h" 13 #import " NSMovie-NJRExtensions.h"13 #import "QTMovie-NJRExtensions.h" 14 14 #import "BDAlias.h" 15 15 … … 36 36 repetitions = numReps; 37 37 // XXX if we support remote movie URLs, need to call EnterMovies() ourselves at least in Jaguar (_MacTech_ December 2002, p. 64); also should do async movie loading (p. 73Ð74). 38 movie = [[NSMovie alloc] initWithURL: [NSURL fileURLWithPath: path] byReference: YES];38 movie = [[QTMovie alloc] initWithFile: path error: NULL]; 39 39 if (movie == nil) { 40 40 [self release]; 41 41 self = nil; 42 42 } else { 43 hasAudio = [movie hasAudio];44 hasVideo = [movie hasVideo];43 hasAudio = [movie NJR_hasAudio]; 44 hasVideo = [movie NJR_hasVideo]; 45 45 46 46 if (!hasAudio && !hasVideo) { … … 63 63 } 64 64 65 - ( NSMovie *)movie;65 - (QTMovie *)movie; 66 66 { 67 67 return movie; … … 97 97 - (NSAttributedString *)actionDescription; 98 98 { 99 BOOL isStatic = [movie isStatic];99 BOOL isStatic = [movie NJR_isStatic]; 100 100 NSMutableAttributedString *string = [[(isStatic ? @"Show " : @"Play ") small] mutableCopy]; 101 101 NSString *kindString = nil, *name = [alias displayNameWithKindString: &kindString]; -
trunk/Cocoa/Pester/Source/PSMovieAlertController.h
r133 r543 11 11 @class PSAlarm; 12 12 @class PSMovieAlert; 13 @class QTMovieView; 13 14 14 15 @interface PSMovieAlertController : NSWindowController { 15 16 PSAlarm *alarm; 16 17 PSMovieAlert *alert; 17 IBOutlet NSMovieView *movieView;18 IBOutlet QTMovieView *movieView; 18 19 void *theMovie; /* Movie */ 19 20 unsigned short repetitions; -
trunk/Cocoa/Pester/Source/PSMovieAlertController.m
r133 r543 10 10 #import "PSMovieAlertController.h" 11 11 #import "PSMovieAlert.h" 12 #import " NSMovie-NJRExtensions.h"12 #import "QTMovie-NJRExtensions.h" 13 13 #import "NJRSoundManager.h" 14 14 #import <QuickTime/Movies.h> … … 38 38 repetitionsRemaining--; 39 39 [movieView gotoBeginning: self]; 40 [movieView start: self];40 [movieView play: self]; 41 41 } 42 42 delay = (GetMovieDuration((Movie)theMovie) - GetMovieTime((Movie)theMovie, NULL)) / (double)GetMovieTimeScale((Movie)theMovie); … … 48 48 { 49 49 if ([self initWithWindowNibName: @"Movie alert"]) { 50 NSMovie *movie = [anAlert movie];50 QTMovie *movie = [anAlert movie]; 51 51 NSWindow *window = [self window]; // connect outlets 52 52 alarm = anAlarm; 53 53 alert = anAlert; 54 theMovie = [movie quickTimeMovie]; 54 55 [movieView setMovie: movie]; 55 theMovie = [movie QTMovie];56 56 if ([alert hasVideo]) { 57 57 NSRect screenRect = [[window screen] visibleFrame]; 58 float magnification = 1.0; 59 NSSize movieSize; 58 NSSize movieSize = [[movie attributeForKey: QTMovieNaturalSizeAttribute] sizeValue]; 60 59 NSSize minSize = [window minSize]; 61 60 float windowFrameHeight = [window frame].size.height - [[window contentView] frame].size.height; … … 63 62 screenRect.size.height -= windowFrameHeight; 64 63 minSize.height -= windowFrameHeight; 65 while (1) { 66 movieSize = [movieView sizeForMagnification: magnification]; 67 movieSize.height -= 16; // controller is hidden, but its size is included (documented, ergh) 68 if (movieSize.width > screenRect.size.width || movieSize.height > screenRect.size.height) 69 magnification /= 2; 70 else 71 break; 64 while (movieSize.width > screenRect.size.width || movieSize.height > screenRect.size.height) { 65 movieSize.width /= 2; 66 movieSize.height /= 2; 72 67 } 73 68 if (movieSize.width < minSize.width) movieSize.width = minSize.width; … … 94 89 repetitions = [alert repetitions]; 95 90 repetitionsRemaining = repetitions; 96 if ([movie hasAudio] && [NJRSoundManager volumeIsNotMutedOrInvalid: [alert outputVolume]] && [NJRSoundManager saveDefaultOutputVolume]) {91 if ([movie NJR_hasAudio] && [NJRSoundManager volumeIsNotMutedOrInvalid: [alert outputVolume]] && [NJRSoundManager saveDefaultOutputVolume]) { 97 92 [NJRSoundManager setDefaultOutputVolume: [alert outputVolume]]; 98 93 } 99 if (![movie isStatic]) [self play]; // if it's an image, don't close the window automatically94 if (![movie NJR_isStatic]) [self play]; // if it's an image, don't close the window automatically 100 95 } 101 96 return self; … … 115 110 { 116 111 repetitions = 0; 117 [movieView stop: self];112 [movieView pause: self]; 118 113 [alert completedForAlarm: alarm]; 119 114 [self autorelease]; -
trunk/Cocoa/Pester/Source/Pester.xcodeproj/project.pbxproj
r541 r543 82 82 E1B11F650CF5F30F004975AA /* NJRIntervalField.m in Sources */ = {isa = PBXBuildFile; fileRef = E13919E303B9E4E100000028 /* NJRIntervalField.m */; }; 83 83 E1B11F660CF5F30F004975AA /* PSError.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ECA00703C002B300F54C66 /* PSError.m */; }; 84 E1B11F670CF5F30F004975AA /* NJRCenteringMovieView.m in Sources */ = {isa = PBXBuildFile; fileRef = E1D358BA03C60CE900C8A18E /* NJRCenteringMovieView.m */; };85 84 E1B11F690CF5F30F004975AA /* PSTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = E1BF6E9103C928D200050002 /* PSTimer.m */; }; 86 85 E1B11F6A0CF5F30F004975AA /* PSWakeAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = E19FD39F03C98645001509F3 /* PSWakeAlert.m */; }; … … 242 241 E1CDEC3D0444053F00AEEDB1 /* NJRNonCenteringWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJRNonCenteringWindow.h; sourceTree = "<group>"; }; 243 242 E1CDEC3E0444053F00AEEDB1 /* NJRNonCenteringWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJRNonCenteringWindow.m; sourceTree = "<group>"; }; 244 E1D358B903C60CE900C8A18E /* NJRCenteringMovieView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJRCenteringMovieView.h; sourceTree = "<group>"; };245 E1D358BA03C60CE900C8A18E /* NJRCenteringMovieView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJRCenteringMovieView.m; sourceTree = "<group>"; };246 243 E1DEF0EA03FE1BF100050002 /* OARightArrowPressed.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = OARightArrowPressed.tiff; sourceTree = "<group>"; }; 247 244 E1DEF0EB03FE1BF100050002 /* OALeftArrow.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = OALeftArrow.tiff; sourceTree = "<group>"; }; … … 655 652 children = ( 656 653 E17F2F4C03FDF67D00050002 /* OACalendarView */, 657 E1D358B903C60CE900C8A18E /* NJRCenteringMovieView.h */,658 E1D358BA03C60CE900C8A18E /* NJRCenteringMovieView.m */,659 654 E1F0B14A03AD8CEF00AEFBE0 /* NJRUnfocusableMovieView.h */, 660 655 E1F0B14B03AD8CEF00AEFBE0 /* NJRUnfocusableMovieView.m */, … … 892 887 E1B11F650CF5F30F004975AA /* NJRIntervalField.m in Sources */, 893 888 E1B11F660CF5F30F004975AA /* PSError.m in Sources */, 894 E1B11F670CF5F30F004975AA /* NJRCenteringMovieView.m in Sources */,895 889 E1B11F690CF5F30F004975AA /* PSTimer.m in Sources */, 896 890 E1B11F6A0CF5F30F004975AA /* PSWakeAlert.m in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.