Formatting.

This commit is contained in:
Jeff Young 2020-12-05 18:03:03 +00:00
parent 3704c1cdb7
commit d43eefbad5
2 changed files with 39 additions and 35 deletions

View File

@ -231,11 +231,11 @@ TOOL_MANAGER::~TOOL_MANAGER()
void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool ) void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool )
{ {
wxASSERT_MSG( m_toolNameIndex.find( aTool->GetName() ) == m_toolNameIndex.end(), wxASSERT_MSG( m_toolNameIndex.find( aTool->GetName() ) == m_toolNameIndex.end(),
wxT( "Adding two tools with the same name may result in unexpected behaviour.") ); wxT( "Adding two tools with the same name may result in unexpected behaviour.") );
wxASSERT_MSG( m_toolIdIndex.find( aTool->GetId() ) == m_toolIdIndex.end(), wxASSERT_MSG( m_toolIdIndex.find( aTool->GetId() ) == m_toolIdIndex.end(),
wxT( "Adding two tools with the same ID may result in unexpected behaviour.") ); wxT( "Adding two tools with the same ID may result in unexpected behaviour.") );
wxASSERT_MSG( m_toolTypes.find( typeid( *aTool ).name() ) == m_toolTypes.end(), wxASSERT_MSG( m_toolTypes.find( typeid( *aTool ).name() ) == m_toolTypes.end(),
wxT( "Adding two tools of the same type may result in unexpected behaviour.") ); wxT( "Adding two tools of the same type may result in unexpected behaviour.") );
m_toolOrder.push_back( aTool ); m_toolOrder.push_back( aTool );
@ -257,8 +257,8 @@ bool TOOL_MANAGER::InvokeTool( TOOL_ID aToolId )
if( tool && tool->GetType() == INTERACTIVE ) if( tool && tool->GetType() == INTERACTIVE )
return invokeTool( tool ); return invokeTool( tool );
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::InvokeTool - no tool with ID %d",
"TOOL_MANAGER::InvokeTool - No interactive tool with ID %d", aToolId ); aToolId );
return false; // there is no tool with the given id return false; // there is no tool with the given id
} }
@ -271,8 +271,8 @@ bool TOOL_MANAGER::InvokeTool( const std::string& aToolName )
if( tool && tool->GetType() == INTERACTIVE ) if( tool && tool->GetType() == INTERACTIVE )
return invokeTool( tool ); return invokeTool( tool );
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::InvokeTool - no tool with name %s",
"TOOL_MANAGER::InvokeTool - No interactive tool with name %s", aToolName ); aToolName );
return false; // there is no tool with the given name return false; // there is no tool with the given name
} }
@ -284,7 +284,7 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
if( !action ) if( !action )
{ {
wxASSERT_MSG( false, wxString::Format( wxT( "Could not find action %s." ), aActionName ) ); wxASSERT_MSG( false, wxString::Format( "Could not find action %s.", aActionName ) );
return false; return false;
} }
@ -451,8 +451,8 @@ void TOOL_MANAGER::ShutdownTool( TOOL_ID aToolId )
if( tool && tool->GetType() == INTERACTIVE ) if( tool && tool->GetType() == INTERACTIVE )
ShutdownTool( tool ); ShutdownTool( tool );
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::ShutdownTool - no tool with ID %d",
"TOOL_MANAGER::ShutdownTool - No interactive tool with ID %d", aToolId ); aToolId );
} }
@ -463,8 +463,8 @@ void TOOL_MANAGER::ShutdownTool( const std::string& aToolName )
if( tool && tool->GetType() == INTERACTIVE ) if( tool && tool->GetType() == INTERACTIVE )
ShutdownTool( tool ); ShutdownTool( tool );
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::ShutdownTool - no tool with name %s",
"TOOL_MANAGER::ShutdownTool - No interactive tool with name %s", aToolName ); aToolName );
} }
@ -490,9 +490,8 @@ void TOOL_MANAGER::ShutdownTool( TOOL_BASE* aTool )
if( st->cofunc ) if( st->cofunc )
{ {
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER shutting down tool %s",
"TOOL_MANAGER::ShutdownTool - Shutting down tool %s", st->theTool->GetName() );
st->theTool->GetName() );
setActiveState( st ); setActiveState( st );
bool end = !st->cofunc->Resume(); bool end = !st->cofunc->Resume();
@ -563,8 +562,8 @@ void TOOL_MANAGER::InitTools()
if( !tool->Init() ) if( !tool->Init() )
{ {
wxMessageBox( wxString::Format( "Initialization of tool \"%s\" failed", wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER initialization of tool '%s' failed",
tool->GetName() ) ); tool->GetName() );
// Unregister the tool // Unregister the tool
setActiveState( nullptr ); setActiveState( nullptr );
@ -649,7 +648,7 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
{ {
bool handled = false; bool handled = false;
wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::dispatchInternal - %s", aEvent.Format() ); wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER dispatching %s", aEvent.Format() );
auto it = m_activeTools.begin(); auto it = m_activeTools.begin();
@ -683,9 +682,9 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
st->pendingWait = false; st->pendingWait = false;
st->waitEvents.clear(); st->waitEvents.clear();
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER waking tool %s for event: %s",
"TOOL_MANAGER::dispatchInternal - Waking tool %s for event: %s", st->theTool->GetName(),
st->theTool->GetName(), aEvent.Format() ); aEvent.Format() );
setActiveState( st ); setActiveState( st );
bool end = !st->cofunc->Resume(); bool end = !st->cofunc->Resume();
@ -699,9 +698,9 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
// If the tool did not request the event be passed to other tools, we're done // If the tool did not request the event be passed to other tools, we're done
if( !st->wakeupEvent.PassEvent() ) if( !st->wakeupEvent.PassEvent() )
{ {
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER %s stopped passing event %s",
"TOOL_MANAGER::dispatchInternal - %s stopped passing event: %s", st->theTool->GetName(),
st->theTool->GetName(), aEvent.Format() ); aEvent.Format() );
return true; return true;
} }
@ -743,9 +742,9 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
// as the state changes, the transition table has to be set up again // as the state changes, the transition table has to be set up again
st->transitions.clear(); st->transitions.clear();
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER running tool %s for event %s",
"TOOL_MANAGER::dispatchInternal - Running tool %s for event: %s", st->theTool->GetName(),
st->theTool->GetName(), aEvent.Format() ); aEvent.Format() );
// got match? Run the handler. // got match? Run the handler.
setActiveState( st ); setActiveState( st );
@ -769,8 +768,10 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
break; // only the first tool gets the event break; // only the first tool gets the event
} }
wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::dispatchInternal - Handled: %s %s", if( handled )
( handled ? "true" : "false" ), aEvent.Format() ); wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER handled %s", aEvent.Format() );
else
wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER didn't handle %s", aEvent.Format() );
return handled; return handled;
} }
@ -796,9 +797,9 @@ bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent )
if( tool != m_toolNameIndex.end() ) if( tool != m_toolNameIndex.end() )
{ {
wxLogTrace( kicadTraceToolStack, wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER running tool %s for event %s",
"TOOL_MANAGER::dispatchActivation - Running tool %s for event: %s", tool->second->theTool->GetName(),
tool->second->theTool->GetName(), aEvent.Format() ); aEvent.Format() );
runTool( tool->second->theTool ); runTool( tool->second->theTool );
return true; return true;
@ -977,7 +978,7 @@ bool TOOL_MANAGER::SaveClipboard( const std::string& aTextUTF8 )
{ {
// Store the UTF8 string as unicode string in clipboard: // Store the UTF8 string as unicode string in clipboard:
wxTheClipboard->SetData( new wxTextDataObject( wxString( aTextUTF8.c_str(), wxTheClipboard->SetData( new wxTextDataObject( wxString( aTextUTF8.c_str(),
wxConvUTF8 ) ) ); wxConvUTF8 ) ) );
wxTheClipboard->Close(); wxTheClipboard->Close();
return true; return true;
@ -1135,8 +1136,10 @@ bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
} }
} }
wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::processEvent - Handled: %s %s", if( handled )
( handled ? "true" : "false" ), aEvent.Format() ); wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER handled %s", aEvent.Format() );
else
wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER didn't handle %s", aEvent.Format() );
return handled; return handled;
} }

View File

@ -1211,6 +1211,7 @@ const BOX2I FOOTPRINT::ViewBBox() const
// Add the Clearance shape size: (shape around the pads when the clearance is shown. Not // Add the Clearance shape size: (shape around the pads when the clearance is shown. Not
// optimized, but the draw cost is small (perhaps smaller than optimization). // optimized, but the draw cost is small (perhaps smaller than optimization).
BOARD* board = GetBoard(); BOARD* board = GetBoard();
if( board ) if( board )
{ {
int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue(); int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue();