Ignore:
Timestamp:
01/05/03 23:02:48 (21 years ago)
Author:
Nicholas Riley
Message:

PSScriptAlert.m: Removed reference to NDAppleScriptObject.

PSMovieAlertController.[hm]: Added minimum sizing.

NJRCenteringMovieView.[hm]: Support for centering movie inside its
frame if the frame is too large for the movie; sizes movie
proportionally if necessary (not used in Pester).

NSImage-NJRExtensions.[hm]: Fixed copyright.

Read Me.rtfd: Updated with bug fixes.

PSMovieAlert.m: Note bug in NSMovieView, currently doesn't affect us.

NJRQTMediaPopUpButton.m: Work around background processor use bug when
NSMovieView has movie set but not playing.

NJRVoicePopUpButton.m: Removed obsolete comment.

PSApplication.m: Only show alarm set window on rapp if alerts aren't
expiring.

PSAlarms.[hm]: Added -alarmsExpiring for support of conditional
rapp window open feature in PSApplication.

PSAlarmSetController.m: Stop window update timer and movie playback on
hide, restart timer on activate - fixes background processor usage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/NJRQTMediaPopUpButton.m

    r53 r60  
    1111#import "NSMovie-NJRExtensions.h"
    1212#import "NSImage-NJRExtensions.h"
     13#import <QuickTime/Movies.h>
    1314
    1415// XXX workaround for SoundFileManager log message in 10.2.3 and earlier
     
    275276}
    276277
     278void
     279MovieStoppedCB(QTCallBack cb, long refCon)
     280{
     281    NSMovieView *preview = (NSMovieView *)refCon;
     282    // if we donÕt do this after the runloop has finished, then we crash in MCIdle because itÕs expecting a movie and doesnÕt have one any more
     283    [preview performSelector: @selector(setMovie:) withObject: nil afterDelay: 0]; // otherwise we get an extra runloop timer which uses a lot of CPU from +[NSMovieView _idleMovies]
     284    DisposeCallBack(cb);
     285}
     286
    277287- (BOOL)_validateWithPreview:(BOOL)doPreview;
    278288{
     
    285295        NSMovie *movie = [[NSMovie alloc] initWithURL: [NSURL fileURLWithPath: [selectedAlias fullPath]] byReference: YES];
    286296        movieCanRepeat = ![movie isStatic];
    287         if ([movie hasAudio])
    288             [preview setMovie: movie];
    289         else {
     297        if ([movie hasAudio]) {
     298            [preview setMovie: doPreview ? movie : nil];
     299        } else {
    290300            [preview setMovie: nil];
    291301            if (movie == nil) {
     
    301311            }
    302312        }
     313        if (doPreview) {
     314            Movie qtMovie = [movie QTMovie];
     315            QTCallBack cbStop = NewCallBack(GetMovieTimeBase(qtMovie), callBackAtExtremes);
     316            QTCallBackUPP cbStopUPP = NewQTCallBackUPP(MovieStoppedCB);
     317            OSErr err = CallMeWhen(cbStop, cbStopUPP, (long)preview, triggerAtStop, 0, 0);
     318            if (err != noErr) {
     319                NSLog(@"CanÕt register QuickTime stop timebase callback for preview: %ld", err);
     320                DisposeCallBack(cbStop);
     321            }
     322            [preview start: self];
     323        }
    303324        [movie release];
    304         if (doPreview) [preview start: self];
    305325    }
    306326    [[NSNotificationCenter defaultCenter] postNotificationName: NJRQTMediaPopUpButtonMovieChangedNotification object: self];
     
    313333{
    314334    [preview stop: self];
     335    [preview setMovie: nil]; // otherwise we get an extra runloop timer which uses a lot of CPU from +[NSMovieView _idleMovies]
    315336}
    316337
Note: See TracChangeset for help on using the changeset viewer.