Exemple #1
0
// ****************************************************************************
//
//  Function Name:	RWindowView::OnAutoScrollTimer( )
//
//  Description:		Called by the autoscroll timer when its timer elapses
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RWindowView::OnAutoScrollTimer( )
	{
	// Get the modifier key state
	YModifierKey modifierKeys = GetModifierKeyState( );

	// Get the current mouse position in both device coordinates and local coordinates
#ifdef _WINDOWS
	POINT	pt;
	::GetCursorPos( &pt );
	GetCWnd( ).ScreenToClient( &pt );
	RRealPoint devicePoint = RRealPoint( pt.x, pt.y );
	RRealPoint localPoint = devicePoint;
	::DeviceUnitsToLogicalUnits( localPoint, *this );
	localPoint = ConvertPointToLocalCoordinateSystem( localPoint );
#endif

	// Get the direction to autoscroll
	EDirection autoScrollDirection = GetAutoScrollDirection( localPoint );

	// If the left button is no longer down, or we are not moving in the same direction,
	// kill the timer.
	if( !( IsMouseCaptured() /*modifierKeys & kModifierLeftButton*/ ) || !( autoScrollDirection & m_AutoScrollDirection ) )
		{
		delete m_pAutoScrollTimer;
		m_pAutoScrollTimer = 0;
		}

	// Otherwise, we are good to autoscroll. Simulate a mouse move event
	else
		OnXMouseMessage( kMouseMove, devicePoint, modifierKeys );
	}
Exemple #2
0
// ****************************************************************************
//
//  Function Name:	RSingleSelection::GetRotateHandleCenterPoint( )
//
//  Description:		Retrieves the center point of the rotate handle
//
//  Returns:			See above
//
//  Exceptions:		Nothing
//
// ****************************************************************************
//
RRealPoint RSingleSelection::GetRotateHandleCenterPoint( ) const
	{
	// Get the bounding rect and center point
	YSelectionBoundingRect boundingRect;
	GetSelectionBoundingRect( boundingRect );
	RRealPoint centerPoint = boundingRect.GetCenterPoint( );

	// We are going to use ratios of similar triangles to calculate the position of the rotate handle
	YRealDimension deltaX = boundingRect.m_BottomRight.m_x - boundingRect.m_BottomLeft.m_x;
	YRealDimension deltaY = boundingRect.m_BottomRight.m_y - boundingRect.m_BottomLeft.m_y;

	YRealDimension deltaXPrime = deltaX * ( 0.5 + kRotateHandleLineLengthRatio );
	YRealDimension deltaYPrime = deltaY * ( 0.5 + kRotateHandleLineLengthRatio );

	return RRealPoint( centerPoint.m_x + deltaXPrime, centerPoint.m_y + deltaYPrime );
	}