home *** CD-ROM | disk | FTP | other *** search
- /*
- File: mtb3.c
- Contains: Main Function
- Written by: DTS and QT Engineering
- Copyright: © 1992-1994 by Apple Computer, Inc., all rights reserved.
- Change History (most recent first):
- <1> 12/4/94 khs changed the format of the file to the new look and feel
- To Do:
- */
-
-
- // INCLUDES
- #include "mtb.h"
-
-
- // MAIN
- void main(void)
- {
- MovieController aController;
- WindowPtr aWindow;
- Rect aRect;
- Movie aMovie;
- Boolean done = false;
- OSErr err;
- EventRecord theEvent;
- WindowPtr whichWindow;
- short part;
-
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(nil);
- MaxApplZone();
-
- if (!IsQuickTimeInstalled())
- {
- CheckError(-1, "\pPlease install QuickTime and try again.");
- }
-
- err = EnterMovies();
- if (err)
- return;
-
- SetRect(&aRect, 100, 100, 200, 200);
- aWindow = NewCWindow(nil, &aRect, "\pMovie", false, noGrowDocProc, (WindowPtr) - 1, true, 0);
- SetPort(aWindow);
- aMovie = GetMovie();
- if (aMovie == nil)
- return;
-
- SetRect(&aRect, 0, 0, 100, 100);
- aController = NewMovieController(aMovie, &aRect, mcTopLeftMovie);
- if (aController == nil)
- return;
-
- err = MCGetControllerBoundsRect(aController, &aRect);
- SizeWindow(aWindow, aRect.right, aRect.bottom, true);
- ShowWindow(aWindow);
- err = MCDoAction(aController, mcActionSetKeysEnabled, (Ptr)true);
-
- while (!done)
- {
- WaitNextEvent(everyEvent, &theEvent, 0, nil);
- if (!MCIsPlayerEvent(aController, &theEvent))
- {
- switch (theEvent.what)
- {
- case updateEvt:
- whichWindow = (WindowPtr)theEvent.message;
- BeginUpdate(whichWindow);
- EraseRect(&whichWindow->portRect);
- EndUpdate(whichWindow);
- break;
- case mouseDown:
- part = FindWindow(theEvent.where, &whichWindow);
- if (whichWindow == aWindow)
- {
- switch (part)
- {
- case inGoAway:
- done = TrackGoAway(whichWindow, theEvent.where);
- break;
-
- case inDrag:
- DragWindow(whichWindow, theEvent.where, &qd.screenBits.bounds);
- break;
- }
- }
- }
- }
- }
- DisposeMovieController(aController);
- DisposeMovie(aMovie);
- DisposeWindow(aWindow);
- }
-
-
-