home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Beta / Quicktime 2.0 Beta.iso / Programming Stuff / Sample Code / DTS Sample Code / MyQuickTimeApp ƒ / MyApplication.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-14  |  16.1 KB  |  597 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        MyApplication.c
  3.     
  4.     Contains:    My Application Shell.
  5.  
  6.     Written by:    John Wang
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <1>        03/14/94    JW        Re-Created for Universal Headers.
  13.  
  14.     To Do:
  15.     
  16. */
  17.  
  18. #ifdef THINK_C
  19. #define        applec
  20. #endif
  21.  
  22. #include    <Types.h>
  23. #include    <Memory.h>
  24. #include    <QuickDraw.h>
  25. #include    <Palettes.h>
  26. #include    <QDOffscreen.h>
  27. #include    <Errors.h>
  28. #include    <Fonts.h>
  29. #include    <Dialogs.h>
  30. #include    <Windows.h>
  31. #include    <Menus.h>
  32. #include    <Events.h>
  33. #include    <Desk.h>
  34. #include    <DiskInit.h>
  35. #include    <OSUtils.h>
  36. #include    <Resources.h>
  37. #include    <ToolUtils.h>
  38. #include    <AppleEvents.h>
  39. #include    <EPPC.h>
  40. #include    <GestaltEqu.h>
  41. #include    <Processes.h>
  42. #include    <Balloons.h>
  43. #include    <Aliases.h>
  44. #include    <MixedMode.h>
  45. #include    <Scrap.h>
  46. #include    <LowMem.h>
  47.  
  48. #include    <Movies.h>
  49.  
  50. #include    "MyApplication Shell (2.01).h"
  51. #include    "MyApplication.h"
  52.  
  53. /* ------------------------------------------------------------------------- */
  54.  
  55. //    These globals are used by the shell and must be defined:
  56.  
  57. Str255        gMyAboutTitle = "\pSample QuickTime Playback Application";
  58. Str255        gMyAboutDesc = "\pThis uses a sample application shell.";
  59.  
  60. struct WindowInfo {
  61.     Movie            theMovie;
  62.     MovieController    theMC;
  63.     Rect            movieRect;
  64.     short            refNum;
  65.     short            resId;
  66. };
  67. typedef        struct WindowInfo WindowInfo, *WindowInfoPtr, **WindowInfoHandle;
  68.  
  69. /* ------------------------------------------------------------------------- */
  70.  
  71. pascal Boolean MyPlayerFilter(MovieController theController, short action, void *params, long refCon);
  72. pascal Boolean MyPlayerFilter(MovieController theController, short action, void *params, long refCon)
  73. {
  74.     Rect        movieBounds;
  75.     
  76.     switch ( action ) {
  77.         case  mcActionControllerSizeChanged:
  78.             MCGetControllerBoundsRect(theController, &movieBounds);
  79.             SizeWindow((WindowPtr) refCon, movieBounds.right - movieBounds.left, movieBounds.bottom - movieBounds.top, true);
  80.             break;
  81.     }
  82.     return ( false );
  83. }
  84.  
  85. /* ------------------------------------------------------------------------- */
  86.  
  87. //    MyInitialize is called at init time after the toolbox is initialized.  This routine is
  88. //    called only once.
  89.  
  90. OSErr MyInitialize()
  91. {
  92.     OSErr        err;
  93.     long        QDfeature;
  94.     
  95.     //    We require QuickTime so make sure it is available.
  96.     err = Gestalt(gestaltQuickTime, &QDfeature);
  97.     if ( err != noErr )
  98.         return(err);
  99.     
  100.     err = EnterMovies();
  101.     if ( err != noErr )
  102.         return(err);
  103.  
  104.     return(noErr);
  105. }
  106.  
  107. //    Depending on the value of the constant MYEVENTDEF, this routine may have different
  108. //    calling frequency.
  109. //    If MYEVENTDEF == 2, then this routine gets called for every
  110. //       window owned by the application of type MAS_WINDOWDOC per iteration of the event loop
  111. //       if the event is NOT a null event.  MyEvent can assume that the grafport and gdevice
  112. //       are set to the window being passed.
  113. //    If MYEVENTDEF == 1, then this routine gets called once per event loop is the
  114. //       event is NOT a null event.  theWindow will be nil.
  115. //    If MYEVENTDEF == 0, this routine never gets called.
  116. //    Returning true indicates that the event was handled and can be ignored by the normal
  117. //    event handler.
  118.  
  119. Boolean MyEvent(WindowPtr theWindow, EventRecord *myEvent)
  120. {
  121.     WindowInfoHandle    myWinfo;
  122.     
  123.     myWinfo = (WindowInfoHandle) GetWRefCon(theWindow);
  124.     if ( MCIsPlayerEvent((**myWinfo).theMC, myEvent) )
  125.         return ( true );
  126.     else
  127.         return ( false );
  128. }
  129.  
  130. //    Depending on the value of the constant MYIDLEDEF, this routine may have different
  131. //    calling frequency.
  132. //    If MYIDLEDEF == 2, then this routine gets called for every
  133. //       window owned by the application of type MAS_WINDOWDOC per iteration of
  134. //       the event loop.  You can assume that the port and gdevice are set to the window.
  135. //    If MYIDLEDEF == 1, then this routine gets called once per event loop.  theWindow will be nil.
  136. //    If MYIDLEDEF == 0, this routine never gets called.
  137.  
  138. void MyIdle(WindowPtr theWindow)
  139. {
  140.     WindowInfoHandle    myWinfo;
  141.     
  142.     myWinfo = (WindowInfoHandle) GetWRefCon(theWindow);
  143.     MCIdle((**myWinfo).theMC);
  144. }
  145.  
  146. //    MyDraw is called when redrawing the window is needed.  The port and gdevice
  147. //    is already set and begin and end update are called for MyDraw.
  148.  
  149. void MyDraw(WindowPtr theWindow)
  150. {
  151. }
  152.  
  153. //    This routine gets called once when the application is quitting.
  154. //    This gives the app the chance to clean up.
  155.  
  156. void MyFinishup()
  157. {
  158. }
  159.  
  160. //    This routine is called whenever the app receives a suspend or resume event.  This
  161. //    allows the yield time (passed to WaitNextEvent) to be changed.  I.e., if you don't
  162. //    do much processing the in background, you should set the yield to a high value
  163. //    when the suspend message is received.
  164.  
  165. long MyYieldTime(long message)
  166. {
  167.     if ( message )
  168.         //    Resume message
  169.         return ( 0 );
  170.     else
  171.         //    Suspend message
  172.         return ( 30 );
  173. }
  174.  
  175. //    If the shell's doCommand routine can not process the menu selection, then this routine is
  176. //    called.  Do not call HiliteMenu because it is called by the shell.
  177. //    If the command can not be handled, this it must be an error and the shell will
  178. //    present a FATAL error to the user.
  179.  
  180. OSErr MyDoCommand(short theMenu, short theItem)
  181. {
  182.     switch ( theMenu ) {
  183.         case kMENU_NEXTID:
  184.             switch ( theItem ) {
  185.                 case kMENU_NEXT1stITEM:
  186.                     break;
  187.                 default:
  188.                     return ( theItem );
  189.             }
  190.             break;
  191.             
  192.         default:
  193.             return ( theItem );
  194.     }
  195.     
  196.     return ( noErr );
  197. }
  198.  
  199. void MyDoKeyDown(EventRecord *myEvent)
  200. {
  201. }
  202.  
  203. void MyInContent(WindowPtr foundWindow, Point where)
  204. {
  205. }
  206.  
  207. void MyZoomWindow(WindowPtr foundWindow, short windowPart)
  208. {
  209.     WStateData            *zoomData;
  210.     WindowInfoHandle    myWinfo;
  211.     Rect                movieBounds;
  212.     
  213.     //    IMPORTANT: Must not change stdState if not zooming out.  Otherwise, it will fool
  214.     //    the WDEF into thinking that it is not zoomed out when it really is.
  215.  
  216.     //    Get the original movie rect.
  217.     myWinfo = (WindowInfoHandle) GetWRefCon(foundWindow);
  218.     movieBounds = (**myWinfo).movieRect;
  219.  
  220.     //    Now set the movie to the new bounds and then get the updated movieBounds.
  221.     if ( windowPart == 8 ) {
  222.         Rect    stdRect, userRect;    //    Get it first because MCMovieChanged changes the zoomRects.
  223.         
  224.         zoomData = (WStateData *) *(((CWindowPeek) foundWindow)->dataHandle);
  225.         stdRect = zoomData->stdState;
  226.         userRect = zoomData->userState;
  227.         
  228.         //    Double the size.  Set the movie size.  Then get the bounds back from MC.
  229.         movieBounds.bottom = movieBounds.bottom << 1;
  230.         movieBounds.right = movieBounds.right << 1;
  231.         SetMovieBox((**myWinfo).theMovie, &movieBounds);
  232.         MCMovieChanged((**myWinfo).theMC, (**myWinfo).theMovie);
  233.         MCGetControllerBoundsRect((**myWinfo).theMC, &movieBounds);
  234.         
  235.         zoomData = (WStateData *) *(((CWindowPeek) foundWindow)->dataHandle);
  236.         stdRect.right = stdRect.left + movieBounds.right;
  237.         stdRect.bottom = stdRect.top + movieBounds.bottom;
  238.         zoomData->stdState = stdRect;
  239.         zoomData->userState = userRect;
  240.         MoveWindow(foundWindow, stdRect.left, stdRect.top, false);
  241.         SizeWindow(foundWindow, movieBounds.right, movieBounds.bottom, true);
  242.     } else {
  243.         Rect    stdRect, userRect;    //    Get it first because MCMovieChanged changes the zoomRects.
  244.         
  245.         zoomData = (WStateData *) *(((CWindowPeek) foundWindow)->dataHandle);
  246.         stdRect = zoomData->stdState;
  247.         userRect = zoomData->userState;
  248.         
  249.         //    Double the size.  Set the movie size.  Then get the bounds back from MC.
  250.         SetMovieBox((**myWinfo).theMovie, &movieBounds);
  251.         MCMovieChanged((**myWinfo).theMC, (**myWinfo).theMovie);
  252.         MCGetControllerBoundsRect((**myWinfo).theMC, &movieBounds);
  253.         zoomData = (WStateData *) *(((CWindowPeek) foundWindow)->dataHandle);
  254.         
  255.         userRect.right = userRect.left + movieBounds.right;
  256.         userRect.bottom = userRect.top + movieBounds.bottom;
  257.         zoomData->stdState = stdRect;
  258.         zoomData->userState = userRect;
  259.         MoveWindow(foundWindow, userRect.left, userRect.top, false);
  260.         SizeWindow(foundWindow, movieBounds.right, movieBounds.bottom, true);
  261.     }
  262. }
  263.  
  264. void MyAdjustMenus()
  265. {
  266. }
  267.  
  268. /* ------------------------------------------------------------------------- */
  269.  
  270. void MyNew()
  271. {
  272.     Movie                myMovie;
  273.     Rect                movieBounds;
  274.     MovieController        mcPlay;
  275.     WindowPtr            myWindow;
  276.     WindowInfoHandle    myWinfo;
  277.     Rect                limitRect = {0, 0, 480, 640};
  278.     long                 controllerFlags;
  279.     
  280.     myMovie = NewMovie(newMovieActive);
  281.     if ( myMovie != nil ) {
  282.         GetMovieBox(myMovie, &movieBounds);
  283.         OffsetRect(&movieBounds, -movieBounds.left, -movieBounds.top);
  284.         SetMovieBox(myMovie, &movieBounds);
  285.         OffsetRect(&movieBounds, 50, 50);
  286.         
  287.         myWindow = NewCWindow(0L, &movieBounds, "\pMovie!", 1, zoomDocProc, (WindowPtr) -1, true, 0L);
  288.         SetMyWindow(myWindow);
  289.         OffsetRect(&movieBounds, -50, -50);
  290.         
  291.         SetPort(myWindow);
  292.         SetMovieGWorld(myMovie, (CGrafPtr) myWindow, 0);
  293.         mcPlay = NewMovieController(myMovie, &movieBounds, mcTopLeftMovie);
  294.  
  295.         myWinfo = (WindowInfoHandle) NewHandle(sizeof(WindowInfo));
  296.         SetWRefCon(myWindow, (long) myWinfo);
  297.         (**myWinfo).movieRect = movieBounds;
  298.         (**myWinfo).theMC = mcPlay;
  299.         (**myWinfo).theMovie = myMovie;
  300.         (**myWinfo).refNum = -1;
  301.         (**myWinfo).resId = 128;
  302.  
  303.         MCGetControllerBoundsRect(mcPlay, &movieBounds);
  304.         SizeWindow(myWindow, movieBounds.right - movieBounds.left, movieBounds.bottom - movieBounds.top, true);
  305.     
  306.         //    Enable editing of movie controller
  307.         MCEnableEditing(mcPlay,true);
  308.     
  309.         //    Turn on the grow box
  310.         MCDoAction(mcPlay, mcActionSetGrowBoxBounds, (void *)&limitRect);
  311.         
  312.         //    Tell the controller to attach a movie’s CLUT to the window as appropriate.
  313.         MCDoAction(mcPlay, mcActionGetFlags, &controllerFlags);
  314.         MCDoAction(mcPlay, mcActionSetFlags, 
  315.                             (void *)(controllerFlags | mcFlagsUseWindowPalette));
  316.     
  317.         //    Allow the controller to accept keyboard events
  318.         MCDoAction(mcPlay, mcActionSetKeysEnabled, (void *)true);
  319.  
  320.         //    Set the filter for events we want to know about
  321.         MCSetActionFilterWithRefCon(mcPlay, NewMCActionFilterWithRefConProc(MyPlayerFilter), (long) myWindow);
  322.     }
  323. }
  324.  
  325. Movie getMovieFromFile(FSSpec *theFSS, short *refNum, short *resId);
  326. Movie getMovieFromFile(FSSpec *theFSS, short *refNum, short *resId)
  327. {
  328.     OSErr                    err;
  329.     StandardFileReply        reply;
  330.     SFTypeList                types;
  331.     Movie                    theMovie;
  332.     FSSpec                    myFSSpec;
  333.  
  334.     if (theFSS == nil) {
  335.         types[0] = 'MooV';
  336.         StandardGetFilePreview(nil, 1, types, &reply);
  337.         if (!reply.sfGood) return((Movie) 0);
  338.         myFSSpec = reply.sfFile;
  339.     } else {
  340.         myFSSpec = *theFSS;
  341.     }
  342.     
  343.     err = OpenMovieFile(&myFSSpec, refNum, fsRdWrPerm);
  344.     if (GetMoviesError()) return((Movie) 0);
  345.     if (err) return ((Movie) 0);
  346.  
  347.     *resId = 0;
  348.     err = NewMovieFromFile(&theMovie, *refNum, resId, (StringPtr) 0,
  349.                         newMovieActive, (Boolean *) 0);
  350.     if (GetMoviesError()) return((Movie) 0);
  351.     if (err) return ((Movie) 0);
  352.  
  353.     return (theMovie);
  354. }
  355.  
  356. //    If theFSS is not nil, then the file to be opened is specified in the FSSpec.
  357. //    MyOpen must make window frontmost so that it can be printed from finder.
  358. void MyOpen(FSSpec *theFSS)
  359. {
  360.     Movie                myMovie;
  361.     Rect                movieBounds;
  362.     short                loopInfo;
  363.     Handle                theLoop;
  364.     UserData            theUserData;
  365.     MovieController        mcPlay;
  366.     WindowPtr            myWindow;
  367.     WindowInfoHandle    myWinfo;
  368.     Rect                limitRect = {0, 0, 480, 640};
  369.     long                 controllerFlags;
  370.     short                refNum, resId;
  371.     
  372.     myMovie =  getMovieFromFile(theFSS, &refNum, &resId);
  373.     if ( myMovie != nil ) {
  374.         GetMovieBox(myMovie, &movieBounds);
  375.         OffsetRect(&movieBounds, -movieBounds.left, -movieBounds.top);
  376.         SetMovieBox(myMovie, &movieBounds);
  377.         OffsetRect(&movieBounds, 50, 50);
  378.         
  379.         myWindow = NewCWindow(0L, &movieBounds, "\pMovie!", 1, zoomDocProc, (WindowPtr) -1, true, 0L);
  380.         SetMyWindow(myWindow);
  381.         OffsetRect(&movieBounds, -50, -50);
  382.         
  383.         SetPort(myWindow);
  384.         SetMovieGWorld(myMovie, (CGrafPtr) myWindow, 0);
  385.         mcPlay = NewMovieController(myMovie, &movieBounds, mcTopLeftMovie);
  386.  
  387.         myWinfo = (WindowInfoHandle) NewHandle(sizeof(WindowInfo));
  388.         SetWRefCon(myWindow, (long) myWinfo);
  389.         (**myWinfo).movieRect = movieBounds;
  390.         (**myWinfo).theMC = mcPlay;
  391.         (**myWinfo).theMovie = myMovie;
  392.         (**myWinfo).refNum = refNum;
  393.         (**myWinfo).resId = resId;
  394.  
  395.         MCGetControllerBoundsRect(mcPlay, &movieBounds);
  396.         SizeWindow(myWindow, movieBounds.right - movieBounds.left, movieBounds.bottom - movieBounds.top, true);
  397.     
  398.         //    Enable editing of movie controller
  399.         MCEnableEditing(mcPlay,true);
  400.     
  401.         //    Turn on the grow box
  402.         MCDoAction(mcPlay, mcActionSetGrowBoxBounds, (void *)&limitRect);
  403.         
  404.         //    Tell the controller to attach a movie’s CLUT to the window as appropriate.
  405.         MCDoAction(mcPlay, mcActionGetFlags, &controllerFlags);
  406.         MCDoAction(mcPlay, mcActionSetFlags, 
  407.                             (void *)(controllerFlags | mcFlagsUseWindowPalette));
  408.     
  409.         //    Allow the controller to accept keyboard events
  410.         MCDoAction(mcPlay, mcActionSetKeysEnabled, (void *)true);
  411.  
  412.         //    Set the filter for events we want to know about
  413.         MCSetActionFilterWithRefCon(mcPlay, NewMCActionFilterWithRefConProc(MyPlayerFilter), (long) myWindow);
  414.     
  415.         //    See my tech note on User Data Atoms for more information about the below code...
  416.         loopInfo = 0;
  417.         theLoop = NewHandle(0);
  418.         theUserData = GetMovieUserData(myMovie);
  419.         if ( CountUserDataType(theUserData, 'LOOP') ) {
  420.             loopInfo = 1;
  421.             GetUserData(theUserData, theLoop, 'LOOP', 1);
  422.             if ( GetHandleSize(theLoop) )
  423.                 if ( (** (long **) theLoop) == 1 )
  424.                     loopInfo = 2;
  425.         }
  426.         if ( loopInfo )
  427.             MCDoAction(mcPlay, mcActionSetLooping, (Ptr) true);
  428.         if ( loopInfo == 2 )
  429.             MCDoAction(mcPlay, mcActionSetLoopIsPalindrome, (Ptr) true);
  430.     }
  431. }
  432.  
  433. void MyClose()
  434. {
  435.     WindowPtr            closeWindow;
  436.     WindowInfoHandle    myWinfo;
  437.     
  438.     closeWindow = FrontWindow();
  439.     if ( closeWindow == nil )
  440.         return;
  441.         
  442.     myWinfo = (WindowInfoHandle) GetWRefCon(closeWindow);
  443.  
  444.     CloseMovieFile((**myWinfo).refNum);
  445.     DisposeMovieController((**myWinfo).theMC);
  446.     DisposeMovie((**myWinfo).theMovie);
  447.     DisposHandle((Handle) myWinfo);
  448.     DisposeWindow(closeWindow);
  449. }
  450.  
  451. void MySave()
  452. {
  453.     WindowPtr            frontWindow;
  454.     WindowInfoHandle    myWinfo;
  455.     OSErr                myErr;
  456.  
  457.     frontWindow = FrontWindow();
  458.     if ( frontWindow == nil ) 
  459.         return;
  460.         
  461.     myWinfo = (WindowInfoHandle) GetWRefCon(frontWindow);
  462.     if ( (**myWinfo).refNum != -1 ) {
  463.         myErr = UpdateMovieResource((**myWinfo).theMovie, (**myWinfo).refNum,
  464.                                         (**myWinfo).resId, nil);
  465.     } else {
  466.         MySaveAs();
  467.     }
  468. }
  469.  
  470. void MySaveAs()
  471. {
  472.     SysBeep(50);
  473. }
  474.  
  475. void MyPageSetup()
  476. {
  477.     SysBeep(50);
  478. }
  479.  
  480. void MyPrint()
  481. {
  482.     SysBeep(50);
  483. }
  484.  
  485. /* ------------------------------------------------------------------------- */
  486.  
  487. void MyUndo(void)
  488. {
  489.     WindowPtr            frontWindow;
  490.     WindowInfoHandle    myWinfo;
  491.     ComponentResult        err;
  492.     
  493.     frontWindow = FrontWindow();
  494.     if ( frontWindow == nil )
  495.         return;
  496.         
  497.     if ( IsMyWindow(frontWindow) ) {
  498.         myWinfo = (WindowInfoHandle) GetWRefCon(frontWindow);
  499.         err = MCUndo((**myWinfo).theMC);
  500.     }    
  501. }
  502.  
  503. void MyCut(void)
  504. {
  505.     WindowPtr            frontWindow;
  506.     WindowInfoHandle    myWinfo;
  507.     Movie                scrapMovie;
  508.     
  509.     frontWindow = FrontWindow();
  510.     if ( frontWindow == nil )
  511.         return;
  512.         
  513.     if ( IsMyWindow(frontWindow) ) {
  514.         myWinfo = (WindowInfoHandle) GetWRefCon(frontWindow);
  515.         scrapMovie = MCCut((**myWinfo).theMC);
  516.         if ( scrapMovie ) {
  517.             PutMovieOnScrap(scrapMovie, 0L);
  518.             DisposeMovie(scrapMovie);
  519.         }
  520.     }    
  521. }
  522.  
  523. void MyCopy(void)
  524. {
  525.     WindowPtr            frontWindow;
  526.     WindowInfoHandle    myWinfo;
  527.     Movie                scrapMovie;
  528.     
  529.     frontWindow = FrontWindow();
  530.     if ( frontWindow == nil )
  531.         return;
  532.         
  533.     if ( IsMyWindow(frontWindow) ) {
  534.         myWinfo = (WindowInfoHandle) GetWRefCon(frontWindow);
  535.         scrapMovie = MCCopy((**myWinfo).theMC);
  536.         if ( scrapMovie ) {
  537.             PutMovieOnScrap(scrapMovie, 0L);
  538.             DisposeMovie(scrapMovie);
  539.         }
  540.     }    
  541. }
  542.  
  543. void MyPaste(void)
  544. {
  545.     WindowPtr            frontWindow;
  546.     WindowInfoHandle    myWinfo;
  547.     ComponentResult        err;
  548.     
  549.     frontWindow = FrontWindow();
  550.     if ( frontWindow == nil )
  551.         return;
  552.         
  553.     if ( IsMyWindow(frontWindow) ) {
  554.         myWinfo = (WindowInfoHandle) GetWRefCon(frontWindow);
  555.         err = MCPaste((**myWinfo).theMC, nil);
  556.     }    
  557. }
  558.  
  559. void MyClear(void)
  560. {
  561.     WindowPtr            frontWindow;
  562.     WindowInfoHandle    myWinfo;
  563.     ComponentResult        err;
  564.     
  565.     frontWindow = FrontWindow();
  566.     if ( frontWindow == nil )
  567.         return;
  568.         
  569.     if ( IsMyWindow(frontWindow) ) {
  570.         myWinfo = (WindowInfoHandle) GetWRefCon(frontWindow);
  571.         err = MCClear((**myWinfo).theMC);
  572.     }    
  573. }
  574.  
  575. void MySelectAll(void)
  576. {
  577.     WindowPtr            frontWindow;
  578.     WindowInfoHandle    myWinfo;
  579.     TimeRecord             tr;
  580.     
  581.     frontWindow = FrontWindow();
  582.     if ( frontWindow == nil )
  583.         return;
  584.         
  585.     if ( IsMyWindow(frontWindow) ) {
  586.         myWinfo = (WindowInfoHandle) GetWRefCon(frontWindow);
  587.     
  588.         tr.value.hiLong = 0;
  589.         tr.value.loLong = 0;
  590.         tr.base = 0;
  591.         tr.scale = GetMovieTimeScale((**myWinfo).theMovie);
  592.         MCDoAction((**myWinfo).theMC, mcActionSetSelectionBegin, &tr);
  593.         tr.value.loLong = GetMovieDuration((**myWinfo).theMovie);
  594.         MCDoAction((**myWinfo).theMC, mcActionSetSelectionDuration, &tr);
  595.     }
  596. }
  597.