diff --git a/common/eda_item.cpp b/common/eda_item.cpp index 83aa5e92b3..a309a15a86 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -129,7 +129,7 @@ wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const } -bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData ) +bool EDA_ITEM::Matches( const wxString& aText, const wxFindReplaceData& aSearchData ) const { wxString text = aText; wxString searchText = aSearchData.GetFindString(); @@ -156,7 +156,7 @@ bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData ) } -bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText ) +bool EDA_ITEM::Replace( const wxFindReplaceData& aSearchData, wxString& aText ) { wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper(); diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 3f9ed7a5b1..9f4bc9ced7 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -175,7 +175,7 @@ int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const } -bool EDA_TEXT::Replace( wxFindReplaceData& aSearchData ) +bool EDA_TEXT::Replace( const wxFindReplaceData& aSearchData ) { bool retval = EDA_ITEM::Replace( aSearchData, m_text ); m_shown_text = UnescapeString( m_text ); diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 4f12261258..30896a9ae3 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1478,7 +1478,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition ) } -bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_COMPONENT::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const { wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 4eb64de239..2412916ab2 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -592,7 +592,7 @@ public: void MirrorX( int aXaxis_position ) override; void Rotate( wxPoint aPosition ) override; - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; void GetEndPoints( std::vector& aItemList ) override; diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 5034d2e0d3..fa9652efb6 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -324,7 +324,7 @@ bool SCH_FIELD::IsVoid() const } -bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_FIELD::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const { wxString text = GetShownText(); int flags = aSearchData.GetFlags(); @@ -391,7 +391,7 @@ bool SCH_FIELD::IsReplaceable() const } -bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_FIELD::Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) { bool isReplaced = false; diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index cf894288a7..76c57b9bd4 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -181,9 +181,9 @@ public: { } - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; - bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override; + bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index bbfe5f9e54..71975d3f3e 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -148,7 +148,7 @@ void SCH_MARKER::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset } -bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_MARKER::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const { return SCH_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData ); } diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 481d8c913b..5c373daa26 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -90,7 +90,7 @@ public: * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if the DRC main or auxiliary text matches the search criteria. */ - bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override; + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxDat ) const override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index b8da3e13e8..056406e8d6 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -115,7 +115,7 @@ int SCH_PIN::GetLength() const } -bool SCH_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) +bool SCH_PIN::Matches( const wxFindReplaceData& aSearchData, void* aAuxDat ) const { if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS ) ) return false; @@ -125,7 +125,7 @@ bool SCH_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) } -bool SCH_PIN::Replace( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_PIN::Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) { bool isReplaced = false; diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index 315f75b8d3..2bb877371c 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -101,9 +101,9 @@ public: /// Returns the pin's position in global coordinates wxPoint GetTransformedPosition() const; - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; - bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override; + bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override; /* * While many of these are currently simply covers for the equivalent LIB_PIN methods, diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 74024530f2..2e5e619f5a 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -789,7 +789,7 @@ void SCH_SHEET::Resize( const wxSize& aSize ) } -bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_SHEET::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const { wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index f5561fe80d..0ff9417da4 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -183,12 +183,12 @@ public: void MirrorY( int aYaxis_position ) override; void Rotate( wxPoint aPosition ) override; - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override { return SCH_ITEM::Matches( GetText(), aSearchData ); } - bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override + bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override { return EDA_TEXT::Replace( aSearchData ); } @@ -525,7 +525,7 @@ public: void MirrorX( int aXaxis_position ) override; void Rotate( wxPoint aPosition ) override; - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; bool IsReplaceable() const override { return true; } diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index e977817c68..d0053006fe 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -283,12 +283,12 @@ public: virtual void Rotate90( bool aClockwise ); virtual void MirrorSpinStyle( bool aLeftRight ); - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override { return SCH_ITEM::Matches( GetText(), aSearchData ); } - bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override + bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override { return EDA_TEXT::Replace( aSearchData ); } diff --git a/include/eda_item.h b/include/eda_item.h index 30f225a3f0..2ff421efec 100644 --- a/include/eda_item.h +++ b/include/eda_item.h @@ -410,7 +410,7 @@ public: * @param aAuxData A pointer to optional data required for the search or NULL if not used. * @return True if the item's text matches the search criteria in \a aSearchData. */ - virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) + virtual bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const { return false; } @@ -424,7 +424,7 @@ public: * @param aText A reference to a wxString object containing the text to be replaced. * @return True if \a aText was modified, otherwise false. */ - static bool Replace( wxFindReplaceData& aSearchData, wxString& aText ); + static bool Replace( const wxFindReplaceData& aSearchData, wxString& aText ); /** * Perform a text replace using the find and replace criteria in \a aSearchData @@ -437,7 +437,7 @@ public: * @param aAuxData A pointer to optional data required for the search or NULL if not used. * @return True if the item text was modified, otherwise false. */ - virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = nullptr ) + virtual bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = nullptr ) { return false; } @@ -517,7 +517,7 @@ protected: * @param aSearchData The criteria to search against. * @return True if \a aText matches the search criteria in \a aSearchData. */ - bool Matches( const wxString& aText, wxFindReplaceData& aSearchData ); + bool Matches( const wxString& aText, const wxFindReplaceData& aSearchData ) const; public: const KIID m_Uuid; diff --git a/include/eda_text.h b/include/eda_text.h index 15e4e6f481..673892c544 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -237,7 +237,7 @@ public: * search and replace criteria. * @return True if the text item was modified, otherwise false. */ - bool Replace( wxFindReplaceData& aSearchData ); + bool Replace( const wxFindReplaceData& aSearchData ); bool IsDefaultFormatting() const; diff --git a/pcbnew/fp_text.h b/pcbnew/fp_text.h index 35781d9cba..3654cba8a0 100644 --- a/pcbnew/fp_text.h +++ b/pcbnew/fp_text.h @@ -78,7 +78,7 @@ public: return false; } - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override { return BOARD_ITEM::Matches( GetShownText(), aSearchData ); } diff --git a/pcbnew/pcb_marker.h b/pcbnew/pcb_marker.h index 204be2174d..82599c5fb0 100644 --- a/pcbnew/pcb_marker.h +++ b/pcbnew/pcb_marker.h @@ -83,7 +83,7 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override { return BOARD_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData ); } diff --git a/pcbnew/pcb_text.h b/pcbnew/pcb_text.h index b284b93856..975124fd25 100644 --- a/pcbnew/pcb_text.h +++ b/pcbnew/pcb_text.h @@ -64,7 +64,7 @@ public: wxString GetShownText( int aDepth = 0 ) const override; - bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override { return BOARD_ITEM::Matches( GetShownText(), aSearchData ); }