P&S: enable delete & backspace shortcuts while router is active

This commit is contained in:
Tomasz Wlostowski 2016-08-15 17:16:47 +02:00 committed by Maciej Suminski
parent 9c8bdcc894
commit 0700178d07
5 changed files with 13 additions and 11 deletions

View File

@ -20,7 +20,6 @@
#include <wx/numdlg.h>
#include <boost/optional.hpp>
#include <functional>
using namespace std::placeholders;
@ -52,10 +51,11 @@ using namespace std::placeholders;
#include "pns_router.h"
#include "pns_meander_placer.h" // fixme: move settings to separate header
#include "pns_tune_status_popup.h"
#include "pns_topology.h"
#include "trace.h"
using namespace KIGFX;
using boost::optional;
TOOL_ACTION PNS_TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions",
AS_CONTEXT, 'E',
@ -105,7 +105,7 @@ void PNS_TOOL_BASE::Reset( RESET_REASON aReason )
m_iface->SetBoard (m_board);
m_iface->SetView( getView() );
m_iface->SetHostFrame ( m_frame );
m_router = new PNS_ROUTER;
m_router->SetInterface(m_iface);
m_router->ClearWorld();
@ -306,8 +306,7 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
TRACE( 0, "%s, layer : %d", m_endItem->KindStr().c_str() % m_endItem->Layers().Start() );
}
#if 0
void PNS_TOOL_BASE::DeleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack )
void PNS_TOOL_BASE::deleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack )
{
PNS_NODE *node = m_router->GetWorld()->Branch();
@ -328,9 +327,7 @@ void PNS_TOOL_BASE::DeleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack )
}
m_router->CommitRouting( node );
}
#endif
PNS_ROUTER *PNS_TOOL_BASE::Router() const
{

View File

@ -58,6 +58,7 @@ protected:
virtual void highlightNet( bool aEnabled, int aNetcode = -1 );
virtual void updateStartItem( TOOL_EVENT& aEvent );
virtual void updateEndItem( TOOL_EVENT& aEvent );
void deleteTraces( PNS_ITEM *aStartItem, bool aWholeTrack );
MSG_PANEL_ITEMS m_panelItems;

View File

@ -710,12 +710,10 @@ int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
m_toolMgr->RunAction( COMMON_ACTIONS::layerToggle, true );
} else if (evt->IsAction ( &COMMON_ACTIONS::remove ) )
{
printf("delitemcursor\n");
//m_router->DeleteTraces( m_startItem, true );
deleteTraces( m_startItem, true );
} else if (evt->IsAction ( &COMMON_ACTIONS::removeAlt ) )
{
printf("delitemcursor [alt]\n");
//m_router->DeleteTraces( m_startItem, false );
deleteTraces( m_startItem, false );
}
handleCommonEvents( *evt );

View File

@ -129,6 +129,11 @@ TOOL_ACTION COMMON_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
_( "Remove" ), _( "Deletes selected item(s)" ), delete_xpm );
TOOL_ACTION COMMON_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BACK_SPACE ),
_( "Remove (alterative)" ), _( "Deletes selected item(s)" ), delete_xpm );
TOOL_ACTION COMMON_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
_( "Properties..." ), _( "Displays item properties dialog" ), editor_xpm );

View File

@ -90,6 +90,7 @@ public:
/// Deleting a BOARD_ITEM
static TOOL_ACTION remove;
static TOOL_ACTION removeAlt;
// Drawing Tool
/// Activation of the drawing tool (line)