56 if(
m_frame->GetFindReplaceDialog() !=
nullptr
58 && aItem->
Matches( data, aSheet )
77 if(
LIB_SYMBOL* symbol = symbolEditor->GetCurSymbol() )
79 for(
SCH_ITEM& item : symbol->GetDrawItems() )
80 visit( &item,
nullptr );
87 visit( item, sheetPath );
92 visit( aChild, sheetPath );
108 visit( item, sheetPath );
115 if( !
m_frame->GetFindReplaceDialog() )
123 else if( selectedOnly )
139 m_frame->GetCanvas()->Refresh();
150 bool past_item = !aAfter;
151 std::vector<SCH_ITEM*> sorted_items;
156 sorted_items.push_back( item );
163 sorted_items.push_back( &field );
166 sorted_items.push_back(
pin );
173 sorted_items.push_back( &field );
176 sorted_items.push_back(
pin );
178 else if( item->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
183 sorted_items.push_back( &field );
190 addItem(
static_cast<SCH_ITEM*
>( item ) );
194 if(
LIB_SYMBOL* symbol = symbolEditor->GetCurSymbol() )
196 for(
SCH_ITEM& item : symbol->GetDrawItems() )
206 std::sort( sorted_items.begin(), sorted_items.end(),
209 if( a->GetPosition().x == b->GetPosition().x )
212 if( a->GetPosition().y == b->GetPosition().y )
213 return a->m_Uuid < b->m_Uuid;
215 return a->GetPosition().y < b->GetPosition().y;
222 std::reverse( sorted_items.begin(), sorted_items.end() );
224 for(
SCH_ITEM* item : sorted_items )
235 if( item->Matches( aData, aSheet ) )
247 bool searchAllSheets =
false;
248 bool selectedOnly =
false;
266 catch(
const std::bad_cast& )
288 bool wrappedAround =
false;
290 for(
int attempt = 0; attempt < 2; ++attempt )
299 afterSheet =
nullptr;
300 wrappedAround =
true;
305 if( afterSheet || !searchAllSheets || selectedOnly )
308 if( !item && searchAllSheets && !selectedOnly )
312 SCH_SCREENS screens( editFrame->Schematic().Root() );
320 paths.push_back( sheet );
326 std::reverse( paths.begin(), paths.end() );
330 if( afterSheet && ( isReversed || !freshSession ) )
333 afterSheet =
nullptr;
338 item =
nextMatch( sheet.LastScreen(), &sheet,
nullptr, data, isReversed );
342 if( editFrame->Schematic().CurrentSheet() != sheet )
378 m_frame->GetCanvas()->Refresh();
385 msg =
_(
"Reached end of symbol." );
386 else if( searchAllSheets )
387 msg =
_(
"Reached end of schematic." );
389 msg =
_(
"Reached end of sheet." );
391 m_frame->ShowFindReplaceStatus( msg, 2000 );
398 m_frame->ShowFindReplaceStatus(
_(
"No matches found." ), 2000 );
422 return match && match->
Matches( data, sheetPath );
445 if( item->
Replace( data, currentSheet ) )
450 commit.
Push( wxS(
"Find and Replace" ) );
455 editFrame->RecalculateConnections(
nullptr,
NO_CLEANUP );
469 bool currentSheetOnly =
true;
470 bool selectedOnly =
false;
484 catch(
const std::bad_cast& )
491 std::set<EDA_ITEM*> replacedRefs;
502 wxCHECK_RET( aSheet, wxT(
"must have a sheetpath for undo" ) );
510 if( sharedRefs && parent && !splitCopies.contains( parent->
m_Uuid ) )
514 if( sharedRef && replacedRefs.contains( sharedRef ) )
519 if( aItem->
Replace( aData, aSheet ) )
521 m_frame->UpdateItem( aItem,
false,
true );
524 replacedRefs.insert( sharedRef );
528 if( currentSheetOnly || selectedOnly )
537 doReplace( item, currentSheet, data );
545 SCH_SHEET_LIST allSheets = schematicFrame->Schematic().Hierarchy();
546 SCH_SCREENS screens( schematicFrame->Schematic().Root() );
552 for(
unsigned ii = 0; ii < sheets.size(); ++ii )
560 doReplace( item, &sheets[0], data );
568 doReplace( field, &sheets[ii], data );
571 item =
nextMatch( screen, &sheets[ii], item, data,
false );
577 if( !commit.
Empty() )
579 commit.
Push( wxS(
"Find and Replace All" ) );
static TOOL_ACTION replaceAll
static TOOL_ACTION updateFind
static TOOL_ACTION findPrevious
static TOOL_ACTION findAndReplace
static TOOL_ACTION replaceAndFindNext
static TOOL_ACTION findNext
static TOOL_ACTION findNextMarker
constexpr const Vec GetCenter() const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
KICAD_T Type() const
Returns the type of object.
void SetForceVisible(bool aEnable)
Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is se...
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
bool IsForceVisible() const
static bool Replace(const EDA_SEARCH_DATA &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsModified
Selected item had a property changed (except movement)
static const TOOL_EVENT PointSelectedEvent
static const TOOL_EVENT UnselectedEvent
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Define a library symbol object.
bool m_AnnotateReusedSheetSuffixes
SCHEMATIC_SETTINGS & Settings() const
std::set< KIID > SplitUnitSymbols() const
Symbols whose copies select different units, for loops that change references as they go.
static TOOL_ACTION changeSheet
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
SCHEMATIC & Schematic() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
std::vector< SCH_FIELD > & GetFields()
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void BuildClientSheetPathList()
Build the list of sheet paths sharing a screen for each screen in use.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
SCH_SHEET_LIST FindAllSheetsForScreen(const SCH_SCREEN *aScreen) const
Return a SCH_SHEET_LIST with a copy of all the SCH_SHEET_PATH using a particular screen.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
size_t GetCurrentHash() const
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
std::vector< SCH_SHEET_PIN * > & GetPins()
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
The symbol library editor main window.
#define BRIGHTENED
item is drawn with a bright contour
@ FRAME_SCH_SYMBOL_EDITOR
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
bool searchCurrentSheetOnly
@ REFERENCE
Field Reference of part, i.e. "IC21".