diff --git a/common/dialogs/dialog_text_entry.cpp b/common/dialogs/dialog_text_entry.cpp index 1a0c902ddc..9a47526baa 100644 --- a/common/dialogs/dialog_text_entry.cpp +++ b/common/dialogs/dialog_text_entry.cpp @@ -48,7 +48,7 @@ void WX_TEXT_ENTRY_DIALOG::SetTextValidator( const wxTextValidator& validator ) } -wxString WX_TEXT_ENTRY_DIALOG::GetValue() +wxString WX_TEXT_ENTRY_DIALOG::GetValue() const { return m_textCtrl->GetValue(); } diff --git a/common/dialogs/dialog_text_entry.h b/common/dialogs/dialog_text_entry.h index ad50c0b488..24291f43d3 100644 --- a/common/dialogs/dialog_text_entry.h +++ b/common/dialogs/dialog_text_entry.h @@ -44,7 +44,7 @@ public: void SetTextValidator( wxTextValidatorStyle style ); void SetTextValidator( const wxTextValidator& validator ); - wxString GetValue(); + wxString GetValue() const; }; #endif // _DIALOG_TEXT_ENTRY_H_ diff --git a/common/eda_size_ctrl.cpp b/common/eda_size_ctrl.cpp index d076cbfcee..2e1e897f5f 100644 --- a/common/eda_size_ctrl.cpp +++ b/common/eda_size_ctrl.cpp @@ -62,7 +62,7 @@ EDA_POSITION_CTRL::~EDA_POSITION_CTRL() /* Returns (in internal units) to coordinate between (in user units) */ -wxPoint EDA_POSITION_CTRL::GetValue() +wxPoint EDA_POSITION_CTRL::GetValue() const { return wxPoint( ValueFromString( m_UserUnit, m_FramePosX->GetValue() ), ValueFromString( m_UserUnit, m_FramePosY->GetValue() ) ); @@ -93,7 +93,7 @@ EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxS } -wxSize EDA_SIZE_CTRL::GetValue() +wxSize EDA_SIZE_CTRL::GetValue() const { wxPoint pos = EDA_POSITION_CTRL::GetValue(); diff --git a/common/eda_text.cpp b/common/eda_text.cpp index dfe6aa4a1c..e230f4be60 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -481,7 +481,7 @@ void EDA_TEXT::printOneLineOfText( RENDER_SETTINGS* aSettings, const wxPoint& aO } -wxString EDA_TEXT::GetTextStyleName() +wxString EDA_TEXT::GetTextStyleName() const { int style = 0; diff --git a/common/origin_transforms.cpp b/common/origin_transforms.cpp index 4972312353..92fe01c3a9 100644 --- a/common/origin_transforms.cpp +++ b/common/origin_transforms.cpp @@ -33,37 +33,37 @@ ORIGIN_TRANSFORMS::~ORIGIN_TRANSFORMS() int ORIGIN_TRANSFORMS::ToDisplay( int aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { return static_cast( ToDisplay( static_cast( aValue ), aCoordType ) ); } long long int ORIGIN_TRANSFORMS::ToDisplay( long long int aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { return aValue; } double ORIGIN_TRANSFORMS::ToDisplay( double aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { return aValue; } int ORIGIN_TRANSFORMS::FromDisplay( int aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { return static_cast( FromDisplay( static_cast( aValue ), aCoordType ) ); } long long int ORIGIN_TRANSFORMS::FromDisplay( long long int aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { return aValue; } double ORIGIN_TRANSFORMS::FromDisplay( double aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { return aValue; } diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp index 0310726eca..229125b171 100644 --- a/common/tool/action_manager.cpp +++ b/common/tool/action_manager.cpp @@ -225,7 +225,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const } -const std::map& ACTION_MANAGER::GetActions() +const std::map& ACTION_MANAGER::GetActions() const { return m_actionNameIndex; } diff --git a/common/view/view.cpp b/common/view/view.cpp index 797c62fd8a..d29a914c88 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -1504,13 +1504,13 @@ bool VIEW::IsVisible( const VIEW_ITEM* aItem ) const } -void VIEW::Update( VIEW_ITEM* aItem ) +void VIEW::Update( const VIEW_ITEM* aItem ) const { Update( aItem, ALL ); } -void VIEW::Update( VIEW_ITEM* aItem, int aUpdateFlags ) +void VIEW::Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const { VIEW_ITEM_DATA* viewData = aItem->viewPrivData(); diff --git a/eeschema/dialogs/dialog_fields_editor_global.cpp b/eeschema/dialogs/dialog_fields_editor_global.cpp index acf7d482cb..da9491fb65 100644 --- a/eeschema/dialogs/dialog_fields_editor_global.cpp +++ b/eeschema/dialogs/dialog_fields_editor_global.cpp @@ -263,13 +263,13 @@ public: return GetValue( m_rows[ aRow ], aCol ); } - std::vector GetRowReferences( int aRow ) + std::vector GetRowReferences( int aRow ) const { wxCHECK( aRow < (int)m_rows.size(), std::vector() ); return m_rows[ aRow ].m_Refs; } - wxString GetValue( DATA_MODEL_ROW& group, int aCol ) + wxString GetValue( const DATA_MODEL_ROW& group, int aCol ) { std::vector references; wxString fieldValue; diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index fe5a252f01..7c83865264 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -613,7 +613,7 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event ) template -wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) +wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) const { if( aValue ) return wxT( "1" ); @@ -623,7 +623,7 @@ wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) template -bool FIELDS_GRID_TABLE::BoolFromString( wxString aValue ) +bool FIELDS_GRID_TABLE::BoolFromString( wxString aValue ) const { if( aValue == "1" ) { diff --git a/eeschema/fields_grid_table.h b/eeschema/fields_grid_table.h index c25c68de27..a9643a36d9 100644 --- a/eeschema/fields_grid_table.h +++ b/eeschema/fields_grid_table.h @@ -96,8 +96,8 @@ public: void SetValue( int aRow, int aCol, const wxString &aValue ) override; void SetValueAsBool( int aRow, int aCol, bool aValue ) override; - wxString StringFromBool( bool aValue ); - bool BoolFromString( wxString aValue ); + wxString StringFromBool( bool aValue ) const; + bool BoolFromString( wxString aValue ) const; protected: void initGrid( DIALOG_SHIM* aDialog ); diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h index f598d2be68..305eaf451c 100644 --- a/eeschema/lib_arc.h +++ b/eeschema/lib_arc.h @@ -65,7 +65,7 @@ public: return wxT( "LIB_ARC" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "Arc" ); } diff --git a/eeschema/lib_bezier.h b/eeschema/lib_bezier.h index a9095cd6d6..9c6a03ba60 100644 --- a/eeschema/lib_bezier.h +++ b/eeschema/lib_bezier.h @@ -49,7 +49,7 @@ public: return wxT( "LIB_BEZIER" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "Bezier" ); } diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index a45d1dc2f3..8cabd5f6dd 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -48,7 +48,7 @@ public: return wxT( "LIB_CIRCLE" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "Circle" ); } diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 7d18a293ba..56e2650743 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -97,7 +97,7 @@ public: return wxT( "LIB_FIELD" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "Field" ); } diff --git a/eeschema/lib_item.h b/eeschema/lib_item.h index 38ffdae449..7840018000 100644 --- a/eeschema/lib_item.h +++ b/eeschema/lib_item.h @@ -120,7 +120,7 @@ public: * Provide a user-consumable name of the object type. Perform localization when * called so that run-time language selection works. */ - virtual wxString GetTypeName() = 0; + virtual wxString GetTypeName() const = 0; /** * Begin drawing a component library draw item at \a aPosition. diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index c2b2dff8a2..1b1f352338 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -117,7 +117,7 @@ public: return wxT( "LIB_PIN" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "Pin" ); } diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h index 7918cfe952..1f7046118a 100644 --- a/eeschema/lib_polyline.h +++ b/eeschema/lib_polyline.h @@ -48,7 +48,7 @@ public: return wxT( "LIB_POLYLINE" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "PolyLine" ); } diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h index 684e6ea66c..fbe57f8917 100644 --- a/eeschema/lib_rectangle.h +++ b/eeschema/lib_rectangle.h @@ -49,7 +49,7 @@ public: return wxT( "LIB_RECTANGLE" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "Rectangle" ); } diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index 2652d94cba..9b1f306958 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -54,7 +54,7 @@ public: return wxT( "LIB_TEXT" ); } - wxString GetTypeName() override + wxString GetTypeName() const override { return _( "Text" ); } diff --git a/eeschema/sch_rtree.h b/eeschema/sch_rtree.h index 19669cdebc..7e2549fdc9 100644 --- a/eeschema/sch_rtree.h +++ b/eeschema/sch_rtree.h @@ -119,7 +119,7 @@ public: * @param aRobust If true, search the whole tree, not just the bounding box * @return true if the item definitely exists, false if it does not exist within bbox */ - bool contains( SCH_ITEM* aItem, bool aRobust = false ) + bool contains( const SCH_ITEM* aItem, bool aRobust = false ) const { const EDA_RECT& bbox = aItem->GetBoundingBox(); const int type = int( aItem->Type() ); @@ -158,12 +158,12 @@ public: * Returns the number of items in the tree * @return number of elements in the tree; */ - size_t size() + size_t size() const { return m_count; } - bool empty() + bool empty() const { return m_count == 0; } diff --git a/include/class_pcb_group.h b/include/class_pcb_group.h index 2ea9d2ce7c..24240c0c21 100644 --- a/include/class_pcb_group.h +++ b/include/class_pcb_group.h @@ -178,7 +178,7 @@ public: * * @param aCommit is the commit to add the children to. */ - void AddChildrenToCommit( BOARD_COMMIT& aCommit ) + void AddChildrenToCommit( BOARD_COMMIT& aCommit ) const { RunOnChildren( [&]( BOARD_ITEM* bItem ) { @@ -191,7 +191,7 @@ public: * Note that this function should not add or remove items to the group * @param aFunction is the function to be invoked. */ - void RunOnChildren( const std::function& aFunction ); + void RunOnChildren( const std::function& aFunction ) const; /** * Invokes a function on all descendents of the group. @@ -199,7 +199,7 @@ public: * groups. * @param aFunction is the function to be invoked. */ - void RunOnDescendants( const std::function& aFunction ); + void RunOnDescendants( const std::function& aFunction ) const; private: std::unordered_set m_items; // Members of the group diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h index 44b1374036..a192cec39b 100644 --- a/include/dialog_helpers.h +++ b/include/dialog_helpers.h @@ -117,7 +117,7 @@ public: void Enable( bool x_win_on, bool y_win_on ); void SetValue( int x_value, int y_value ); - wxPoint GetValue(); + wxPoint GetValue() const; }; @@ -132,7 +132,7 @@ public: EDA_UNITS user_unit, wxBoxSizer* BoxSizer ); ~EDA_SIZE_CTRL() { } - wxSize GetValue(); + wxSize GetValue() const; }; diff --git a/include/eda_rect.h b/include/eda_rect.h index 0508db41db..362b4b51ed 100644 --- a/include/eda_rect.h +++ b/include/eda_rect.h @@ -106,7 +106,7 @@ public: * @brief GetSizeMax * @return the max size dimension */ - int GetSizeMax() const { return ( m_Size.x > m_Size.y )?m_Size.x:m_Size.y; } + int GetSizeMax() const { return ( m_Size.x > m_Size.y ) ? m_Size.x : m_Size.y; } int GetX() const { return m_Pos.x; } int GetY() const { return m_Pos.y; } diff --git a/include/eda_text.h b/include/eda_text.h index f0ba647293..c10268f068 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -351,7 +351,7 @@ public: /** * @return a wxString with the style name( Normal, Italic, Bold, Bold+Italic) */ - wxString GetTextStyleName(); + wxString GetTextStyleName() const; /** * Populate \a aPositions with the position of each line of diff --git a/include/gbr_netlist_metadata.h b/include/gbr_netlist_metadata.h index 82b6edf48f..ce82d8be26 100644 --- a/include/gbr_netlist_metadata.h +++ b/include/gbr_netlist_metadata.h @@ -107,7 +107,7 @@ public: void Clear() { clear(); } - const wxString& GetValue() { return m_field; } + const wxString& GetValue() const { return m_field; } void SetField( const wxString& aField, bool aUseUTF8, bool aEscapeString ) { @@ -116,7 +116,7 @@ public: m_escapeString = aEscapeString; } - bool IsEmpty() { return m_field.IsEmpty(); } + bool IsEmpty() const { return m_field.IsEmpty(); } std::string GetGerberString(); diff --git a/include/libeval_compiler/libeval_compiler.h b/include/libeval_compiler/libeval_compiler.h index ab6bf07f19..009a637cec 100644 --- a/include/libeval_compiler/libeval_compiler.h +++ b/include/libeval_compiler/libeval_compiler.h @@ -254,7 +254,7 @@ public: VAR_REF() {}; virtual ~VAR_REF() {}; - virtual VAR_TYPE_T GetType() = 0; + virtual VAR_TYPE_T GetType() const = 0; virtual VALUE GetValue( CONTEXT* aCtx ) = 0; }; diff --git a/include/origin_transforms.h b/include/origin_transforms.h index 9a4e808b73..244641dc0e 100644 --- a/include/origin_transforms.h +++ b/include/origin_transforms.h @@ -23,7 +23,7 @@ */ #ifndef ORIGIN_TRANSFORMS_H_ -#define ORIGIN_TRANSFORMS_H_ 1 +#define ORIGIN_TRANSFORMS_H_ /** * A class to perform either relative or absolute display origin @@ -61,28 +61,28 @@ public: // =============== Single-axis Transforms =============== virtual int ToDisplay( int aValue, - COORD_TYPES_T aCoordType ); + COORD_TYPES_T aCoordType ) const; virtual long long int ToDisplay( long long int aValue, - COORD_TYPES_T aCoordType ); + COORD_TYPES_T aCoordType ) const; virtual double ToDisplay( double aValue, - COORD_TYPES_T aCoordType ); + COORD_TYPES_T aCoordType ) const; virtual int FromDisplay( int aValue, - COORD_TYPES_T aCoordType ); + COORD_TYPES_T aCoordType ) const; virtual long long int FromDisplay( long long int aValue, - COORD_TYPES_T aCoordType ); + COORD_TYPES_T aCoordType ) const; virtual double FromDisplay( double aValue, - COORD_TYPES_T aCoordType ); + COORD_TYPES_T aCoordType ) const; // =============== Two-axis Transforms =============== template - T ToDisplayAbs( const T& aValue ) + T ToDisplayAbs( const T& aValue ) const { T displayValue; @@ -92,7 +92,7 @@ public: } template - T ToDisplayRel( const T& aValue ) + T ToDisplayRel( const T& aValue ) const { T displayValue; @@ -103,7 +103,7 @@ public: template - T FromDisplayAbs( const T& aValue ) + T FromDisplayAbs( const T& aValue ) const { T displayValue; @@ -113,7 +113,7 @@ public: } template - T FromDisplayRel( const T& aValue ) + T FromDisplayRel( const T& aValue ) const { T displayValue; diff --git a/include/tool/action_manager.h b/include/tool/action_manager.h index 8b1d564f7b..a96575619a 100644 --- a/include/tool/action_manager.h +++ b/include/tool/action_manager.h @@ -110,7 +110,7 @@ public: /** * Get a list of currently-registered actions mapped by their name. */ - const std::map& GetActions(); + const std::map& GetActions() const; /** * Finds an action with a given name (if there is one available). diff --git a/include/view/view.h b/include/view/view.h index bc7b0196cd..e0ac202429 100644 --- a/include/view/view.h +++ b/include/view/view.h @@ -141,8 +141,8 @@ public: * @param aItem: the item to update. * @param aUpdateFlags: how much the object has changed. */ - virtual void Update( VIEW_ITEM* aItem, int aUpdateFlags ); - virtual void Update( VIEW_ITEM* aItem ); + virtual void Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const; + virtual void Update( const VIEW_ITEM* aItem ) const; /** * Function SetRequired() diff --git a/include/view/view_rtree.h b/include/view/view_rtree.h index 3f16c8777d..92e72564eb 100644 --- a/include/view/view_rtree.h +++ b/include/view/view_rtree.h @@ -77,7 +77,7 @@ public: * with aBounds. */ template - void Query( const BOX2I& aBounds, Visitor& aVisitor ) // const + void Query( const BOX2I& aBounds, Visitor& aVisitor ) const { int mmin[2] = { aBounds.GetX(), aBounds.GetY() }; int mmax[2] = { aBounds.GetRight(), aBounds.GetBottom() }; diff --git a/include/widgets/bitmap_toggle.h b/include/widgets/bitmap_toggle.h index 44d97a283d..9866df16e7 100644 --- a/include/widgets/bitmap_toggle.h +++ b/include/widgets/bitmap_toggle.h @@ -50,7 +50,7 @@ public: void SetValue( bool aValue ); ///> Read the checkbox state - bool GetValue() { return m_checked; } + bool GetValue() const { return m_checked; } private: bool m_checked; diff --git a/libs/kimath/include/geometry/shape_index.h b/libs/kimath/include/geometry/shape_index.h index b0607875f6..3f06b23573 100644 --- a/libs/kimath/include/geometry/shape_index.h +++ b/libs/kimath/include/geometry/shape_index.h @@ -173,7 +173,7 @@ class SHAPE_INDEX * Checks if the iterator has reached the end. * @return true if it is in an invalid position (data finished) */ - bool IsNull() + bool IsNull() const { return iterator.IsNull(); } @@ -184,7 +184,7 @@ class SHAPE_INDEX * Checks if the iterator has not reached the end. * @return true if it is in an valid position (data not finished) */ - bool IsNotNull() + bool IsNotNull() const { return iterator.IsNotNull(); } @@ -275,7 +275,7 @@ class SHAPE_INDEX * @param aVisitor object to be invoked on every object contained in the search area. */ template - int Query( const SHAPE *aShape, int aMinDistance, V& aVisitor, bool aExact ) + int Query( const SHAPE *aShape, int aMinDistance, V& aVisitor) const { BOX2I box = aShape->BBox(); box.Inflate( aMinDistance ); @@ -377,4 +377,4 @@ typename SHAPE_INDEX::Iterator SHAPE_INDEX::Begin() return Iterator( this ); } -#endif +#endif /* __SHAPE_INDEX_H */ diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index afef86ac26..c5be887e83 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -969,7 +969,7 @@ wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource ) } -unsigned BOARD::GetNodesCount( int aNet ) +unsigned BOARD::GetNodesCount( int aNet ) const { unsigned retval = 0; @@ -1854,7 +1854,7 @@ bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, wxString* aError } -const std::vector BOARD::GetPads() +const std::vector BOARD::GetPads() const { std::vector allPads; @@ -1868,7 +1868,7 @@ const std::vector BOARD::GetPads() } -unsigned BOARD::GetPadCount() +unsigned BOARD::GetPadCount() const { unsigned retval = 0; diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 47b8f08ad0..a301b621b9 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -680,7 +680,7 @@ public: * @param aNet Only count nodes belonging to this net * @return the number of pads members of nets (i.e. with netcode > 0) */ - unsigned GetNodesCount( int aNet = -1 ); + unsigned GetNodesCount( int aNet = -1 ) const; /** * @return the number of unconnected nets in the current ratsnest. @@ -690,7 +690,7 @@ public: /** * @return the number of pads in board */ - unsigned GetPadCount(); + unsigned GetPadCount() const; /** * Return a reference to a list of all the pads. @@ -700,7 +700,7 @@ public: * * @return D_PADS - a full list of pads */ - const std::vector GetPads(); + const std::vector GetPads() const; void BuildListOfNets() { diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 5f4ffd3ccd..60ffaa342f 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -1063,7 +1063,7 @@ EDA_ITEM* MODULE::Clone() const } -void MODULE::RunOnChildren( const std::function& aFunction ) +void MODULE::RunOnChildren( const std::function& aFunction ) const { try { diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index dead267f12..475843048c 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -594,7 +594,7 @@ public: * Note that this function should not add or remove items to the module * @param aFunction is the function to be invoked. */ - void RunOnChildren( const std::function& aFunction ); + void RunOnChildren( const std::function& aFunction ) const; /** * Returns a set of all layers that this module has drawings on similar to ViewGetLayers() diff --git a/pcbnew/class_pcb_group.cpp b/pcbnew/class_pcb_group.cpp index 11e40a372f..4f39e3a6eb 100644 --- a/pcbnew/class_pcb_group.cpp +++ b/pcbnew/class_pcb_group.cpp @@ -310,7 +310,7 @@ void PCB_GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aFunction ) +void PCB_GROUP::RunOnChildren( const std::function& aFunction ) const { try { @@ -324,7 +324,7 @@ void PCB_GROUP::RunOnChildren( const std::function& aFuncti } -void PCB_GROUP::RunOnDescendants( const std::function& aFunction ) +void PCB_GROUP::RunOnDescendants( const std::function& aFunction ) const { try { diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 673bf7d2bb..8b79ebd7e7 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -713,7 +713,7 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& } -void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector& aList ) const { wxString msg; diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index e74c4f8bcb..4c9949ba35 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -259,7 +259,7 @@ public: #endif protected: - void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector& aList ); + void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector& aList ) const; int m_Width; ///< Thickness of track, or via diameter diff --git a/pcbnew/connectivity/connectivity_rtree.h b/pcbnew/connectivity/connectivity_rtree.h index c57a566b8b..76ff2689db 100644 --- a/pcbnew/connectivity/connectivity_rtree.h +++ b/pcbnew/connectivity/connectivity_rtree.h @@ -107,7 +107,7 @@ public: * with aBounds. */ template - void Query( const BOX2I& aBounds, const LAYER_RANGE& aRange, Visitor& aVisitor ) + void Query( const BOX2I& aBounds, const LAYER_RANGE& aRange, Visitor& aVisitor ) const { const int mmin[3] = { aRange.Start(), aBounds.GetX(), aBounds.GetY() }; const int mmax[3] = { aRange.End(), aBounds.GetRight(), aBounds.GetBottom() }; diff --git a/pcbnew/dialogs/dialog_get_footprint_by_name.h b/pcbnew/dialogs/dialog_get_footprint_by_name.h index 234bce7119..17f10bc167 100644 --- a/pcbnew/dialogs/dialog_get_footprint_by_name.h +++ b/pcbnew/dialogs/dialog_get_footprint_by_name.h @@ -55,7 +55,7 @@ public: } // returns the selected text (fp reference) - const wxString GetValue() + const wxString GetValue() const { return m_SearchTextCtrl->GetValue(); } diff --git a/pcbnew/dialogs/wizard_3DShape_Libs_downloader.h b/pcbnew/dialogs/wizard_3DShape_Libs_downloader.h index 58a1e44fd7..dfcb6f8402 100644 --- a/pcbnew/dialogs/wizard_3DShape_Libs_downloader.h +++ b/pcbnew/dialogs/wizard_3DShape_Libs_downloader.h @@ -95,7 +95,7 @@ protected: } ///> Gets the current target for downloaded libraries - inline wxString getDownloadDir() + inline wxString getDownloadDir() const { return m_downloadDir->GetValue(); } diff --git a/pcbnew/drc/drc_rtree.h b/pcbnew/drc/drc_rtree.h index e20773c7a6..5facb3ecaf 100644 --- a/pcbnew/drc/drc_rtree.h +++ b/pcbnew/drc/drc_rtree.h @@ -240,7 +240,7 @@ public: bool CheckColliding( SHAPE* aRefShape, PCB_LAYER_ID aTargetLayer, int aClearance = 0, - std::function aFilter = nullptr ) + std::function aFilter = nullptr ) const { BOX2I box = aRefShape->BBox(); box.Inflate( aClearance ); @@ -276,7 +276,7 @@ public: PCB_LAYER_ID aTargetLayer, std::function aFilter = nullptr, std::function aVisitor = nullptr, - int aClearance = 0 ) + int aClearance = 0 ) const { // keep track of BOARD_ITEMs that have been already found to collide (some items // might be build of COMPOUND/triangulated shapes and a single subshape collision @@ -344,7 +344,7 @@ public: ITEM_WITH_SHAPE*, ITEM_WITH_SHAPE*, bool* aCollision )> aVisitor, int aMaxClearance, - std::function aProgressReporter ) + std::function aProgressReporter ) const { std::vector< PAIR_INFO > pairsToVisit; @@ -463,12 +463,12 @@ public: * Returns the number of items in the tree * @return number of elements in the tree; */ - size_t size() + size_t size() const { return m_count; } - bool empty() + bool empty() const { return m_count == 0; } diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 721f36c731..9489eba2a2 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -488,9 +488,9 @@ void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions() } -BOARD_ITEM* PCB_EXPR_VAR_REF::GetObject( LIBEVAL::CONTEXT* aCtx ) const +BOARD_ITEM* PCB_EXPR_VAR_REF::GetObject( const LIBEVAL::CONTEXT* aCtx ) const { - wxASSERT( dynamic_cast( aCtx ) ); + wxASSERT( dynamic_cast( aCtx ) ); const PCB_EXPR_CONTEXT* ctx = static_cast( aCtx ); BOARD_ITEM* item = ctx->GetItem( m_itemIndex ); diff --git a/pcbnew/pcb_expr_evaluator.h b/pcbnew/pcb_expr_evaluator.h index f5640f52bd..2e282f541b 100644 --- a/pcbnew/pcb_expr_evaluator.h +++ b/pcbnew/pcb_expr_evaluator.h @@ -97,7 +97,7 @@ public: bool IsEnum() const { return m_isEnum; } void SetType( LIBEVAL::VAR_TYPE_T type ) { m_type = type; } - LIBEVAL::VAR_TYPE_T GetType() override { return m_type; } + LIBEVAL::VAR_TYPE_T GetType() const override { return m_type; } void AddAllowedClass( TYPE_ID type_hash, PROPERTY_BASE* prop ) { @@ -106,7 +106,7 @@ public: virtual LIBEVAL::VALUE GetValue( LIBEVAL::CONTEXT* aCtx ) override; - BOARD_ITEM* GetObject( LIBEVAL::CONTEXT* aCtx ) const; + BOARD_ITEM* GetObject( const LIBEVAL::CONTEXT* aCtx ) const; private: std::unordered_map m_matchingTypes; diff --git a/pcbnew/pcb_origin_transforms.cpp b/pcbnew/pcb_origin_transforms.cpp index f491ffd6c2..d35be4f462 100644 --- a/pcbnew/pcb_origin_transforms.cpp +++ b/pcbnew/pcb_origin_transforms.cpp @@ -39,7 +39,7 @@ PCB_ORIGIN_TRANSFORMS::~PCB_ORIGIN_TRANSFORMS() {} long long int PCB_ORIGIN_TRANSFORMS::ToDisplay( long long int aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { long long int value = aValue; @@ -57,7 +57,7 @@ long long int PCB_ORIGIN_TRANSFORMS::ToDisplay( long long int aValue, } double PCB_ORIGIN_TRANSFORMS::ToDisplay( double aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { double value = aValue; @@ -75,7 +75,7 @@ double PCB_ORIGIN_TRANSFORMS::ToDisplay( double aValue, } long long int PCB_ORIGIN_TRANSFORMS::FromDisplay( long long int aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { long long value = aValue; @@ -93,7 +93,7 @@ long long int PCB_ORIGIN_TRANSFORMS::FromDisplay( long long int aValue, } double PCB_ORIGIN_TRANSFORMS::FromDisplay( double aValue, - COORD_TYPES_T aCoordType ) + COORD_TYPES_T aCoordType ) const { double value = aValue; diff --git a/pcbnew/pcb_origin_transforms.h b/pcbnew/pcb_origin_transforms.h index 6657b73252..49e3e2af19 100644 --- a/pcbnew/pcb_origin_transforms.h +++ b/pcbnew/pcb_origin_transforms.h @@ -23,7 +23,7 @@ */ #ifndef PCB_ORIGIN_TRANSFORM_H_ -#define PCB_ORIGIN_TRANSFORM_H_ 1 +#define PCB_ORIGIN_TRANSFORM_H_ #include @@ -38,16 +38,16 @@ public: using ORIGIN_TRANSFORMS::ToDisplay; - virtual long long int ToDisplay( long long int aValue, COORD_TYPES_T aCoordType ) override; + virtual long long int ToDisplay( long long int aValue, COORD_TYPES_T aCoordType ) const override; - virtual double ToDisplay( double aValue, COORD_TYPES_T aCoordType ) override; + virtual double ToDisplay( double aValue, COORD_TYPES_T aCoordType ) const override; using ORIGIN_TRANSFORMS::FromDisplay; - virtual long long int FromDisplay( long long int aValue, COORD_TYPES_T aCoordType ) override; + virtual long long int FromDisplay( long long int aValue, COORD_TYPES_T aCoordType ) const override; - virtual double FromDisplay( double aValue, COORD_TYPES_T aCoordType ) override; + virtual double FromDisplay( double aValue, COORD_TYPES_T aCoordType ) const override; /** diff --git a/pcbnew/pcb_view.cpp b/pcbnew/pcb_view.cpp index dcf04f16b5..d2cbef7f43 100644 --- a/pcbnew/pcb_view.cpp +++ b/pcbnew/pcb_view.cpp @@ -90,13 +90,13 @@ void PCB_VIEW::Remove( KIGFX::VIEW_ITEM* aItem ) } -void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) +void PCB_VIEW::Update( const KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) const { - BOARD_ITEM* item = static_cast( aItem ); + const BOARD_ITEM* item = static_cast( aItem ); if( item->Type() == PCB_MODULE_T ) { - MODULE* mod = static_cast( item ); + const MODULE* mod = static_cast( item ); mod->RunOnChildren( [this, aUpdateFlags] ( BOARD_ITEM* aModItem ) { @@ -108,7 +108,7 @@ void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) } -void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem ) +void PCB_VIEW::Update( const KIGFX::VIEW_ITEM* aItem ) const { PCB_VIEW::Update( aItem, KIGFX::ALL ); } diff --git a/pcbnew/pcb_view.h b/pcbnew/pcb_view.h index eedffb0ac3..2086e8f628 100644 --- a/pcbnew/pcb_view.h +++ b/pcbnew/pcb_view.h @@ -46,10 +46,10 @@ public: virtual void Remove( VIEW_ITEM* aItem ) override; /// @copydoc VIEW::Update() - virtual void Update( VIEW_ITEM* aItem, int aUpdateFlags ) override; + virtual void Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const override; /// @copydoc VIEW::Update() - virtual void Update( VIEW_ITEM* aItem ) override; + virtual void Update( const VIEW_ITEM* aItem ) const override; void UpdateDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions ); }; diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h index f87caa9ad8..56ee6f5fb9 100644 --- a/pcbnew/router/pns_index.h +++ b/pcbnew/router/pns_index.h @@ -78,7 +78,7 @@ public: * @return number of items found. */ template - int Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ); + int Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) const; /** * Searches items in the index that are in proximity of aShape. @@ -92,7 +92,7 @@ public: * @return number of items found. */ template - int Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ); + int Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const; /** * Returns list of all items in a given net. @@ -120,7 +120,7 @@ public: private: template - int querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ); + int querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const; std::deque m_subIndices; std::map m_netMap; @@ -129,16 +129,16 @@ private: template -int INDEX::querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) +int INDEX::querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const { if( aIndex >= m_subIndices.size() ) return 0; - return m_subIndices[aIndex].Query( aShape, aMinDistance, aVisitor, false ); + return m_subIndices[aIndex].Query( aShape, aMinDistance, aVisitor); } template -int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) +int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) const { int total = 0; @@ -151,7 +151,7 @@ int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) } template -int INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) +int INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const { int total = 0; diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index 23dbabf7be..297b7c4306 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -179,7 +179,7 @@ public: ///> Zooms the screen to center and fit the current selection. void zoomFitSelection(); - BOARD* GetBoard() + BOARD* GetBoard() const { return board(); } @@ -394,4 +394,4 @@ private: std::unique_ptr m_priv; }; -#endif +#endif /* __SELECTION_TOOL_H */ diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index ece962c951..231fcc4dc6 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -208,18 +208,18 @@ NET_GRID_ENTRY& NET_GRID_TABLE::GetEntry( int aRow ) } -int NET_GRID_TABLE::GetRowByNetcode( int aCode ) +int NET_GRID_TABLE::GetRowByNetcode( int aCode ) const { - auto it = std::find_if( m_nets.begin(), m_nets.end(), + auto it = std::find_if( m_nets.cbegin(), m_nets.cend(), [aCode]( const NET_GRID_ENTRY& aEntry ) { return aEntry.code == aCode; } ); - if( it == m_nets.end() ) + if( it == m_nets.cend() ) return -1; - return std::distance( m_nets.begin(), it ); + return std::distance( m_nets.cbegin(), it ); } diff --git a/pcbnew/widgets/appearance_controls.h b/pcbnew/widgets/appearance_controls.h index e017326fc8..05e1135718 100644 --- a/pcbnew/widgets/appearance_controls.h +++ b/pcbnew/widgets/appearance_controls.h @@ -112,7 +112,7 @@ public: NET_GRID_ENTRY& GetEntry( int aRow ); - int GetRowByNetcode( int aCode ); + int GetRowByNetcode( int aCode ) const; void Rebuild();