static void QTFrame_CalcWindowMinMaxInfo (HWND theWnd, LPMINMAXINFO lpMinMax) { WindowObject myWindowObject = NULL; Movie myMovie = NULL; MovieController myMC = NULL; GraphicsImportComponent myImporter = NULL; Rect myRect; ComponentResult myErr = noErr; myWindowObject = QTFrame_GetWindowObjectFromWindow(theWnd); if (myWindowObject != NULL) { myMC = (**myWindowObject).fController; myMovie = (**myWindowObject).fMovie; myImporter = (**myWindowObject).fGraphicsImporter; } // we're expecting a window with either an image or a movie if ((myImporter == NULL) && (myMovie == NULL)) return; if (myImporter != NULL) { myErr = GraphicsImportGetBoundsRect(myImporter, &myRect); if (myErr != noErr) return; } if (myMovie != NULL) { GetMovieBox(myMovie, &myRect); if (myMC != NULL) if (MCGetVisible(myMC)) MCGetControllerBoundsRect(myMC, &myRect); } // we currently don't allow images or movies to be resized, so we return both // min and max rectangles set to the current image or movie size, plus the // appropriate window frame and caption sizes lpMinMax->ptMinTrackSize.x = myRect.right + (2 * GetSystemMetrics(SM_CXFRAME)); lpMinMax->ptMinTrackSize.y = myRect.bottom + (2 * GetSystemMetrics(SM_CXFRAME)) + GetSystemMetrics(SM_CYCAPTION); lpMinMax->ptMaxTrackSize.x = lpMinMax->ptMinTrackSize.x; lpMinMax->ptMaxTrackSize.y = lpMinMax->ptMinTrackSize.y; lpMinMax->ptMaxSize.x = lpMinMax->ptMinTrackSize.x; lpMinMax->ptMaxSize.y = lpMinMax->ptMinTrackSize.y; }
pascal Boolean playermoviecontrollereventfilter (MovieController mc, short action, void *params, long refcon) { #pragma unused (mc, refcon, params) /* 7.0b4 PBS: Handle movie controller events. Unused -- but there's a good chance it will be needed later. */ if (action == mcActionControllerSizeChanged) { Rect bounds; MCGetControllerBoundsRect (currentcontroller, &bounds); SizeWindow (playerwindow, bounds.right, bounds.bottom, false); } /*if*/ return (false); /*Further processing should occur.*/ } /*playermoviecontrollereventfilter*/
boolean playeropenmovieinwindow ( ptrfilespec f ) { // // 2006-06-23 creedon: FSRef-zed // // 7.0b4 PBS: open a movie in the QuickTime Player window and display it. If the window isn't already open, open it. // short movieresref; OSErr err; hdlwindowinfo hinfo; FSSpec fs; if (macgetfsspec (f, &fs) != noErr) return (false); if (!findplayerwindow (&hinfo)) playeropencommand (); // If the Player window doesn't exist, create a new one. getwindowinfo (playerwindow, &playerwindowinfo); playerdisposecurrentmovie (); // make sure the current movie has been disposed SetGWorld (GetWindowPort (playerwindow), nil); err = OpenMovieFile ( &fs, &movieresref, fsRdPerm); if (err != noErr) return (false); NewMovieFromFile (¤tmovie, movieresref, nil, nil, newMovieActive, nil); CloseMovieFile (movieresref); SetMovieGWorld (currentmovie, GetWindowPort (playerwindow), nil); GetMovieBox (currentmovie, ¤tmovierect); OffsetRect (¤tmovierect, -currentmovierect.left, -currentmovierect.top); SetMovieBox (currentmovie, ¤tmovierect); currentcontroller = NewMovieController (currentmovie, ¤tmovierect, mcTopLeftMovie); MCGetControllerBoundsRect (currentcontroller, ¤tmovierect); //MCSetActionFilterWithRefCon (currentcontroller, NewMCActionFilterWithRefConProc(playermoviecontrollereventfilter), (long) playerwindow); SizeWindow (playerwindow, currentmovierect.right, currentmovierect.bottom, false); (**playerwindowinfo).contentrect = currentmovierect; AlignWindow (playerwindow, false, nil, nil); // position for optimal playback //MCDoAction (currentcontroller, mcActionSetKeysEnabled, (void *) true); /*enable keyboard input*/ /*No!*/ MoviesTask (nil, 0); MCIdle (currentcontroller); return (true); } // playeropenmovieinwindow