From 07635d2fc745b8c20dd4540013318a2aba9333af Mon Sep 17 00:00:00 2001 From: Dominik Wernberger Date: Sun, 20 Dec 2020 19:50:45 +0100 Subject: [PATCH] Minor adjustments --- common/eda_text.cpp | 58 +++++++++---------- common/richio.cpp | 14 ++--- eeschema/sch_component.h | 4 +- eeschema/sch_draw_panel.h | 2 +- eeschema/sch_item.h | 2 +- eeschema/sch_painter.cpp | 4 +- eeschema/sch_painter.h | 2 +- eeschema/sch_sheet.h | 4 +- eeschema/sch_view.cpp | 2 +- include/eda_text.h | 2 +- include/richio.h | 2 +- .../class_board_stackup.cpp | 14 ++--- .../class_board_stackup.h | 2 +- pcbnew/exporters/export_hyperlynx.cpp | 4 +- pcbnew/exporters/gerber_jobfile_writer.cpp | 2 +- pcbnew/footprint.cpp | 2 +- pcbnew/fp_text.h | 4 +- pcbnew/plugins/kicad/kicad_plugin.cpp | 28 ++++----- pcbnew/plugins/kicad/pcb_parser.cpp | 4 +- pcbnew/zone.h | 2 +- utils/idftools/idf_common.h | 6 +- 21 files changed, 82 insertions(+), 82 deletions(-) diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 9f4bc9ced7..622ab66f64 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -523,47 +523,47 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl // and does not define FormatInternalUnits, used here // however this function should exist - aFormatter->Print( aNestLevel + 1, "(effects" ); + aFormatter->Print( aNestLevel + 1, "(effects" ); - // Text size - aFormatter->Print( 0, " (font" ); + // Text size + aFormatter->Print( 0, " (font" ); - aFormatter->Print( 0, " (size %s %s)", - FormatInternalUnits( GetTextHeight() ).c_str(), - FormatInternalUnits( GetTextWidth() ).c_str() ); + aFormatter->Print( 0, " (size %s %s)", + FormatInternalUnits( GetTextHeight() ).c_str(), + FormatInternalUnits( GetTextWidth() ).c_str() ); - if( GetTextThickness() ) - aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextThickness() ).c_str() ); + if( GetTextThickness() ) + aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextThickness() ).c_str() ); - if( IsBold() ) - aFormatter->Print( 0, " bold" ); + if( IsBold() ) + aFormatter->Print( 0, " bold" ); - if( IsItalic() ) - aFormatter->Print( 0, " italic" ); + if( IsItalic() ) + aFormatter->Print( 0, " italic" ); - aFormatter->Print( 0, ")"); // (font + aFormatter->Print( 0, ")"); // (font - if( IsMirrored() || - GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER || - GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER ) - { - aFormatter->Print( 0, " (justify"); + if( IsMirrored() || + GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER || + GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER ) + { + aFormatter->Print( 0, " (justify"); - if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER ) - aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" ); + if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER ) + aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" ); - if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER ) - aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" ); + if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER ) + aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" ); - if( IsMirrored() ) - aFormatter->Print( 0, " mirror" ); - aFormatter->Print( 0, ")" ); // (justify - } + if( IsMirrored() ) + aFormatter->Print( 0, " mirror" ); + aFormatter->Print( 0, ")" ); // (justify + } - if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() ) - aFormatter->Print( 0, " hide" ); + if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() ) + aFormatter->Print( 0, " hide" ); - aFormatter->Print( 0, ")\n" ); // (justify + aFormatter->Print( 0, ")\n" ); // (justify #endif } diff --git a/common/richio.cpp b/common/richio.cpp index 28b10cb74d..04bf898bb3 100644 --- a/common/richio.cpp +++ b/common/richio.cpp @@ -395,7 +395,7 @@ int OUTPUTFORMATTER::vprint( const char* fmt, va_list ap ) int OUTPUTFORMATTER::sprint( const char* fmt, ... ) { - va_list args; + va_list args; va_start( args, fmt ); int ret = vprint( fmt, args); @@ -416,7 +416,7 @@ int OUTPUTFORMATTER::Print( int nestLevel, const char* fmt, ... ) int result = 0; int total = 0; - for( int i=0; i Sets rendering targets & dependencies for layers. }; -#endif +#endif // __SCH_DRAW_PANEL_H diff --git a/eeschema/sch_item.h b/eeschema/sch_item.h index e510671b21..162809ddd6 100644 --- a/eeschema/sch_item.h +++ b/eeschema/sch_item.h @@ -289,7 +289,7 @@ public: * * @param aLayer The layer number. */ - void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; } + void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; } /** * Return the layers the item is drawn on (which may be more than its "home" layer) diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index f3b7361dbb..f1119ef515 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -254,7 +254,7 @@ float SCH_PAINTER::getShadowWidth() const // For best visuals the selection width must be a cross between the zoom level and the // default line width. - return (float) fabs( matrix.GetScale().x * 2.75 ) + Mils2iu( eeconfig()->m_Selection.thickness ); + return (float) std::fabs( matrix.GetScale().x * 2.75 ) + Mils2iu( eeconfig()->m_Selection.thickness ); } @@ -1682,7 +1682,7 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer ) } } - VECTOR2D pos = aSheet->GetPosition(); + VECTOR2D pos = aSheet->GetPosition(); VECTOR2D size = aSheet->GetSize(); if( aLayer == LAYER_SHEET_BACKGROUND ) diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h index 821a1007fa..bff365e6d5 100644 --- a/eeschema/sch_painter.h +++ b/eeschema/sch_painter.h @@ -209,4 +209,4 @@ private: }; // namespace KIGFX -#endif +#endif // __SCH_PAINTER_H diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 48f26b7c57..cafa764ef1 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -549,8 +549,8 @@ public: bool CanConnect( const SCH_ITEM* aItem ) const override { return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) || - ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS ) || - ( aItem->Type() == SCH_NO_CONNECT_T ); + ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS ) || + ( aItem->Type() == SCH_NO_CONNECT_T ); } std::vector GetConnectionPoints() const override; diff --git a/eeschema/sch_view.cpp b/eeschema/sch_view.cpp index d35c592d00..56117586d9 100644 --- a/eeschema/sch_view.cpp +++ b/eeschema/sch_view.cpp @@ -87,7 +87,7 @@ void SCH_VIEW::ResizeSheetWorkingArea( const SCH_SCREEN* aScreen ) const PAGE_INFO& page_info = aScreen->GetPageSettings(); double max_size_x = page_info.GetWidthIU() * 3.0; double max_size_y = page_info.GetHeightIU() * 3.0; - m_boundary.SetOrigin( -max_size_x/4, -max_size_y/4 ); + m_boundary.SetOrigin( -max_size_x / 4, -max_size_y / 4 ); m_boundary.SetSize( max_size_x, max_size_y ); } diff --git a/include/eda_text.h b/include/eda_text.h index 673892c544..337c419826 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -297,7 +297,7 @@ public: void TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCornerBuffer, int aClearanceValue ) const; - std::shared_ptr GetEffectiveTextShape( ) const; + std::shared_ptr GetEffectiveTextShape() const; /** * Test if \a aPoint is within the bounds of this object. diff --git a/include/richio.h b/include/richio.h index 00e751660a..0b207a2de2 100644 --- a/include/richio.h +++ b/include/richio.h @@ -398,7 +398,7 @@ private: char quoteChar[2]; int sprint( const char* fmt, ... ); - int vprint( const char* fmt, va_list ap ); + int vprint( const char* fmt, va_list ap ); }; diff --git a/pcbnew/board_stackup_manager/class_board_stackup.cpp b/pcbnew/board_stackup_manager/class_board_stackup.cpp index d7db2d9a63..351ddffaf6 100644 --- a/pcbnew/board_stackup_manager/class_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/class_board_stackup.cpp @@ -438,7 +438,7 @@ bool BOARD_STACKUP::SynchronizeWithBoard( BOARD_DESIGN_SETTINGS* aSettings ) } // Now initialize all stackup items to the initial values, when exist - for( BOARD_STACKUP_ITEM* item: stackup.GetList() ) + for( BOARD_STACKUP_ITEM* item : stackup.GetList() ) { bool found = false; // Search for initial settings: @@ -475,12 +475,12 @@ bool BOARD_STACKUP::SynchronizeWithBoard( BOARD_DESIGN_SETTINGS* aSettings ) } // Transfer other stackup settings from aSettings - BOARD_STACKUP& source_stackup = aSettings->GetStackupDescriptor(); - m_HasDielectricConstrains = source_stackup.m_HasDielectricConstrains; + const BOARD_STACKUP& source_stackup = aSettings->GetStackupDescriptor(); + m_HasDielectricConstrains = source_stackup.m_HasDielectricConstrains; m_EdgeConnectorConstraints = source_stackup.m_EdgeConnectorConstraints; m_CastellatedPads = source_stackup.m_CastellatedPads; - m_EdgePlating = source_stackup.m_EdgePlating; - m_FinishType = source_stackup.m_FinishType; + m_EdgePlating = source_stackup.m_EdgePlating; + m_FinishType = source_stackup.m_FinishType; *this = stackup; @@ -608,8 +608,8 @@ void BOARD_STACKUP::BuildDefaultStackupList( const BOARD_DESIGN_SETTINGS* aSetti const BOARD_STACKUP& source_stackup = aSettings->GetStackupDescriptor(); m_EdgeConnectorConstraints = source_stackup.m_EdgeConnectorConstraints; m_CastellatedPads = source_stackup.m_CastellatedPads; - m_EdgePlating = source_stackup.m_EdgePlating; - m_FinishType = source_stackup.m_FinishType; + m_EdgePlating = source_stackup.m_EdgePlating; + m_FinishType = source_stackup.m_FinishType; } } diff --git a/pcbnew/board_stackup_manager/class_board_stackup.h b/pcbnew/board_stackup_manager/class_board_stackup.h index 50b9b554e6..4fe174ac66 100644 --- a/pcbnew/board_stackup_manager/class_board_stackup.h +++ b/pcbnew/board_stackup_manager/class_board_stackup.h @@ -168,7 +168,7 @@ public: wxString FormatDielectricLayerName() const; // Getters: - bool IsEnabled() const {return m_enabled; } + bool IsEnabled() const { return m_enabled; } BOARD_STACKUP_ITEM_TYPE GetType() const { return m_Type; } PCB_LAYER_ID GetBrdLayerId() const { return m_LayerId; } diff --git a/pcbnew/exporters/export_hyperlynx.cpp b/pcbnew/exporters/export_hyperlynx.cpp index bbba99e13b..ebf96c3a2e 100644 --- a/pcbnew/exporters/export_hyperlynx.cpp +++ b/pcbnew/exporters/export_hyperlynx.cpp @@ -175,9 +175,9 @@ private: switch( aStack.m_shape ) { case PAD_SHAPE_CIRCLE: - case PAD_SHAPE_OVAL: shapeId = 0; break; + case PAD_SHAPE_OVAL: shapeId = 0; break; case PAD_SHAPE_ROUNDRECT: shapeId = 2; break; - case PAD_SHAPE_RECT: shapeId = 1; break; + case PAD_SHAPE_RECT: shapeId = 1; break; default: shapeId = 0; diff --git a/pcbnew/exporters/gerber_jobfile_writer.cpp b/pcbnew/exporters/gerber_jobfile_writer.cpp index 793d3c76db..bb97f42716 100644 --- a/pcbnew/exporters/gerber_jobfile_writer.cpp +++ b/pcbnew/exporters/gerber_jobfile_writer.cpp @@ -563,7 +563,7 @@ void GERBER_JOBFILE_WRITER::addJSONMaterialStackup() m_json["MaterialStackup"] = nlohmann::ordered_json::array(); // Build the candidates list: - LSET maskLayer; + LSET maskLayer; BOARD_STACKUP brd_stackup = m_pcb->GetDesignSettings().GetStackupDescriptor(); // Ensure brd_stackup is up to date (i.e. no change made by SynchronizeWithBoard() ) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index e5a4d256a5..4fcb423003 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -279,7 +279,7 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther ) m_3D_Drawings.clear(); m_3D_Drawings = aOther.m_3D_Drawings; m_doc = aOther.m_doc; - m_keywords = aOther.m_keywords; + m_keywords = aOther.m_keywords; m_properties = aOther.m_properties; // Ensure auxiliary data is up to date diff --git a/pcbnew/fp_text.h b/pcbnew/fp_text.h index b6d6cbaa48..4a611cbf46 100644 --- a/pcbnew/fp_text.h +++ b/pcbnew/fp_text.h @@ -48,8 +48,8 @@ public: enum TEXT_TYPE { TEXT_is_REFERENCE = 0, - TEXT_is_VALUE = 1, - TEXT_is_DIVERS = 2 + TEXT_is_VALUE = 1, + TEXT_is_DIVERS = 2 }; FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type = TEXT_is_DIVERS ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index 72fe8b878a..65a5c19024 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -556,7 +556,7 @@ void PCB_IO::formatBoardLayers( const BOARD* aBoard, int aNestLevel ) const User_9 }; - for( LSEQ seq = aBoard->GetEnabledLayers().Seq( non_cu, arrayDim( non_cu ) ); seq; ++seq ) + for( LSEQ seq = aBoard->GetEnabledLayers().Seq( non_cu, arrayDim( non_cu ) ); seq; ++seq ) { PCB_LAYER_ID layer = *seq; @@ -801,7 +801,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const m_out->Print( aNestLevel, "(gr_poly (pts\n" ); - for( int ii = 0; ii < pointsCount; ++ii ) + for( int ii = 0; ii < pointsCount; ++ii ) { int nestLevel = 0; @@ -900,7 +900,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const m_out->Print( aNestLevel, "(fp_poly (pts" ); - for( int ii = 0; ii < pointsCount; ++ii ) + for( int ii = 0; ii < pointsCount; ++ii ) { int nestLevel = 0; @@ -986,8 +986,8 @@ void PCB_IO::format( const FOOTPRINT* aFootprint, int aNestLevel ) const if( initial_comments ) { - for( unsigned i=0; iGetCount(); ++i ) - m_out->Print( aNestLevel, "%s\n", TO_UTF8( (*initial_comments)[i] ) ); + for( unsigned i = 0; i < initial_comments->GetCount(); ++i ) + m_out->Print( aNestLevel, "%s\n", TO_UTF8( (*initial_comments)[i] ) ); m_out->Print( 0, "\n" ); // improve readability? } @@ -1177,7 +1177,7 @@ void PCB_IO::format( const FOOTPRINT* aFootprint, int aNestLevel ) const void PCB_IO::formatLayers( LSET aLayerMask, int aNestLevel ) const { - std::string output; + std::string output; if( aNestLevel == 0 ) output += ' '; @@ -1932,21 +1932,21 @@ void PCB_IO::format( const ZONE* aZone, int aNestLevel ) const if( aZone->GetNumCorners() ) { bool new_polygon = true; - bool is_closed = false; + bool is_closed = false; for( auto iterator = aZone->CIterateWithHoles(); iterator; ++iterator ) { if( new_polygon ) { newLine = 0; - m_out->Print( aNestLevel+1, "(polygon\n" ); - m_out->Print( aNestLevel+2, "(pts\n" ); + m_out->Print( aNestLevel + 1, "(polygon\n" ); + m_out->Print( aNestLevel + 2, "(pts\n" ); new_polygon = false; is_closed = false; } if( newLine == 0 ) - m_out->Print( aNestLevel+3, "(xy %s %s)", + m_out->Print( aNestLevel + 3, "(xy %s %s)", FormatInternalUnits( iterator->x ).c_str(), FormatInternalUnits( iterator->y ).c_str() ); else @@ -1971,8 +1971,8 @@ void PCB_IO::format( const ZONE* aZone, int aNestLevel ) const if( newLine != 0 ) m_out->Print( 0, "\n" ); - m_out->Print( aNestLevel+2, ")\n" ); - m_out->Print( aNestLevel+1, ")\n" ); + m_out->Print( aNestLevel + 2, ")\n" ); + m_out->Print( aNestLevel + 1, ")\n" ); new_polygon = true; } } @@ -1982,8 +1982,8 @@ void PCB_IO::format( const ZONE* aZone, int aNestLevel ) const if( newLine != 0 ) m_out->Print( 0, "\n" ); - m_out->Print( aNestLevel+2, ")\n" ); - m_out->Print( aNestLevel+1, ")\n" ); + m_out->Print( aNestLevel + 2, ")\n" ); + m_out->Print( aNestLevel + 1, ")\n" ); } } diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index d3d376f81d..36e95ccbcc 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -1118,7 +1118,7 @@ void PCB_PARSER::parseBoardStackup() int dielectric_idx = 1; // the index of dielectric layers BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor(); - for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { if( CurTok() != T_LEFT ) Expecting( T_LEFT ); @@ -2391,7 +2391,7 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT() Unexpected( CurText() ); } - for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { if( token != T_LEFT ) Expecting( T_LEFT ); diff --git a/pcbnew/zone.h b/pcbnew/zone.h index 4c971528dd..72d582ef8e 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -684,7 +684,7 @@ public: /** * Checks if a given filled polygon is an insulated island * @param aLayer is the layer to test - * @param aPolyIdx is an inndex into m_FilledPolysList[aLayer] + * @param aPolyIdx is an index into m_FilledPolysList[aLayer] * @return true if the given polygon is insulated (i.e. has no net connection) */ bool IsIsland( PCB_LAYER_ID aLayer, int aPolyIdx ) const; diff --git a/utils/idftools/idf_common.h b/utils/idftools/idf_common.h index 3614745b25..fedae703df 100644 --- a/utils/idftools/idf_common.h +++ b/utils/idftools/idf_common.h @@ -417,19 +417,19 @@ public: bool Matches( double aDrillDia, double aPosX, double aPosY ) const; /** - * Function GettDrillDia + * Function GetDrillDia * returns the drill diameter in mm */ double GetDrillDia() const; /** - * Function GettDrillXPos + * Function GetDrillXPos * returns the drill's X position in mm */ double GetDrillXPos() const; /** - * Function GettDrillYPos + * Function GetDrillYPos * returns the drill's Y position in mm */ double GetDrillYPos() const;