Mostly formatting cleanup but a few type-casting cleanups too.

This commit is contained in:
Jeff Young 2020-11-24 22:16:41 +00:00
parent 31a26e7d25
commit 9c7c05c161
72 changed files with 226 additions and 205 deletions

View File

@ -110,7 +110,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_TEXT* aText,
wxStringSplit( aText->GetShownText(), strings_list, '\n' );
std::vector<wxPoint> positions;
positions.reserve( strings_list.Count() );
aText->GetLinePositions( positions, strings_list.Count());
aText->GetLinePositions( positions, strings_list.Count() );
for( unsigned ii = 0; ii < strings_list.Count(); ++ii )
{
@ -494,8 +494,7 @@ void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const FOOTPRINT* aFootprint
// shape size and pos is the same as their hole:
if( aSkipNPTHPadsWihNoCopper && ( pad->GetAttribute() == PAD_ATTRIB_NPTH ) )
{
if( (pad->GetDrillSize() == pad->GetSize()) &&
(pad->GetOffset() == wxPoint( 0, 0 )) )
if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == wxPoint( 0, 0 ) )
{
switch( pad->GetShape() )
{
@ -735,7 +734,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_SHAPE* aShape,
default:
wxFAIL_MSG( "BOARD_ADAPTER::AddShapeWithClearanceToContainer no implementation for "
+ PCB_SHAPE_TYPE_T_asString( aShape->GetShape()) );
+ PCB_SHAPE_TYPE_T_asString( aShape->GetShape() ) );
break;
}
}

View File

@ -622,7 +622,7 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent &event )
float delta_move = m_delta_move_step_factor * m_camera.ZoomGet();
if( m_boardAdapter.GetFlag( FL_MOUSEWHEEL_PANNING ) )
delta_move *= (0.01f * event.GetWheelRotation());
delta_move *= 0.01f * event.GetWheelRotation();
else
if( event.GetWheelRotation() < 0 )
delta_move = -delta_move;

View File

@ -1287,7 +1287,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot,
if( !fp->Models().empty() )
{
if( m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) )
if( m_boardAdapter.ShouldFPBeDisplayed( (FOOTPRINT_ATTR_T) fp->GetAttributes() ) )
{
if( ( aRenderTopOrBot && !fp->IsFlipped() )
|| ( !aRenderTopOrBot && fp->IsFlipped() ) )

View File

@ -829,7 +829,7 @@ void C3D_RENDER_RAYTRACING::Reload( REPORTER* aStatusReporter,
static_cast<const CBVHCONTAINER2D *>(ii->second);
// Only get the Solder mask layers
if( !((layer_id == B_Mask) || (layer_id == F_Mask)) )
if( !( layer_id == B_Mask || layer_id == F_Mask ) )
continue;
SFVEC3F layerColor;
@ -1403,7 +1403,7 @@ void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSki
for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() )
{
if( !fp->Models().empty()
&& m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) )
&& m_boardAdapter.ShouldFPBeDisplayed( (FOOTPRINT_ATTR_T) fp->GetAttributes() ) )
{
double zpos = m_boardAdapter.GetModulesZcoord3DIU( fp->IsFlipped() );

View File

@ -245,9 +245,9 @@ bool CBBOX::Inside( const SFVEC3F &aPoint ) const
{
wxASSERT( IsInitialized() );
return (( aPoint.x >= m_min.x ) && ( aPoint.x <= m_max.x ) &&
( aPoint.y >= m_min.y ) && ( aPoint.y <= m_max.y ) &&
( aPoint.z >= m_min.z ) && ( aPoint.z <= m_max.z ));
return ( aPoint.x >= m_min.x ) && ( aPoint.x <= m_max.x ) &&
( aPoint.y >= m_min.y ) && ( aPoint.y <= m_max.y ) &&
( aPoint.z >= m_min.z ) && ( aPoint.z <= m_max.z );
}

View File

@ -86,7 +86,7 @@ GLuint OGL_LoadTexture( const CIMAGE &aImage )
unsigned char* dst = rgbaBuffer;
const unsigned char* ori = aImage.GetBuffer();
for( unsigned int i = 0; i < (aImage.GetWidth() * aImage.GetHeight()); ++i )
for( unsigned int i = 0; i < ( aImage.GetWidth() * aImage.GetHeight() ); ++i )
{
unsigned char v = *ori;

View File

@ -65,7 +65,7 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetFootprintInfo( const wxString& aFootprintName
wxCHECK_MSG( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) < 0, NULL,
wxString::Format( wxT( "\"%s\" is not a valid LIB_ID." ), aFootprintName ) );
return GetFootprintInfo( fpid.GetLibNickname(), fpid.GetLibItemName());
return GetFootprintInfo( fpid.GetLibNickname(), fpid.GetLibItemName() );
}

View File

@ -103,7 +103,7 @@ void TEMPLATE_FIELDNAME::Parse( TEMPLATE_FIELDNAMES_LEXER* in )
in->NeedLEFT(); // begin (name ...)
if( (tok = in->NextTok()) != T_name )
if( ( tok = in->NextTok() ) != T_name )
in->Expecting( T_name );
in->NeedSYMBOLorNUMBER();

View File

@ -218,7 +218,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
if( component->GetAltFPID().empty() )
continue;
if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy())
if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy() )
continue;
m_indexes.push_back( ii );

View File

