Commit 2aef11a5 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Made rotate & flip tool actions generic.

Drawing tool reacts to rotate & flip events while placing a text.
parent 4b277784
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -41,11 +41,11 @@ TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
        AS_GLOBAL, 'M',
        AS_GLOBAL, 'M',
        "Move", "Moves the selected item(s)" );
        "Move", "Moves the selected item(s)" );


TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.InteractiveEdit.rotate",
TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.rotate",
        AS_CONTEXT, 'R',
        AS_CONTEXT, 'R',
        "Rotate", "Rotates selected item(s)" );
        "Rotate", "Rotates selected item(s)" );


TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.flip",
        AS_CONTEXT, 'F',
        AS_CONTEXT, 'F',
        "Flip", "Flips selected item(s)" );
        "Flip", "Flips selected item(s)" );


+14 −0
Original line number Original line Diff line number Diff line
@@ -374,6 +374,20 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent )
            break;
            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 ) )
        else if( evt->IsClick( BUT_LEFT ) )
        {
        {
            newText->ClearFlags();
            newText->ClearFlags();