Movies and Menus
Subject:   tried your ordering and no springs
Date:   2002-02-02 10:27:24
From:   psheldon
Response to: some isolations

Note I have done mnc, minimum necessary change (actually alleged necessary change). My point is to not merely get something that works, but to learn how to isolate why something doesn't work, a much harder task but hope doable and rewarding. I don't have confidence in isolating my own mistakes in cocoa and "fear the old days" of spending huge amounts of time in debugging and being beat up by old men who had "gone to the dark side of the force" to judge others who couldn't get "death stars" operational in time.
Coding should be better than that. When I saw Inside Mac with its "managers" I thought to obsoletize these bogeys.
So, here goes mnc (from Sci Fi, "The End of Eternity", where misguided folks debug history and Noise Lambent teaches them another way):

- (IBAction)openMovie:(id)sender
NSArray *fileTypes = [NSArray arrayWithObjects:@"mov", @"mpg",
@"gif",//my addition (works)
@"jpg", nil];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
int result = [oPanel runModalForDirectory:NSHomeDirectory() file:nil types:fileTypes];
if (result == NSOKButton)

//the following were added
//NSWindow *window = [NSApp mainWindow];//(dimamarkman)
NSWindow *window = [movieView window];//michele
NSRect frameView = [movieView frame];
NSSize viewSize;

NSArray *movieToOpen = [oPanel URLs];
NSURL *movieURL = [movieToOpen objectAtIndex:0];
NSMovie *movie = [[[NSMovie alloc] initWithURL:movieURL byReference:NO] autorelease];

//must come first --- michele
[movieView setMovie:movie];
//no springs in nib file --- michele (I cleaned target just to be safe)

//the following were added (dimamarkman unless otherwise commented)
[movieView showController:YES adjustingSize:YES];//michele
[window setTitle:[[[oPanel filenames] objectAtIndex:0] lastPathComponent]];

//the following were added (dimamarkman unless otherwise commented)
viewSize = [movieView sizeForMagnification:1.0];
[movieView resizeWithMagnification:1.0];
viewSize.width = 2*frameView.origin.x + viewSize.width;
viewSize.height = 2*frameView.origin.y + viewSize.height;
[window setContentSize:viewSize];

[window makeKeyAndOrderFront: self];//michele
[window display];//michele


- (IBAction)playMovie:(id)sender
[movieView start:self];

- (IBAction)pauseMovie:(id)sender
[movieView stop:self];

- (IBAction)toggleLoopMode:(id)sender
if ( [ContextualMenuToggleLoopItem state] == NSOnState ) {
[ContextualMenuToggleLoopItem setState:NSOffState];
[movieView setLoopMode:NSQTMovieNormalPlayback];
} else {
[ContextualMenuToggleLoopItem setState:NSOnState];
[movieView setLoopMode:NSQTMovieLoopingPlayback];

1 to 1 of 1
  1. forgot to tell fact
    2002-02-02 10:32:53  psheldon [View]

    • thanks michele
      2002-02-03 21:56:46  psheldon [View]

    • added if before size adjustment to avoid mp3's
      2002-02-02 18:50:56  psheldon [View]

1 to 1 of 1