Added VIEW::ToWorld( double ).

TOOL_EVENT message is supposed to contain string as parameter.
Added missing header for class_drawsegment.h (KiROUND).
Renamed SELECTION_TOOL::containsSelected() to SELECTION_TOOL::selectionContains().
This commit is contained in:
Maciej Suminski 2014-02-27 16:13:27 +01:00
parent a42a83a394
commit e6598e9d41
7 changed files with 23 additions and 6 deletions

View File

@ -204,6 +204,14 @@ VECTOR2D VIEW::ToWorld( const VECTOR2D& aCoord, bool aAbsolute ) const
}
double VIEW::ToWorld( double aSize ) const
{
const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
return matrix.GetScale().x * aSize;
}
VECTOR2D VIEW::ToScreen( const VECTOR2D& aCoord, bool aAbsolute ) const
{
const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix();

View File

@ -189,7 +189,7 @@ public:
m_scope( aScope ),
m_mouseButtons( 0 )
{
if( aCategory == TC_COMMAND )
if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE )
m_commandStr = aExtraParam;
}
@ -317,7 +317,7 @@ public:
if( !( m_actions & aEvent.m_actions ) )
return false;
if( m_category == TC_COMMAND )
if( m_category == TC_COMMAND || m_category == TC_MESSAGE )
{
if( m_commandStr && aEvent.m_commandStr )
return *m_commandStr == *aEvent.m_commandStr;

View File

@ -232,6 +232,14 @@ public:
*/
VECTOR2D ToWorld( const VECTOR2D& aCoord, bool aAbsolute = true ) const;
/**
* Function ToWorld()
* Converts a screen space one dimensional size to a one dimensional size in world
* space coordinates.
* @param aCoord: the size to be converted
*/
double ToWorld( double aSize ) const;
/**
* Function ToScreen()
* Converts a world space point/vector to a point/vector in screen space coordinates.

View File

@ -34,6 +34,7 @@
#include <PolyLine.h>
#include <math_for_graphics.h>
#include <trigo.h>
#include <common.h>
class LINE_READER;

View File

@ -101,7 +101,7 @@ private:
///> Removes and frees a single BOARD_ITEM.
void remove( BOARD_ITEM* aItem );
///> Sets up handlers for various events
///> Sets up handlers for various events.
void setTransitions();
///> The required update flag for modified items

View File

@ -133,7 +133,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
else
{
// Check if dragging has started within any of selected items bounding box
if( containsSelected( evt->Position() ) )
if( selectionContains( evt->Position() ) )
{
// Yes -> run the move tool and wait till it finishes
m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
@ -566,7 +566,7 @@ void SELECTION_TOOL::deselectVisually( BOARD_ITEM* aItem ) const
}
bool SELECTION_TOOL::containsSelected( const VECTOR2I& aPoint ) const
bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
{
const unsigned GRIP_MARGIN = 20;
VECTOR2D margin = getView()->ToWorld( VECTOR2D( GRIP_MARGIN, GRIP_MARGIN ), false );

View File

@ -207,7 +207,7 @@ private:
*
* @return True if the given point is contained in any of selected items' bouding box.
*/
bool containsSelected( const VECTOR2I& aPoint ) const;
bool selectionContains( const VECTOR2I& aPoint ) const;
/// Visual representation of selection box
SELECTION_AREA* m_selArea;