& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
- /**
- * @copydoc EDA_ITEM::IsReplaceable()
- */
- virtual bool IsReplaceable() const { return true; }
-
#if defined(DEBUG)
// comment inherited by Doxygen from Base_Struct
diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp
index 294af7a7b3..1dfde15e0f 100644
--- a/eeschema/sch_sheet_pin.cpp
+++ b/eeschema/sch_sheet_pin.cpp
@@ -399,7 +399,7 @@ bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData,
wxCHECK_MSG( GetParent() != NULL, false,
wxT( "Sheet pin " ) + m_Text + wxT( " does not have a parent sheet!" ) );
- wxLogTrace( traceFindReplace, wxT( " child item " ) + GetSelectMenuText() );
+ wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
if( SCH_ITEM::Matches( m_Text, aSearchData ) )
{
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index e8eca4e3a8..a2e4fcc124 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -167,7 +167,7 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() const
bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation )
{
- wxLogTrace( traceFindReplace, wxT( " item " ) + GetSelectMenuText() );
+ wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
if( SCH_ITEM::Matches( m_Text, aSearchData ) )
{
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index c67a805eea..7ed820a04f 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -206,6 +206,19 @@ public:
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
+ /**
+ * @copydoc EDA_ITEM::Replace(wxFindReplaceData&)
+ */
+ virtual bool Replace( wxFindReplaceData& aSearchData )
+ {
+ return EDA_ITEM::Replace( aSearchData, m_Text );
+ }
+
+ /**
+ * @copydoc EDA_ITEM::IsReplaceable()
+ */
+ virtual bool IsReplaceable() const { return true; }
+
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList );
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index a2410d0aa8..ad5e8da5b7 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -204,7 +204,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_undoItem = NULL;
m_hasAutoSave = true;
- m_foundItemIndex = 0;
CreateScreens();
diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp
index 52fe06a97d..f76a0a31fa 100644
--- a/eeschema/tool_sch.cpp
+++ b/eeschema/tool_sch.cpp
@@ -77,9 +77,9 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
msg = AddHotkeyName( HELP_FIND, s_Schematic_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT );
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg );
- // m_HToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiBitmap( find_replace_xpm ),
- // wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ),
- // HELP_REPLACE, NULL );
+ m_HToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiBitmap( find_replace_xpm ),
+ wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ),
+ HELP_REPLACE, NULL );
m_HToolBar->AddSeparator();
diff --git a/include/base_struct.h b/include/base_struct.h
index f1952b9608..fb356741d8 100644
--- a/include/base_struct.h
+++ b/include/base_struct.h
@@ -374,6 +374,9 @@ protected:
EDA_ITEM* m_Son; /* Linked list: Link (son struct) */
unsigned long m_TimeStamp; ///< Time stamp used for logical links
+ /// Set to true to override the visibility setting of the item.
+ bool m_forceVisible;
+
public:
int m_Flags; // flags for editing and other uses.
@@ -465,6 +468,16 @@ public:
void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
int GetFlags() const { return m_Flags; }
+ /**
+ * Function SetForceVisible
+ * is used to set and cleag force visible flag used to force the item to be drawn
+ * even if it's draw attribute is set to not visible.
+ *
+ * @param aEnable True forces the item to be drawn. False uses the item's visibility
+ * setting to determine if the item is to be drawn.
+ */
+ void SetForceVisible( bool aEnable ) { m_forceVisible = aEnable; }
+
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status
@@ -546,7 +559,7 @@ public:
* but it may also be used to collect output.
* @param scanTypes A KICAD_T array that is EOT terminated, and provides both
* the order and interest level of of the types of objects to
- * be iterated over.
+ * be iterated over.
* @return SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned
* SEARCH_QUIT, else SCAN_CONTINUE;
*/
@@ -614,9 +627,8 @@ public:
* @param aAuxData A pointer to optional data required for the search or NULL
* if not used.
* @param aFindLocation A pointer to a wxPoint object to store the location of
- * matched item. The pointer can be NULL is not used.
- * @return True if this schematic text item matches the search criteria in
- * \a aSearchData.
+ * matched item. The pointer can be NULL if it is not used.
+ * @return True if the item's text matches the search criteria in \a aSearchData.
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation )
{
@@ -633,6 +645,32 @@ public:
*/
bool Matches( const wxString& aText, wxFindReplaceData& aSearchData );
+ /**
+ * Function Replace
+ * performs a text replace on \a aText using the find and replace criteria in
+ * \a aSearchData on items that support text find and replace.
+ *
+ * @param aSearchData A reference to a wxFindReplaceData object containing the
+ * search and replace criteria.
+ * @param aText A reference to a wxString object containing the text to be
+ * replaced.
+ * @return True if \a aText was modified, otherwise false.
+ */
+ bool Replace( wxFindReplaceData& aSearchData, wxString& aText );
+
+ /**
+ * Function Replace
+ * performs a text replace using the find and replace criteria in \a aSearchData
+ * on items that support text find and replace.
+ *
+ * This function must be overridden for items that support text replace.
+ *
+ * @param aSearchData A reference to a wxFindReplaceData object containing the
+ * search and replace criteria.
+ * @return True if the item text was modified, otherwise false.
+ */
+ virtual bool Replace( wxFindReplaceData& aSearchData ) { return false; }
+
/**
* Function IsReplaceable
*
diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h
index d82d2de86a..e459759588 100644
--- a/include/sch_item_struct.h
+++ b/include/sch_item_struct.h
@@ -64,6 +64,10 @@ typedef vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS;
/// Flag to enable find and replace tracing using the WXTRACE environment variable.
extern const wxString traceFindReplace;
+/// Flag to enable find item tracing using the WXTRACE environment variable. This
+/// flag generates a lot of debug output.
+extern const wxString traceFindItem;
+
enum DANGLING_END_T {
UNKNOWN = 0,