@ -2667,7 +2667,7 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
// For a hier label, check if the parent pin is connected
if( aSubgraph->m_hier_parent &&
( aSubgraph->m_hier_parent->m_strong_driver ||
aSubgraph->m_hier_parent->m_drivers.size() > 1))
aSubgraph->m_hier_parent->m_drivers.size() > 1) )
{
// For now, a simple check: if there is more than one driver, the parent is probably
// connected elsewhere (because at least one driver will be the hier pin itself)

View File

@ -99,7 +99,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::GetTextLines(wxGrid& grid,
const wxRect& rect,
int row, int col)
{
dc.SetFont(attr.GetFont());
dc.SetFont( attr.GetFont() );
const wxCoord maxWidth = rect.GetWidth();
// Transform logical lines into physical ones, wrapping the longer ones.
@ -215,7 +215,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
n = 1;
}
lines.push_back(word.substr(0, n));
lines.push_back( word.substr(0, n) );
// Check if the remainder of the string fits in one line.
//
@ -225,6 +225,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
// recompute it.
const wxString rest = word.substr(n);
const wxCoord restWidth = dc.GetTextExtent(rest).x;
if ( restWidth <= maxWidth )
{
line = rest;

View File

@ -87,7 +87,7 @@ public:
{
wxString fieldValue;
if( pins.empty())
if( pins.empty() )
return fieldValue;
for( LIB_PIN* pin : pins )

View File

@ -222,10 +222,9 @@ END_EVENT_TABLE()
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
const wxString& title,
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
NETLIST_TYPE_ID id_NetType ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
{
m_IdNetType = id_NetType;
m_pageNetFmtName = title;
@ -234,7 +233,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_IsCurrentFormat = NULL;
m_AdjustPassiveValues = NULL;
wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_DefaultNetFmtName;
wxString netfmtName = static_cast<NETLIST_DIALOG*>( parent->GetParent() )->m_DefaultNetFmtName;
bool selected = m_pageNetFmtName == netfmtName;
@ -262,7 +261,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_IsCurrentFormat->SetValue( selected );
if( selected )
((NETLIST_DIALOG*)parent->GetParent())->m_asFormatSelected = true;
( (NETLIST_DIALOG*)parent->GetParent() )->m_asFormatSelected = true;
}

View File

@ -1013,7 +1013,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
wxPoint begin;
wxPoint end;
int nameTextOffset = 0;
bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
bool showName = !m_name.IsEmpty() && ( m_name != wxT( "~" ) );
bool showNum = !m_number.IsEmpty();
int minsizeV = TARGET_PIN_RADIUS;
@ -1140,14 +1140,14 @@ wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
m_number,
m_name,
GetElectricalTypeName(),
PinShapeGetText( m_shape ));
PinShapeGetText( m_shape ) );
}
else
{
return wxString::Format( _( "Pin %s [%s, %s]" ),
m_number,
GetElectricalTypeName(),
PinShapeGetText( m_shape ));
PinShapeGetText( m_shape ) );
}
}

View File

@ -185,7 +185,7 @@ void InitTables()
const wxArrayString& PinTypeNames()
{
if( g_typeNames.empty())
if( g_typeNames.empty() )
InitTables();
return g_typeNames;
@ -194,7 +194,7 @@ const wxArrayString& PinTypeNames()
const std::vector<BITMAP_DEF>& PinTypeIcons()
{
if( g_typeIcons.empty())
if( g_typeIcons.empty() )
InitTables();
return g_typeIcons;
@ -203,7 +203,7 @@ const std::vector<BITMAP_DEF>& PinTypeIcons()
const wxArrayString& PinShapeNames()
{
if( g_shapeNames.empty())
if( g_shapeNames.empty() )
InitTables();
return g_shapeNames;
@ -212,7 +212,7 @@ const wxArrayString& PinShapeNames()
const std::vector<BITMAP_DEF>& PinShapeIcons()
{
if( g_shapeIcons.empty())
if( g_shapeIcons.empty() )
InitTables();
return g_shapeIcons;
@ -221,7 +221,7 @@ const std::vector<BITMAP_DEF>& PinShapeIcons()
const wxArrayString& PinOrientationNames()
{
if( g_orientationNames.empty())
if( g_orientationNames.empty() )
InitTables();
return g_orientationNames;
@ -230,7 +230,7 @@ const wxArrayString& PinOrientationNames()
const std::vector<BITMAP_DEF>& PinOrientationIcons()
{
if( g_orientationIcons.empty())
if( g_orientationIcons.empty() )
InitTables();
return g_orientationIcons;

View File

@ -295,7 +295,7 @@ void SCH_BASE_FRAME::createCanvas()
}
SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize,
GetGalDisplayOptions(), m_canvasType ));
GetGalDisplayOptions(), m_canvasType ) );
ActivateGalCanvas();
}

View File

@ -149,7 +149,7 @@ void SCH_PLUGIN::SymbolLibOptions( PROPERTIES* aListToAppendTo ) const
(*aListToAppendTo)["username"] = UTF8( _(
"User name for <b>login</b> to some special library server."
));
) );
(*aListToAppendTo)["password"] = UTF8( _(
"Password for <b>login</b> to some special library server."

View File

@ -1037,10 +1037,10 @@ bool SCH_SHEET::operator <( const SCH_ITEM& aItem ) const
auto sheet = static_cast<const SCH_SHEET*>( &aItem );
if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText())
if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText() )
return m_fields[ SHEETNAME ].GetText() < sheet->m_fields[ SHEETNAME ].GetText();
if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText())
if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText() )
return m_fields[ SHEETFILENAME ].GetText() < sheet->m_fields[ SHEETFILENAME ].GetText();
return false;

View File

@ -956,14 +956,10 @@ bool SIM_PLOT_FRAME::loadWorkbook( const wxString& aPath )
bool SIM_PLOT_FRAME::saveWorkbook( const wxString& aPath )
{
wxString savePath = aPath;
if( !savePath.Lower().EndsWith(".wbk"))
{
if( !savePath.Lower().EndsWith(".wbk") )
savePath += ".wbk";
};
wxTextFile file( savePath );

View File

@ -310,7 +310,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
void LIB_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta )
{
static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ));
static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ) );
aItem->SetFlags( IS_MOVED );
}

View File

@ -1350,7 +1350,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true );
editor->LoadSymbolAndSelectLib( component->GetLibId(), component->GetUnit(),
component->GetConvert());
component->GetConvert() );
editor->Show( true );
editor->Raise();

View File

@ -229,7 +229,7 @@ static wxFindReplaceData g_markersOnly;
int SCH_EDITOR_CONTROL::FindAndReplace( const TOOL_EVENT& aEvent )
{
m_frame->ShowFindReplaceDialog( aEvent.IsAction( &ACTIONS::findAndReplace ));
m_frame->ShowFindReplaceDialog( aEvent.IsAction( &ACTIONS::findAndReplace ) );
return UpdateFind( aEvent );
}

View File

@ -70,7 +70,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
if( gerber->GetMessages().size() > 0 )
{
HTML_MESSAGE_BOX dlg( this, _("Errors") );
dlg.ListSet(gerber->GetMessages());
dlg.ListSet( gerber->GetMessages() );
dlg.ShowModal();
}

View File

@ -275,7 +275,7 @@ int LAYER_WIDGET::findLayerRow( LAYER_NUM aLayer ) const
wxWindow* w = getLayerComp( row, 0 );
wxASSERT( w );
if( aLayer == getDecodedId( w->GetId() ))
if( aLayer == getDecodedId( w->GetId() ) )
return row;
}
@ -304,7 +304,7 @@ int LAYER_WIDGET::findRenderRow( int aId ) const
wxWindow* w = getRenderComp( row, 0 );
wxASSERT( w );
if( aId == getDecodedId( w->GetId() ))
if( aId == getDecodedId( w->GetId() ) )
return row;
}

View File

@ -80,8 +80,8 @@ void TEMPLATE_WIDGET::Unselect()
void TEMPLATE_WIDGET::SetTemplate(PROJECT_TEMPLATE* aTemplate)
{
m_currTemplate = aTemplate;
m_staticTitle->SetLabel( *(aTemplate->GetTitle()) );
m_bitmapIcon->SetBitmap( *(aTemplate->GetIcon()) );
m_staticTitle->SetLabel( *(aTemplate->GetTitle() ) );
m_bitmapIcon->SetBitmap( *(aTemplate->GetIcon() ) );
}

View File

@ -1180,16 +1180,17 @@ void SHAPE_LINE_CHAIN::POINT_INSIDE_TRACKER::AddPolyline( const SHAPE_LINE_CHAIN
{
if( !m_count )
{
m_lastPoint = aPolyline.CPoint(0);
m_firstPoint = aPolyline.CPoint(0);
m_lastPoint = aPolyline.CPoint( 0 );
m_firstPoint = aPolyline.CPoint( 0 );
}
m_count += aPolyline.PointCount();
for (int i = 1; i < aPolyline.PointCount(); i++ )
for( int i = 1; i < aPolyline.PointCount(); i++ )
{
auto p = aPolyline.CPoint( i );
if( !processVertex( m_lastPoint, p ))
if( !processVertex( m_lastPoint, p ) )
return;
m_lastPoint = p;

View File

@ -210,8 +210,7 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
m_itemsList.clear();
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
wxFileName fn( ((PL_EDITOR_FRAME*) GetParent())->GetCurrentFileName() );
wxFileName fn( static_cast<PL_EDITOR_FRAME*>( GetParent() )->GetCurrentFileName() );
if( fn.GetName().IsEmpty() )
SetTitle( "<default page layout>" );

View File

@ -133,7 +133,7 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// Single click? Select single object
if( evt->IsClick( BUT_LEFT ) )
{
SelectPoint( evt->Position());
SelectPoint( evt->Position() );
}
// right click? if there is any object - show the context menu

View File

@ -156,7 +156,7 @@ void ACTION_PLUGINS::register_action( ACTION_PLUGIN* aAction )
}
// Load icon if supplied
if (!aAction->GetIconFileName().IsEmpty())
if( !aAction->GetIconFileName().IsEmpty() )
{
{
wxLogNull eat_errors;

View File

@ -128,7 +128,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
{
cmp* current = *iter;
if( (current->m_Val == fp->GetValue()) && (current->m_fpid == fp->GetFPID()) )
if( current->m_Val == fp->GetValue() && current->m_fpid == fp->GetFPID() )
{
current->m_Ref.Append( wxT( ", " ), 1 );
current->m_Ref.Append( fp->Reference().GetShownText() );

View File

@ -277,7 +277,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
{
graphic->RebuildBezierToSegmentsPointsList( graphic->GetWidth() );
for( const wxPoint& pt : graphic->GetBezierPoints())
for( const wxPoint& pt : graphic->GetBezierPoints() )
{
if( pt.x < xmin.x )
{

View File

@ -230,7 +230,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
// Module Properties
m_AutoPlaceCtrl->SetSelection( (m_footprint->IsLocked()) ? 1 : 0 );
m_AutoPlaceCtrl->SetSelection( m_footprint->IsLocked() ? 1 : 0 );
m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Enable hotkey move commands and Auto Placement" ) );
m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Disable hotkey move commands and Auto Placement" ) );
@ -334,7 +334,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
m_modelsGrid->SetColSize( 1, m_modelsGrid->GetVisibleWidth( 1, true, false, false ) );
Layout();
adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
return true;
}
@ -829,7 +829,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::adjustGridColumns( int aWidth )
void DIALOG_FOOTPRINT_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
{
if( !m_itemsGrid->IsCellEditControlShown() && !m_modelsGrid->IsCellEditControlShown() )
adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
if( m_itemsGrid->IsCellEditControlShown() )
{
@ -889,7 +889,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
void DIALOG_FOOTPRINT_FP_EDITOR::OnGridSize( wxSizeEvent& event )
{
adjustGridColumns( event.GetSize().GetX());
adjustGridColumns( event.GetSize().GetX() );
event.Skip();
}

View File

@ -345,7 +345,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
if( m_updateMode )
{
if( processFootprint( mod, mod->GetFPID()) )
if( processFootprint( mod, mod->GetFPID() ) )
change = true;
}
else
@ -394,7 +394,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
m_resetTextItemLayers->GetValue(),
m_resetTextItemEffects->GetValue(),
m_resetFabricationAttrs->GetValue(),
m_reset3DModels->GetValue());
m_reset3DModels->GetValue() );
if( aFootprint == m_currentFootprint )
m_currentFootprint = newFootprint;

View File

@ -403,7 +403,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
m_modelsGrid->SetColSize( 1, m_modelsGrid->GetVisibleWidth( 1, true, false, false ) );
Layout();
adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
return true;
}
@ -856,7 +856,7 @@ void DIALOG_FOOTPRINT_PROPERTIES::adjustGridColumns( int aWidth )
void DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& )
{
if( !m_itemsGrid->IsCellEditControlShown() && !m_modelsGrid->IsCellEditControlShown() )
adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
// Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
// even when the original validation was triggered from a killFocus event, and so
@ -912,7 +912,7 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::OnGridSize( wxSizeEvent& aEvent )
{
adjustGridColumns( aEvent.GetSize().GetX());
adjustGridColumns( aEvent.GetSize().GetX() );
aEvent.Skip();
}

View File

@ -735,7 +735,7 @@ protected:
if( !aItem.IsOk() )
return wxDataViewItem();
return wxDataViewItem( static_cast<const LIST_ITEM*>( aItem.GetID())->Parent() );
return wxDataViewItem( static_cast<const LIST_ITEM*>( aItem.GetID() )->Parent() );
}
@ -744,7 +744,7 @@ protected:
if( !aItem.IsOk() )
return true;
return static_cast<const LIST_ITEM*>( aItem.GetID())->GetIsGroup();
return static_cast<const LIST_ITEM*>( aItem.GetID() )->GetIsGroup();
}

View File

@ -627,7 +627,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
tempOptions.SetSketchPadsOnFabLayers( m_sketchPadsOnFabLayers->GetValue());
tempOptions.SetSketchPadsOnFabLayers( m_sketchPadsOnFabLayers->GetValue() );
tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );

View File

@ -133,7 +133,7 @@ bool DRC_TEST_PROVIDER_ANNULUS::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, via->GetPosition());
reportViolation( drcItem, via->GetPosition() );
}
return true;

View File

@ -138,7 +138,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run()
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_ZONE_HAS_EMPTY_NET );
drcItem->SetItems( zone );
reportViolation( drcItem, zone->GetPosition());
reportViolation( drcItem, zone->GetPosition() );
}
}
@ -163,7 +163,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run()
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNCONNECTED_ITEMS );
drcItem->SetItems( edge.GetSourceNode()->Parent(), edge.GetTargetNode()->Parent() );
reportViolation( drcItem, (wxPoint) edge.GetSourceNode()->Pos());
reportViolation( drcItem, (wxPoint) edge.GetSourceNode()->Pos() );
}
reportRuleStatistics();

View File

@ -498,7 +498,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + m_msg );
drce->SetItems( pad, otherPad );
reportViolation( drce, otherPad->GetPosition());
reportViolation( drce, otherPad->GetPosition() );
}
return true;

View File

@ -447,7 +447,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
drce->SetViolatingRule( maxUncoupledConstraint->GetParentRule() );
reportViolation( drce, (*it.second.itemsP.begin())->GetPosition() );
reportViolation( drce, ( *it.second.itemsP.begin() )->GetPosition() );
}
}

View File

@ -88,7 +88,7 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, item->GetPosition());
reportViolation( drcItem, item->GetPosition() );
}
};

View File

@ -149,7 +149,7 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkPad( PAD* aPad )
drcItem->SetItems( aPad );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, aPad->GetPosition());
reportViolation( drcItem, aPad->GetPosition() );
}
}
@ -191,7 +191,7 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkVia( VIA* via, bool aExceedMicro, bool aE
drcItem->SetItems( via );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, via->GetPosition());
reportViolation( drcItem, via->GetPosition() );
}
}

View File

@ -108,7 +108,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
for( unsigned ii = 0; ii < aNetlist.GetCount(); ii++ )
{
COMPONENT* component = aNetlist.GetComponent( ii );
FOOTPRINT* footprint = board->FindFootprintByReference( component->GetReference());
FOOTPRINT* footprint = board->FindFootprintByReference( component->GetReference() );
if( footprint == nullptr )
{

View File

@ -288,20 +288,24 @@ bool DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal( bool aDelayReportMode )
ent.fromItem = nullptr;
ent.toItem = nullptr;
for( auto citem : nitem.second )
for( BOARD_CONNECTED_ITEM* citem : nitem.second )
{
if ( auto via = dyn_cast<VIA*>( citem ) )
if( citem->Type() == PCB_VIA_T )
{
ent.viaCount++;
ent.totalVia += computeViaThruLength( via, nitem.second ); // fixme: via thru distance
ent.totalVia += computeViaThruLength( static_cast<VIA*>( citem ), nitem.second );
}
else if ( TRACK* trk = dyn_cast<TRACK*>(citem ))
else if( citem->Type() == PCB_TRACE_T )
{
ent.totalRoute += trk->GetLength();
ent.totalRoute += static_cast<TRACK*>( citem )->GetLength();
}
else if ( PAD* pad = dyn_cast<PAD*>( citem ))
else if ( citem->Type() == PCB_ARC_T )
{
ent.totalPadToDie += pad->GetPadToDieLength();
ent.totalRoute += static_cast<ARC*>( citem )->GetLength();
}
else if( citem->Type() == PCB_PAD_T )
{
ent.totalPadToDie += static_cast<PAD*>( citem )->GetPadToDieLength();
}
}

View File

@ -138,7 +138,7 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers()
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition());
reportViolation( drcItem, item->GetPosition() );
}
return true;
};
@ -163,7 +163,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
std::shared_ptr<DRC_ITEM>drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition());
reportViolation( drcItem, item->GetPosition() );
}
return true;
};
@ -198,7 +198,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
drcItem->SetItems( text );
reportViolation( drcItem, text->GetPosition());
reportViolation( drcItem, text->GetPosition() );
}
}
}

View File

@ -128,7 +128,7 @@ bool DRC_TEST_PROVIDER_VIA_DIAMETER::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, via->GetPosition());
reportViolation( drcItem, via->GetPosition() );
}
return true;

View File

@ -1362,10 +1362,10 @@ static void export_vrml_footprint( MODEL_VRML& aModel, BOARD* aPcb, FOOTPRINT* a
{
// Reference and value
if( aFootprint->Reference().IsVisible() )
export_vrml_fp_text( &aFootprint->Reference());
export_vrml_fp_text( &aFootprint->Reference() );
if( aFootprint->Value().IsVisible() )
export_vrml_fp_text( &aFootprint->Value());
export_vrml_fp_text( &aFootprint->Value() );
// Export footprint graphics
@ -1374,7 +1374,7 @@ static void export_vrml_footprint( MODEL_VRML& aModel, BOARD* aPcb, FOOTPRINT* a
switch( item->Type() )
{
case PCB_FP_TEXT_T:
export_vrml_fp_text( static_cast<FP_TEXT*>( item ));
export_vrml_fp_text( static_cast<FP_TEXT*>( item ) );
break;
case PCB_FP_SHAPE_T:

View File

@ -192,7 +192,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked( wxCommandEve
if( dialog.ShowModal() == wxID_YES )
{
wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName()).GetPath();
wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName() ).GetPath();
if( !dirName.MakeRelativeTo( boardFilePath ) )
wxMessageBox( _( "Cannot make path relative (target volume different from board file volume)!" ),

View File

@ -995,7 +995,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint()
if( ConfirmRevertDialog( this, msg ) )
{
Clear_Pcb( false );
AddFootprintToBoard( (FOOTPRINT*) m_revertModule->Clone());
AddFootprintToBoard( static_cast<FOOTPRINT*>( m_revertModule->Clone() ) );
Zoom_Automatique( false );

View File

@ -89,7 +89,7 @@ bool GRAPHICS_CLEANER::isNullSegment( PCB_SHAPE* aSegment )
default:
wxFAIL_MSG( "GRAPHICS_CLEANER::isNullSegment unsupported PCB_SHAPE shape: "
+ PCB_SHAPE_TYPE_T_asString( aSegment->GetShape()) );
+ PCB_SHAPE_TYPE_T_asString( aSegment->GetShape() ) );
return false;
}
}
@ -128,7 +128,7 @@ bool GRAPHICS_CLEANER::areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 )
default:
wxFAIL_MSG( "GRAPHICS_CLEANER::areEquivalent unsupported PCB_SHAPE shape: "
+ PCB_SHAPE_TYPE_T_asString( aShape1->GetShape()) );
+ PCB_SHAPE_TYPE_T_asString( aShape1->GetShape() ) );
return false;
}
}

View File

@ -191,7 +191,7 @@ void KICAD_NETLIST_PARSER::parseNet()
wxString pin_function;
// The token net was read, so the next data is (code <number>)
while( (token = NextTok()) != T_EOF )
while( (token = NextTok() ) != T_EOF )
{
if( token == T_RIGHT )
break;
@ -215,7 +215,7 @@ void KICAD_NETLIST_PARSER::parseNet()
case T_node:
pin_function.Clear(); // By default: no pin function.
while( (token = NextTok()) != T_EOF )
while( (token = NextTok() ) != T_EOF )
{
if( token == T_RIGHT )
break;
@ -303,7 +303,7 @@ void KICAD_NETLIST_PARSER::parseComponent()
std::map<wxString, wxString> properties;
// The token comp was read, so the next data is (ref P1)
while( (token = NextTok()) != T_RIGHT )
while( (token = NextTok() ) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();
@ -466,7 +466,7 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
int pinCount = 0;
// The last token read was libpart, so read the next token
while( (token = NextTok()) != T_RIGHT )
while( (token = NextTok() ) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();
@ -487,7 +487,7 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
case T_footprints:
// Read all fp elements (footprint filter item)
while( (token = NextTok()) != T_RIGHT )
while( (token = NextTok() ) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();
@ -502,7 +502,7 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
break;
case T_aliases:
while( (token = NextTok()) != T_RIGHT )
while( (token = NextTok() ) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();
@ -517,7 +517,7 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
break;
case T_pins:
while( (token = NextTok()) != T_RIGHT )
while( (token = NextTok() ) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();

View File

@ -1339,7 +1339,8 @@ bool PCB_EDIT_FRAME::ReannotateSchematic( std::string& aNetlist )
bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, FETCH_NETLIST_MODE aMode )
{
if( !TestStandalone( )) {
if( !TestStandalone() )
{
DisplayError( this, _( "Cannot update the PCB because Pcbnew is opened in stand-alone "
"mode. In order to create or update PCBs from schematics, you "
"must launch the KiCad project manager and create a project." ) );

View File

@ -674,7 +674,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
}
else
{
if( arc_hittest >= (3600.0 + GetAngle()) )
if( arc_hittest >= ( 3600.0 + GetAngle() ) )
return true;
}
}
@ -1197,7 +1197,7 @@ bool PCB_SHAPE::IsPolyShapeValid() const
if( GetPolyShape().OutlineCount() == 0 )
return false;
const SHAPE_LINE_CHAIN& outline = ((SHAPE_POLY_SET&)GetPolyShape()).Outline( 0 );
const SHAPE_LINE_CHAIN& outline = ( (SHAPE_POLY_SET&)GetPolyShape() ).Outline( 0 );
return outline.PointCount() > 2;
}

View File

@ -294,7 +294,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( FOOTPRINT* aFootprint )
if( GetPlotReference() && m_layerMask[textLayer]
&& ( textItem->IsVisible() || GetPlotInvisibleText() ) )
{
PlotFootprintTextItem( textItem, getColor( textLayer ));
PlotFootprintTextItem( textItem, getColor( textLayer ) );
}
textItem = &aFootprint->Value();
@ -303,7 +303,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( FOOTPRINT* aFootprint )
if( GetPlotValue() && m_layerMask[textLayer]
&& ( textItem->IsVisible() || GetPlotInvisibleText() ) )
{
PlotFootprintTextItem( textItem, getColor( textLayer ));
PlotFootprintTextItem( textItem, getColor( textLayer ) );
}
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
@ -330,7 +330,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( FOOTPRINT* aFootprint )
if( textItem->GetText() == wxT( "${VALUE}" ) && !GetPlotValue() )
continue;
PlotFootprintTextItem( textItem, getColor( textLayer ));
PlotFootprintTextItem( textItem, getColor( textLayer ) );
}
}
@ -483,7 +483,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire )
radius = aMire->GetSize() / 2;
// Draw the circle
draw.SetEnd( wxPoint( draw.GetStart().x + radius, draw.GetStart().y ));
draw.SetEnd( wxPoint( draw.GetStart().x + radius, draw.GetStart().y ) );
PlotPcbShape( &draw );
@ -505,12 +505,12 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire )
wxPoint mirePos( aMire->GetPosition() );
// Draw the X or + shape:
draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ));
draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ));
draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ) );
draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ) );
PlotPcbShape( &draw );
draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ));
draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ));
draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ) );
draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ) );
PlotPcbShape( &draw );
}
@ -731,7 +731,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( PCB_TEXT* aText )
wxStringSplit( shownText, strings_list, '\n' );
positions.reserve( strings_list.Count() );
aText->GetLinePositions( positions, strings_list.Count());
aText->GetLinePositions( positions, strings_list.Count() );
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{

View File

@ -1521,7 +1521,7 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
double degrees = ( aFPText->GetTextAngle() + aFootprint->GetOrientation() ) / 10;
// @todo there are a few more cases than these to contend with:
if( ( !aFPText->IsMirrored() && ( abs( degrees ) == 180 || abs( degrees ) == 270 ))
if( ( !aFPText->IsMirrored() && ( abs( degrees ) == 180 || abs( degrees ) == 270 ) )
|| ( aFPText->IsMirrored() && ( degrees == 360 ) ) )
{
// ETEXT::TOP_RIGHT:

View File

@ -420,7 +420,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
// well as value visible, so place the value right below the reference.
footprint->Value().SetTextAngle( footprint->Reference().GetTextAngle() );
footprint->Value().SetTextSize( footprint->Reference().GetTextSize() );
footprint->Value().SetTextThickness( footprint->Reference().GetTextThickness());
footprint->Value().SetTextThickness( footprint->Reference().GetTextThickness() );
textPos.y += thsize * 13 / 10; // 130% line height
footprint->Value().SetTextPos( textPos );
footprint->Value().SetPos0( textPos );

View File

@ -290,7 +290,8 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
}
break;
case T_thickness:aText->SetTextThickness( parseBoardUnits( "text thickness" ));
case T_thickness:
aText->SetTextThickness( parseBoardUnits( "text thickness" ) );
NeedRIGHT();
break;
@ -2217,7 +2218,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
std::vector< wxPoint > pts;
while( (token = NextTok()) != T_RIGHT )
while( (token = NextTok() ) != T_RIGHT )
pts.push_back( parseXY() );
shape->SetPolyPoints( pts );
@ -3394,7 +3395,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
std::vector< wxPoint > pts;
while( (token = NextTok()) != T_RIGHT )
while( (token = NextTok() ) != T_RIGHT )
pts.push_back( parseXY() );
shape->SetPolyPoints( pts );
@ -4287,23 +4288,29 @@ VIA* PCB_PARSER::parseVIA()
break;
case T_layers:
{
PCB_LAYER_ID layer1, layer2;
NextTok();
layer1 = lookUpLayer<PCB_LAYER_ID>( m_layerIndices );
NextTok();
layer2 = lookUpLayer<PCB_LAYER_ID>( m_layerIndices );
via->SetLayerPair( layer1, layer2 );
NeedRIGHT();
}
{
PCB_LAYER_ID layer1, layer2;
NextTok();
layer1 = lookUpLayer<PCB_LAYER_ID>( m_layerIndices );
NextTok();
layer2 = lookUpLayer<PCB_LAYER_ID>( m_layerIndices );
via->SetLayerPair( layer1, layer2 );
NeedRIGHT();
}
break;
case T_net:
if(! via->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true))
THROW_IO_ERROR(
wxString::Format( _( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource(), CurLineNumber(), CurOffset() )
);
if( !via->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
{
THROW_IO_ERROR( wxString::Format( _( "Invalid net ID in\n"
"file: '%s'\n"
"line: %d\n"
"offset: %d" ),
CurSource(),
CurLineNumber(),
CurOffset() ) );
}
NeedRIGHT();
break;
@ -4526,9 +4533,14 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
m_board->SetModified();
}
else if( token == T_hatch )
{
zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
}
else
{
zone->SetFillMode( ZONE_FILL_MODE::POLYGONS );
}
NeedRIGHT();
break;
@ -4582,7 +4594,8 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
NeedRIGHT();
break;
case T_thermal_bridge_width:zone->SetThermalReliefSpokeWidth( parseBoardUnits( T_thermal_bridge_width ));
case T_thermal_bridge_width:
zone->SetThermalReliefSpokeWidth( parseBoardUnits( T_thermal_bridge_width ) );
NeedRIGHT();
break;

View File

@ -390,7 +390,7 @@ bool DP_GATEWAYS::FitGateways( DP_GATEWAYS& aEntry, DP_GATEWAYS& aTarget,
bool DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const
{
VECTOR2I dir ( std::abs (a.x - b.x), std::abs ( a.y - b.y ));
VECTOR2I dir( std::abs (a.x - b.x), std::abs ( a.y - b.y ) );
return (dir.x == 0 && dir.y != 0) || (dir.x == dir.y) || (dir.y == 0 && dir.x != 0);
}

View File

@ -130,7 +130,8 @@ const ITEM_SET DRAGGER::findViaFanoutByHandle ( NODE *aNode, const VIA_HANDLE& h
l.Reverse();
rv.Add( l );
} else if ( item->OfKind( ITEM::VIA_T ))
}
else if( item->OfKind( ITEM::VIA_T ) )
{
rv.Add( item );
}

View File

@ -265,19 +265,19 @@ protected:
bool m_routable;
};
template< typename T, typename S >
std::unique_ptr< T > ItemCast( std::unique_ptr< S > aPtr )
template<typename T, typename S>
std::unique_ptr<T> ItemCast( std::unique_ptr<S> aPtr )
{
static_assert(std::is_base_of< ITEM, S >::value, "Need to be handed a ITEM!");
static_assert(std::is_base_of< ITEM, T >::value, "Need to cast to an ITEM!");
return std::unique_ptr< T >( static_cast<T*>(aPtr.release()) );
static_assert( std::is_base_of<ITEM, S>::value, "Need to be handed a ITEM!" );
static_assert( std::is_base_of<ITEM, T>::value, "Need to cast to an ITEM!" );
return std::unique_ptr<T>( static_cast<T*>( aPtr.release() ) );
}
template< typename T >
std::unique_ptr< typename std::remove_const< T >::type > Clone( const T& aItem )
template<typename T>
std::unique_ptr< typename std::remove_const<T>::type > Clone( const T& aItem )
{
static_assert(std::is_base_of< ITEM, T >::value, "Need to be handed an ITEM!");
return std::unique_ptr< typename std::remove_const< T >::type >( aItem.Clone() );
static_assert( std::is_base_of<ITEM, T>::value, "Need to be handed an ITEM!" );
return std::unique_ptr<typename std::remove_const<T>::type>( aItem.Clone() );
}
}

View File

@ -1103,14 +1103,14 @@ bool PNS_KICAD_IFACE::IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const
{
const VIA* via = static_cast<const VIA*>( aItem->Parent() );
return via->FlashLayer( static_cast<PCB_LAYER_ID>( aLayer ));
return via->FlashLayer( static_cast<PCB_LAYER_ID>( aLayer ) );
}
case PCB_PAD_T:
{
const PAD* pad = static_cast<const PAD*>( aItem->Parent() );
return pad->FlashLayer( static_cast<PCB_LAYER_ID>( aLayer ));
return pad->FlashLayer( static_cast<PCB_LAYER_ID>( aLayer ) );
}
default:

View File

@ -222,7 +222,7 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
}
}
}
else if ( !a_in && !b_in )
else if( !a_in && !b_in )
{
int min_idx = INT_MAX;
int max_idx = INT_MIN;
@ -231,7 +231,7 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
{
const SEG& os = aObstacle.CSegment(j);
if (os.Intersect(a))
if( os.Intersect(a) )
{
min_idx = std::min(min_idx, j);
max_idx = std::max(max_idx, j);

View File

@ -231,13 +231,14 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool
lc.Append( ( int ) p.x, ( int ) p.y );
}
}
break;
break;
case MEANDER_STYLE_CHAMFER:
{
double radius = (double) aDir.EuclideanNorm();
double correction = 0;
if( m_dual && radius > m_meanCornerRadius )
correction = (double)(-2 * abs(m_baselineOffset)) * tan( 22.5 * M_PI / 180.0 );
correction = (double)( -2 * abs(m_baselineOffset) ) * tan( 22.5 * M_PI / 180.0 );
VECTOR2D dir_cu = dir_u.Resize( correction );
VECTOR2D dir_cv = dir_v.Resize( correction );
@ -246,8 +247,8 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool
lc.Append( ( int ) p.x, ( int ) p.y );
p = aP + dir_u + (dir_v + dir_cv) * ( aSide ? -1.0 : 1.0 );
lc.Append( ( int ) p.x, ( int ) p.y );
break;
}
break;
}
p = aP + dir_u + dir_v * ( aSide ? -1.0 : 1.0 );

View File

@ -64,24 +64,25 @@ void MEANDER_PLACER_BASE::UpdateSettings( const MEANDER_SETTINGS& aSettings )
}
void MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin,
const VECTOR2I& aTuneStart,
const VECTOR2I& aCursorPos,
SHAPE_LINE_CHAIN& aPre,
SHAPE_LINE_CHAIN& aTuned,
SHAPE_LINE_CHAIN& aPost )
void MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aTuneStart,
const VECTOR2I& aCursorPos, SHAPE_LINE_CHAIN& aPre,
SHAPE_LINE_CHAIN& aTuned, SHAPE_LINE_CHAIN& aPost )
{
VECTOR2I cp ( aCursorPos );
if ( cp == aTuneStart ) // we don't like tuning segments with 0 length
if( cp == aTuneStart ) // we don't like tuning segments with 0 length
{
int idx = aOrigin.FindSegment( cp );
if( idx >= 0 )
{
const SEG& s = aOrigin.CSegment( idx );
cp += (s.B - s.A).Resize(2);
} else
}
else
{
cp += VECTOR2I (2, 5); // some arbitrary value that is not 45 degrees oriented
}
}
VECTOR2I n = aOrigin.NearestPoint( cp );
@ -136,7 +137,9 @@ void MEANDER_PLACER_BASE::tuneLineLength( MEANDERED_LINE& aTuned, long long int
m->Recalculate();
finished = true;
} else {
}
else
{
m->MakeEmpty();
}
}
@ -146,7 +149,7 @@ void MEANDER_PLACER_BASE::tuneLineLength( MEANDERED_LINE& aTuned, long long int
remaining = aElongation;
int meanderCount = 0;
for(MEANDER_SHAPE* m : aTuned.Meanders())
for( MEANDER_SHAPE* m : aTuned.Meanders() )
{
if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
{
@ -170,7 +173,7 @@ void MEANDER_PLACER_BASE::tuneLineLength( MEANDERED_LINE& aTuned, long long int
if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
{
m->Resize( std::max( m->Amplitude() - balance / 2,
(long long int) ( m_settings.m_minAmplitude ) ) );
(long long int) m_settings.m_minAmplitude ) );
}
}
}

View File

