diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 6046bc8b8c..5d8d421f9b 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -780,7 +780,7 @@ LSET GERBVIEW_FRAME::GetVisibleLayers() const } -void GERBVIEW_FRAME::SetVisibleLayers( LSET aLayerMask ) +void GERBVIEW_FRAME::SetVisibleLayers( const LSET& aLayerMask ) { if( GetCanvas() ) { diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index c00aa45540..3912786594 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -117,7 +117,7 @@ public: * * @param aLayerMask The new set of visible layers */ - void SetVisibleLayers( LSET aLayerMask ); + void SetVisibleLayers( const LSET& aLayerMask ); /** * Test whether a given layer is visible. diff --git a/include/board_design_settings.h b/include/board_design_settings.h index 24a5720ecf..c9b1eac9dc 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -583,7 +583,7 @@ public: * * @param aMask = The new bit-mask of enabled layers. */ - void SetEnabledLayers( LSET aMask ); + void SetEnabledLayers( const LSET& aMask ); /** * Test whether a given layer \a aLayerId is enabled. diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 8f6da7c719..9042e12c80 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -337,7 +337,8 @@ public: * @param aDlgPosition is the position of dialog (default is centered). * @return the selected layer id. */ - PCB_LAYER_ID SelectOneLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask = LSET(), + PCB_LAYER_ID SelectOneLayer( PCB_LAYER_ID aDefaultLayer, + const LSET& aNotAllowedLayersMask = LSET(), wxPoint aDlgPosition = wxDefaultPosition ); /** diff --git a/include/render_settings.h b/include/render_settings.h index 315378e8b4..e9b38e6ed0 100644 --- a/include/render_settings.h +++ b/include/render_settings.h @@ -117,7 +117,7 @@ public: void SetLayerName( const wxString& aLayerName ) { m_layerName = aLayerName; } LSET GetPrintLayers() const { return m_printLayers; } - void SetPrintLayers( LSET aLayerSet ) { m_printLayers = aLayerSet; } + void SetPrintLayers( const LSET& aLayerSet ) { m_printLayers = aLayerSet; } /** * Clear the list of active layers. diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index b63366a2ac..469e89ed81 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -251,7 +251,7 @@ bool AR_AUTOPLACER::fillMatrix() } -void AR_AUTOPLACER::addFpBody( const VECTOR2I& aStart, const VECTOR2I& aEnd, LSET aLayerMask ) +void AR_AUTOPLACER::addFpBody( const VECTOR2I& aStart, const VECTOR2I& aEnd, const LSET& aLayerMask ) { // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack if( aLayerMask[ F_Cu ] ) diff --git a/pcbnew/autorouter/ar_autoplacer.h b/pcbnew/autorouter/ar_autoplacer.h index b8154927d9..d2a39add07 100644 --- a/pcbnew/autorouter/ar_autoplacer.h +++ b/pcbnew/autorouter/ar_autoplacer.h @@ -114,7 +114,7 @@ private: const PAD* nearestPad( FOOTPRINT* aRefFP, PAD* aRefPad, const VECTOR2I& aOffset ); // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack - void addFpBody( const VECTOR2I& aStart, const VECTOR2I& aEnd, LSET aLayerMask ); + void addFpBody( const VECTOR2I& aStart, const VECTOR2I& aEnd, const LSET& aLayerMask ); // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack void addPad( PAD* aPad, int aClearance ); diff --git a/pcbnew/autorouter/ar_matrix.cpp b/pcbnew/autorouter/ar_matrix.cpp index 8a539ff545..fa1f9585c9 100644 --- a/pcbnew/autorouter/ar_matrix.cpp +++ b/pcbnew/autorouter/ar_matrix.cpp @@ -437,8 +437,8 @@ void AR_MATRIX::traceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int lay } -void AR_MATRIX::traceFilledCircle( - int cx, int cy, int radius, LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic ) +void AR_MATRIX::traceFilledCircle( int cx, int cy, int radius, const LSET& aLayerMask, int color, + AR_MATRIX::CELL_OP op_logic ) { int row, col; int ux0, uy0, ux1, uy1; @@ -602,7 +602,7 @@ void AR_MATRIX::traceArc( int ux0, int uy0, int ux1, int uy1, const EDA_ANGLE& a void AR_MATRIX::TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, double angle, - LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic ) + const LSET& aLayerMask, int color, AR_MATRIX::CELL_OP op_logic ) { int row, col; int cx, cy; // Center of rectangle @@ -689,7 +689,7 @@ void AR_MATRIX::TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, double } -void AR_MATRIX::TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, LSET aLayerMask, +void AR_MATRIX::TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, const LSET& aLayerMask, int color, AR_MATRIX::CELL_OP op_logic ) { int row, col; @@ -793,8 +793,8 @@ void AR_MATRIX::TraceSegmentPcb( PCB_SHAPE* aShape, int aColor, int aMargin, * (aKeepOut ... 0). The decreasing value depends on the distance to the first rectangle * Therefore the cost is high in rect x0,y0 to x1,y1, and decrease outside this rectangle */ -void AR_MATRIX::CreateKeepOutRectangle( - int ux0, int uy0, int ux1, int uy1, int marge, int aKeepOut, LSET aLayerMask ) +void AR_MATRIX::CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1, int marge, + int aKeepOut, const LSET& aLayerMask ) { int row, col; int row_min, row_max, col_min, col_max, pmarge; diff --git a/pcbnew/autorouter/ar_matrix.h b/pcbnew/autorouter/ar_matrix.h index 9a7c052930..19dd5fbded 100644 --- a/pcbnew/autorouter/ar_matrix.h +++ b/pcbnew/autorouter/ar_matrix.h @@ -112,14 +112,14 @@ public: void TraceSegmentPcb( PCB_SHAPE* aShape, int aColor, int aMargin, AR_MATRIX::CELL_OP op_logic ); void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1, int marge, int aKeepOut, - LSET aLayerMask ); + const LSET& aLayerMask ); void PlacePad( PAD* aPad, int color, int marge, AR_MATRIX::CELL_OP op_logic ); - void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, double angle, LSET aLayerMask, + void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, double angle, const LSET& aLayerMask, int color, AR_MATRIX::CELL_OP op_logic ); - void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, LSET aLayerMask, int color, + void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, const LSET& aLayerMask, int color, AR_MATRIX::CELL_OP op_logic ); private: @@ -129,7 +129,7 @@ private: void traceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic ); - void traceFilledCircle( int cx, int cy, int radius, LSET aLayerMask, int color, + void traceFilledCircle( int cx, int cy, int radius, const LSET& aLayerMask, int color, AR_MATRIX::CELL_OP op_logic ); void traceArc( int ux0, int uy0, int ux1, int uy1, const EDA_ANGLE& arcAngle, int lg, diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 6955b87c9a..b5b2728b10 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -841,7 +841,7 @@ LSET BOARD::GetVisibleLayers() const } -void BOARD::SetEnabledLayers( LSET aLayerSet ) +void BOARD::SetEnabledLayers( const LSET& aLayerSet ) { GetDesignSettings().SetEnabledLayers( aLayerSet ); } @@ -853,7 +853,7 @@ bool BOARD::IsLayerEnabled( PCB_LAYER_ID aLayer ) const } -void BOARD::SetVisibleLayers( LSET aLayerSet ) +void BOARD::SetVisibleLayers( const LSET& aLayerSet ) { if( m_project ) m_project->GetLocalSettings().m_VisibleLayers = aLayerSet; @@ -2209,17 +2209,14 @@ int BOARD::SetAreasNetCodesFromNetNames() } -PAD* BOARD::GetPad( const VECTOR2I& aPosition, LSET aLayerSet ) const +PAD* BOARD::GetPad( const VECTOR2I& aPosition, const LSET& aLayerSet ) const { - if( !aLayerSet.any() ) - aLayerSet = LSET::AllCuMask(); - for( FOOTPRINT* footprint : m_footprints ) { PAD* pad = nullptr; if( footprint->HitTest( aPosition ) ) - pad = footprint->GetPad( aPosition, aLayerSet ); + pad = footprint->GetPad( aPosition, aLayerSet.any() ? aLayerSet : LSET::AllCuMask() ); if( pad ) return pad; @@ -2239,7 +2236,7 @@ PAD* BOARD::GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const } -PAD* BOARD::GetPadFast( const VECTOR2I& aPosition, LSET aLayerSet ) const +PAD* BOARD::GetPadFast( const VECTOR2I& aPosition, const LSET& aLayerSet ) const { for( FOOTPRINT* footprint : Footprints() ) { @@ -2258,7 +2255,7 @@ PAD* BOARD::GetPadFast( const VECTOR2I& aPosition, LSET aLayerSet ) const } -PAD* BOARD::GetPad( std::vector& aPadList, const VECTOR2I& aPosition, LSET aLayerSet ) const +PAD* BOARD::GetPad( std::vector& aPadList, const VECTOR2I& aPosition, const LSET& aLayerSet ) const { // Search aPadList for aPosition // aPadList is sorted by X then Y values, and a fast binary search is used @@ -2398,9 +2395,9 @@ std::tuple BOARD::GetTrackLength( const PCB_TRACK& aTrack ) double length = 0.0; double package_length = 0.0; - auto connectivity = GetBoard()->GetConnectivity(); - BOARD_STACKUP& stackup = GetDesignSettings().GetStackupDescriptor(); - bool useHeight = GetDesignSettings().m_UseHeightForLengthCalcs; + auto connectivity = GetBoard()->GetConnectivity(); + BOARD_STACKUP& stackup = GetDesignSettings().GetStackupDescriptor(); + bool useHeight = GetDesignSettings().m_UseHeightForLengthCalcs; for( BOARD_CONNECTED_ITEM* item : connectivity->GetConnectedItems( &aTrack, EXCLUDE_ZONES ) ) { diff --git a/pcbnew/board.h b/pcbnew/board.h index 2385eb3045..b01bf85e6a 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -616,7 +616,7 @@ public: * * @param aLayerMask the new bit-mask of enabled layers. */ - void SetEnabledLayers( LSET aLayerMask ); + void SetEnabledLayers( const LSET& aLayerMask ); void SetLayerSet( const LSET& aLayerMask ) override { SetEnabledLayers( aLayerMask ); } /** @@ -649,7 +649,7 @@ public: * * @param aLayerMask is the new bit-mask of visible layers. */ - void SetVisibleLayers( LSET aLayerMask ); + void SetVisibleLayers( const LSET& aLayerMask ); // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that // are not stored in the bitmap. @@ -1110,7 +1110,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a PAD object if found or NULL if not found. */ - PAD* GetPad( const VECTOR2I& aPosition, LSET aLayerMask ) const; + PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const; PAD* GetPad( const VECTOR2I& aPosition ) const { return GetPad( aPosition, LSET().set() ); @@ -1134,7 +1134,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a PAD object if found or NULL if not found. */ - PAD* GetPadFast( const VECTOR2I& aPosition, LSET aLayerMask ) const; + PAD* GetPadFast( const VECTOR2I& aPosition, const LSET& aLayerMask ) const; /** * Locate the pad connected at \a aPosition on \a aLayer starting at list position @@ -1150,7 +1150,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return a PAD object pointer to the connected pad. */ - PAD* GetPad( std::vector& aPadList, const VECTOR2I& aPosition, LSET aLayerMask ) const; + PAD* GetPad( std::vector& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const; /** * First empties then fills the vector with all pads and sorts them by increasing x diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 768691fd36..a2a5cb127b 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -1473,16 +1473,16 @@ void BOARD_DESIGN_SETTINGS::SetUserDefinedLayerCount( int aNewLayerCount ) } -void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LSET aMask ) +void BOARD_DESIGN_SETTINGS::SetEnabledLayers( const LSET& aMask ) { + m_enabledLayers = aMask; + // Ensures mandatory back and front layers are always enabled regardless of board file // configuration. - aMask.set( B_Cu ).set( F_Cu ) - .set( B_CrtYd ).set( F_CrtYd ) - .set( Edge_Cuts ) - .set( Margin ); - - m_enabledLayers = aMask; + m_enabledLayers.set( B_Cu ).set( F_Cu ) + .set( B_CrtYd ).set( F_CrtYd ) + .set( Edge_Cuts ) + .set( Margin ); // update layer counts to ensure their consistency with m_EnabledLayers LSET copperLayers = aMask; diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index df1f1a7169..13f3f5592e 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -1349,7 +1349,7 @@ void PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom( BOARD* aBoard ) } -void PANEL_SETUP_BOARD_STACKUP::OnLayersOptionsChanged( LSET aNewLayerSet ) +void PANEL_SETUP_BOARD_STACKUP::OnLayersOptionsChanged( const LSET& aNewLayerSet ) { // Can be called spuriously from events before the layers page is even created if( !m_panelLayers->IsInitialized() ) diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.h b/pcbnew/board_stackup_manager/panel_board_stackup.h index 63503db096..01f24cf324 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.h +++ b/pcbnew/board_stackup_manager/panel_board_stackup.h @@ -103,7 +103,7 @@ public: * Rebuild the Layer Stack Panel if the new layer set differs * from the current layet set */ - void OnLayersOptionsChanged( LSET aNewLayerSet ); + void OnLayersOptionsChanged( const LSET& aNewLayerSet ); /// @return the number of copper layers configured for the board stackup int GetCopperLayerCount() const; diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 24de8eeb0c..979b370423 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -327,7 +327,7 @@ public: * @param aVisibleLayerMask is the current visible layers (bit mask). * @param aPreferredLayer is the layer to search first. */ - GENERAL_COLLECTORS_GUIDE( LSET aVisibleLayerMask, PCB_LAYER_ID aPreferredLayer, + GENERAL_COLLECTORS_GUIDE( const LSET& aVisibleLayerMask, PCB_LAYER_ID aPreferredLayer, KIGFX::VIEW* aView ) { static const VECTOR2I one( 1, 1 ); @@ -375,7 +375,7 @@ public: { m_visibleLayers.set( aLayerId, isVisible ); } - void SetLayerVisibleBits( LSET aLayerBits ) { m_visibleLayers = aLayerBits; } + void SetLayerVisibleBits( const LSET& aLayerBits ) { m_visibleLayers = aLayerBits; } /** * @return int - the preferred layer for HitTest()ing. diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index f11364ce0f..559612c303 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -151,7 +151,7 @@ void DRC_TEST_PROVIDER::reportRuleStatistics() } -int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, LSET aLayers, +int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, const LSET& aLayers, const std::function& aFunc ) { BOARD *brd = m_drcEngine->GetBoard(); diff --git a/pcbnew/drc/drc_test_provider.h b/pcbnew/drc/drc_test_provider.h index 57d4a22a97..22ae1c4aa7 100644 --- a/pcbnew/drc/drc_test_provider.h +++ b/pcbnew/drc/drc_test_provider.h @@ -102,7 +102,7 @@ public: virtual const wxString GetDescription() const; protected: - int forEachGeometryItem( const std::vector& aTypes, LSET aLayers, + int forEachGeometryItem( const std::vector& aTypes, const LSET& aLayers, const std::function& aFunc ); // Do not use a wxString with a vararg list: it is a complex thing and can create issues. diff --git a/pcbnew/exporters/export_gencad_writer.cpp b/pcbnew/exporters/export_gencad_writer.cpp index 7b00b55a1d..e0915e9151 100644 --- a/pcbnew/exporters/export_gencad_writer.cpp +++ b/pcbnew/exporters/export_gencad_writer.cpp @@ -107,7 +107,7 @@ static wxString escapeString( const wxString& aString ) } -static std::string fmt_mask( LSET aSet ) +static std::string fmt_mask( const LSET& aSet ) { return ( aSet & LSET::AllCuMask() ).to_string(); } diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 05aaf9c3fe..a9fc6c691d 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -1454,7 +1454,7 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText ) const } -const BOX2I FOOTPRINT::GetLayerBoundingBox( LSET aLayers ) const +const BOX2I FOOTPRINT::GetLayerBoundingBox( const LSET& aLayers ) const { std::vector texts; const BOARD* board = GetBoard(); @@ -1943,7 +1943,7 @@ PAD* FOOTPRINT::FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe } -PAD* FOOTPRINT::GetPad( const VECTOR2I& aPosition, LSET aLayerMask ) +PAD* FOOTPRINT::GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) { for( PAD* pad : m_pads ) { diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 281cde525f..daa971a0c1 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -144,7 +144,7 @@ public: } LSET GetPrivateLayers() const { return m_privateLayers; } - void SetPrivateLayers( LSET aLayers ) { m_privateLayers = aLayers; } + void SetPrivateLayers( const LSET& aLayers ) { m_privateLayers = aLayers; } ///< @copydoc BOARD_ITEM_CONTAINER::Add() void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT, @@ -199,7 +199,7 @@ public: /** * Return the bounding box of the footprint on a given set of layers */ - const BOX2I GetLayerBoundingBox( LSET aLayers ) const; + const BOX2I GetLayerBoundingBox( const LSET& aLayers ) const; VECTOR2I GetCenter() const override { return GetBoundingBox( false ).GetCenter(); } @@ -769,7 +769,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a #PAD object if found otherwise NULL. */ - PAD* GetPad( const VECTOR2I& aPosition, LSET aLayerMask = LSET::AllLayersMask() ); + PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask = LSET::AllLayersMask() ); std::vector GetPads( const wxString& aPadNumber, const PAD* aIgnore = nullptr ) const; diff --git a/pcbnew/grid_layer_box_helpers.cpp b/pcbnew/grid_layer_box_helpers.cpp index 5908ba09e3..f249ebd2c2 100644 --- a/pcbnew/grid_layer_box_helpers.cpp +++ b/pcbnew/grid_layer_box_helpers.cpp @@ -110,7 +110,7 @@ void GRID_CELL_LAYER_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& // Note: this implementation is an adaptation of wxGridCellChoiceEditor -GRID_CELL_LAYER_SELECTOR::GRID_CELL_LAYER_SELECTOR( PCB_BASE_FRAME* aFrame, LSET aMask, +GRID_CELL_LAYER_SELECTOR::GRID_CELL_LAYER_SELECTOR( PCB_BASE_FRAME* aFrame, const LSET& aMask, bool aShowNonActivated ) : m_frame( aFrame ), m_mask( aMask ), diff --git a/pcbnew/grid_layer_box_helpers.h b/pcbnew/grid_layer_box_helpers.h index 921c5d76b7..7c7198b54b 100644 --- a/pcbnew/grid_layer_box_helpers.h +++ b/pcbnew/grid_layer_box_helpers.h @@ -56,7 +56,7 @@ private: class GRID_CELL_LAYER_SELECTOR : public wxGridCellEditor { public: - GRID_CELL_LAYER_SELECTOR( PCB_BASE_FRAME* aFrame, LSET forbiddenLayers, + GRID_CELL_LAYER_SELECTOR( PCB_BASE_FRAME* aFrame, const LSET& forbiddenLayers, bool aShowNonActivated = false ); wxGridCellEditor* Clone() const override; diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 7e9f7a100b..fa23c29a54 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -330,7 +330,7 @@ PCB_LAYER_ID PAD::GetPrincipalLayer() const } -bool PAD::FlashLayer( LSET aLayers ) const +bool PAD::FlashLayer( const LSET& aLayers ) const { for( PCB_LAYER_ID layer : aLayers.Seq() ) { diff --git a/pcbnew/pad.h b/pcbnew/pad.h index 0fc3df7058..c108638651 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -814,7 +814,7 @@ public: * @return true if connected by pad or track (or optionally zone) on any of the associated * layers */ - bool FlashLayer( LSET aLayers ) const; + bool FlashLayer( const LSET& aLayers ) const; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override; diff --git a/pcbnew/pcb_layer_box_selector.h b/pcbnew/pcb_layer_box_selector.h index e91a0e312e..1426e1d032 100644 --- a/pcbnew/pcb_layer_box_selector.h +++ b/pcbnew/pcb_layer_box_selector.h @@ -54,7 +54,7 @@ public: void SetBoardFrame( PCB_BASE_FRAME* aFrame ); // SetLayerSet allows disabling some layers, which are not shown in list - void SetNotAllowedLayerSet( LSET aMask ) { m_layerMaskDisable = aMask; } + void SetNotAllowedLayerSet( const LSET& aMask ) { m_layerMaskDisable = aMask; } // If the UNDEFINED_LAYER should be selectable, give it a name here. Usually either // INDETERMINATE_STATE or INDETERMINATE_ACTION. diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 3dcf0217ab..dffb56e442 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -163,11 +163,11 @@ public: void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; } bool GetSubtractMaskFromSilk() const { return m_subtractMaskFromSilk; } - void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; } - LSET GetLayerSelection() const { return m_layerSelection; } + void SetLayerSelection( const LSET& aSelection ) { m_layerSelection = aSelection; } + LSET GetLayerSelection() const { return m_layerSelection; } void SetPlotOnAllLayersSequence( LSEQ aSeq ) { m_plotOnAllLayersSequence = aSeq; } - LSEQ GetPlotOnAllLayersSequence() const { return m_plotOnAllLayersSequence; } + LSEQ GetPlotOnAllLayersSequence() const { return m_plotOnAllLayersSequence; } void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; } bool GetUseAuxOrigin() const { return m_useAuxOrigin; } diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index a1272967f6..6e90110092 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -1344,7 +1344,7 @@ void PCB_VIA::SanitizeLayers() } -bool PCB_VIA::FlashLayer( LSET aLayers ) const +bool PCB_VIA::FlashLayer( const LSET& aLayers ) const { for( size_t ii = 0; ii < aLayers.size(); ++ii ) { diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index 94fcbcc6c0..7058c57b82 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -634,7 +634,7 @@ public: * @return true if connected by pad or track (or optionally zone) on any of the associated * layers. */ - bool FlashLayer( LSET aLayers ) const; + bool FlashLayer( const LSET& aLayers ) const; /** * Return the top-most and bottom-most connected layers. diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 3c81a73046..c26a37755e 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -83,7 +83,7 @@ public: } // Basic functions to plot a board item - void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; } + void SetLayerSet( const LSET& aLayerMask ) { m_layerMask = aLayerMask; } void PlotFootprintGraphicItems( const FOOTPRINT* aFootprint ); void PlotFootprintTextItems( const FOOTPRINT* aFootprint ); @@ -215,7 +215,7 @@ void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer, * SetDrillMarksType( DrillMarksType aVal ) * aVal = no hole, small hole, actual hole size */ -void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, +void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); /** @@ -226,7 +226,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, * @param aLayerMask is the mask to define the layers to plot. * @param aPlotOpt is the plot options. Has meaning for some formats only. */ -void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, +void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); /** diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index be24e9727e..414da58e7b 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -90,7 +90,7 @@ void PlotPolySet( BOARD* aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlot * Solder mask layers have a minimum thickness value and cannot be drawn like standard layers, * unless the minimum thickness is 0. */ -void PlotSolderMaskLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, +void PlotSolderMaskLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { if( aBoard->GetDesignSettings().m_SolderMaskMinWidth == 0 ) @@ -109,7 +109,7 @@ void PlotSolderMaskLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, } -void PlotClippedSilkLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, +void PlotClippedSilkLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { SHAPE_POLY_SET silkscreen, solderMask; @@ -329,7 +329,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer, /** * Plot any layer EXCEPT a solder-mask with an enforced minimum width. */ -void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, +void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); @@ -840,7 +840,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, /** * Plot outlines. */ -void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, +void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, const LSET& aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index ed6d7ee4b5..7e3bdd4b54 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -299,7 +299,8 @@ void PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick( wxGridEvent& event ) } -PCB_LAYER_ID PCB_BASE_FRAME::SelectOneLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask, +PCB_LAYER_ID PCB_BASE_FRAME::SelectOneLayer( PCB_LAYER_ID aDefaultLayer, + const LSET& aNotAllowedLayersMask, wxPoint aDlgPosition ) { PCB_ONE_LAYER_SELECTOR dlg( this, aDefaultLayer, aNotAllowedLayersMask, true ); diff --git a/pcbnew/tools/pcb_picker_tool.h b/pcbnew/tools/pcb_picker_tool.h index 55a6fb6041..25f06f9bc9 100644 --- a/pcbnew/tools/pcb_picker_tool.h +++ b/pcbnew/tools/pcb_picker_tool.h @@ -71,7 +71,7 @@ public: /** * Set the tool's snap layer set. */ - inline void SetLayerSet( LSET aLayerSet ) { m_layerMask = aLayerSet; } + inline void SetLayerSet( const LSET& aLayerSet ) { m_layerMask = aLayerSet; } int SelectPointInteractively( const TOOL_EVENT& aEvent ); int SelectItemInteractively( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index f1e5491d5d..5b708a3d52 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -1294,7 +1294,7 @@ void APPEARANCE_CONTROLS::SetObjectVisible( GAL_LAYER_ID aLayer, bool isVisible } -void APPEARANCE_CONTROLS::setVisibleLayers( LSET aLayers ) +void APPEARANCE_CONTROLS::setVisibleLayers( const LSET& aLayers ) { KIGFX::VIEW* view = m_frame->GetCanvas()->GetView(); diff --git a/pcbnew/widgets/appearance_controls.h b/pcbnew/widgets/appearance_controls.h index cabafda362..df329c5df0 100644 --- a/pcbnew/widgets/appearance_controls.h +++ b/pcbnew/widgets/appearance_controls.h @@ -333,7 +333,7 @@ private: void onObjectVisibilityChanged( GAL_LAYER_ID aLayer, bool isVisible, bool isFinal ); - void setVisibleLayers( LSET aLayers ); + void setVisibleLayers( const LSET& aLayers ); void setVisibleObjects( GAL_SET aObjects );