The Selection Tool is always active. Removed entries for toolbar menu and hotkeys for the tool.
This commit is contained in:
parent
7d788109fe
commit
24a317ce28
|
@ -280,11 +280,6 @@ void TOOL_DISPATCHER::DispatchWxCommand( const wxCommandEvent& aEvent )
|
|||
toolName = "pcbnew.InteractiveRouter";
|
||||
activateTool = true;
|
||||
break;
|
||||
|
||||
case ID_SELECTION_TOOL:
|
||||
toolName = "pcbnew.InteractiveSelection";
|
||||
activateTool = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// do nothing if the legacy view is active
|
||||
|
|
|
@ -97,7 +97,7 @@ struct TOOL_MANAGER::TOOL_STATE
|
|||
|
||||
|
||||
TOOL_MANAGER::TOOL_MANAGER() :
|
||||
m_model( NULL ), m_view( NULL )
|
||||
m_model( NULL ), m_view( NULL ), m_viewControls( NULL ), m_editFrame( NULL )
|
||||
{
|
||||
m_actionMgr = new ACTION_MANAGER( this );
|
||||
}
|
||||
|
@ -476,7 +476,8 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
|||
if( m_view->IsDirty() )
|
||||
{
|
||||
PCB_EDIT_FRAME* f = static_cast<PCB_EDIT_FRAME*>( GetEditFrame() );
|
||||
f->GetGalCanvas()->Refresh(); // fixme: ugly hack, provide a method in TOOL_DISPATCHER.
|
||||
if( f->IsGalCanvasActive() )
|
||||
f->GetGalCanvas()->Refresh(); // fixme: ugly hack, provide a method in TOOL_DISPATCHER.
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -310,11 +310,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
editMenu->AppendSeparator();
|
||||
|
||||
AddMenuItem( editMenu, ID_SELECTION_TOOL,
|
||||
_( "Select Tool" ),
|
||||
_( "Interactive selection and drag&drop tool." ),
|
||||
KiBitmap( tools_xpm ) );
|
||||
|
||||
AddMenuItem( editMenu, ID_PNS_ROUTER_TOOL,
|
||||
_( "Interactive router" ),
|
||||
_( "Interactive router drag&drop tool." ),
|
||||
|
|
|
@ -121,8 +121,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
// menu Config
|
||||
|
||||
/* Tom's hacks start */
|
||||
EVT_MENU ( ID_SELECTION_TOOL, PCB_EDIT_FRAME::onGenericCommand )
|
||||
EVT_TOOL ( ID_SELECTION_TOOL, PCB_EDIT_FRAME::onGenericCommand )
|
||||
EVT_MENU ( ID_PNS_ROUTER_TOOL, PCB_EDIT_FRAME::onGenericCommand )
|
||||
EVT_TOOL ( ID_PNS_ROUTER_TOOL, PCB_EDIT_FRAME::onGenericCommand )
|
||||
/* Tom's hacks end */
|
||||
|
|
|
@ -370,7 +370,6 @@ enum pcbnew_ids
|
|||
ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
||||
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD,
|
||||
|
||||
ID_SELECTION_TOOL,
|
||||
ID_PNS_ROUTER_TOOL
|
||||
};
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
|
||||
// Selection tool actions
|
||||
TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
|
||||
AS_GLOBAL, 'S',
|
||||
"Selection tool", "Allows to select items" );
|
||||
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
|
||||
|
||||
// Edit tool actions
|
||||
TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
|
||||
|
|
|
@ -35,12 +35,12 @@
|
|||
class COMMON_ACTIONS
|
||||
{
|
||||
public:
|
||||
/// Activation of the move tool
|
||||
static TOOL_ACTION editActivate;
|
||||
|
||||
/// Activation of the selection tool
|
||||
static TOOL_ACTION selectionActivate;
|
||||
|
||||
/// Activation of the edit tool
|
||||
static TOOL_ACTION editActivate;
|
||||
|
||||
/// Rotation of selected objects
|
||||
static TOOL_ACTION rotate;
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ void PCB_EDIT_FRAME::setupTools()
|
|||
|
||||
// Register tool actions
|
||||
m_toolManager->RegisterAction( &COMMON_ACTIONS::editActivate );
|
||||
m_toolManager->RegisterAction( &COMMON_ACTIONS::selectionActivate );
|
||||
m_toolManager->RegisterAction( &COMMON_ACTIONS::rotate );
|
||||
m_toolManager->RegisterAction( &COMMON_ACTIONS::flip );
|
||||
m_toolManager->RegisterAction( &COMMON_ACTIONS::properties );
|
||||
|
@ -57,6 +56,12 @@ void PCB_EDIT_FRAME::setupTools()
|
|||
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||
m_toolManager->RegisterTool( new ROUTER_TOOL );
|
||||
m_toolManager->RegisterTool( new EDIT_TOOL );
|
||||
|
||||
m_toolManager->SetEnvironment( NULL, m_galCanvas->GetView(),
|
||||
m_galCanvas->GetViewControls(), this );
|
||||
|
||||
// Run the selection tool, it is supposed to be always active
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,6 +66,8 @@ SELECTION_TOOL::~SELECTION_TOOL()
|
|||
|
||||
void SELECTION_TOOL::Reset()
|
||||
{
|
||||
clearSelection();
|
||||
|
||||
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
|
||||
getView()->Remove( m_selection.group );
|
||||
getView()->Add( m_selection.group );
|
||||
|
@ -77,12 +79,6 @@ void SELECTION_TOOL::Reset()
|
|||
|
||||
int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
|
||||
{
|
||||
KIGFX::VIEW* view = getView();
|
||||
|
||||
assert( getModel<BOARD>( PCB_T ) != NULL );
|
||||
|
||||
view->Add( m_selection.group );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
while( OPT_TOOL_EVENT evt = Wait() )
|
||||
{
|
||||
|
@ -94,8 +90,8 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( !m_selection.Empty() ) // Cancel event deselects items...
|
||||
clearSelection();
|
||||
else // ...unless there is nothing selected
|
||||
break; // then exit the tool
|
||||
|
||||
// This tool never exits
|
||||
}
|
||||
|
||||
// single click? Select single object
|
||||
|
@ -142,8 +138,8 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
m_selection.group->Clear();
|
||||
view->Remove( m_selection.group );
|
||||
// This tool is supposed to be active forever
|
||||
assert( false );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -188,6 +184,7 @@ void SELECTION_TOOL::clearSelection()
|
|||
{
|
||||
KIGFX::VIEW_GROUP::const_iter it, it_end;
|
||||
|
||||
// Restore the initial properties
|
||||
for( it = m_selection.group->Begin(), it_end = m_selection.group->End(); it != it_end; ++it )
|
||||
{
|
||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( *it );
|
||||
|
@ -196,8 +193,7 @@ void SELECTION_TOOL::clearSelection()
|
|||
item->ClearSelected();
|
||||
}
|
||||
|
||||
m_selection.group->Clear();
|
||||
m_selection.items.clear();
|
||||
m_selection.Clear();
|
||||
|
||||
// Do not show the context menu when there is nothing selected
|
||||
SetContextMenu( &m_menu, CMENU_OFF );
|
||||
|
@ -609,3 +605,10 @@ bool SELECTION_TOOL::containsSelected( const VECTOR2I& aPoint ) const
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SELECTION_TOOL::SELECTION::Clear()
|
||||
{
|
||||
items.clear();
|
||||
group->Clear();
|
||||
}
|
||||
|
|
|
@ -78,6 +78,10 @@ public:
|
|||
{
|
||||
return items.size();
|
||||
}
|
||||
|
||||
/// Clears both the VIEW_GROUP and set of selected items. Please note that it does not
|
||||
/// change properties of selected items (e.g. selection flag).
|
||||
void Clear();
|
||||
};
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
|
|
Loading…
Reference in New Issue