34#include <wx/fdrepdlg.h>
38 m_forceVisible( false ),
40 m_structType( idType )
46 m_forceVisible( false ),
48 m_structType( idType )
53 m_Uuid( base.m_Uuid ),
54 m_parent( base.m_parent ),
55 m_forceVisible( base.m_forceVisible ),
56 m_flags( base.m_flags ),
57 m_structType( base.m_structType )
83 wxCHECK_MSG(
false,
nullptr, wxT(
"Clone not implemented in derived class " ) +
GetClass() +
84 wxT(
". Bad programmer!" ) );
91 const std::vector<KICAD_T>& aScanTypes )
93#if 0 && defined(DEBUG)
94 std::cout <<
GetClass().mb_str() <<
' ';
99 if( INSPECT_RESULT::QUIT == inspector(
this, testData ) )
100 return INSPECT_RESULT::QUIT;
103 return INSPECT_RESULT::CONTINUE;
109 wxFAIL_MSG( wxT(
"GetItemDescription() was not overridden for schematic item type " ) +
112 return wxString( wxT(
"Undefined item description for " ) +
GetClass() );
118 wxString
text = aText;
128 searchText.MakeUpper();
131 if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::WHOLEWORD )
135 while( ii < (
int)
text.length() )
137 int next =
text.find( searchText, ii );
139 if(
next == wxNOT_FOUND )
143 next += searchText.length();
145 bool startOK = ( ii == 0 || !wxIsalnum(
text.GetChar( ii - 1 ) ) );
146 bool endOK = (
next == (int)
text.length() || !wxIsalnum(
text.GetChar(
next ) ) );
148 if( startOK && endOK )
156 else if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
158 return text.Matches( searchText );
162 return text.Find( searchText ) != wxNOT_FOUND;
169 wxString
text = aText;
172 bool replaced =
false;
177 searchText = searchText.Upper();
182 while( ii < (
int)
text.length() )
184 int next =
text.find( searchText, ii );
186 if(
next == wxNOT_FOUND )
188 result += aText.Mid( ii, wxString::npos );
193 result += aText.Mid( ii,
next - ii );
196 next += searchText.length();
201 if( aSearchData.
matchMode == EDA_SEARCH_MATCH_MODE::WHOLEWORD )
203 startOK = ( ii == 0 || !wxIsalnum(
text.GetChar( ii - 1 ) ) );
204 endOK = (
next == (int)
text.length() || !wxIsalnum(
text.GetChar(
next ) ) );
212 if( startOK && endOK )
220 result += aText.GetChar( ii );
232 wxFAIL_MSG( wxString::Format( wxT(
"Less than operator not defined for item type %s." ),
271 return BITMAPS::dummy_item;
277void EDA_ITEM::ShowDummy( std::ostream& os )
const
282 os <<
'<' << s.Lower().mb_str() <<
">"
283 <<
" Need ::Show() override for this class "
284 <<
"</" << s.Lower().mb_str() <<
">\n";
288std::ostream& EDA_ITEM::NestedSpace(
int nestLevel, std::ostream& os )
290 for(
int i = 0; i<nestLevel; ++i )
306 return wxGetTranslation( typeDescr );
322 .Map(
NOT_USED, wxT(
"<not used>" ) )
BITMAPS
A list of all bitmap identifiers.
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.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
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)
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 bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
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 GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const
Return a user-visible description string of this item.
virtual wxString GetFriendlyName() 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
Linked list: Link (parent struct)
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.
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
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
const INSPECTOR_FUNC & INSPECTOR
#define IS_CHANGED
Item was edited, and modified.
Some functions to handle hotkeys in KiCad.
#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_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_ITEM_LIST_T
class BOARD_ITEM_LIST, a list of board items
@ 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_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_BITMAP_T
class PCB_BITMAP, bitmap on a layer
@ 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_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