advertisement

Article:
  Movies and Menus
Subject:   Showing controller
Date:   2002-01-31 19:28:03
From:   michele
I've made some changes to the open method, so that one could open a wide variety of files known by QT, play them in background, always have a QT controller, display them at whatever magnification and not worry about closing them.


First : duplicated the name of types, as it appears that the types could be capitals or not.


Second: added some HFS file types, as some movies created on OS 9 and earlier do not have an extension of mov:


// Define the array of file types used for the movie in the open panel
NSArray *fileTypes = [NSArray arrayWithObjects :
@"mov", @"MOV", @"mpg", @"MPG", @"mp3", @"jpg", @"swf", @"avi", @"wav", @"aiff", @"midi",
@"mpeg", @"png", @"tiff", @"pict", @"gif", NSFileTypeForHFSTypeCode('Moov'), nil];


Third: autorelease the movie


NSMovie *myMovie = [[[NSMovie alloc] initWithURL: movieURL
byReference: NO] autorelease];


Fourth: add the movie's title
NSWindow *movieWindow = [movieView window];
[movieWindow setTitle: [[[myOpenPanel filenames] objectAtIndex: 0]
lastPathComponent]];


Fifth: display the controller taking in account the controller's size
[movieView showController: YES adjustingSize: YES];


Sixth: implemented a function to draw the movie at whatever magnification
[self resizeMovieViewAndWindow: 1.0];


Seventh: allowed play in background
[movieWindow makeKeyAndOrderFront: self];


Eighth: ensure that the controller redisplays after reopening an image file
[movieWindow display];


Michèle