Made rotate & flip tool actions generic.

Drawing tool reacts to rotate & flip events while placing a text.
This commit is contained in:
Maciej Suminski 2014-02-10 17:08:55 +01:00
parent 4b27778451
commit 2aef11a5fc
2 changed files with 16 additions and 2 deletions

View File

@ -41,11 +41,11 @@ TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
AS_GLOBAL, 'M',
"Move", "Moves the selected item(s)" );
TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.InteractiveEdit.rotate",
TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.rotate",
AS_CONTEXT, 'R',
"Rotate", "Rotates selected item(s)" );
TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.flip",
AS_CONTEXT, 'F',
"Flip", "Flips selected item(s)" );

View File

@ -374,6 +374,20 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent )
break;
}
else if( evt->Category() == TC_COMMAND )
{
if( evt->IsAction( &COMMON_ACTIONS::rotate ) )
{
newText->Rotate( newText->GetPosition(), getEditFrame<PCB_EDIT_FRAME>()->GetRotationAngle() );
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
else if( evt->IsAction( &COMMON_ACTIONS::flip ) )
{
newText->Flip( newText->GetPosition() );
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
}
else if( evt->IsClick( BUT_LEFT ) )
{
newText->ClearFlags();