diff --git a/common/dialogs/dialog_color_picker.cpp b/common/dialogs/dialog_color_picker.cpp index fe1e82459e..19e32b753d 100644 --- a/common/dialogs/dialog_color_picker.cpp +++ b/common/dialogs/dialog_color_picker.cpp @@ -684,7 +684,7 @@ void DIALOG_COLOR_PICKER::OnColorValueText( wxCommandEvent& event ) } -bool DIALOG_COLOR_PICKER::setHSvaluesFromCursor( wxPoint aMouseCursor ) +bool DIALOG_COLOR_PICKER::setHSvaluesFromCursor( const wxPoint& aMouseCursor ) { wxPoint mousePos = aMouseCursor; wxSize bmsize = m_bitmapHSV->GetSize(); diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 70230e5dbe..ca177d31a3 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -219,7 +219,7 @@ void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi } -void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, +void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, const COLOR4D& aColor, wxPenStyle aStyle ) { GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle ); @@ -359,7 +359,7 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int w } -void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, +void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, const COLOR4D& aColor ) { GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor ); @@ -374,7 +374,7 @@ void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, } -void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, +void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, const COLOR4D& aColor ) { GRSetColorPen( aDC, aColor, aWidth ); @@ -565,7 +565,7 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, const COLOR4D& } -void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, +void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth, const COLOR4D& aColor ) { GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor ); @@ -584,7 +584,7 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width } -void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, +void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, const COLOR4D& aColor ) { GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor ); @@ -630,8 +630,8 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc } -void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, wxPoint aCenter, - int aWidth, const COLOR4D& aColor ) +void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, + const wxPoint& aCenter, int aWidth, const COLOR4D& aColor ) { GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y, aWidth, aColor ); diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index 7e61673878..b3aafa3916 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -539,7 +539,7 @@ void DIALOG_PLOT_SCHEMATIC::createDxfFile( bool aPlotAll, bool aPlotDrawingSheet bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDxf( const wxString& aFileName, SCH_SCREEN* aScreen, RENDER_SETTINGS* aRenderSettings, - wxPoint aPlotOffset, + const wxPoint& aPlotOffset, double aScale, bool aPlotFrameRef ) { @@ -707,7 +707,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, - wxPoint aPlot0ffset, + const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef, HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits ) @@ -1061,7 +1061,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, - wxPoint aPlot0ffset, + const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef ) { diff --git a/eeschema/dialogs/dialog_plot_schematic.h b/eeschema/dialogs/dialog_plot_schematic.h index dabe767c16..c06efc4118 100644 --- a/eeschema/dialogs/dialog_plot_schematic.h +++ b/eeschema/dialogs/dialog_plot_schematic.h @@ -112,8 +112,8 @@ private: // DXF void createDxfFile( bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS* aRenderSettings ); bool plotOneSheetDxf( const wxString& aFileName, SCH_SCREEN* aScreen, - RENDER_SETTINGS* aRenderSettings, wxPoint aPlotOffset, double aScale, - bool aPlotFrameRef ); + RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset, + double aScale, bool aPlotFrameRef ); // HPGLGetPlotOriginAndUnits HPGL_PLOT_ORIGIN_AND_UNITS getPlotOriginAndUnits() @@ -155,14 +155,14 @@ private: void setHpglPenWidth(); bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, - wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef, + const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef, HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits ); // PS void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings ); bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, - wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef ); + const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef ); // SVG void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings ); diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 4cb0521524..753f818160 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -2000,7 +2000,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure, void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( - LAYER_ID aCadstarSheetID, wxPoint aPosition, wxSize aSheetSize, + LAYER_ID aCadstarSheetID, const wxPoint& aPosition, wxSize aSheetSize, const SCH_SHEET_PATH& aParentSheet ) { wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), , @@ -2855,7 +2855,7 @@ std::pair CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( } -wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( wxPoint aCadstarPoint ) +wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( const wxPoint& aCadstarPoint ) { wxPoint retval; @@ -2866,8 +2866,8 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( wxPoint aCadstarPoint ) } -wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint( wxPoint aCadstarPoint, - wxPoint aCadstarCentre ) +wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint( const wxPoint& aCadstarPoint, + const wxPoint& aCadstarCentre ) { wxPoint retval; @@ -2912,13 +2912,13 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint, } -double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( wxPoint aPoint ) +double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( const wxPoint& aPoint ) { return NormalizeAnglePos( ArcTangente( aPoint.y, aPoint.x ) ); } -double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( wxPoint aPoint ) +double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( const wxPoint& aPoint ) { return sqrt( ( (double) aPoint.x * (double) aPoint.x ) + ( (double) aPoint.y * (double) aPoint.y ) ); diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h index bd039a9899..b75a9b4ade 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h @@ -121,8 +121,8 @@ private: void loadTextVariables(); //Helper Functions for loading sheets - void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, wxPoint aPosition, wxSize aSheetSize, - const SCH_SHEET_PATH& aParentSheet ); + void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, const wxPoint& aPosition, + wxSize aSheetSize, const SCH_SHEET_PATH& aParentSheet ); void loadChildSheets( LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH& aSheet ); @@ -218,9 +218,9 @@ private: std::pair getFigureExtentsKiCad( const FIGURE& aCadstarFigure ); - wxPoint getKiCadPoint( wxPoint aCadstarPoint ); + wxPoint getKiCadPoint( const wxPoint& aCadstarPoint ); - wxPoint getKiCadLibraryPoint( wxPoint aCadstarPoint, wxPoint aCadstarCentre ); + wxPoint getKiCadLibraryPoint( const wxPoint& aCadstarPoint, const wxPoint& aCadstarCentre ); wxPoint applyTransform( const wxPoint& aPoint, const wxPoint& aMoveVector = { 0, 0 }, const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, @@ -281,14 +281,14 @@ private: * @param aPoint * @return Angle in decidegrees of the polar representation of the point, scaled 0..360 */ - double getPolarAngle( wxPoint aPoint ); + double getPolarAngle( const wxPoint& aPoint ); /** * @brief * @param aPoint * @return Radius of polar representation of the point */ - double getPolarRadius( wxPoint aPoint ); + double getPolarRadius( const wxPoint& aPoint ); }; // CADSTAR_SCH_ARCHIVE_LOADER diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index b8df9aa7da..81c790a41f 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -358,16 +358,18 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent ) } -SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, wxPoint aPos ) +SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const wxPoint& aPos ) { SCHEMATIC_SETTINGS& cfg = getModel()->Settings(); + wxPoint pos = aPos; + if( aPos == wxDefaultPosition ) - aPos = static_cast( getViewControls()->GetCursorPosition() ); + pos = static_cast( getViewControls()->GetCursorPosition() ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); - m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( aPos ); + m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos ); m_busUnfold.entry->SetParent( m_frame->GetScreen() ); m_frame->AddToScreen( m_busUnfold.entry, m_frame->GetScreen() ); @@ -378,7 +380,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, wxPoint aPo m_busUnfold.label->SetFlags( IS_NEW | IS_MOVING ); m_busUnfold.in_progress = true; - m_busUnfold.origin = aPos; + m_busUnfold.origin = pos; m_busUnfold.net_name = aNet; getViewControls()->SetCrossHairCursorPosition( m_busUnfold.entry->GetEnd(), false ); diff --git a/eeschema/tools/sch_line_wire_bus_tool.h b/eeschema/tools/sch_line_wire_bus_tool.h index 25ddc2bb16..f75505292d 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.h +++ b/eeschema/tools/sch_line_wire_bus_tool.h @@ -96,7 +96,7 @@ public: private: int doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw ); SCH_LINE* startSegments( int aType, const VECTOR2D& aPos ); - SCH_LINE* doUnfoldBus( const wxString& aNet, wxPoint aPos = wxDefaultPosition ); + SCH_LINE* doUnfoldBus( const wxString& aNet, const wxPoint& aPos = wxDefaultPosition ); void finishSegments(); /** diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index b5605e9131..7aa086c34b 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -525,7 +525,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) } -void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint, +void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoint& aPoint, EDA_ITEMS& aList ) { EE_RTREE& items = m_frame->GetScreen()->Items(); diff --git a/eeschema/tools/sch_move_tool.h b/eeschema/tools/sch_move_tool.h index 1079eb2cc7..bf843f2e47 100644 --- a/eeschema/tools/sch_move_tool.h +++ b/eeschema/tools/sch_move_tool.h @@ -68,7 +68,7 @@ private: ///< Find additional items for a drag operation. ///< Connected items with no wire are included (as there is no wire to adjust for the drag). ///< Connected wires are included with any un-connected ends flagged (STARTPOINT or ENDPOINT). - void getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint, EDA_ITEMS& aList ); + void getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoint& aPoint, EDA_ITEMS& aList ); ///< Set up handlers for various events. void setTransitions() override; diff --git a/gerbview/am_primitive.cpp b/gerbview/am_primitive.cpp index 402efbe3ca..912a31d3cd 100644 --- a/gerbview/am_primitive.cpp +++ b/gerbview/am_primitive.cpp @@ -95,15 +95,17 @@ const int seg_per_circle = 64; // Number of segments to approximate a circle void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_SET& aShapeBuffer, - wxPoint aShapePos ) + const wxPoint& aShapePos ) { #define TO_POLY_SHAPE \ { \ if( polybuffer.size() > 1 ) \ { \ aShapeBuffer.NewOutline(); \ + \ for( unsigned jj = 0; jj < polybuffer.size(); jj++ ) \ aShapeBuffer.Append( polybuffer[jj].x, polybuffer[jj].y ); \ + \ aShapeBuffer.Append( polybuffer[0].x, polybuffer[0].y ); \ } \ } @@ -809,7 +811,7 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent ) SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent, - wxPoint aShapePos ) + const wxPoint& aShapePos ) { SHAPE_POLY_SET holeBuffer; bool hasHole = false; @@ -858,8 +860,8 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, - wxDC* aDC, const COLOR4D& aColor, wxPoint aShapePos, - bool aFilledShape ) + wxDC* aDC, const COLOR4D& aColor, + const wxPoint& aShapePos, bool aFilledShape ) { SHAPE_POLY_SET* shapeBuffer = GetApertureMacroShape( aParent, aShapePos ); diff --git a/gerbview/am_primitive.h b/gerbview/am_primitive.h index 38ba3163f5..233a44a01e 100644 --- a/gerbview/am_primitive.h +++ b/gerbview/am_primitive.h @@ -142,7 +142,7 @@ public: */ void DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_SET& aShapeBuffer, - wxPoint aShapePos ); + const wxPoint& aShapePos ); private: /** @@ -189,7 +189,8 @@ struct APERTURE_MACRO * @param aParent is the parent #GERBER_DRAW_ITEM which is actually drawn. * @return the shape of the item. */ - SHAPE_POLY_SET* GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent, wxPoint aShapePos ); + SHAPE_POLY_SET* GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent, + const wxPoint& aShapePos ); /** * Draw the primitive shape for flashed items. @@ -204,7 +205,8 @@ struct APERTURE_MACRO * @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode. */ void DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - const COLOR4D& aColor, wxPoint aShapePos, bool aFilledShape ); + const COLOR4D& aColor, const wxPoint& aShapePos, + bool aFilledShape ); /** * Calculate a value that can be used to evaluate the size of text when displaying the diff --git a/include/dialogs/dialog_color_picker.h b/include/dialogs/dialog_color_picker.h index 4a8819a132..32e2e34f7c 100644 --- a/include/dialogs/dialog_color_picker.h +++ b/include/dialogs/dialog_color_picker.h @@ -172,7 +172,7 @@ private: * if Saturation value computed from aMouseCursor is <= 1.0, * and false if aMouseCursor is outside this area. */ - bool setHSvaluesFromCursor( wxPoint aMouseCursor ); + bool setHSvaluesFromCursor( const wxPoint& aMouseCursor ); ///< Event handler for defined color buttons void buttColorClick( wxMouseEvent& event ); diff --git a/include/gr_basic.h b/include/gr_basic.h index f9c2d8a871..92b08f88d3 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -104,7 +104,7 @@ void GRForceBlackPen( bool flagforce ); */ bool GetGRForceBlackPenState( void ); -void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, +void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, const COLOR4D& aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID ); void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, const COLOR4D& Color, wxPenStyle aStyle = wxPENSTYLE_SOLID ); @@ -171,9 +171,9 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, const CO void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, const COLOR4D& Color ); void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, const COLOR4D& Color, const COLOR4D& BgColor ); -void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, +void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, const COLOR4D& aColor ); -void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, +void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth, const COLOR4D& aColor ); void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, @@ -184,8 +184,8 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc, int yc, const COLOR4D& Color ); void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc, int yc, int width, const COLOR4D& Color ); -void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, - wxPoint aCenter, int aWidth, const COLOR4D& aColor ); +void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, + const wxPoint& aCenter, int aWidth, const COLOR4D& aColor ); void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle, int r, const COLOR4D& Color, const COLOR4D& BgColor ); void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, @@ -195,12 +195,12 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int w void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, const COLOR4D& Color ); -void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, +void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, const COLOR4D& aColor ); void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int aPenSize, const COLOR4D& Color ); -void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, +void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, const COLOR4D& aColor ); void GRSetColor( const COLOR4D& Color ); diff --git a/libs/kimath/include/convert_basic_shapes_to_polygon.h b/libs/kimath/include/convert_basic_shapes_to_polygon.h index 269f503b1e..9db154d6dc 100644 --- a/libs/kimath/include/convert_basic_shapes_to_polygon.h +++ b/libs/kimath/include/convert_basic_shapes_to_polygon.h @@ -75,7 +75,7 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa * @param aMinSegCount is the min count of segments to approximate. * Default = 0 to do not force a min count. */ -void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter, int aRadius, +void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 ); /** @@ -89,7 +89,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter, * @param aMinSegCount is the min count of segments to approximate. * Default = 0 to do not force a min count. */ -void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, int aRadius, +void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 ); @@ -110,8 +110,9 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, i * @param aMinSegCount is the min count of segments to approximate. * Default = 0 to do not force a min count. */ -void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aEnd, - int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 ); +void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart, + const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, + int aMinSegCount = 0 ); /** * Convert a rectangle or trapezoid to a polygon. @@ -172,8 +173,9 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, * @param aError is the internal units allowed for error in approximation. * @param aErrorLoc determines if the approximation error be placed outside or inside the polygon. */ -void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aMid, - wxPoint aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc ); +void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart, + const wxPoint& aMid, const wxPoint& aEnd, int aWidth, int aError, + ERROR_LOC aErrorLoc ); /** * Convert arcs to multiple straight segments. @@ -185,7 +187,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoi * @param aError is the internal units allowed for error in approximation. * @param aErrorLoc determines if the approximation error be placed outside or inside the polygon. */ -void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCentre, int aRadius, +void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCentre, int aRadius, int aWidth, int aError, ERROR_LOC aErrorLoc ); #endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H diff --git a/libs/kimath/include/geometry/convex_hull.h b/libs/kimath/include/geometry/convex_hull.h index 1da0780429..95cf271122 100644 --- a/libs/kimath/include/geometry/convex_hull.h +++ b/libs/kimath/include/geometry/convex_hull.h @@ -57,6 +57,6 @@ void BuildConvexHull( std::vector& aResult, const SHAPE_POLY_SET& aPoly * @param aRotation is the rotation of the convex hull. */ void BuildConvexHull( std::vector& aResult, const SHAPE_POLY_SET& aPolygons, - wxPoint aPosition, double aRotation ); + const wxPoint& aPosition, double aRotation ); #endif // __CONVEX_HULL_H diff --git a/libs/kimath/include/trigo.h b/libs/kimath/include/trigo.h index 29b8b6eca0..ddfa8aa14c 100644 --- a/libs/kimath/include/trigo.h +++ b/libs/kimath/include/trigo.h @@ -58,8 +58,8 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd, * @return bool - true if the two segments defined by four points intersect. * (i.e. if the 2 segments have at least a common point) */ -bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, - const wxPoint &a_p1_l2, const wxPoint &a_p2_l2, +bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1, + const wxPoint& a_p1_l2, const wxPoint& a_p2_l2, wxPoint* aIntersectionPoint = nullptr ); /* @@ -75,8 +75,7 @@ void RotatePoint( int *pX, int *pY, double angle ); void RotatePoint( int *pX, int *pY, int cx, int cy, double angle ); /* - * Calculates the new coord point point - * for a rotation angle in (1 / 10 degree) + * Calculate the new coord point point for a rotation angle in (1 / 10 degree). */ inline void RotatePoint( wxPoint* point, double angle ) { @@ -91,8 +90,7 @@ inline void RotatePoint( VECTOR2I& point, double angle ) void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, double angle ); /* - * Calculates the new coord point point - * for a center rotation center and angle in (1 / 10 degree) + * Calculate the new coord point point for a center rotation center and angle in (1 / 10 degree). */ void RotatePoint( wxPoint *point, const wxPoint & centre, double angle ); @@ -114,12 +112,12 @@ const wxPoint GetArcCenter( const wxPoint& aStart, const wxPoint& aMid, const wx const wxPoint GetArcCenter( VECTOR2I aStart, VECTOR2I aEnd, double aAngle ); /** - * Returns the subtended angle for a given arc + * Return the subtended angle for a given arc. */ double GetArcAngle( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ); /** - * Returns the middle point of an arc, half-way between aStart and aEnd. There are two possible + * Return the middle point of an arc, half-way between aStart and aEnd. There are two possible * solutions which can be found by toggling aMinArcAngle. The behaviour is undefined for * semicircles (i.e. 180 degree arcs). * @@ -162,9 +160,9 @@ inline double EuclideanNorm( const wxSize &vector ) //! @param linePointA Point on line //! @param linePointB Point on line //! @param referencePoint Reference point -inline double DistanceLinePoint( const wxPoint &linePointA, - const wxPoint &linePointB, - const wxPoint &referencePoint ) +inline double DistanceLinePoint( const wxPoint& linePointA, + const wxPoint& linePointB, + const wxPoint& referencePoint ) { // Some of the multiple double casts are redundant. However in the previous // definition the cast was (implicitly) done too late, just before @@ -183,7 +181,7 @@ inline double DistanceLinePoint( const wxPoint &linePointA, //! @param pointB Second point //! @param threshold The maximum distance //! @return True or false -inline bool HitTestPoints( const wxPoint &pointA, const wxPoint &pointB, double threshold ) +inline bool HitTestPoints( const wxPoint& pointA, const wxPoint& pointB, double threshold ) { wxPoint vectorAB = pointB - pointA; @@ -197,7 +195,7 @@ inline bool HitTestPoints( const wxPoint &pointA, const wxPoint &pointB, double //! @brief Determine the cross product //! @param vectorA Two-dimensional vector //! @param vectorB Two-dimensional vector -inline double CrossProduct( const wxPoint &vectorA, const wxPoint &vectorB ) +inline double CrossProduct( const wxPoint& vectorA, const wxPoint& vectorB ) { // As before the cast is to avoid int overflow return (double)vectorA.x * vectorB.y - (double)vectorA.y * vectorB.x; @@ -211,7 +209,8 @@ inline double CrossProduct( const wxPoint &vectorA, const wxPoint &vectorB ) * @param aEnd is the second end-point of the line segment * @param aDist = maximum distance for hit */ -bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist ); +bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd, + int aDist ); /** * Return the length of a line segment defined by \a aPointA and \a aPointB. @@ -223,8 +222,7 @@ bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int inline double GetLineLength( const wxPoint& aPointA, const wxPoint& aPointB ) { // Implicitly casted to double - return hypot( aPointA.x - aPointB.x, - aPointA.y - aPointB.y ); + return hypot( aPointA.x - aPointB.x, aPointA.y - aPointB.y ); } // These are the usual degrees <-> radians conversion routines @@ -244,8 +242,10 @@ template inline T NormalizeAngle360Max( T Angle ) { while( Angle < -3600 ) Angle += 3600; + while( Angle > 3600 ) Angle -= 3600; + return Angle; } @@ -255,27 +255,29 @@ template inline T NormalizeAngle360Min( T Angle ) { while( Angle <= -3600 ) Angle += 3600; + while( Angle >= 3600 ) Angle -= 3600; + return Angle; } -/// Normalize angle to be in the 0.0 .. -360.0 range: -/// angle is in 1/10 degrees +/// Normalize angle to be in the 0.0 .. -360.0 range: angle is in 1/10 degrees. template inline T NormalizeAngleNeg( T Angle ) { while( Angle <= -3600 ) Angle += 3600; + while( Angle > 0 ) Angle -= 3600; + return Angle; } -/// Normalize angle to be in the 0.0 .. 360.0 range: -/// angle is in 1/10 degrees +/// Normalize angle to be in the 0.0 .. 360.0 range: angle is in 1/10 degrees. template inline T NormalizeAnglePos( T Angle ) { while( Angle < 0 ) @@ -291,14 +293,15 @@ template inline void NORMALIZE_ANGLE_POS( T& Angle ) } -/// Normalize angle to be in the 0.0 .. 360.0 range: -/// angle is in degrees +/// Normalize angle to be in the 0.0 .. 360.0 range: angle is in degrees. inline double NormalizeAngleDegreesPos( double Angle ) { while( Angle < 0 ) Angle += 360.0; + while( Angle >= 360.0 ) Angle -= 360.0; + return Angle; } @@ -313,19 +316,22 @@ inline double NormalizeAngleRadiansPos( double Angle ) { while( Angle < 0 ) Angle += (2 * M_PI ); + while( Angle >= ( 2 * M_PI ) ) Angle -= ( 2 * M_PI ); + return Angle; } -/// Normalize angle to be aMin < angle <= aMax -/// angle is in degrees +/// Normalize angle to be aMin < angle <= aMax angle is in degrees. inline double NormalizeAngleDegrees( double Angle, double aMin, double aMax ) { while( Angle < aMin ) Angle += 360.0; + while( Angle >= aMax ) Angle -= 360.0; + return Angle; } @@ -343,10 +349,13 @@ template inline T AddAngles( T a1, T2 a2 ) template inline T NegateAndNormalizeAnglePos( T Angle ) { Angle = -Angle; + while( Angle < 0 ) Angle += 3600; + while( Angle >= 3600 ) Angle -= 3600; + return Angle; } @@ -361,8 +370,10 @@ template inline T NormalizeAngle90( T Angle ) { while( Angle < -900 ) Angle += 1800; + while( Angle > 900 ) Angle -= 1800; + return Angle; } @@ -377,8 +388,10 @@ template inline T NormalizeAngle180( T Angle ) { while( Angle <= -1800 ) Angle += 3600; + while( Angle > 1800 ) Angle -= 3600; + return Angle; } diff --git a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp index 1daa7af2fc..616d1d895f 100644 --- a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp +++ b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp @@ -39,7 +39,7 @@ #include -void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter, int aRadius, +void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount ) { wxPoint corner_position; @@ -78,7 +78,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, wxPoint aCenter, } -void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, int aRadius, +void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount ) { wxPoint corner_position; @@ -123,8 +123,9 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, i } -void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aEnd, - int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount ) +void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart, + const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, + int aMinSegCount ) { // To build the polygonal shape outside the actual shape, we use a bigger // radius to build rounded ends. @@ -479,8 +480,9 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa } -void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoint aMid, - wxPoint aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc ) +void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart, + const wxPoint& aMid, const wxPoint& aEnd, int aWidth, + int aError, ERROR_LOC aErrorLoc ) { SHAPE_ARC arc( aStart, aMid, aEnd, aWidth ); // Currentlye have currently 2 algos: @@ -611,7 +613,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aStart, wxPoi } -void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCentre, int aRadius, +void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCentre, int aRadius, int aWidth, int aError, ERROR_LOC aErrorLoc ) { int inner_radius = aRadius - ( aWidth / 2 ); diff --git a/libs/kimath/src/geometry/convex_hull.cpp b/libs/kimath/src/geometry/convex_hull.cpp index 63dfe5d6c8..9a0eed1e0d 100644 --- a/libs/kimath/src/geometry/convex_hull.cpp +++ b/libs/kimath/src/geometry/convex_hull.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -138,7 +138,7 @@ void BuildConvexHull( std::vector& aResult, const SHAPE_POLY_SET& aPoly void BuildConvexHull( std::vector& aResult, const SHAPE_POLY_SET& aPolygons, - wxPoint aPosition, double aRotation ) + const wxPoint& aPosition, double aRotation ) { // Build the convex hull of the SHAPE_POLY_SET std::vector buf; diff --git a/libs/kimath/src/trigo.cpp b/libs/kimath/src/trigo.cpp index 31daca245f..0beeca4788 100644 --- a/libs/kimath/src/trigo.cpp +++ b/libs/kimath/src/trigo.cpp @@ -58,8 +58,8 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd, // Returns true if the segment 1 intersected the segment 2. -bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, - const wxPoint &a_p1_l2, const wxPoint &a_p2_l2, +bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1, + const wxPoint& a_p1_l2, const wxPoint& a_p2_l2, wxPoint* aIntersectionPoint ) { @@ -126,7 +126,8 @@ bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, } -bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist ) +bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd, + int aDist ) { int xmin = aStart.x; int xmax = aEnd.x; diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index 0a4da8d05d..d86917d378 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -189,7 +189,6 @@ bool AR_AUTOPLACER::fillMatrix() for( int v = 0; v < outline.PointCount(); v++ ) { - int seg_startX = outline.CPoint( v ).x; int seg_startY = outline.CPoint( v ).y; int seg_endX = outline.CPoint( v + 1 ).x; @@ -252,6 +251,7 @@ bool AR_AUTOPLACER::fillMatrix() { int seg_start_x = x_coordinates[ii] - coord_orgin.x; int seg_end_x = x_coordinates[ii + 1] - coord_orgin.x; + // Fill cells at y coord = idy, // and at x cood >= seg_start_x and <= seg_end_x @@ -263,7 +263,6 @@ bool AR_AUTOPLACER::fillMatrix() if( idx * step >= seg_start_x ) m_matrix.SetCell( idy, idx, AR_SIDE_BOTTOM, CELL_IS_ZONE ); } - } } // End examine segments in one area @@ -286,7 +285,7 @@ void AR_AUTOPLACER::rotateFootprint( FOOTPRINT* aFootprint, double angle, bool i } -void AR_AUTOPLACER::addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask ) +void AR_AUTOPLACER::addFpBody( const wxPoint& aStart, const wxPoint& aEnd, LSET aLayerMask ) { // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack if( aLayerMask[ F_Cu ] ) @@ -308,6 +307,7 @@ void AR_AUTOPLACER::addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask ) } } + void AR_AUTOPLACER::addPad( PAD* aPad, int aClearance ) { // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack @@ -1022,7 +1022,6 @@ end_of_tst: if( error == AR_ABORT_PLACEMENT ) break; - bestRotation += initialOrient; if( bestRotation != footprint->GetOrientation() ) diff --git a/pcbnew/autorouter/ar_autoplacer.h b/pcbnew/autorouter/ar_autoplacer.h index 8639442c6c..3333674fe2 100644 --- a/pcbnew/autorouter/ar_autoplacer.h +++ b/pcbnew/autorouter/ar_autoplacer.h @@ -3,9 +3,9 @@ * * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 2011 Wayne Stambaugh * - * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -71,8 +71,7 @@ public: } /** - * a callback function to redraw on screen the view after changes, - * for instance after moving a footprint + * Callback to redraw on screen the view after changes, for instance after moving a footprint. */ void SetRefreshCallback( std::function aCallback ) { @@ -89,8 +88,10 @@ private: void rotateFootprint( FOOTPRINT* aFootprint, double angle, bool incremental ); int genPlacementRoutingMatrix(); - /** fills m_matrix cells from m_boardShape. - * cells inside m_boardShape are set to CELL_IS_ZONE + /** + * Fill m_matrix cells from m_boardShape. + * + * Cells inside m_boardShape are set to CELL_IS_ZONE. */ bool fillMatrix(); void genModuleOnRoutingMatrix( FOOTPRINT* aFootprint ); @@ -113,7 +114,7 @@ private: const PAD* nearestPad( FOOTPRINT* aRefFP, PAD* aRefPad, const wxPoint& aOffset ); // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack - void addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask ); + void addFpBody( const wxPoint& aStart, const wxPoint& aEnd, LSET aLayerMask ); // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack void addPad( PAD* aPad, int aClearance ); @@ -126,8 +127,10 @@ private: SHAPE_POLY_SET m_topFreeArea; // The polygonal description of the top side free areas; SHAPE_POLY_SET m_bottomFreeArea; // The polygonal description of the bottom side free areas; SHAPE_POLY_SET m_boardShape; // The polygonal description of the board; - SHAPE_POLY_SET m_fpAreaTop; // The polygonal description of the footprint to place, top side; - SHAPE_POLY_SET m_fpAreaBottom; // The polygonal description of the footprint to place, bottom side; + SHAPE_POLY_SET m_fpAreaTop; // The polygonal description of the footprint to place, + // top side; + SHAPE_POLY_SET m_fpAreaBottom; // The polygonal description of the footprint to place, + // bottom side; BOARD* m_board; diff --git a/pcbnew/dialogs/dialog_create_array.cpp b/pcbnew/dialogs/dialog_create_array.cpp index f8f507990c..072efb6151 100644 --- a/pcbnew/dialogs/dialog_create_array.cpp +++ b/pcbnew/dialogs/dialog_create_array.cpp @@ -145,7 +145,7 @@ static const std::vector numberingTypeData { DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, std::unique_ptr& aSettings, - bool enableNumbering, wxPoint aOrigPos ) : + bool enableNumbering, const wxPoint& aOrigPos ) : DIALOG_CREATE_ARRAY_BASE( aParent ), m_settings( aSettings ), m_originalItemPosition( aOrigPos ), @@ -503,4 +503,4 @@ void DIALOG_CREATE_ARRAY::calculateCircularArrayProperties() centre -= m_originalItemPosition; m_circRadius.SetValue( int( centre.EuclideanNorm() ) ); -} \ No newline at end of file +} diff --git a/pcbnew/dialogs/dialog_create_array.h b/pcbnew/dialogs/dialog_create_array.h index 3057b2f028..adfc9bdd9a 100644 --- a/pcbnew/dialogs/dialog_create_array.h +++ b/pcbnew/dialogs/dialog_create_array.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 John Beard, john.j.beard@gmail.com - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -49,7 +49,7 @@ public: * @param aOrigPos original item position (used for computing the circular array radius) */ DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, std::unique_ptr& aOptions, - bool enableNumbering, wxPoint aOrigPos ); + bool enableNumbering, const wxPoint& aOrigPos ); private: // Event callbacks diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index a260035f28..99ff8f1b4a 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2017-2020 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -189,7 +189,6 @@ void DRC_ENGINE::loadImplicitRules() silkClearanceConstraint.Value().SetMin( bds.m_SilkClearance ); rule->AddConstraint( silkClearanceConstraint ); - // 2) micro-via specific defaults (new DRC doesn't treat microvias in any special way) DRC_RULE* uViaRule = createImplicitRule( _( "board setup micro-via constraints" ) ); @@ -461,6 +460,7 @@ void DRC_ENGINE::loadImplicitRules() (int) netclassClearanceRules.size() ) ); } + static wxString formatConstraint( const DRC_CONSTRAINT& constraint ) { struct FORMATTER @@ -523,9 +523,6 @@ static wxString formatConstraint( const DRC_CONSTRAINT& constraint ) } -/** - * @throws PARSE_ERROR - */ void DRC_ENGINE::loadRules( const wxFileName& aPath ) { if( aPath.FileExists() ) @@ -622,9 +619,6 @@ void DRC_ENGINE::compileRules() } -/** - * @throws PARSE_ERROR - */ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath ) { m_testProviders = DRC_TEST_PROVIDER_REGISTRY::Instance().GetTestProviders(); @@ -1107,7 +1101,7 @@ bool DRC_ENGINE::IsErrorLimitExceeded( int error_code ) } -void DRC_ENGINE::ReportViolation( const std::shared_ptr& aItem, wxPoint aPos ) +void DRC_ENGINE::ReportViolation( const std::shared_ptr& aItem, const wxPoint& aPos ) { m_errorLimits[ aItem->GetErrorCode() ] -= 1; @@ -1136,6 +1130,7 @@ void DRC_ENGINE::ReportViolation( const std::shared_ptr& aItem, wxPoin } } + void DRC_ENGINE::ReportAux ( const wxString& aStr ) { if( !m_reporter ) @@ -1323,8 +1318,10 @@ bool DRC_ENGINE::IsNetTie( BOARD_ITEM* aItem ) DRC_TEST_PROVIDER* DRC_ENGINE::GetTestProvider( const wxString& name ) const { for( auto prov : m_testProviders ) + { if( name == prov->GetName() ) return prov; + } return nullptr; } diff --git a/pcbnew/drc/drc_engine.h b/pcbnew/drc/drc_engine.h index 1374750534..7884b934c5 100644 --- a/pcbnew/drc/drc_engine.h +++ b/pcbnew/drc/drc_engine.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -64,7 +64,8 @@ class DRC_CONSTRAINT; typedef -std::function& aItem, wxPoint aPos )> DRC_VIOLATION_HANDLER; +std::function& aItem, + const wxPoint& aPos )> DRC_VIOLATION_HANDLER; /** @@ -95,9 +96,12 @@ public: void SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet ) { m_drawingSheet = aDrawingSheet; } DS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet; } - void SetDebugOverlay( std::shared_ptr aOverlay ) { m_debugOverlay = aOverlay; } - std::shared_ptr GetDebugOverlay() const { return m_debugOverlay; } + void SetDebugOverlay( std::shared_ptr aOverlay ) + { + m_debugOverlay = aOverlay; + } + std::shared_ptr GetDebugOverlay() const { return m_debugOverlay; } /** * Set an optional DRC violation handler (receives DRC_ITEMs and positions). @@ -128,14 +132,14 @@ public: void SetLogReporter( REPORTER* aReporter ) { m_reporter = aReporter; } /** - * Initializes the DRC engine. + * Initialize the DRC engine. * * @throws PARSE_ERROR if the rules file contains errors */ void InitEngine( const wxFileName& aRulePath ); /** - * Runs the DRC tests. + * Run the DRC tests. */ void RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints ); @@ -154,7 +158,7 @@ public: bool RulesValid() { return m_rulesValid; } - void ReportViolation( const std::shared_ptr& aItem, wxPoint aPos ); + void ReportViolation( const std::shared_ptr& aItem, const wxPoint& aPos ); bool ReportProgress( double aProgress ); bool ReportPhase( const wxString& aMessage ); void ReportAux( const wxString& aStr ); @@ -168,7 +172,7 @@ public: static bool IsNetADiffPair( BOARD* aBoard, NETINFO_ITEM* aNet, int& aNetP, int& aNetN ); /** - * Checks if the given net is a diff pair, returning its polarity and complement if so + * Check if the given net is a diff pair, returning its polarity and complement if so * @param aNetName is the input net name, like DIFF_P * @param aComplementNet will be filled with the complement, like DIFF_N * @param aBaseDpName will be filled with the base name, like DIFF @@ -188,7 +192,7 @@ private: } /** - * Loads and parses a rule set from an sexpr text file. + * Load and parse a rule set from an sexpr text file. * * @throws PARSE_ERROR */ diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index 9d5fcc1728..83f8cd4d3b 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -53,7 +53,8 @@ const wxString DRC_TEST_PROVIDER::GetName() const { return ""; } const wxString DRC_TEST_PROVIDER::GetDescription() const { return ""; } -void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr& item, wxPoint aMarkerPos ) +void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr& item, + const wxPoint& aMarkerPos ) { if( item->GetViolatingRule() ) accountCheck( item->GetViolatingRule() ); diff --git a/pcbnew/drc/drc_test_provider.h b/pcbnew/drc/drc_test_provider.h index 740aecc187..c410aeb41a 100644 --- a/pcbnew/drc/drc_test_provider.h +++ b/pcbnew/drc/drc_test_provider.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -64,10 +64,10 @@ public: } }; + /** - * DRC_TEST_PROVIDER - * is a base class that represents a DRC "provider" which runs some DRC functions over a - * #BOARD and spits out #DRC_ITEMs and positions as needed. + * Represent a DRC "provider" which runs some DRC functions over a #BOARD and spits out + * #DRC_ITEMs and positions as needed. */ class DRC_TEST_PROVIDER { @@ -82,7 +82,7 @@ public: } /** - * Runs this provider against the given PCB with configured options (if any). + * Run this provider against the given PCB with configured options (if any). */ virtual bool Run() = 0; @@ -113,7 +113,7 @@ protected: const std::function& aFunc ); virtual void reportAux( wxString fmt, ... ); - virtual void reportViolation( std::shared_ptr& item, wxPoint aMarkerPos ); + virtual void reportViolation( std::shared_ptr& item, const wxPoint& aMarkerPos ); virtual bool reportProgress( int aCount, int aSize, int aDelta ); virtual bool reportPhase( const wxString& aStageName ); diff --git a/pcbnew/exporters/gendrill_Excellon_writer.h b/pcbnew/exporters/gendrill_Excellon_writer.h index fa4b624caf..33b71620fb 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.h +++ b/pcbnew/exporters/gendrill_Excellon_writer.h @@ -86,7 +86,8 @@ public: * @param aMerge_PTH_NPTH set to true to create only one file containing PTH and NPTH * false to create 2 separate files : one for PTH and one for NPTH. */ - void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMerge_PTH_NPTH ) + void SetOptions( bool aMirror, bool aMinimalHeader, const wxPoint& aOffset, + bool aMerge_PTH_NPTH ) { m_mirror = aMirror; m_offset = aOffset; diff --git a/pcbnew/exporters/gendrill_gerber_writer.h b/pcbnew/exporters/gendrill_gerber_writer.h index dbb88f9074..6110bc8ea3 100644 --- a/pcbnew/exporters/gendrill_gerber_writer.h +++ b/pcbnew/exporters/gendrill_gerber_writer.h @@ -35,7 +35,7 @@ class BOARD; /** - * GERBER_WRITER is a class mainly used to create Gerber drill files + * Used to create Gerber drill files. */ class GERBER_WRITER: public GENDRILL_WRITER_BASE { @@ -60,7 +60,7 @@ public: * * @param aOffset is the drill coordinates offset. */ - void SetOptions( wxPoint aOffset ) + void SetOptions( const wxPoint& aOffset ) { m_offset = aOffset; m_merge_PTH_NPTH = false; diff --git a/pcbnew/exporters/gerber_placefile_writer.h b/pcbnew/exporters/gerber_placefile_writer.h index 80a3490c28..e1c773d6d7 100644 --- a/pcbnew/exporters/gerber_placefile_writer.h +++ b/pcbnew/exporters/gerber_placefile_writer.h @@ -34,7 +34,7 @@ class FOOTPRINT; class PAD; /** - * PLACEFILE_GERBER_WRITER is a class mainly used to create Gerber drill files. + * Used to create Gerber drill files. */ class PLACEFILE_GERBER_WRITER { @@ -53,7 +53,7 @@ public: * * @param aOffset is the drill coordinates offset. */ - void SetOptions( wxPoint aOffset ) + void SetOptions( const wxPoint& aOffset ) { m_offset = aOffset; } diff --git a/pcbnew/plugins/altium/altium_parser_pcb.h b/pcbnew/plugins/altium/altium_parser_pcb.h index 150cd5ec1e..66df82aaa8 100644 --- a/pcbnew/plugins/altium/altium_parser_pcb.h +++ b/pcbnew/plugins/altium/altium_parser_pcb.h @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Thomas Pointhuber + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -211,7 +212,7 @@ struct ALTIUM_VERTICE const wxPoint position; const wxPoint center; - explicit ALTIUM_VERTICE( const wxPoint aPosition ) + explicit ALTIUM_VERTICE( const wxPoint& aPosition ) : isRound( false ), radius( 0 ), startangle( 0. ), diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 76f595b693..000e72eeb6 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -284,7 +284,6 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup() wxASSERT( totalCopperLayers == cadstarBoardStackup.size() ); wxASSERT( cadstarBoardStackup.back().ConstructionLayers.size() == 0 ); - // Create a new stackup from default stackup list BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor(); stackup.RemoveAll(); @@ -695,7 +694,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryFigures( const SYMDEF_PCB& aComponen } -void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint ) +void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponent, + FOOTPRINT* aFootprint ) { int totalCopperPads = 0; @@ -730,7 +730,6 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen if( !found ) anchorPad = aComponent.ComponentPads.at( compCopper.AssociatedPadIDs.front() ); - PAD* pad = new PAD( aFootprint ); pad->SetAttribute( PAD_ATTRIB::SMD ); pad->SetLayerSet( LSET( 1, copperLayer ) ); @@ -1066,7 +1065,6 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, if( csPadcode.ReliefWidth != UNDEFINED_VALUE ) pad->SetThermalSpokeWidth( getKiCadLength( csPadcode.ReliefWidth ) ); - if( csPadcode.DrillDiameter != UNDEFINED_VALUE ) { if( csPadcode.SlotLength != UNDEFINED_VALUE ) @@ -1091,7 +1089,6 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, pad->SetDrillSize( { 0, 0 } ); } - if( csPadcode.SlotOrientation != 0 ) { LSET lset = pad->GetLayerSet(); @@ -1114,8 +1111,8 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, padShape->SetPolyShape( padOutline ); padShape->SetWidth( 0 ); padShape->Move( padOffset - drillOffset ); - padShape->Rotate( wxPoint( 0, 0 ), 1800.0 - getAngleTenthDegree( csPadcode.SlotOrientation ) ); - + padShape->Rotate( wxPoint( 0, 0 ), + 1800.0 - getAngleTenthDegree( csPadcode.SlotOrientation ) ); SHAPE_POLY_SET editedPadOutline = padShape->GetPolyShape(); @@ -1141,7 +1138,6 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, "pad shape. The hole has been moved to the center of the pad." ), csPadcode.Name ); } - } else { @@ -1262,8 +1258,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadFigures() { FIGURE& fig = figPair.second; drawCadstarShape( fig.Shape, getKiCadLayer( fig.LayerID ), - getLineThickness( fig.LineCodeID ), wxString::Format( "FIGURE %s", fig.ID ), m_board, - fig.GroupID ); + getLineThickness( fig.LineCodeID ), wxString::Format( "FIGURE %s", fig.ID ), + m_board, fig.GroupID ); //TODO process "swaprule" (doesn't seem to apply to Layout Figures?) //TODO process re-use block when KiCad Supports it @@ -1993,7 +1989,6 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers() rawPolys.Inflate( copperWidth / 2, 32 ); } - if( pouredZone->HasFilledPolysForLayer( getKiCadLayer( csCopper.LayerID ) ) ) { rawPolys.BooleanAdd( pouredZone->RawPolysList( getKiCadLayer( csCopper.LayerID )), @@ -2129,7 +2124,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNets() else if( ( pin.PadID - (long) 1 ) > footprint->Pads().size() ) { wxLogWarning( wxString::Format( _( "The net '%s' references non-existent pad index" - " '%d' in component '%s'. This has been ignored." ), + " '%d' in component '%s'. This has been " + "ignored." ), netnameForErrorReporting, pin.PadID, footprint->GetReference() ) ); @@ -2592,11 +2588,11 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape, case SHAPE_TYPE::OUTLINE: ///TODO update this when Polygons in KiCad can be defined with no fill drawCadstarVerticesAsShapes( aCadstarShape.Vertices, aKiCadLayer, aLineThickness, - aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor, - aTransformCentre, aMirrorInvert ); + aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, + aScalingFactor, aTransformCentre, aMirrorInvert ); drawCadstarCutoutsAsShapes( aCadstarShape.Cutouts, aKiCadLayer, aLineThickness, - aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor, - aTransformCentre, aMirrorInvert ); + aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, + aScalingFactor, aTransformCentre, aMirrorInvert ); break; case SHAPE_TYPE::HATCHED: @@ -2892,7 +2888,8 @@ SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHA } if( aLineThickness > 0 ) - polySet.Inflate( aLineThickness / 2, 32, SHAPE_POLY_SET::CORNER_STRATEGY::ROUND_ALL_CORNERS ); + polySet.Inflate( aLineThickness / 2, 32, + SHAPE_POLY_SET::CORNER_STRATEGY::ROUND_ALL_CORNERS ); #ifdef DEBUG for( int i = 0; i < polySet.OutlineCount(); ++i ) @@ -3004,7 +3001,8 @@ std::vector CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes( if( shape->GetClass() == wxT( "MGRAPHIC" ) ) { FP_SHAPE* fp_shape = (FP_SHAPE*) shape; - SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(), fp_shape->GetAngle() / 10.0 ); + SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(), + fp_shape->GetAngle() / 10.0 ); track = new PCB_ARC( aParentContainer, &arc ); } else @@ -3689,7 +3687,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities() } -FOOTPRINT* CADSTAR_PCB_ARCHIVE_LOADER::getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID ) +FOOTPRINT* CADSTAR_PCB_ARCHIVE_LOADER::getFootprintFromCadstarID( + const COMPONENT_ID& aCadstarComponentID ) { if( m_componentMap.find( aCadstarComponentID ) == m_componentMap.end() ) return nullptr; @@ -3698,7 +3697,7 @@ FOOTPRINT* CADSTAR_PCB_ARCHIVE_LOADER::getFootprintFromCadstarID( const COMPONEN } -wxPoint CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPoint( wxPoint aCadstarPoint ) +wxPoint CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPoint( const wxPoint& aCadstarPoint ) { wxPoint retval; @@ -3709,9 +3708,8 @@ wxPoint CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPoint( wxPoint aCadstarPoint ) } -double CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle( wxPoint aPoint ) +double CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle( const wxPoint& aPoint ) { - return NormalizeAnglePos( ArcTangente( aPoint.y, aPoint.x ) ); } @@ -3798,7 +3796,8 @@ NETINFO_ITEM* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet( const NET_ID& aCadstarNet } -PCB_LAYER_ID CADSTAR_PCB_ARCHIVE_LOADER::getKiCadCopperLayerID( unsigned int aLayerNum, bool aDetectMaxLayer ) +PCB_LAYER_ID CADSTAR_PCB_ARCHIVE_LOADER::getKiCadCopperLayerID( unsigned int aLayerNum, + bool aDetectMaxLayer ) { if( aDetectMaxLayer && aLayerNum == Assignments.Technology.MaxPhysicalLayer ) return PCB_LAYER_ID::B_Cu; @@ -3842,6 +3841,7 @@ PCB_LAYER_ID CADSTAR_PCB_ARCHIVE_LOADER::getKiCadCopperLayerID( unsigned int aLa return PCB_LAYER_ID::UNDEFINED_LAYER; } + bool CADSTAR_PCB_ARCHIVE_LOADER::isLayerSet( const LAYER_ID& aCadstarLayerID ) { wxCHECK( Assignments.Layerdefs.Layers.find( aCadstarLayerID ) @@ -3875,7 +3875,8 @@ PCB_LAYER_ID CADSTAR_PCB_ARCHIVE_LOADER::getKiCadLayer( const LAYER_ID& aCadstar return PCB_LAYER_ID::UNDEFINED_LAYER; } - wxCHECK( m_layermap.find( aCadstarLayerID ) != m_layermap.end(), PCB_LAYER_ID::UNDEFINED_LAYER ); + wxCHECK( m_layermap.find( aCadstarLayerID ) != m_layermap.end(), + PCB_LAYER_ID::UNDEFINED_LAYER ); return m_layermap.at( aCadstarLayerID ); } diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h index 31c356d087..caeba27860 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h @@ -419,7 +419,7 @@ private: * @param aCadstarPoint * @return */ - wxPoint getKiCadPoint( wxPoint aCadstarPoint ); + wxPoint getKiCadPoint( const wxPoint& aCadstarPoint ); /** * @brief @@ -466,7 +466,7 @@ private: * @param aPoint * @return Angle in decidegrees of the polar representation of the point, scaled 0..360 */ - double getPolarAngle( wxPoint aPoint ); + double getPolarAngle( const wxPoint& aPoint ); /** * @brief Searches m_netMap and returns the NETINFO_ITEM pointer if exists. Otherwise diff --git a/pcbnew/tools/drawing_stackup_table_tool.cpp b/pcbnew/tools/drawing_stackup_table_tool.cpp index 34089e6c34..81d5462983 100644 --- a/pcbnew/tools/drawing_stackup_table_tool.cpp +++ b/pcbnew/tools/drawing_stackup_table_tool.cpp @@ -209,7 +209,7 @@ static std::vector initTextTable( std::vector DRAWING_TOOL::DrawSpecificationStackup( - wxPoint aOrigin, PCB_LAYER_ID aLayer, bool aDrawNow, wxPoint* tableSize ) + const wxPoint& aOrigin, PCB_LAYER_ID aLayer, bool aDrawNow, wxPoint* tableSize ) { BOARD_COMMIT commit( m_frame ); std::vector> texts; @@ -296,6 +296,7 @@ std::vector DRAWING_TOOL::DrawSpecificationStackup( // If the user did not open the dialog, then get the names from the board. // But dielectric layer names will be missing. t = static_cast( dataStyle->Duplicate() ); + if( layers.at( i )->GetLayerName().IsEmpty() ) { t->SetText( m_frame->GetBoard()->GetLayerName( layers.at( i )->GetBrdLayerId() ) ); @@ -304,6 +305,7 @@ std::vector DRAWING_TOOL::DrawSpecificationStackup( { t->SetText( layers.at( i )->GetLayerName() ); } + colLayer.push_back( t ); t = static_cast( dataStyle->Duplicate() ); @@ -342,12 +344,10 @@ std::vector DRAWING_TOOL::DrawSpecificationStackup( texts.push_back( colColor ); texts.push_back( colEpsilon ); texts.push_back( colTanD ); - std::vector table = - initTextTable( texts, aOrigin, aLayer, tableSize, true ); + std::vector table = initTextTable( texts, aOrigin, aLayer, tableSize, true ); if( aDrawNow ) { - for( auto item : table ) commit.Add( item ); @@ -359,7 +359,7 @@ std::vector DRAWING_TOOL::DrawSpecificationStackup( std::vector DRAWING_TOOL::DrawBoardCharacteristics( - wxPoint aOrigin, PCB_LAYER_ID aLayer, bool aDrawNow, wxPoint* tableSize ) + const wxPoint& aOrigin, PCB_LAYER_ID aLayer, bool aDrawNow, wxPoint* tableSize ) { BOARD_COMMIT commit( m_frame ); std::vector objects; @@ -671,6 +671,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent, return 0; } + int DRAWING_TOOL::PlaceCharacteristics( const TOOL_EVENT& aEvent ) { wxPoint tableSize = wxPoint(); @@ -744,6 +745,7 @@ int DRAWING_TOOL::PlaceCharacteristics( const TOOL_EVENT& aEvent ) return 0; } + int DRAWING_TOOL::PlaceStackup( const TOOL_EVENT& aEvent ) { wxPoint tableSize = wxPoint(); diff --git a/pcbnew/tools/drawing_tool.h b/pcbnew/tools/drawing_tool.h index 41f61d02ae..0a320722a7 100644 --- a/pcbnew/tools/drawing_tool.h +++ b/pcbnew/tools/drawing_tool.h @@ -84,24 +84,20 @@ public: MODE GetDrawingMode() const; /** - * Function DrawBoardCharacteristics() */ - std::vector DrawBoardCharacteristics( wxPoint origin, PCB_LAYER_ID aLayer, + std::vector DrawBoardCharacteristics( const wxPoint& origin, PCB_LAYER_ID aLayer, bool aDrawNow, wxPoint* tablesize ); /** - * Function DrawSpecificationStackup() */ - std::vector DrawSpecificationStackup( wxPoint origin, PCB_LAYER_ID aLayer, + std::vector DrawSpecificationStackup( const wxPoint& origin, PCB_LAYER_ID aLayer, bool aDrawNow, wxPoint* tablesize ); /** - * Function PlaceCharacteristics() */ int PlaceCharacteristics( const TOOL_EVENT& aEvent ); /** - * Function PlaceStackup() */ int PlaceStackup( const TOOL_EVENT& aEvent ); @@ -185,7 +181,8 @@ public: * @param aItems BOARD_ITEMs to add to the board. * @param aPreview BOARD_ITEMs only used during placement / preview. * @param aLayers Set of allowed destination when asking the user. - * If set to NULL, the user is not asked and all BOARD_ITEMs remain on their layers. + * If set to NULL, the user is not asked and all BOARD_ITEMs remain on + * their layers. */ int InteractivePlaceWithPreview( const TOOL_EVENT& aEvent, std::vector& aItems, diff --git a/pcbnew/tools/position_relative_tool.cpp b/pcbnew/tools/position_relative_tool.cpp index 41580f5911..2ba163fd62 100644 --- a/pcbnew/tools/position_relative_tool.cpp +++ b/pcbnew/tools/position_relative_tool.cpp @@ -133,7 +133,8 @@ int POSITION_RELATIVE_TOOL::PositionRelative( const TOOL_EVENT& aEvent ) } -int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( wxPoint aPosAnchor, wxPoint aTranslation ) +int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const wxPoint& aPosAnchor, + const wxPoint& aTranslation ) { wxPoint aggregateTranslation = aPosAnchor + aTranslation - GetSelectionAnchorPosition(); diff --git a/pcbnew/tools/position_relative_tool.h b/pcbnew/tools/position_relative_tool.h index 45b8db0edb..7bc4bbad67 100644 --- a/pcbnew/tools/position_relative_tool.h +++ b/pcbnew/tools/position_relative_tool.h @@ -72,7 +72,7 @@ public: * Position the m_position_relative_selection selection relative to anchor position using * the given translation. */ - int RelativeItemSelectionMove( wxPoint anchor, wxPoint translation ); + int RelativeItemSelectionMove( const wxPoint& anchor, const wxPoint& translation ); ///< Set up handlers for various events. void setTransitions() override; diff --git a/pcbnew/zone.h b/pcbnew/zone.h index a2c4cf3183..a2548ff0a7 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -100,6 +100,7 @@ public: return BOARD_CONNECTED_ITEM::GetNetClassName(); } + /** * Copy aZone data to me */ @@ -187,6 +188,7 @@ public: m_thermalReliefGap = aThermalReliefGap; } + int GetThermalReliefGap() const { return m_thermalReliefGap; } int GetThermalReliefGap( PAD* aPad, wxString* aSource = nullptr ) const; @@ -197,6 +199,7 @@ public: m_thermalReliefSpokeWidth = aThermalReliefSpokeWidth; } + int GetThermalReliefSpokeWidth() const { return m_thermalReliefSpokeWidth; } int GetThermalReliefSpokeWidth( PAD* aPad, wxString* aSource = nullptr ) const; @@ -226,6 +229,7 @@ public: { return m_fillFlags.count( aLayer ) ? m_fillFlags[ aLayer ] : false; } + void SetFillFlag( PCB_LAYER_ID aLayer, bool aFlag ) { m_fillFlags[ aLayer ] = aFlag; } bool IsFilled() const { return m_isFilled; } @@ -568,7 +572,7 @@ public: return m_Poly->CVertex( index ); } - void SetCornerPosition( int aCornerIndex, wxPoint new_pos ) + void SetCornerPosition( int aCornerIndex, const wxPoint& new_pos ) { SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;