Commit 5d1ec2b2 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Restored invocation of SELECTION_TOOL commands with TOOL_ACTIONs.

parent 5703b7e8
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@

#include <tool/context_menu.h>
#include <tools/common_actions.h>
#include <tools/selection_tool.h>

#include <ratsnest_data.h>

@@ -637,7 +636,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
    BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();

    // Deselect all items
    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );

    getEditFrame<PCB_EDIT_FRAME>()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL,
                                               _( "Interactive Router" ) );
+7 −2
Original line number Diff line number Diff line
@@ -31,17 +31,22 @@
TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
        AS_GLOBAL, 0, "", "" );    // No description, it is not supposed to be shown anywhere

TOOL_ACTION COMMON_ACTIONS::selectionSingle( "pcbnew.InteractiveSelection.Single",
        AS_GLOBAL, 0, "", "" );    // No description, it is not supposed to be shown anywhere

TOOL_ACTION COMMON_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
        AS_GLOBAL, 0, "", "" );    // No description, it is not supposed to be shown anywhere

// Edit tool actions
TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
        AS_GLOBAL, 'M',
        "Move", "Moves the selected item(s)" );

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

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

+6 −0
Original line number Diff line number Diff line
@@ -37,6 +37,12 @@ public:
    /// Activation of the selection tool
    static TOOL_ACTION selectionActivate;

    /// Select a single item under the cursor position
    static TOOL_ACTION selectionSingle;

    /// Clears the current selection
    static TOOL_ACTION selectionClear;

    // Edit Tool
    /// Activation of the edit tool
    static TOOL_ACTION editActivate;
+8 −9
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
#include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h>
#include <router/direction.h>
#include "selection_tool.h"

#include <class_board.h>
#include <class_drawsegment.h>
@@ -103,7 +102,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );

@@ -289,7 +288,7 @@ int DRAWING_TOOL::PlaceTextModule( TOOL_EVENT& aEvent )
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );
    m_controls->SetAutoPan( true );
@@ -394,7 +393,7 @@ int DRAWING_TOOL::PlaceTextPcb( TOOL_EVENT& aEvent )
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );
    m_controls->SetAutoPan( true );
@@ -500,7 +499,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );

@@ -696,7 +695,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
    m_view->Add( &preview );
    preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->SetSnapping( true );
    m_controls->SetAutoPan( true );

@@ -771,7 +770,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );
    m_controls->SetAutoPan( true );
@@ -882,7 +881,7 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous )
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );

@@ -1058,7 +1057,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->GetTool<SELECTION_TOOL>()->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );

+7 −7
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ EDIT_TOOL::EDIT_TOOL() :
bool EDIT_TOOL::Init()
{
    // Find the selection tool, so they can cooperate
    m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );

    if( !m_selectionTool )
    {
@@ -198,7 +198,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
    }

    if( unselect )
        m_selectionTool->ClearSelection();
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );

    RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
    ratsnest->ClearSimple();
@@ -251,7 +251,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
        std::vector<PICKED_ITEMS_LIST*>& undoList = editFrame->GetScreen()->m_UndoList.m_CommandsList;

        // Some of properties dialogs alter pointers, so we should deselect them
        m_selectionTool->ClearSelection();
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
        STATUS_FLAGS flags = item->GetFlags();
        item->ClearFlags();

@@ -328,7 +328,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
        getModel<BOARD>()->GetRatsnest()->Recalculate();

    if( unselect )
        m_selectionTool->ClearSelection();
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );

    m_toolMgr->RunAction( COMMON_ACTIONS::pointEditorUpdate );
    setTransitions();
@@ -382,7 +382,7 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
        getModel<BOARD>()->GetRatsnest()->Recalculate();

    if( unselect )
        m_selectionTool->ClearSelection();
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );

    m_toolMgr->RunAction( COMMON_ACTIONS::pointEditorUpdate );
    setTransitions();
@@ -407,7 +407,7 @@ int EDIT_TOOL::Remove( TOOL_EVENT& aEvent )
    PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();

    // As we are about to remove items, they have to be removed from the selection first
    m_selectionTool->ClearSelection();
    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );

    // Save them
    for( unsigned int i = 0; i < selectedItems.GetCount(); ++i )
@@ -525,7 +525,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION_TOOL::SELECTION& aSelec
bool EDIT_TOOL::makeSelection( const SELECTION_TOOL::SELECTION& aSelection )
{
    if( aSelection.Empty() )                        // Try to find an item that could be modified
        m_selectionTool->SelectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionSingle );

    return !aSelection.Empty();
}
Loading