Exemplo n.º 1
0
/*
 * 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
	}
    }
}
Exemplo n.º 2
0
// --------------------------------------------------------------------------------------------------------------
OSStatus DoPageSetup(WindowRef window, void *docDataP)
{
    OSStatus		err = noErr;

    if(docDataP){
        PMPrintSession printSession;
        PMPageFormat pageFormat = NULL;
        err = PMCreateSession(&printSession);
        if(!err){
            Boolean accepted;
            err = MySetupPageFormatForPrinting(printSession, docDataP, &pageFormat);
            if(!err){
                Cursor arrow;
                SetCursor(GetQDGlobalsArrow(&arrow));
                err = PMSessionUseSheets(printSession, window, gMyPageSetupDoneProc);             
                if(!err)
                    err = PMSessionPageSetupDialog(printSession, pageFormat, &accepted);
		// when using sheets, the value of accepted returned here is irrelevant
		// since it is our sheet done proc that is called when the dialog is dismissed
            }
            if(err){	// only if there is an error do we release the session
                        // otherwise we'll do that in our sheet done proc
                (void)PMRelease(printSession);
            }
	}
    }
    DoErrorAlert(err, kMyPrintErrorFormatStrKey);
    return err;
} // DoPageSetup
Exemplo n.º 3
0
void QTApp_Idle (WindowReference theWindow)
{
	WindowObject 		myWindowObject = NULL;
	GrafPtr 			mySavedPort;
	
	GetPort(&mySavedPort);
	MacSetPort(QTFrame_GetPortFromWindowReference(theWindow));
	
	myWindowObject = QTFrame_GetWindowObjectFromWindow(theWindow);
	if (myWindowObject != NULL) {
		MovieController		myMC = NULL;
	
		myMC = (**myWindowObject).fController;
		if (myMC != NULL) {
			
			// run any idle-time tasks for the movie
			
#if TARGET_OS_MAC
			// restore the cursor to the arrow
			// if it's outside the front movie window or outside the window's visible region
			if (theWindow == QTFrame_GetFrontMovieWindow()) {
				Rect			myRect;
				Point			myPoint;
				RgnHandle		myVisRegion;
				Cursor			myArrow;
				
				GetMouse(&myPoint);
				myVisRegion = NewRgn();
				GetPortVisibleRegion(QTFrame_GetPortFromWindowReference(theWindow), myVisRegion);
				GetWindowPortBounds(theWindow, &myRect);
				if (!MacPtInRect(myPoint, &myRect) || !PtInRgn(myPoint, myVisRegion))
					MacSetCursor(GetQDGlobalsArrow(&myArrow));
					
				DisposeRgn(myVisRegion);
			}
#endif // TARGET_OS_MAC
		}
	}
	
	// grant the sequence grabber some processor time
	if (gSeqGrabber != NULL)
		SGIdle(gSeqGrabber);

	MacSetPort(mySavedPort);
}
Exemplo n.º 4
0
void QTApp_Idle (WindowReference theWindow)
{
	WindowObject 		myWindowObject = NULL;
	GrafPtr 			mySavedPort;
	
	GetPort(&mySavedPort);
	MacSetPort(QTFrame_GetPortFromWindowReference(theWindow));
	
	myWindowObject = QTFrame_GetWindowObjectFromWindow(theWindow);
	if (myWindowObject != NULL) {
		MovieController		myMC = NULL;
	
		myMC = (**myWindowObject).fController;
		if (myMC != NULL) {
			
			// run any idle-time tasks for the movie
			
#if TARGET_OS_MAC
			// restore the cursor to the arrow
			// if it's outside the front movie window or outside the window's visible region
			if (theWindow == QTFrame_GetFrontMovieWindow()) {
				Rect			myRect;
				Point			myPoint;
				RgnHandle		myVisRegion;
				Cursor			myArrow;
				
				GetMouse(&myPoint);
				myVisRegion = NewRgn();
				GetPortVisibleRegion(QTFrame_GetPortFromWindowReference(theWindow), myVisRegion);
				GetWindowPortBounds(theWindow, &myRect);
				if (!MacPtInRect(myPoint, &myRect) || !PtInRgn(myPoint, myVisRegion))
					MacSetCursor(GetQDGlobalsArrow(&myArrow));
					
				DisposeRgn(myVisRegion);
			}
#endif // TARGET_OS_MAC
		}
		
		// see whether the user has added a text track behind our backs (e.g. by pasting some text)
		QTText_SyncWindowData(myWindowObject);
	}
	
	MacSetPort(mySavedPort);
}
Exemplo n.º 5
0
void AboutBox::Idle()
{
	if (mKillMe) return;
	
	// if cursor is over the URL pane, go to click cursor
	Point p;
	GetMouse( &p );
	if (PtInRect( p, &mUrlPane->mFrame )) {
		if (mHandCursor) SetCursor(*mHandCursor);
		else {
			mHandCursor = GetCursor(kHandCursorID);
		}
	}
	else {
	  #if TARGET_API_MAC_CARBON
		Cursor arrow;
		::SetCursor(GetQDGlobalsArrow(&arrow));
	  #else
		::SetCursor(&qd.arrow);
	  #endif
	}
	
}
Exemplo n.º 6
0
static void process_event(
	EventRecord *event)
{
	WindowPtr window;
	short part_code;
	Rect size_rect;
	long new_size;
	GrafPtr old_port;

	switch(event->what)
	{
		case kHighLevelEvent:
				AEProcessAppleEvent(event);
			break;
	
		case mouseDown:
			/* Did we hit one of the floaters? */
			part_code= FindWindow(event->where, &window);
			
			switch (part_code)
			{
				case inSysWindow:
					break;
					
				case inMenuBar:
					do_menu_command(MenuSelect(event->where));
					break;
					
				case inContent:
					if(window != FrontWindow())
						SelectWindow(window);
					click_in_log_window(window,event->where,(event->modifiers & shiftKey) != 0);
					break;

				case inDrag:
			#ifdef OP_PLATFORM_MAC_CARBON_FLAG
					{
						Rect	tempRect;
						GetRegionBounds(GetGrayRgn(), &tempRect);
						DragWindow(window, event->where, &tempRect);
					}
					#else
						DragWindow(window, event->where, &qd.screenBits.bounds);
					#endif
					break;

				case inGrow:
			#ifdef OP_PLATFORM_MAC_CARBON_FLAG
						GetRegionBounds(GetGrayRgn(), &size_rect);
					#else
						size_rect = qd.screenBits.bounds;
					#endif
					InsetRect(&size_rect, 4, 4);
					new_size= GrowWindow(window, event->where, &size_rect);
					if(new_size) 
					{
						/* Resize the window */
						SizeWindow(window, LoWord(new_size), HiWord(new_size), true);
					}
					break;

				case inGoAway:
					if(TrackGoAway(window, event->where)) 
					{
						/* Close the window... */
						handle_close(window);
					}
					break;

				case inZoomIn:
				case inZoomOut:
					if(TrackBox(window, event->where, part_code)) 
					{
						GetPort(&old_port);
						SetPortWindowPort(window);
					#ifdef OP_PLATFORM_MAC_CARBON_FLAG
						{
							Rect windowBounds;
                                                
							GetWindowPortBounds(window, &windowBounds);
							EraseRect(&windowBounds);
						}
						#else
							EraseRect(&window->portRect);
						#endif
						
						ZoomWindow(window, part_code, true);
						SetPort(old_port);
					}
					break;
			}
			break;
		
		case keyDown:
		case autoKey:
			if(!process_key(event, event->message&charCodeMask))
			{
				/* Not handled by anyone.. */
				SysBeep(-1);
			}
			break;
			
		case updateEvt:
			/* Update the window.. */
			update_window((WindowPtr)event->message);
			break;
			
		case activateEvt:
			/* Activate event->message, event->modifiers&activeFlag.. */
			break;

		case osEvt:
			switch ((event->message>>24) & 0xff)
			{
				case suspendResumeMessage:
					if (event->message&resumeFlag)
					{
						/* resume */
					#ifdef OP_PLATFORM_MAC_CARBON_FLAG
						{
							Cursor		arrowCursor;
							SetCursor(GetQDGlobalsArrow(&arrowCursor));
						}
						#else
							SetCursor(&qd.arrow);
						#endif
					}
					else
					{
						/* suspend */
					}
					break;

				case mouseMovedMessage:
					break;
 			}
			break;
	}

	return;
}