Replace SetToolID( ID_NO_TOOL_SELECTED, ...) by SetNoToolSelected() in code

This commit is contained in:
jean-pierre charras 2017-06-12 16:17:48 +02:00
parent 6ed4f9b208
commit ad48cd435d
12 changed files with 34 additions and 30 deletions

View File

@ -1160,7 +1160,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
m_auimgr.Update();
// Reset current tool on switch();
SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
SetNoToolSelected();
m_galCanvasActive = aEnable;
}

View File

@ -127,12 +127,12 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SaveCopyInUndoList( part );
PlaceAnchor();
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "Unhandled command ID %d" ), GetToolId() ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
}
}

View File

@ -1150,7 +1150,7 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
if( lastToolID != ID_ZOOM_SELECTION )
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
else
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_LIBEDIT_PIN_BUTT:
@ -1166,7 +1166,7 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
}
break;
@ -1197,13 +1197,13 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, m_canvas->GetDefaultCursor(), _( "Import" ) );
LoadOneSymbol();
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_LIBEDIT_EXPORT_BODY_BUTT:
SetToolID( id, m_canvas->GetDefaultCursor(), _( "Export" ) );
SaveOneSymbol();
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:

View File

@ -381,7 +381,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
#endif /* KICAD_SPICE */
default:
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick invalid tool ID <" ) +
wxString::Format( wxT( "%d> selected." ), GetToolId() ) );
}

View File

@ -108,9 +108,8 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
default:
// Stop the current command and deselect the current tool
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
SetNoToolSelected();
break;
}
@ -157,7 +156,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
else
{
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
}
break;
@ -527,7 +526,7 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
switch( id )
{
case ID_NO_TOOL_SELECTED:
SetToolID( id, m_canvas->GetDefaultCursor(), _( "No tool selected" ) );
SetNoToolSelected();
break;
case ID_HIGHLIGHT:
@ -539,7 +538,7 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
if( lastToolID != ID_ZOOM_SELECTION )
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
else
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_HIERARCHY_PUSH_POP_BUTT:

View File

@ -178,7 +178,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
if( GetToolId() == ID_NO_TOOL_SELECTED )
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
else
m_canvas->SetCursor( (wxStockCursor) m_canvas->GetCurrentCursor() );
break;
@ -208,7 +208,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_NO_TOOL_SELECTED:
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_ZOOM_SELECTION:
@ -216,7 +216,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( GetToolId() != ID_ZOOM_SELECTION )
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
else
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_POPUP_CLOSE_CURRENT_TOOL:

View File

@ -128,7 +128,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
switch( id )
{
case ID_NO_TOOL_SELECTED:
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_ZOOM_SELECTION:
@ -136,7 +136,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( GetToolId() != ID_ZOOM_SELECTION )
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
else
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_SELECT_PAGE_NUMBER:

View File

@ -171,7 +171,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
if( GetToolId() == ID_NO_TOOL_SELECTED )
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
else
SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
@ -186,7 +186,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_lastDrawToolId != GetToolId() )
m_lastDrawToolId = GetToolId();
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
}
break;
}
@ -308,7 +308,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_CLOSE_CURRENT_TOOL:
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
@ -1422,6 +1422,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
int lastToolID = GetToolId();
if( GetToolId() == id )
return;
@ -1435,11 +1436,15 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
switch( id )
{
case ID_NO_TOOL_SELECTED:
SetToolID( id, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
case ID_ZOOM_SELECTION:
SetToolID( id, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
// This tool is located on the main toolbar: switch it on or off on click on it
if( lastToolID != ID_ZOOM_SELECTION )
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
else
SetNoToolSelected();
break;
case ID_TRACK_BUTT:

View File

@ -170,7 +170,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
// Usually, we do not need to change twice the anchor position,
// so deselect the active tool
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
SetCurItem( NULL );
m_canvas->Refresh();
}
@ -202,12 +202,12 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_MODEDIT_MEASUREMENT_TOOL:
DisplayError( this, wxT( "Unsupported tool in legacy canvas" ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
default:
DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessCommand error" ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
}
m_canvas->CrossHairOn( DC );

View File

@ -113,7 +113,7 @@ void PCB_EDIT_FRAME::MuWaveCommand( wxDC* DC, const wxPoint& MousePos )
default:
m_canvas->SetCursor( wxCURSOR_ARROW );
DisplayError( this, wxT( "PCB_EDIT_FRAME::MuWaveCommand() id error" ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
}

View File

@ -441,12 +441,12 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_MEASUREMENT_TOOL:
DisplayError( this, _( "This tool is not available in the legacy canvas" ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
default:
DisplayError( this, wxT( "PCB_EDIT_FRAME::OnLeftClick() id error" ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetNoToolSelected();
break;
}
}

View File

@ -394,7 +394,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
controls->SetSnapping( true );
Activate();
m_frame->SetToolID( ID_PCB_MODULE_BUTT, wxCURSOR_HAND, _( "Add footprint" ) );
m_frame->SetToolID( ID_PCB_MODULE_BUTT, wxCURSOR_PENCIL, _( "Add footprint" ) );
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )