void handleMenuSelection(long result) { int menuID, menuItem; RgnHandle rgnHandle = NewRgn(); menuID = HiWord(result); menuItem = LoWord(result); if (menuID == FILE_MENU) { if (menuItem == FILE_SAVE) saveToPICTFile(); else if (menuItem == FILE_QUIT) gDone = true; else if (menuItem == FILE_CLOSE) { DisposeWindow(FrontWindow()); if (FrontWindow() == NULL) gDone = true; } else if (menuItem == FILE_NEW) { } else if (menuItem == FILE_REFRESH) { createImage(); drawImage(FrontWindow()); QDFlushPortBuffer(GetWindowPort(FrontWindow()), GetPortVisibleRegion(GetWindowPort(FrontWindow()), rgnHandle)); } } HiliteMenu(0); DisposeRgn(rgnHandle); }
/* set the controls in the TextEdit window correctly */ void NATEsetscroll(na_win *winp, Boolean moved, Rect *hrect, Rect *vrect) { short vmax, vvalue, hmax, hvalue; TEPtr te = *teinfo->hTE; ControlHandle vctrl, hctrl; vmax = te->nLines + (*(*te->hText + te->teLength - 1) == '\015' ? 1 : 0) - (te->viewRect.bottom - te->viewRect.top) / teinfo->lheight; hmax = (short) teinfo->docwidth - (te->viewRect.right - te->viewRect.left); if (vmax < 0) vmax = 0; if (hmax < 0) hmax = 0; vvalue = (te->viewRect.top - te->destRect.top) / teinfo->lheight; hvalue = te->viewRect.left - te->destRect.left; if (!(winp->flags & NATE_NOVSCROLL)) { if (teinfo->vctrl == (ControlHandle) NULL) { teinfo->vctrl = NewControl(winp->pwin, vrect, "\p", true, vvalue, 0, vmax, scrollBarProc, 0); if (winp->pwin != FrontWindow()) HiliteControl(teinfo->vctrl, 255); } else { if (vvalue < 0) vvalue = 0; if (vvalue > vmax) vvalue = vmax; SetCtlMax(vctrl = teinfo->vctrl, vmax); SetCtlValue(vctrl, vvalue); if (moved) { MoveControl(vctrl, vrect->left, vrect->top); SizeControl(vctrl, vrect->right - vrect->left, vrect->bottom - vrect->top); ShowControl(vctrl); } } } if (!(winp->flags & NATE_NOHSCROLL)) { if (teinfo->hctrl == (ControlHandle) NULL) { teinfo->hctrl = NewControl(winp->pwin, hrect, "\p", true, hvalue, 0, hmax, scrollBarProc, 0); if (winp->pwin != FrontWindow()) HiliteControl(teinfo->hctrl, 255); } else { if (hvalue < 0) hvalue = 0; if (hvalue > hmax) hvalue = hmax; SetCtlMax(hctrl = teinfo->hctrl, hmax); SetCtlValue(hctrl, hvalue); if (moved) { MoveControl(hctrl, hrect->left, hrect->top); SizeControl(hctrl, hrect->right - hrect->left, hrect->bottom - hrect->top); ShowControl(hctrl); } } } }
static void mac_adjustmenus(void) { WindowPtr window; MenuHandle menu; window = FrontWindow(); menu = GetMenuHandle(mApple); EnableItem(menu, 0); EnableItem(menu, iAbout); menu = GetMenuHandle(mFile); EnableItem(menu, 0); EnableItem(menu, iNew); if (window != NULL) EnableItem(menu, iClose); else DisableItem(menu, iClose); EnableItem(menu, iQuit); if (mac_wininfo(window)->adjustmenus != NULL) (*mac_wininfo(window)->adjustmenus)(window); else { DisableItem(menu, iSave); DisableItem(menu, iSaveAs); menu = GetMenuHandle(mEdit); DisableItem(menu, 0); menu = GetMenuHandle(mWindow); DisableItem(menu, 0); /* Until we get more than 1 item on it. */ } DrawMenuBar(); }
void DoVolume() { short lastAmp=mac_amplitude; //SndCommand theCmd; Point p; SetPortWindowPort(win.ref); GetMouse(&p); /*GlobalToLocal(&p);*/ if( PtInRect(p, &rVol) && FrontWindow()==win.ref ) { mac_amplitude=255*((double)rVol.bottom-10-p.v)/(rVol.bottom-rVol.top-20); if( mac_amplitude<0 ) mac_amplitude=0; if( mac_amplitude>255 ) mac_amplitude=255; if( lastAmp!=mac_amplitude ) { //theCmd.cmd=ampCmd; //theCmd.param1=mac_amplitude; //SndDoImmediate(gSndCannel, &theCmd); mac_setVolume(mac_amplitude); InvalRect(&rVol); } } }
void doMouseDown(EventRecord *eventStrucPtr) { WindowRef windowRef; WindowPartCode partCode, zoomPart; BitMap screenBits; Rect constraintRect, mainScreenRect; Point standardStateHeightAndWidth; long newSize; partCode = FindWindow(eventStrucPtr->where,&windowRef); switch(partCode) { case inMenuBar: break; case inContent: if(windowRef != FrontWindow()) SelectWindow(windowRef); else doInContent(eventStrucPtr,windowRef); break; case inDrag: DragWindow(windowRef,eventStrucPtr->where,NULL); break; case inGoAway: break; case inGrow: constraintRect.top = 75; constraintRect.left = 250; constraintRect.bottom = constraintRect.right = 32767; newSize = GrowWindow(windowRef,eventStrucPtr->where,&constraintRect); if (newSize != 0) SizeWindow(windowRef,LoWord(newSize),HiWord(newSize),true); window_adjust_scrollbars(windowRef); window_invalidate(windowRef); break; case inZoomIn: case inZoomOut: mainScreenRect = GetQDGlobalsScreenBits(&screenBits)->bounds; standardStateHeightAndWidth.v = mainScreenRect.bottom; standardStateHeightAndWidth.h = mainScreenRect.right; if(IsWindowInStandardState(windowRef,&standardStateHeightAndWidth,NULL)) zoomPart = inZoomIn; else zoomPart = inZoomOut; if(TrackBox(windowRef,eventStrucPtr->where,partCode)) { ZoomWindowIdeal(windowRef,zoomPart,&standardStateHeightAndWidth); window_adjust_scrollbars(windowRef); } break; } }
static int HandleMacEvents(void) { EventRecord theEvent; int eventFound = 0, needsUpdate = 0; Point currentMouse; WindowRef windowRef; Rect mouseRect; /* * Check for mouse moved events. These events aren't placed on the * system event queue unless we call WaitNextEvent. */ GetGlobalMouse(¤tMouse); if ((notifier.eventProcPtr != NULL) && !EqualPt(currentMouse, notifier.lastMousePosition)) { notifier.lastMousePosition = currentMouse; theEvent.what = nullEvent; if ((*notifier.eventProcPtr)(&theEvent) == true) { eventFound = 1; } } /* * Check for update events. Since update events aren't generated * until we call GetNextEvent, we may need to force a call to * GetNextEvent, even if the queue is empty. */ for (windowRef = FrontWindow(); windowRef != NULL; windowRef = GetNextWindow(windowRef)) { GetWindowUpdateRgn(windowRef, notifier.utilityRgn); if (!EmptyRgn(notifier.utilityRgn)) { needsUpdate = 1; break; } } /* * Process events from the OS event queue. */ while (needsUpdate || (GetEvQHdr()->qHead != NULL)) { GetGlobalMouse(¤tMouse); SetRect(&mouseRect, currentMouse.h, currentMouse.v, currentMouse.h + 1, currentMouse.v + 1); RectRgn(notifier.utilityRgn, &mouseRect); WaitNextEvent(everyEvent, &theEvent, 5, notifier.utilityRgn); needsUpdate = 0; if ((notifier.eventProcPtr != NULL) && ((*notifier.eventProcPtr)(&theEvent) == true)) { eventFound = 1; } } return eventFound; }
static void mac_config(int midsession) { Session *s; WinInfo *wi; Str255 mactitle; char *str; if (midsession) { s = mac_windowsession(FrontWindow()); } else { s = snew(Session); memset(s, 0, sizeof(*s)); do_defaults(NULL, &s->cfg); s->hasfile = FALSE; s->session_closed = FALSE; } /* Copy the configuration somewhere else in case this is a * * reconfiguration and the user cancels the operation */ s->temp_cfg = s->cfg; if (HAVE_COLOR_QD()) s->settings_window = GetNewCWindow(wSettings, NULL, (WindowPtr)-1); else s->settings_window = GetNewWindow(wSettings, NULL, (WindowPtr)-1); s->ctrlbox = ctrl_new_box(); setup_config_box(s->ctrlbox, midsession, 0, 0); s->settings_ctrls.data = &s->temp_cfg; if (midsession) s->settings_ctrls.end = &mac_enddlg_reconfig; else s->settings_ctrls.end = &mac_enddlg_config; macctrl_layoutbox(s->ctrlbox, s->settings_window, &s->settings_ctrls); wi = snew(WinInfo); memset(wi, 0, sizeof(*wi)); wi->s = s; wi->mcs = &s->settings_ctrls; wi->wtype = wSettings; wi->update = &macctrl_update; wi->click = &macctrl_click; wi->key = &macctrl_key; wi->activate = &macctrl_activate; wi->adjustmenus = &macctrl_adjustmenus; wi->close = &mac_closedlg; SetWRefCon(s->settings_window, (long)wi); if (midsession) str = dupprintf("%s Reconfiguration", appname); else str = dupprintf("%s Configuration", appname); c2pstrcpy(mactitle, str); sfree(str); SetWTitle(s->settings_window, mactitle); ShowWindow(s->settings_window); }
static void GenerateEditEvent( int flag) { XVirtualEvent event; Point where; Tk_Window tkwin; Window window; TkDisplay *dispPtr; if (TkMacHaveAppearance() >= 0x110) { window = TkMacGetXWindow(FrontNonFloatingWindow()); } else { window = TkMacGetXWindow(FrontWindow()); } dispPtr = TkGetDisplayList(); tkwin = Tk_IdToWindow(dispPtr->display, window); tkwin = (Tk_Window) ((TkWindow *) tkwin)->dispPtr->focusPtr; if (tkwin == NULL) { return; } event.type = VirtualEvent; event.serial = Tk_Display(tkwin)->request; event.send_event = false; event.display = Tk_Display(tkwin); event.event = Tk_WindowId(tkwin); event.root = XRootWindow(Tk_Display(tkwin), 0); event.subwindow = None; event.time = TkpGetMS(); GetMouse(&where); tkwin = Tk_TopCoordsToWindow(tkwin, where.h, where.v, &event.x, &event.y); LocalToGlobal(&where); event.x_root = where.h; event.y_root = where.v; event.state = TkMacButtonKeyState(); event.same_screen = true; switch (flag) { case EDIT_CUT: event.name = Tk_GetUid("Cut"); break; case EDIT_COPY: event.name = Tk_GetUid("Copy"); break; case EDIT_PASTE: event.name = Tk_GetUid("Paste"); break; case EDIT_CLEAR: event.name = Tk_GetUid("Clear"); break; } Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); }
// tools void NCarbonWindowManager::DoIdle() { NWindowManager::DoIdle(); WindowRef winFront = FrontWindow(); if(winFront) IdleControls(winFront); }
void pause( void ) { EventRecord event; Str255 saveTitle; if( FrontWindow() ) { GetWTitle( FrontWindow(), saveTitle ); SetWTitle( FrontWindow(), "\p(paused)" ); } do { // wait } while( false == WaitNextEvent( mDownMask + keyDownMask, &event, 0, NULL ) ); if( FrontWindow() ) SetWTitle( FrontWindow(), saveTitle ); }
void doEventLoop() { EventRecord event; WindowPtr window; short clickArea; Rect screenRect; RgnHandle rgnHandle = NewRgn(); for (;;) { if (WaitNextEvent( everyEvent, &event, 0, nil )) { if (event.what == mouseDown) { clickArea = FindWindow( event.where, &window ); if (clickArea == inDrag) { //screenRect = (**GetGrayRgn ()).rgnBBox; GetRegionBounds(GetGrayRgn(), &screenRect); DragWindow( window, event.where, &screenRect ); } else if (clickArea == inContent) { if (window != FrontWindow()) SelectWindow( window ); } else if (clickArea == inGoAway) if (TrackGoAway( window, event.where )) return; } else if (event.what == updateEvt) { window = (WindowPtr)event.message; //SetPort( window ); SetPortWindowPort( window ); BeginUpdate( window ); drawPixelImageData(); EndUpdate( window ); QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle)); } else if (event.what == activateEvt) { /*if (event.modifiers & activeFlag) { window = (WindowPtr)event.message; SetPortWindowPort(window); drawPixelImageData(); QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle)); }*/ /*if (event.modifiers & activeFlag) PostEvent(updateEvt, (unsigned long)gWindow);*/ } } } DisposeRgn(rgnHandle); }
static void ProcessEvent () { EventRecord myEvent; WindowPtr whichWindow; /* do system tasks */ SystemTask(); /* get event */ if (GetNextEvent(everyEvent,&myEvent)) { switch (myEvent.what) { case mouseDown : switch (FindWindow(myEvent.where,&whichWindow)) { case inSysWindow : SystemClick(&myEvent,whichWindow); break; case inMenuBar : DoCommand(MenuSelect(myEvent.where)); break; case inDrag : DragWindow(whichWindow,myEvent.where,&dragRect); break; case inContent : if (whichWindow!=FrontWindow()) SelectWindow(whichWindow); else { /*DoContentClick(whichWindow,&myEvent);*/ } break; case inGrow : /*DoGrowWindow(whichWindow,&myEvent);*/ break; case inGoAway : /*DoGoAway(whichWindow,&myEvent);*/ break; } break; /* mouseDown */ case keyDown : case autoKey : DoKey(&myEvent); break; case activateEvt : /*DoActivate(&myEvent);*/ break; case updateEvt : whichWindow = (WindowPtr) myEvent.message; /*DoUpdate(whichWindow,&myEvent);*/ break; } } } /* ProcessEvent */
void doEventLoop() { EventRecord anEvent; WindowPtr evtWind; short clickArea; Rect screenRect; Point thePoint; Rect zoomFrom, zoomTo; zoomFrom.top = zoomTo.top = -1; while (!gDone) { if (WaitNextEvent( everyEvent, &anEvent, 0, nil )) { if (anEvent.what == mouseDown) { clickArea = FindWindow( anEvent.where, &evtWind ); if (clickArea == inDrag) { GetRegionBounds( GetGrayRgn(), &screenRect ); DragWindow( evtWind, anEvent.where, &screenRect ); } else if (clickArea == inContent) { if (evtWind != FrontWindow()) SelectWindow( evtWind ); else { thePoint = anEvent.where; GlobalToLocal( &thePoint ); //Handle click in window content here GetRect(&zoomFrom, &zoomTo); } } else if (clickArea == inGoAway) if (TrackGoAway( evtWind, anEvent.where )) gDone = true; } else if (anEvent.what == updateEvt) { evtWind = (WindowPtr)anEvent.message; SetPortWindowPort( evtWind ); BeginUpdate( evtWind ); //Call Draw Function here.... if (zoomFrom.top != -1) FrameRect(&zoomFrom); if (zoomTo.top != -1) FrameRect(&zoomTo); EndUpdate (evtWind); } } } }
void disposedirwindow (WindowPtr wp) { SendBehind (g_hotband, (WindowPtr) 0); if ((**g_selection)[0] != 0 && (*(**g_selection)[0])->contrlOwner == wp) (**g_selection)[0] = 0; DisposHandle ((*(opendirinfo **) ((WindowPeek) wp)->refCon)->path); DisposeWindow (wp); showviewmenu (FrontWindow () != g_hotband); }
static int MyConvertEvent(EventRecord *event) { if (SIOUXIsAppWindow(FrontWindow())) { if (SIOUXHandleOneEvent(event)) return 0; return TkMacConvertEvent(event); } else { if (TkMacConvertEvent(event)) return 1; SIOUXHandleOneEvent(event); return 0; } }
void mac_savesession(void) { Session *s = mac_windowsession(FrontWindow()); void *sesshandle; assert(s->hasfile); sesshandle = open_settings_w_fsp(&s->savefile); if (sesshandle == NULL) return; /* XXX report error */ save_open_settings(sesshandle, &s->cfg); close_settings_w(sesshandle); }
/* * Like FrontWindow(), but return NULL if we aren't the front process * (i.e. the front window isn't one of ours). */ WindowPtr mac_frontwindow(void) { ProcessSerialNumber frontpsn; ProcessSerialNumber curpsn = { 0, kCurrentProcess }; Boolean result; GetFrontProcess(&frontpsn); if (SameProcess(&frontpsn, &curpsn, &result) == noErr && result) return FrontWindow(); return NULL; }
P1(PUBLIC pascal trap, BOOLEAN, SystemEvent, EventRecord *, evp) { BOOLEAN retval; WindowPeek wp; INTEGER rn; DCtlHandle dctlh; LONGINT templ; if (SEvtEnb) { wp = 0; switch (evp->what) { default: case CWC(nullEvent): case CWC(mouseDown): case CWC(networkEvt): case CWC(driverEvt): case CWC(app1Evt): case CWC(app2Evt): case CWC(app3Evt): case CWC(app4Evt): break; case CWC(mouseUp): case CWC(keyDown): case CWC(keyUp): case CWC(autoKey): wp = (WindowPeek) FrontWindow(); break; case CWC(updateEvt): case CWC(activateEvt): wp = (WindowPeek) MR(evp->message); break; case CWC(diskEvt): /* NOTE: I think the code around toolevent.c:277 should really be here. I'm not going to get all excited about it right now though. */ break; } if (wp) { rn = WINDOW_KIND (wp); if ((retval = rn < 0)) { dctlh = rntodctlh(rn); if (Hx(dctlh, dCtlEMask) & (1 << CW(evp->what))) { templ = (LONGINT) (long) RM(evp); Control(rn, accEvent, (Ptr) &templ); } } } else retval = FALSE; } else retval = FALSE; return retval; }
long whats_on_top( void) { WindowPtr window= FrontWindow(); /* FLOATS */ if (window) { return GetWRefCon(window); } return NONE; }
NWindow* NCarbonWindowManager::GetFrontWindow() const { WindowRef winFront = FrontWindow(); if(winFront) { NUInt32 wRef = GetWRefCon(winFront); if(NObject::CheckValidNObject(wRef)) return (NWindow*)wRef; } return NULL; }
void close_front_window( void) { WindowPtr wp; if((wp= FrontWindow()) != NULL) { handle_close(wp); } return; }
void mac_dupsession(void) { Session *s1 = mac_windowsession(FrontWindow()); Session *s2; s2 = snew(Session); memset(s2, 0, sizeof(*s2)); s2->cfg = s1->cfg; s2->hasfile = s1->hasfile; s2->savefile = s1->savefile; mac_startsession(s2); }
P1(PUBLIC pascal trap, BOOLEAN, SystemEdit, INTEGER, editcmd) { WindowPeek wp; BOOLEAN retval; wp = (WindowPeek) FrontWindow(); if (!wp) retval = FALSE; else if ((retval = WINDOW_KIND (wp) < 0)) Control (WINDOW_KIND (wp), editcmd + accUndo, (Ptr) 0); return retval; }
/* * Handle a key press */ static void mac_keypress(EventRecord *event) { WindowPtr window; window = FrontWindow(); if (event->what == keyDown && (event->modifiers & cmdKey)) { mac_adjustmenus(); mac_menucommand(MenuKey(event->message & charCodeMask)); } else { if (mac_wininfo(window)->key != NULL) (*mac_wininfo(window)->key)(window, event); } }
static pascal void MyPrivateEventProc( const NavEventCallbackMessage callbackSelector, NavCBRecPtr callbackParms, NavCallBackUserData callbackUD ) { switch ( callbackSelector ) { case kNavCBEvent: { switch (callbackParms->eventData.eventDataParms.event->what) { case updateEvt: case activateEvt: HandleEvent(callbackParms->eventData.eventDataParms.event); break; } } break; case kNavCBUserAction: { if ( callbackParms->userAction == kNavUserActionOpen ) { // This is an open files action, send an AppleEvent NavReplyRecord reply; OSStatus status; status = NavDialogGetReply( callbackParms->context, &reply ); if ( status == noErr ) { SendOpenAE( reply.selection ); NavDisposeReply( &reply ); } } } break; case kNavCBTerminate: { if ( callbackParms->context == gOpenFileDialog ) { NavDialogDispose( gOpenFileDialog ); gOpenFileDialog = NULL; } // if after dismissing the dialog SimpleText has no windows open (so Activate event will not be sent) - // call AdjustMenus ourselves to have at right menus enabled if (FrontWindow() == nil) AdjustMenus(nil, true, false); } break; } }
void handle_quit( void) { WindowPtr wp; NMBoolean cancelled= false; while((wp= FrontWindow())!= NULL) { cancelled= handle_close(wp); if(cancelled) break; } if(!cancelled) quitting= true; }
/* * Make sure the right cursor's being displayed. */ static void mac_adjustcursor(RgnHandle cursrgn) { Point mouse; WindowPtr window, front; short part; #if TARGET_API_MAC_CARBON Cursor arrow; RgnHandle visrgn; #endif GetMouse(&mouse); LocalToGlobal(&mouse); part = FindWindow(mouse, &window); front = FrontWindow(); if (part != inContent || window == NULL || window != front) { /* Cursor isn't in the front window, so switch to arrow */ #if TARGET_API_MAC_CARBON GetQDGlobalsArrow(&arrow); SetCursor(&arrow); #else SetCursor(&qd.arrow); #endif SetRectRgn(cursrgn, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX); if (front != NULL) { #if TARGET_API_MAC_CARBON visrgn = NewRgn(); GetPortVisibleRegion(GetWindowPort(front), visrgn); DiffRgn(cursrgn, visrgn, cursrgn); DisposeRgn(visrgn); #else DiffRgn(cursrgn, front->visRgn, cursrgn); #endif } } else { if (mac_wininfo(window)->adjustcursor != NULL) (*mac_wininfo(window)->adjustcursor)(window, mouse, cursrgn); else { #if TARGET_API_MAC_CARBON GetQDGlobalsArrow(&arrow); SetCursor(&arrow); GetPortVisibleRegion(GetWindowPort(window), cursrgn); #else SetCursor(&qd.arrow); CopyRgn(window->visRgn, cursrgn); #endif } } }
void doEventLoop() { EventRecord anEvent; WindowPtr evtWind; short clickArea; Rect screenRect; while (!gDone) { if (WaitNextEvent( everyEvent, &anEvent, 0, nil )) { if (anEvent.what == mouseDown) { clickArea = FindWindow( anEvent.where, &evtWind ); if (clickArea == inMenuBar) handleMenuSelection(MenuSelect(anEvent.where)); else if (clickArea == inDrag) { //screenRect = (**GetGrayRgn ()).rgnBBox; GetRegionBounds(GetGrayRgn(), &screenRect); DragWindow( evtWind, anEvent.where, &screenRect ); } else if (clickArea == inContent) { if (evtWind != FrontWindow()) SelectWindow( evtWind ); } else if (clickArea == inGoAway) if (TrackGoAway( evtWind, anEvent.where )) gDone = true; } else if (anEvent.what == updateEvt) { evtWind = (WindowPtr)anEvent.message; //SetPort( evtWind ); SetPortWindowPort( evtWind ); BeginUpdate( evtWind ); drawImage( evtWind ); EndUpdate (evtWind); } else if (anEvent.what == autoKey || anEvent.what == keyDown) handleKeyPress(&anEvent); } } }
static void mac_menucommand(long result) { short menu, item; WindowPtr window; #if !TARGET_API_MAC_CARBON Str255 da; #endif menu = HiWord(result); item = LoWord(result); window = FrontWindow(); /* Things which do the same whatever window we're in. */ switch (menu) { case mApple: switch (item) { case iAbout: mac_openabout(); goto done; #if !TARGET_API_MAC_CARBON default: GetMenuItemText(GetMenuHandle(mApple), item, da); OpenDeskAcc(da); goto done; #endif } break; case mFile: switch (item) { case iNew: mac_newkey(); goto done; case iClose: mac_closewindow(window); goto done; case iQuit: cleanup_exit(0); goto done; } break; } /* If we get here, handling is up to window-specific code. */ if (mac_wininfo(window)->menu != NULL) (*mac_wininfo(window)->menu)(window, menu, item); done: HiliteMenu(0); }
OSErr DoPlayMovie(Boolean useOverlay) { Rect movieBounds; OSErr err; BailErr((err = GetAMovieFile(&mMovie))); GetMovieBox(mMovie, &movieBounds); mMovieController = NewMovieController(mMovie, &movieBounds, mcTopLeftMovie | mcNotVisible); NormalizeMovieRect(mMovie); GetMovieBox(mMovie, &movieBounds); BailErr((err = InitializeMungData(movieBounds, FrontWindow(), useOverlay, /* overlay */ true, /* clamp */ false /* draw with QT Effect */ ))); // This is key, as we need to draw all frames in our // offscreen gworld first. Once there, our custom // decompressor component can perform overlay drawing // or color clamping SetMovieGWorld(mMovie, GetMungDataOffscreen(), nil); // Our DrawCompleteProc calls BlitOneMungData which SetupMovieDrawCompleteProc(); // --------- SetMovieActive(mMovie, true); #ifndef __APPLE_CC__ // Due to a bug in Jaguar, some QT functions are missing from // /System/Library/CFMSupport/CarbonLib, so we must manually // grab the function pointers from the QuickTime.framework // for CFM Carbon applications. MachO Carbon applications do not // have the problem. GetMissingQTFunctionPointers(); #endif InstallMovieIdlingEventLoopTimer(&mMovieTimerState); // start the movie playing MCDoAction(mMovieController, mcActionPrerollAndPlay, (void*)Long2Fix(1)); bail: return err; }