Commit 62e2537e authored by Maciej Suminski's avatar Maciej Suminski
Browse files

selection_tool: Renamed selectSingle to selectCursor.

parent 18898fe8
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
        AS_GLOBAL, 0,
        AS_GLOBAL, 0,
        "", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
        "", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere


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


+1 −1
Original line number Original line Diff line number Diff line
@@ -41,7 +41,7 @@ public:
    static TOOL_ACTION selectionActivate;
    static TOOL_ACTION selectionActivate;


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


    /// Clears the current selection
    /// Clears the current selection
    static TOOL_ACTION selectionClear;
    static TOOL_ACTION selectionClear;
+1 −1
Original line number Original line Diff line number Diff line
@@ -581,7 +581,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION& aSelection )
bool EDIT_TOOL::makeSelection( const SELECTION& aSelection )
bool EDIT_TOOL::makeSelection( const SELECTION& aSelection )
{
{
    if( aSelection.Empty() )                        // Try to find an item that could be modified
    if( aSelection.Empty() )                        // Try to find an item that could be modified
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionSingle, true );
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );


    return !aSelection.Empty();
    return !aSelection.Empty();
}
}
+10 −10
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
                if( !m_additive )
                if( !m_additive )
                    clearSelection();
                    clearSelection();


                selectSingle( evt->Position() );
                selectCursor( evt->Position() );
            }
            }
        }
        }


@@ -119,7 +119,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
        else if( evt->IsClick( BUT_RIGHT ) )
        else if( evt->IsClick( BUT_RIGHT ) )
        {
        {
            if( m_selection.Empty() )
            if( m_selection.Empty() )
                selectSingle( evt->Position() );
                selectCursor( evt->Position() );


            generateMenu();
            generateMenu();
        }
        }
@@ -128,7 +128,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
        else if( evt->IsDblClick( BUT_LEFT ) )
        else if( evt->IsDblClick( BUT_LEFT ) )
        {
        {
            if( m_selection.Empty() )
            if( m_selection.Empty() )
                selectSingle( evt->Position() );
                selectCursor( evt->Position() );


            m_toolMgr->RunAction( COMMON_ACTIONS::properties );
            m_toolMgr->RunAction( COMMON_ACTIONS::properties );
        }
        }
@@ -143,7 +143,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
            else if( m_selection.Empty() )
            else if( m_selection.Empty() )
            {
            {
                // There is nothing selected, so try to select something
                // There is nothing selected, so try to select something
                if( !selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ), false ) )
                if( !selectCursor( getView()->ToWorld( getViewControls()->GetMousePosition() ), false ) )
                {
                {
                    // If nothings has been selected or user wants to select more
                    // If nothings has been selected or user wants to select more
                    // draw the selection box
                    // draw the selection box
@@ -171,10 +171,10 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
            }
            }
        }
        }


        else if( evt->IsAction( &COMMON_ACTIONS::selectionSingle ) )
        else if( evt->IsAction( &COMMON_ACTIONS::selectionCursor ) )
        {
        {
            // GetMousePosition() is used, as it is independent of snapping settings
            // GetMousePosition() is used, as it is independent of snapping settings
            selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
            selectCursor( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
        }
        }


        else if( evt->IsAction( &COMMON_ACTIONS::find ) )
        else if( evt->IsAction( &COMMON_ACTIONS::find ) )
@@ -245,7 +245,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
}
}




bool SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere, bool aAllowDisambiguation )
bool SELECTION_TOOL::selectCursor( const VECTOR2I& aWhere, bool aAllowDisambiguation )
{
{
    BOARD_ITEM* item;
    BOARD_ITEM* item;
    GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide();
    GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide();
@@ -395,7 +395,7 @@ bool SELECTION_TOOL::selectMultiple()
void SELECTION_TOOL::setTransitions()
void SELECTION_TOOL::setTransitions()
{
{
    Go( &SELECTION_TOOL::Main, COMMON_ACTIONS::selectionActivate.MakeEvent() );
    Go( &SELECTION_TOOL::Main, COMMON_ACTIONS::selectionActivate.MakeEvent() );
    Go( &SELECTION_TOOL::SingleSelection, COMMON_ACTIONS::selectionSingle.MakeEvent() );
    Go( &SELECTION_TOOL::CursorSelection, COMMON_ACTIONS::selectionCursor.MakeEvent() );
    Go( &SELECTION_TOOL::ClearSelection, COMMON_ACTIONS::selectionClear.MakeEvent() );
    Go( &SELECTION_TOOL::ClearSelection, COMMON_ACTIONS::selectionClear.MakeEvent() );
    Go( &SELECTION_TOOL::find, COMMON_ACTIONS::find.MakeEvent() );
    Go( &SELECTION_TOOL::find, COMMON_ACTIONS::find.MakeEvent() );
    Go( &SELECTION_TOOL::findMove, COMMON_ACTIONS::findMove.MakeEvent() );
    Go( &SELECTION_TOOL::findMove, COMMON_ACTIONS::findMove.MakeEvent() );
@@ -444,9 +444,9 @@ bool SELECTION_TOOL::CheckLock()
}
}




int SELECTION_TOOL::SingleSelection( TOOL_EVENT& aEvent )
int SELECTION_TOOL::CursorSelection( TOOL_EVENT& aEvent )
{
{
    selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
    selectCursor( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
    setTransitions();
    setTransitions();


    return 0;
    return 0;
+5 −5
Original line number Original line Diff line number Diff line
@@ -151,8 +151,8 @@ public:
    ///> Checks if the user has agreed to modify locked items for the given selection.
    ///> Checks if the user has agreed to modify locked items for the given selection.
    bool CheckLock();
    bool CheckLock();


    ///> Select single item event handler.
    ///> Select a single item under cursor event handler.
    int SingleSelection( TOOL_EVENT& aEvent );
    int CursorSelection( TOOL_EVENT& aEvent );


    ///> Clear current selection event handler.
    ///> Clear current selection event handler.
    int ClearSelection( TOOL_EVENT& aEvent );
    int ClearSelection( TOOL_EVENT& aEvent );
@@ -168,7 +168,7 @@ public:


private:
private:
    /**
    /**
     * Function selectSingle()
     * Function selectCursor()
     * Selects an item pointed by the parameter aWhere. If there is more than one item at that
     * Selects an item pointed by the parameter aWhere. If there is more than one item at that
     * place, there is a menu displayed that allows to choose the item.
     * place, there is a menu displayed that allows to choose the item.
     *
     *
@@ -177,7 +177,7 @@ private:
     * a menu is shown, otherise function finishes without selecting anything.
     * a menu is shown, otherise function finishes without selecting anything.
     * @return True if an item was selected, false otherwise.
     * @return True if an item was selected, false otherwise.
     */
     */
    bool selectSingle( const VECTOR2I& aWhere, bool aAllowDisambiguation = true );
    bool selectCursor( const VECTOR2I& aWhere, bool aAllowDisambiguation = true );


    /**
    /**
     * Function selectMultiple()
     * Function selectMultiple()
@@ -208,7 +208,7 @@ private:
    /**
    /**
     * Function disambiguationMenu()
     * Function disambiguationMenu()
     * Handles the menu that allows to select one of many items in case there is more than one
     * Handles the menu that allows to select one of many items in case there is more than one
     * item at the selected point (@see selectSingle()).
     * item at the selected point (@see selectCursor()).
     *
     *
     * @param aItems contains list of items that are displayed to the user.
     * @param aItems contains list of items that are displayed to the user.
     */
     */