From 2aef11a5fc8716d5dd6dd4418e0ce702cd71f686 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 10 Feb 2014 17:08:55 +0100 Subject: [PATCH] Made rotate & flip tool actions generic. Drawing tool reacts to rotate & flip events while placing a text. --- pcbnew/tools/common_actions.cpp | 4 ++-- pcbnew/tools/drawing_tool.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/common_actions.cpp b/pcbnew/tools/common_actions.cpp index 44217508bc..0878657b1f 100644 --- a/pcbnew/tools/common_actions.cpp +++ b/pcbnew/tools/common_actions.cpp @@ -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)" ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index d658f3c23d..9950ea65e9 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -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()->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();