Exemplo n.º 1
0
// ****************************************************************************
//
//  Function Name:	RDragSelectionTracker::GetFeedbackBoundingRect( )
//
//  Description:		Returns the feedback bounding rect
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
RRealRect RDragSelectionTracker::GetFeedbackBoundingRect( const RRealPoint& point ) const
	{
	// Get the view transform
	R2dTransform transform;
	m_pView->GetViewTransform( transform, TRUE );

	// Get the bounding rect, in device units
	RRealRect boundingRect = m_pSelection->GetDragTrackingFeedbackBoundingRect( transform, point - m_TrackingMouseDownPoint );

	// Convert back to logical units
	transform.Invert( );
	return boundingRect * transform;
	}
Exemplo n.º 2
0
// ****************************************************************************
//
//  Function Name:	RResizeSelectionTracker::GetFeedbackBoundingRect( )
//
//  Description:		Returns the feedback bounding rect
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
RRealRect RResizeSelectionTracker::GetFeedbackBoundingRect( const RRealPoint& point ) const
	{
	// Get the view transform
	R2dTransform transform;
	m_pView->GetViewTransform( transform, TRUE );

	RRealSize scaleFactor = CalcScaleFactor( point );

	RRealRect boundingRect = m_pSelection->GetResizeTrackingFeedbackBoundingRect( transform, m_ScalingCenter, scaleFactor, m_fMaintainAspectRatio );

	// Convert back to logical units
	transform.Invert( );
	return boundingRect * transform;
	}
Exemplo n.º 3
0
// ****************************************************************************
//
//  Function Name:	RBreakGroupAction::Undo( )
//
//  Description:		Undoes the action
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RBreakGroupAction::Undo( )
	{
	// Call the base method to setup the state properly
	RUndoableAction::Undo( );

	// Add the group component
	m_pParentDocument->AddComponent( m_pGroupDocument );

	// Unselect the current selection
	m_pCurrentSelection->UnselectAll( );

	// Go through all components in the selection
	RCompositeSelection::YIterator iterator = m_OldSelection.Start( );
	for( ; iterator != m_OldSelection.End( ); ++iterator )
		{
		// Get the component document
		RComponentDocument* pComponentDocument = dynamic_cast<RComponentDocument*>( ( *iterator )->GetRDocument( ) );
		TpsAssert( pComponentDocument, "Invalid document." );

		// Remove the component from its current document
		m_pParentDocument->RemoveComponent( pComponentDocument );

		// NULL out the views parent
		( *iterator )->SetParentView( NULL );

		// Add it to the group component
		m_pGroupDocument->AddComponent( pComponentDocument );

		// Move the component back to the groups coordinate space
		R2dTransform transform = m_pGroupView->GetBoundingRect( ).GetTransform( );
		transform.Invert( );
		YComponentBoundingRect temp = ( *iterator )->GetBoundingRect( );
		temp *= transform;
		( *iterator )->SetBoundingRect( temp );
		}

	//	Update the view that its layout has changed
	m_pCurrentSelection->GetView()->XUpdateAllViews( kLayoutChanged, 0 );

	// Select the group component
	m_pCurrentSelection->Select( m_pGroupDocument, TRUE );
	}
Exemplo n.º 4
0
// ****************************************************************************
//
//  Function Name:	RWindowView::GetCursorPosition( )
//
//  Description:		Gets the current cursor position within this view
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
RRealPoint RWindowView::GetCursorPosition( ) const
	{
	// Get the absolute cursor position
	POINT	pt;
	::GetCursorPos( &pt );

	// Convert to client coordinates
	GetCWnd( ).ScreenToClient( &pt );
	RRealPoint cursorPosition( pt.x, pt.y );

	// Convert to logical units
	::DeviceUnitsToLogicalUnits( cursorPosition, *this );

	// Get our transform
 	R2dTransform transform;
	ApplyTransform( transform, FALSE, FALSE );

	// Invert the transform and convert the point to our coordinate system
	transform.Invert( );
	return cursorPosition * transform;
	}
Exemplo n.º 5
0
// ****************************************************************************
//
//  Function Name:	RRotateSelectionTracker::GetFeedbackBoundingRect( )
//
//  Description:		Returns the feedback bounding rect
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
RRealRect RRotateSelectionTracker::GetFeedbackBoundingRect( const RRealPoint& point ) const
	{
	// Get the view transform
	R2dTransform transform;
	m_pView->GetViewTransform( transform, TRUE );

	// Calculate the angle
	YAngle angle = CalcAngle( point );

	// Get the bounding rect, in device units
	RRealRect boundingRect = m_pSelection->GetRotateTrackingFeedbackBoundingRect( transform, m_TrackingRotationCenter, angle );

	// Convert back to logical units
	transform.Invert( );
	boundingRect *= transform;

	// Add the feedback line
	boundingRect.AddPointToRect( point );

	return boundingRect;
	}