35#include <wx/fdrepdlg.h>
40 KIGFX::VIEW_ITEM( isSCH_ITEM, isBOARD_ITEM ),
41 m_structType( idType ),
45 m_forceVisible( false ),
51 KIGFX::VIEW_ITEM( isSCH_ITEM, isBOARD_ITEM ),
52 m_structType( idType ),
56 m_forceVisible( false ),
62 KIGFX::VIEW_ITEM( base.IsSCH_ITEM(), base.IsBOARD_ITEM() ),
63 m_Uuid( base.m_Uuid ),
64 m_structType( base.m_structType ),
65 m_flags( base.m_flags ),
66 m_parent( base.m_parent ),
67 m_group( base.m_group ),
68 m_forceVisible( base.m_forceVisible ),
81 if( parent->
Type() == aType )
94 return group->AsEdaItem()->m_Uuid;
120 wxCHECK_MSG(
false,
nullptr, wxT(
"Clone not implemented in derived class " ) +
GetClass() +
121 wxT(
". Bad programmer!" ) );
128 const std::vector<KICAD_T>& aScanTypes )
130#if 0 && defined(DEBUG)
131 std::cout <<
GetClass().mb_str() <<
' ';
134 if(
IsType( aScanTypes ) )
136 if( INSPECT_RESULT::QUIT == inspector(
this, testData ) )
137 return INSPECT_RESULT::QUIT;
140 return INSPECT_RESULT::CONTINUE;
146 wxFAIL_MSG( wxT(
"GetItemDescription() was not overridden for schematic item type " ) +
149 return wxString( wxT(
"Undefined item description for " ) +
GetClass() );
155 return wxIsalnum( c ) || c ==
'_';
161 wxString
text = aText;
171 searchText.MakeUpper();
175 [](
const wxUniChar& c )
177 return wxIsalnum( c ) || c ==
'_';
180 if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::PERMISSIVE )
186 else if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::WHOLEWORD )
190 while( ii < (
int)
text.length() )
192 int next =
text.find( searchText, ii );
194 if(
next == wxNOT_FOUND )
198 next += searchText.length();
200 bool startOK = ( ii == 0 || !
isWordChar(
text.GetChar( ii - 1 ) ) );
203 if( startOK && endOK )
211 else if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
213 return text.Matches( searchText );
215 else if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::REGEX )
222 if( !aSearchData.
regex.Compile( searchText,
flag ) )
228 return aSearchData.
regex.Matches(
text );
232 return text.Find( searchText ) != wxNOT_FOUND;
239 wxString
text = aText;
242 bool replaced =
false;
244 if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::REGEX )
251 if( !aSearchData.
regex.Compile( searchText,
flag ) )
267 searchText = searchText.Upper();
272 while( ii < (
int)
text.length() )
274 int next =
text.find( searchText, ii );
276 if(
next == wxNOT_FOUND )
278 result += aText.Mid( ii, wxString::npos );
283 result += aText.Mid( ii,
next - ii );
286 next += searchText.length();
291 if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::WHOLEWORD )
302 if( startOK && endOK )
310 result += aText.GetChar( ii );
322 wxFAIL_MSG( wxString::Format( wxT(
"Less than operator not defined for item type %s." ),
356 std::vector<int> layers{ 1 };
363 return BITMAPS::dummy_item;
369void EDA_ITEM::ShowDummy( std::ostream& os )
const
374 os <<
'<' << s.Lower().mb_str() <<
">"
375 <<
" Need ::Show() override for this class "
376 <<
"</" << s.Lower().mb_str() <<
">\n";
380std::ostream& EDA_ITEM::NestedSpace(
int nestLevel, std::ostream& os )
382 for(
int i = 0; i<nestLevel; ++i )
398 return wxGetTranslation( typeDescr );
414 .Map(
NOT_USED, wxT(
"<not used>" ) )
BITMAPS
A list of all bitmap identifiers.
bool Find(const wxString &aTerm, int &aMatchersTriggered, int &aPosition)
Look in all existing matchers, return the earliest match of any of the existing.
A set of EDA_ITEMs (i.e., without duplicates).
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const
Return a user-visible description string of this item.
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
bool operator<(const EDA_ITEM &aItem) const
Test if another item is less than this object.
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
EDA_GROUP * m_group
The group this item belongs to, if any. No ownership implied.
KIID GetParentGroupId() const
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
virtual wxString GetFriendlyName() const
EDA_ITEM * GetParent() const
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
virtual wxString GetClass() const =0
Return the class name.
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
EDA_ITEM * m_parent
Owner.
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...
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
EDA_ITEM * findParent(KICAD_T aType) const
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
static ENUM_MAP< T > & Instance()
void SetForcedTransparency(double aForcedTransparency)
double GetForcedTransparency() const
PROPERTY_BASE & SetIsHiddenFromPropertiesManager(bool aHide=true)
Provide class metadata.Helper macro to map type hashes to names.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
static struct EDA_ITEM_DESC _EDA_ITEM_DESC
bool isWordChar(const wxUniChar &c)
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
#define IS_CHANGED
Item was edited, and modified.
Abstract pattern-matching tool and implementations.
Some functions to handle hotkeys in KiCad.
The Cairo implementation of the graphics abstraction layer.
#define NO_SETTER(owner, type)
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
EDA_SEARCH_MATCH_MODE matchMode
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_ITEM_LIST_T
class BOARD_ITEM_LIST, a list of board items
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ NOT_USED
the 3d code uses this value
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ SCREEN_T
not really an item, used to identify a screen
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I