@ -574,8 +574,11 @@ void NODE::Add( LINE& aLine, bool aAllowRedundant )
auto s = l.Arc( i );
ARC* rarc;
if( !aAllowRedundant && ( rarc = findRedundantArc( s.GetP0(), s.GetP1(), aLine.Layers(), aLine.Net() ) ) )
if( !aAllowRedundant
&& ( rarc = findRedundantArc( s.GetP0(), s.GetP1(), aLine.Layers(), aLine.Net() ) ) )
{
aLine.Link( rarc );
}
else
{
auto newarc = std::make_unique< ARC >( aLine, s );
@ -594,8 +597,9 @@ void NODE::Add( LINE& aLine, bool aAllowRedundant )
if( s.A != s.B )
{
SEGMENT* rseg;
if( !aAllowRedundant &&
(rseg = findRedundantSegment( s.A, s.B, aLine.Layers(), aLine.Net() )) )
if( !aAllowRedundant
&& ( rseg = findRedundantSegment( s.A, s.B, aLine.Layers(), aLine.Net() ) ) )
{
// another line could be referencing this segment too :(
aLine.Link( rseg );
@ -1311,9 +1315,13 @@ void NODE::AllItemsInNet( int aNet, std::set<ITEM*>& aItems, int aKindMask)
INDEX::NET_ITEMS_LIST* l_root = m_root->m_index->GetItemsForNet( aNet );
if( l_root )
for( INDEX::NET_ITEMS_LIST::iterator i = l_root->begin(); i!= l_root->end(); ++i )
if( !Overrides( *i ) && (*i)->OfKind( aKindMask ))
{
for( INDEX::NET_ITEMS_LIST::iterator i = l_root->begin(); i != l_root->end(); ++i )
{
if( !Overrides( *i ) && (*i)->OfKind( aKindMask ) )
aItems.insert( *i );
}
}
}
}
@ -1359,9 +1367,11 @@ SEGMENT* NODE::findRedundantSegment( const VECTOR2I& A, const VECTOR2I& B, const
const VECTOR2I a2( seg2->Seg().A );
const VECTOR2I b2( seg2->Seg().B );
if( seg2->Layers().Start() == lr.Start() &&
((A == a2 && B == b2) || (A == b2 && B == a2)) )
if( seg2->Layers().Start() == lr.Start()
&& ( ( A == a2 && B == b2 ) || ( A == b2 && B == a2 ) ) )
{
return seg2;
}
}
}
@ -1374,7 +1384,7 @@ SEGMENT* NODE::findRedundantSegment( SEGMENT* aSeg )
}
ARC* NODE::findRedundantArc( const VECTOR2I& A, const VECTOR2I& B, const LAYER_RANGE& lr,
int aNet )
int aNet )
{
JOINT* jtStart = FindJoint( A, lr.Start(), aNet );
@ -1390,9 +1400,11 @@ ARC* NODE::findRedundantArc( const VECTOR2I& A, const VECTOR2I& B, const LAYER_R
const VECTOR2I a2( seg2->Anchor( 0 ) );
const VECTOR2I b2( seg2->Anchor( 1 ) );
if( seg2->Layers().Start() == lr.Start() &&
((A == a2 && B == b2) || (A == b2 && B == a2)) )
if( seg2->Layers().Start() == lr.Start()
&& ( ( A == a2 && B == b2 ) || ( A == b2 && B == a2 ) ) )
{
return seg2;
}
}
}
@ -1405,11 +1417,8 @@ ARC* NODE::findRedundantArc( ARC* aArc )
}
int NODE::QueryJoints( const BOX2I& aBox,
std::vector<JOINT*>& aJoints,
int aLayerMask,
int aKindMask
)
int NODE::QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints, int aLayerMask,
int aKindMask )
{
int n = 0;
@ -1417,21 +1426,21 @@ int NODE::QueryJoints( const BOX2I& aBox,
for( auto j = m_joints.begin(); j != m_joints.end(); ++j )
{
if ( aBox.Contains(j->second.Pos()) && j->second.LinkCount ( aKindMask ) )
if( aBox.Contains( j->second.Pos() ) && j->second.LinkCount( aKindMask ) )
{
aJoints.push_back( &j->second );
n++;
}
}
if ( isRoot() )
if( isRoot() )
return n;
for( auto j = m_root->m_joints.begin(); j != m_root->m_joints.end(); ++j )
{
if( ! Overrides( &j->second) )
{ if ( aBox.Contains(j->second.Pos()) && j->second.LinkCount ( aKindMask ) )
if( !Overrides( &j->second) )
{
if( aBox.Contains( j->second.Pos() ) && j->second.LinkCount( aKindMask ) )
{
aJoints.push_back( &j->second );
n++;
@ -1440,8 +1449,6 @@ int NODE::QueryJoints( const BOX2I& aBox,
}
return n;
}

View File

@ -1227,7 +1227,7 @@ SHOVE::SHOVE_STATUS SHOVE::shoveMainLoop()
{
// If we're shoving a free via then push a proxy LINE (with the via on the end) onto
// the stack.
pushLineStack( LINE( *m_draggedVia ));
pushLineStack( LINE( *m_draggedVia ) );
}
while( !m_lineStack.empty() )
@ -1460,7 +1460,7 @@ static VIA* findViaByHandle ( NODE *aNode, const VIA_HANDLE& handle )
for( ITEM* item : jt->LinkList() )
{
if ( item->OfKind( ITEM::VIA_T ))
if( item->OfKind( ITEM::VIA_T ) )
{
if( item->Net() == handle.net && item->Layers().Overlaps(handle.layers) )
return static_cast<VIA*>( item );
@ -1511,7 +1511,7 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveDraggingVia( const VIA_HANDLE aOldVia, const VEC
// Push the via to its new location
//
st = pushOrShoveVia( viaToDrag, ( aWhere - viaToDrag->Pos()), 0 );
st = pushOrShoveVia( viaToDrag, ( aWhere - viaToDrag->Pos() ), 0 );
// Shove any colliding objects out of the way
//

View File

@ -227,15 +227,11 @@ const WALKAROUND::RESULT WALKAROUND::Route( const LINE& aInitialPath )
auto old = path_cw.CLine();
if( clipToLoopStart( path_cw.Line() ))
{
if( clipToLoopStart( path_cw.Line() ) )
s_cw = ALMOST_DONE;
}
if( clipToLoopStart( path_ccw.Line() ))
{
if( clipToLoopStart( path_ccw.Line() ) )
s_ccw = ALMOST_DONE;
}
if( s_cw != IN_PROGRESS )

View File

@ -65,7 +65,7 @@ int main( int argc, char** argv )
}
catch( const IO_ERROR& ioe )
{
fprintf( stderr, "%s\n", TO_UTF8(ioe.What()) );
fprintf( stderr, "%s\n", TO_UTF8(ioe.What() ) );
failed = true;
}

View File

@ -268,7 +268,7 @@ void TEXT_MOD_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
text.SetTextHeight( ValueFromString( m_userUnits, aValue ) );
break;
case TMC_THICKNESS:text.SetTextThickness( ValueFromString( m_userUnits, aValue ));
case TMC_THICKNESS:text.SetTextThickness( ValueFromString( m_userUnits, aValue ) );
break;
case TMC_ORIENTATION:

View File

@ -1917,7 +1917,7 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
m_controls->CaptureCursor( false );
};
if( evt->IsCancelInteractive())
if( evt->IsCancelInteractive() )
{
if( polyGeomMgr.IsPolygonInProgress() )
cleanup();

View File

@ -391,7 +391,7 @@ int FOOTPRINT_EDITOR_TOOLS::ExportFootprint( const TOOL_EVENT& aEvent )
int FOOTPRINT_EDITOR_TOOLS::EditFootprint( const TOOL_EVENT& aEvent )
{
m_frame->LoadFootprintFromLibrary( m_frame->GetTreeFPID());
m_frame->LoadFootprintFromLibrary( m_frame->GetTreeFPID() );
return 0;
}

View File

@ -89,10 +89,10 @@ int main( int argc, char *argv[] )
trackB.SetLayer( F_Cu );
trackA.SetWidth( Mils2iu( 10 ));
trackB.SetWidth( Mils2iu( 20 ));
trackA.SetWidth( Mils2iu( 10 ) );
trackB.SetWidth( Mils2iu( 20 ) );
testEvalExpr( "A.fromTo('U1', 'U3') && A.NetClass == 'DDR3_A' ", VAL(0),false, &trackA, &trackB );
testEvalExpr( "A.fromTo('U1', 'U3') && A.NetClass == 'DDR3_A' ", VAL(0), false, &trackA, &trackB );
return 0;