From 9c7c05c161b9144952635a3d4211b448be217fff Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 24 Nov 2020 22:16:41 +0000 Subject: [PATCH] Mostly formatting cleanup but a few type-casting cleanups too. --- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 7 ++- 3d-viewer/3d_canvas/eda_3d_canvas.cpp | 2 +- .../c3d_render_ogl_legacy.cpp | 2 +- .../c3d_render_createscene.cpp | 4 +- .../3d_render_raytracing/shapes3D/cbbox.cpp | 6 +-- 3d-viewer/common_ogl/ogl_utils.cpp | 2 +- common/footprint_info.cpp | 2 +- common/template_fieldnames.cpp | 2 +- cvpcb/readwrite_dlgs.cpp | 2 +- eeschema/connection_graph.cpp | 2 +- .../dialogs/dialog_edit_components_libid.cpp | 5 +- .../dialogs/dialog_lib_edit_pin_table.cpp | 2 +- eeschema/dialogs/dialog_netlist.cpp | 9 ++-- eeschema/lib_pin.cpp | 6 +-- eeschema/pin_type.cpp | 12 ++--- eeschema/sch_base_frame.cpp | 2 +- eeschema/sch_plugin.cpp | 2 +- eeschema/sch_sheet.cpp | 4 +- eeschema/sim/sim_plot_frame.cpp | 6 +-- eeschema/tools/lib_move_tool.cpp | 2 +- eeschema/tools/sch_edit_tool.cpp | 2 +- eeschema/tools/sch_editor_control.cpp | 2 +- gerbview/readgerb.cpp | 2 +- gerbview/widgets/layer_widget.cpp | 4 +- kicad/dialogs/dialog_template_selector.cpp | 4 +- libs/kimath/src/geometry/shape_line_chain.cpp | 9 ++-- .../dialogs/design_inspector.cpp | 3 +- pagelayout_editor/tools/pl_selection_tool.cpp | 2 +- pcbnew/action_plugin.cpp | 2 +- pcbnew/build_BOM_from_board.cpp | 2 +- .../convert_drawsegment_list_to_polygon.cpp | 2 +- .../dialog_edit_footprint_for_fp_editor.cpp | 8 +-- pcbnew/dialogs/dialog_exchange_footprints.cpp | 4 +- .../dialogs/dialog_footprint_properties.cpp | 6 +-- pcbnew/dialogs/dialog_net_inspector.cpp | 4 +- pcbnew/dialogs/dialog_plot.cpp | 2 +- pcbnew/drc/drc_test_provider_annulus.cpp | 2 +- pcbnew/drc/drc_test_provider_connectivity.cpp | 4 +- .../drc_test_provider_copper_clearance.cpp | 2 +- .../drc_test_provider_diff_pair_coupling.cpp | 2 +- pcbnew/drc/drc_test_provider_disallow.cpp | 2 +- pcbnew/drc/drc_test_provider_hole_size.cpp | 4 +- pcbnew/drc/drc_test_provider_lvs.cpp | 2 +- .../drc/drc_test_provider_matched_length.cpp | 18 ++++--- pcbnew/drc/drc_test_provider_misc.cpp | 6 +-- pcbnew/drc/drc_test_provider_via_diameter.cpp | 2 +- pcbnew/exporters/export_vrml.cpp | 6 +-- pcbnew/exporters/gen_footprints_placefile.cpp | 2 +- pcbnew/footprint_libraries_utils.cpp | 2 +- pcbnew/graphics_cleaner.cpp | 4 +- .../netlist_reader/kicad_netlist_reader.cpp | 14 ++--- pcbnew/pcb_edit_frame.cpp | 3 +- pcbnew/pcb_shape.cpp | 4 +- pcbnew/plot_brditems_plotter.cpp | 18 +++---- pcbnew/plugins/eagle/eagle_plugin.cpp | 2 +- pcbnew/plugins/geda/gpcb_plugin.cpp | 2 +- pcbnew/plugins/kicad/pcb_parser.cpp | 49 +++++++++++------- pcbnew/router/pns_diff_pair.cpp | 2 +- pcbnew/router/pns_dragger.cpp | 3 +- pcbnew/router/pns_item.h | 18 +++---- pcbnew/router/pns_kicad_iface.cpp | 4 +- pcbnew/router/pns_line.cpp | 4 +- pcbnew/router/pns_meander.cpp | 7 +-- pcbnew/router/pns_meander_placer_base.cpp | 25 +++++---- pcbnew/router/pns_node.cpp | 51 +++++++++++-------- pcbnew/router/pns_shove.cpp | 6 +-- pcbnew/router/pns_walkaround.cpp | 8 +-- .../specctra_import_export/specctra_test.cpp | 2 +- pcbnew/text_mod_grid_table.cpp | 2 +- pcbnew/tools/drawing_tool.cpp | 2 +- pcbnew/tools/footprint_editor_tools.cpp | 2 +- qa/libeval_compiler/libeval_compiler_test.cpp | 6 +-- 72 files changed, 226 insertions(+), 205 deletions(-) diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 3263386449..efd79c38e4 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -110,7 +110,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_TEXT* aText, wxStringSplit( aText->GetShownText(), strings_list, '\n' ); std::vector 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; } } diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 8f6692fbe0..f10b098807 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -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; diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp index 3a27a3f8fd..f046a05244 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp @@ -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() ) ) diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp index fefa19d57a..5dd4c40d02 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp @@ -829,7 +829,7 @@ void C3D_RENDER_RAYTRACING::Reload( REPORTER* aStatusReporter, static_cast(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() ); diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp index 72b15229ca..f54ca255f3 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp @@ -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 ); } diff --git a/3d-viewer/common_ogl/ogl_utils.cpp b/3d-viewer/common_ogl/ogl_utils.cpp index e269910f25..2033e28b6a 100644 --- a/3d-viewer/common_ogl/ogl_utils.cpp +++ b/3d-viewer/common_ogl/ogl_utils.cpp @@ -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; diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index cd3ac63cf1..40ed54d073 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -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() ); } diff --git a/common/template_fieldnames.cpp b/common/template_fieldnames.cpp index dc0976d9d3..f114f37f7c 100644 --- a/common/template_fieldnames.cpp +++ b/common/template_fieldnames.cpp @@ -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(); diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index 3bb79ad00a..1bf17d4fa0 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -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 ); diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 1daf5bad83..034eb5f564 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -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) diff --git a/eeschema/dialogs/dialog_edit_components_libid.cpp b/eeschema/dialogs/dialog_edit_components_libid.cpp index e03a2be72a..428d191bca 100644 --- a/eeschema/dialogs/dialog_edit_components_libid.cpp +++ b/eeschema/dialogs/dialog_edit_components_libid.cpp @@ -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; diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index dd9869fd62..8c18498d6e 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -87,7 +87,7 @@ public: { wxString fieldValue; - if( pins.empty()) + if( pins.empty() ) return fieldValue; for( LIB_PIN* pin : pins ) diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp index 95aa005c23..1aabd7da56 100644 --- a/eeschema/dialogs/dialog_netlist.cpp +++ b/eeschema/dialogs/dialog_netlist.cpp @@ -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( 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; } diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index a615dfbf5a..21dc1962d0 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -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 ) ); } } diff --git a/eeschema/pin_type.cpp b/eeschema/pin_type.cpp index 8319e15241..0d18877f6b 100644 --- a/eeschema/pin_type.cpp +++ b/eeschema/pin_type.cpp @@ -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& PinTypeIcons() { - if( g_typeIcons.empty()) + if( g_typeIcons.empty() ) InitTables(); return g_typeIcons; @@ -203,7 +203,7 @@ const std::vector& 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& PinShapeIcons() { - if( g_shapeIcons.empty()) + if( g_shapeIcons.empty() ) InitTables(); return g_shapeIcons; @@ -221,7 +221,7 @@ const std::vector& 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& PinOrientationIcons() { - if( g_orientationIcons.empty()) + if( g_orientationIcons.empty() ) InitTables(); return g_orientationIcons; diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 714c715e47..8f926bdb1f 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -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(); } diff --git a/eeschema/sch_plugin.cpp b/eeschema/sch_plugin.cpp index 035c3ed111..59ac10e5f1 100644 --- a/eeschema/sch_plugin.cpp +++ b/eeschema/sch_plugin.cpp @@ -149,7 +149,7 @@ void SCH_PLUGIN::SymbolLibOptions( PROPERTIES* aListToAppendTo ) const (*aListToAppendTo)["username"] = UTF8( _( "User name for login to some special library server." - )); + ) ); (*aListToAppendTo)["password"] = UTF8( _( "Password for login to some special library server." diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 72ad6104e8..d61d36b4c2 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1037,10 +1037,10 @@ bool SCH_SHEET::operator <( const SCH_ITEM& aItem ) const auto sheet = static_cast( &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; diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 30838ee144..61448f34dc 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -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 ); diff --git a/eeschema/tools/lib_move_tool.cpp b/eeschema/tools/lib_move_tool.cpp index f288cf15bb..ab482c18e7 100644 --- a/eeschema/tools/lib_move_tool.cpp +++ b/eeschema/tools/lib_move_tool.cpp @@ -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( aItem )->Offset( mapCoords( aDelta )); + static_cast( aItem )->Offset( mapCoords( aDelta ) ); aItem->SetFlags( IS_MOVED ); } diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 7782db5489..8a13467ddc 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -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(); diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index c9eb0c8dff..631985ea37 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -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 ); } diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index b4e54a2ff1..08abacbf9d 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -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(); } diff --git a/gerbview/widgets/layer_widget.cpp b/gerbview/widgets/layer_widget.cpp index 643909879d..f5906765cc 100644 --- a/gerbview/widgets/layer_widget.cpp +++ b/gerbview/widgets/layer_widget.cpp @@ -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; } diff --git a/kicad/dialogs/dialog_template_selector.cpp b/kicad/dialogs/dialog_template_selector.cpp index e182d6b873..eb6435d845 100644 --- a/kicad/dialogs/dialog_template_selector.cpp +++ b/kicad/dialogs/dialog_template_selector.cpp @@ -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() ) ); } diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index 034a8405f2..f4288b52b1 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -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; diff --git a/pagelayout_editor/dialogs/design_inspector.cpp b/pagelayout_editor/dialogs/design_inspector.cpp index 7498dd2827..bb463339d9 100644 --- a/pagelayout_editor/dialogs/design_inspector.cpp +++ b/pagelayout_editor/dialogs/design_inspector.cpp @@ -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( GetParent() )->GetCurrentFileName() ); if( fn.GetName().IsEmpty() ) SetTitle( "" ); diff --git a/pagelayout_editor/tools/pl_selection_tool.cpp b/pagelayout_editor/tools/pl_selection_tool.cpp index a16dd9d5b7..596b8c3936 100644 --- a/pagelayout_editor/tools/pl_selection_tool.cpp +++ b/pagelayout_editor/tools/pl_selection_tool.cpp @@ -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 diff --git a/pcbnew/action_plugin.cpp b/pcbnew/action_plugin.cpp index e79ea29638..3831c09ec7 100644 --- a/pcbnew/action_plugin.cpp +++ b/pcbnew/action_plugin.cpp @@ -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; diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index 876c741a20..0d02235d51 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -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() ); diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp index 46d596aa7d..59351b2e9c 100644 --- a/pcbnew/convert_drawsegment_list_to_polygon.cpp +++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp @@ -277,7 +277,7 @@ bool ConvertOutlineToPolygon( std::vector& 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 ) { diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp index fa49da6df4..37c2927376 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp @@ -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(); } diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 24528de593..9aa6fa6734 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -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; diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp index 9c771c6fd2..ff2baeeed2 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties.cpp @@ -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(); } diff --git a/pcbnew/dialogs/dialog_net_inspector.cpp b/pcbnew/dialogs/dialog_net_inspector.cpp index 2a12064854..19ef031f04 100644 --- a/pcbnew/dialogs/dialog_net_inspector.cpp +++ b/pcbnew/dialogs/dialog_net_inspector.cpp @@ -735,7 +735,7 @@ protected: if( !aItem.IsOk() ) return wxDataViewItem(); - return wxDataViewItem( static_cast( aItem.GetID())->Parent() ); + return wxDataViewItem( static_cast( aItem.GetID() )->Parent() ); } @@ -744,7 +744,7 @@ protected: if( !aItem.IsOk() ) return true; - return static_cast( aItem.GetID())->GetIsGroup(); + return static_cast( aItem.GetID() )->GetIsGroup(); } diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 57fd609f1e..7b9a316ca9 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -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() ); diff --git a/pcbnew/drc/drc_test_provider_annulus.cpp b/pcbnew/drc/drc_test_provider_annulus.cpp index def238a849..6cf40db4f3 100644 --- a/pcbnew/drc/drc_test_provider_annulus.cpp +++ b/pcbnew/drc/drc_test_provider_annulus.cpp @@ -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; diff --git a/pcbnew/drc/drc_test_provider_connectivity.cpp b/pcbnew/drc/drc_test_provider_connectivity.cpp index 7563c4ff43..e4128d7036 100644 --- a/pcbnew/drc/drc_test_provider_connectivity.cpp +++ b/pcbnew/drc/drc_test_provider_connectivity.cpp @@ -138,7 +138,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run() { std::shared_ptr 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 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(); diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 88bf820a8b..9ee75b2a4e 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -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; diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index b212d91be5..55eb4ef67e 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -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() ); } } diff --git a/pcbnew/drc/drc_test_provider_disallow.cpp b/pcbnew/drc/drc_test_provider_disallow.cpp index 090bf6789e..63ba817c93 100644 --- a/pcbnew/drc/drc_test_provider_disallow.cpp +++ b/pcbnew/drc/drc_test_provider_disallow.cpp @@ -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() ); } }; diff --git a/pcbnew/drc/drc_test_provider_hole_size.cpp b/pcbnew/drc/drc_test_provider_hole_size.cpp index 1b7a68fc86..f5db8ff61f 100644 --- a/pcbnew/drc/drc_test_provider_hole_size.cpp +++ b/pcbnew/drc/drc_test_provider_hole_size.cpp @@ -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() ); } } diff --git a/pcbnew/drc/drc_test_provider_lvs.cpp b/pcbnew/drc/drc_test_provider_lvs.cpp index 0a8af24cfa..9b2a9c1ad3 100644 --- a/pcbnew/drc/drc_test_provider_lvs.cpp +++ b/pcbnew/drc/drc_test_provider_lvs.cpp @@ -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 ) { diff --git a/pcbnew/drc/drc_test_provider_matched_length.cpp b/pcbnew/drc/drc_test_provider_matched_length.cpp index bac14fe121..3a499083f1 100644 --- a/pcbnew/drc/drc_test_provider_matched_length.cpp +++ b/pcbnew/drc/drc_test_provider_matched_length.cpp @@ -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( citem ) ) + if( citem->Type() == PCB_VIA_T ) { ent.viaCount++; - ent.totalVia += computeViaThruLength( via, nitem.second ); // fixme: via thru distance + ent.totalVia += computeViaThruLength( static_cast( citem ), nitem.second ); } - else if ( TRACK* trk = dyn_cast(citem )) + else if( citem->Type() == PCB_TRACE_T ) { - ent.totalRoute += trk->GetLength(); + ent.totalRoute += static_cast( citem )->GetLength(); } - else if ( PAD* pad = dyn_cast( citem )) + else if ( citem->Type() == PCB_ARC_T ) { - ent.totalPadToDie += pad->GetPadToDieLength(); + ent.totalRoute += static_cast( citem )->GetLength(); + } + else if( citem->Type() == PCB_PAD_T ) + { + ent.totalPadToDie += static_cast( citem )->GetPadToDieLength(); } } diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index d7cc6df4ed..95b1aec7e3 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -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_ptrdrcItem = 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 drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE ); drcItem->SetItems( text ); - reportViolation( drcItem, text->GetPosition()); + reportViolation( drcItem, text->GetPosition() ); } } } diff --git a/pcbnew/drc/drc_test_provider_via_diameter.cpp b/pcbnew/drc/drc_test_provider_via_diameter.cpp index 778ac25ef1..304db3b2e3 100644 --- a/pcbnew/drc/drc_test_provider_via_diameter.cpp +++ b/pcbnew/drc/drc_test_provider_via_diameter.cpp @@ -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; diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index 696cfe36f4..f27fb61b1c 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -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( item )); + export_vrml_fp_text( static_cast( item ) ); break; case PCB_FP_SHAPE_T: diff --git a/pcbnew/exporters/gen_footprints_placefile.cpp b/pcbnew/exporters/gen_footprints_placefile.cpp index 53efa4c1f4..4ccd7eedee 100644 --- a/pcbnew/exporters/gen_footprints_placefile.cpp +++ b/pcbnew/exporters/gen_footprints_placefile.cpp @@ -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)!" ), diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 25afba282d..b14e09267d 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -995,7 +995,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint() if( ConfirmRevertDialog( this, msg ) ) { Clear_Pcb( false ); - AddFootprintToBoard( (FOOTPRINT*) m_revertModule->Clone()); + AddFootprintToBoard( static_cast( m_revertModule->Clone() ) ); Zoom_Automatique( false ); diff --git a/pcbnew/graphics_cleaner.cpp b/pcbnew/graphics_cleaner.cpp index d34683c9c8..02e08d16e6 100644 --- a/pcbnew/graphics_cleaner.cpp +++ b/pcbnew/graphics_cleaner.cpp @@ -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; } } diff --git a/pcbnew/netlist_reader/kicad_netlist_reader.cpp b/pcbnew/netlist_reader/kicad_netlist_reader.cpp index b71399ff79..5f3f813ead 100644 --- a/pcbnew/netlist_reader/kicad_netlist_reader.cpp +++ b/pcbnew/netlist_reader/kicad_netlist_reader.cpp @@ -191,7 +191,7 @@ void KICAD_NETLIST_PARSER::parseNet() wxString pin_function; // The token net was read, so the next data is (code ) - 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 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(); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 597a6fac07..e54c22114c 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -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." ) ); diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index ef9ba8c8e1..7400d15b4a 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -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; } diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 90bd3adf0c..6439232335 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -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++ ) { diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 46a4d506d0..5d3cc50f6e 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -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: diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index ffdb6aeece..805138f01a 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -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 ); diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 3cfb09c12a..5938d6b4c1 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -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( m_layerIndices ); - NextTok(); - layer2 = lookUpLayer( m_layerIndices ); - via->SetLayerPair( layer1, layer2 ); - NeedRIGHT(); - } + { + PCB_LAYER_ID layer1, layer2; + NextTok(); + layer1 = lookUpLayer( m_layerIndices ); + NextTok(); + layer2 = lookUpLayer( 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; diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp index 46f5004112..d8bfb4495c 100644 --- a/pcbnew/router/pns_diff_pair.cpp +++ b/pcbnew/router/pns_diff_pair.cpp @@ -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); } diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index ae4c8b39c6..1e4a46e96a 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -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 ); } diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index 22c76f6ced..d8b01d228b 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -265,19 +265,19 @@ protected: bool m_routable; }; -template< typename T, typename S > -std::unique_ptr< T > ItemCast( std::unique_ptr< S > aPtr ) +template +std::unique_ptr ItemCast( std::unique_ptr 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(aPtr.release()) ); + static_assert( std::is_base_of::value, "Need to be handed a ITEM!" ); + static_assert( std::is_base_of::value, "Need to cast to an ITEM!" ); + return std::unique_ptr( static_cast( aPtr.release() ) ); } -template< typename T > -std::unique_ptr< typename std::remove_const< T >::type > Clone( const T& aItem ) +template +std::unique_ptr< typename std::remove_const::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::value, "Need to be handed an ITEM!" ); + return std::unique_ptr::type>( aItem.Clone() ); } } diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 8faa592bd1..04df5b7a38 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1103,14 +1103,14 @@ bool PNS_KICAD_IFACE::IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const { const VIA* via = static_cast( aItem->Parent() ); - return via->FlashLayer( static_cast( aLayer )); + return via->FlashLayer( static_cast( aLayer ) ); } case PCB_PAD_T: { const PAD* pad = static_cast( aItem->Parent() ); - return pad->FlashLayer( static_cast( aLayer )); + return pad->FlashLayer( static_cast( aLayer ) ); } default: diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index b3a2dbd5f8..41ea888728 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -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); diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index a892d293b9..2943d1aaeb 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -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 ); diff --git a/pcbnew/router/pns_meander_placer_base.cpp b/pcbnew/router/pns_meander_placer_base.cpp index f51ca0f221..acb0577980 100644 --- a/pcbnew/router/pns_meander_placer_base.cpp +++ b/pcbnew/router/pns_meander_placer_base.cpp @@ -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 ) ); } } } diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index d240620fb3..0bf4066879 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -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& 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& aJoints, - int aLayerMask, - int aKindMask - ) +int NODE::QueryJoints( const BOX2I& aBox, std::vector& 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; - - } diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 75528bbe89..a10cc5ff33 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -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( 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 // diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp index 4acd3c893d..16909bd2ec 100644 --- a/pcbnew/router/pns_walkaround.cpp +++ b/pcbnew/router/pns_walkaround.cpp @@ -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 ) diff --git a/pcbnew/specctra_import_export/specctra_test.cpp b/pcbnew/specctra_import_export/specctra_test.cpp index 3f987e33c4..ee95d71bff 100644 --- a/pcbnew/specctra_import_export/specctra_test.cpp +++ b/pcbnew/specctra_import_export/specctra_test.cpp @@ -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; } diff --git a/pcbnew/text_mod_grid_table.cpp b/pcbnew/text_mod_grid_table.cpp index ee9b8d2f81..899c174969 100644 --- a/pcbnew/text_mod_grid_table.cpp +++ b/pcbnew/text_mod_grid_table.cpp @@ -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: diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 940c5dcdd0..83d0e53d45 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -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(); diff --git a/pcbnew/tools/footprint_editor_tools.cpp b/pcbnew/tools/footprint_editor_tools.cpp index c4c730da23..babcc325e9 100644 --- a/pcbnew/tools/footprint_editor_tools.cpp +++ b/pcbnew/tools/footprint_editor_tools.cpp @@ -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; } diff --git a/qa/libeval_compiler/libeval_compiler_test.cpp b/qa/libeval_compiler/libeval_compiler_test.cpp index 1af54972fc..a37a9d597e 100644 --- a/qa/libeval_compiler/libeval_compiler_test.cpp +++ b/qa/libeval_compiler/libeval_compiler_test.cpp @@ -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;