43#define BITMAP_FONT_SIZE_THRESHOLD 3
53 EDA_ITEM( aParent, aType, true, false ),
99 ruleArea->RemoveItem(
this );
152 if(
group->AsEdaItem()->IsLocked() )
176 if( addToParentGroup )
178 wxCHECK_MSG( aCommit, newItem,
"Must supply a commit to update parent group" );
183 group->AddItem( newItem );
194 return aLabel ?
_(
"All units" ) : wxString(
_HKI(
"All units" ) );
196 return symbol->GetUnitDisplayName( aUnit, aLabel );
198 return wxEmptyString;
204 if( aBodyStyle == 0 )
205 return aLabel ?
_(
"All body styles" ) : wxString(
_HKI(
"All body styles" ) );
207 return symbol->GetBodyStyleDescription( aBodyStyle, aLabel );
209 return wxEmptyString;
215 if( aUnit ==
_HKI(
"All units" ) )
223 for(
int ii = 1; ii <= symbol->GetUnitCount(); ii++ )
225 if( symbol->GetUnitDisplayName( ii,
false ) == aUnit )
242 if( aBodyStyle ==
_HKI(
"All body styles" ) )
252 if( symbol->GetBodyStyleDescription( bodyStyle,
false ) == aBodyStyle )
299 const wxString& aVariantName )
const
306 if( area->GetExcludedFromSim( aInstance, aVariantName ) )
315 const wxString& aVariantName )
const
322 if( area->GetExcludedFromBOM( aInstance, aVariantName ) )
331 const wxString& aVariantName )
const
338 if( area->GetExcludedFromBoard( aInstance, aVariantName ) )
347 const wxString& aVariantName )
const
354 if( area->GetExcludedFromPosFiles( aInstance, aVariantName ) )
364 if(
GetDNP( aInstance, aVariantName ) )
369 if( area->GetDNP( aInstance, aVariantName ) )
382 std::function<bool( wxString* )> libSymbolResolver =
383 [&]( wxString* token ) ->
bool
389 std::function<bool( wxString* )> symbolResolver =
390 [&]( wxString* token ) ->
bool
396 std::function<bool( wxString* )> schematicResolver =
397 [&]( wxString* token ) ->
bool
403 return schematic->ResolveTextVar( aPath, token, depth + 1 );
408 std::function<bool( wxString* )> sheetResolver =
409 [&]( wxString* token ) ->
bool
418 path.push_back( sheet );
423 retval |= schematic->ResolveTextVar( &
path, token, depth + 1 );
428 std::function<bool( wxString* )> labelResolver =
429 [&]( wxString* token ) ->
bool
438 wxString variantName;
441 variantName = schematic->GetCurrentVariant();
444 std::function<bool( wxString* )> fieldResolver =
445 [&]( wxString* token ) ->
bool
447 bool resolved =
false;
450 resolved = libSymbolResolver( token );
452 resolved = symbolResolver( token );
454 resolved = sheetResolver( token );
456 resolved = labelResolver( token );
461 resolved |= schematicResolver( token );
515 conn->SetGraph( aGraph );
517 for(
auto& member : conn->AllMembers() )
518 member->SetGraph( aGraph );
525 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
529 if( !schematic || !schematic->IsValid() )
532 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Project().GetProjectFile().m_NetSettings;
540 return netSettings->GetEffectiveNetClass( connection->
Name() );
542 if( std::shared_ptr<NETCLASS> defaultNetclass = netSettings->GetDefaultNetclass() )
543 return defaultNetclass;
569 if( vec.size() == vec.capacity() )
570 vec.reserve( vec.size() + 4096 );
573 auto it = std::lower_bound( vec.begin(), vec.end(), aItem );
575 if( it == vec.end() || *it != aItem )
576 vec.insert( it, aItem );
621 static wxString s_empty;
634 if( aImage ==
nullptr )
678 auto clearTextCaches =
685 text->ClearBoundingBoxCache();
686 text->ClearRenderCache();
690 clearTextCaches(
this );
710 return (
compare( aOther ) < 0 );
762 return schematic->Settings().m_MaxError;
775 return cfg->m_Appearance.default_font;
784 return schematic->Settings().m_FontMetrics;
829 if( symbol->IsMultiUnit() )
832 if( symbol->IsMultiBodyStyle() )
836 aList.emplace_back(
_(
"Private" ), wxEmptyString );
844 return schematic->GetEmbeddedFiles()->GetFontFiles();
848 if(
EMBEDDED_FILES* symbolEmbeddedFiles = symbol->GetEmbeddedFiles() )
849 return symbolEmbeddedFiles->UpdateFontFiles();
874 return symbol->IsMultiUnit();
880 auto multiBodyStyle =
886 return symbol->IsMultiBodyStyle();
899 choices.Add(
_HKI(
"All units" ), 0 );
905 for(
int ii = 1; ii <= symbol->GetUnitCount(); ii++ )
906 choices.Add( symbol->GetUnitDisplayName( ii,
false ), ii );
921 choices.Add(
_HKI(
"All body styles" ) );
928 choices.Add( symbol->GetBodyStyleDescription( ii,
false ) );
946 const auto aPos = a.GetPosition();
947 const auto bPos = b.GetPosition();
948 return aPos.y < bPos.y ? true : ( aPos.y > bPos.y ? false : aPos.x < bPos.x );
958std::vector<DANGLING_END_ITEM>::iterator
963 auto start = aItemListByPos.begin();
964 auto end = aItemListByPos.end();
965 return std::lower_bound( start,
end, needle,
lessYX );
969std::vector<DANGLING_END_ITEM>::iterator
974 auto start = aItemListByType.begin();
975 auto end = aItemListByType.end();
976 return std::lower_bound( start,
end, needle,
lessType );
981 std::vector<DANGLING_END_ITEM>& aItemListByType,
982 std::vector<DANGLING_END_ITEM>& aItemListByPos )
985 std::stable_sort( aItemListByType.begin(), aItemListByType.end(),
lessType );
988 std::sort( aItemListByPos.begin(), aItemListByPos.end(),
lessYX );
constexpr EDA_IU_SCALE schIUScale
constexpr double ARC_LOW_DEF_MM
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
void RemoveItem(SCH_ITEM *aItem)
static std::vector< DANGLING_END_ITEM >::iterator get_lower_type(std::vector< DANGLING_END_ITEM > &aItemListByType, const DANGLING_END_T &aType)
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
Both contain the same information.
Helper class used to store the state of schematic items that can be connected to other schematic item...
DANGLING_END_T GetType() const
The base class for create windows for drawing purpose.
A set of EDA_ITEMs (i.e., without duplicates).
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual void ClearEditFlags()
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM_FLAGS GetTempFlags() const
EDA_ITEM * GetParent() const
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * m_parent
Owner.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
virtual void ClearTempFlags()
EDA_ITEM * findParent(KICAD_T aType) const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Class that other classes need to inherit from, in order to be inspectable.
static const METRICS & Default()
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
int GetMinPenWidth() const
const wxString & GetDefaultFont() const
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
virtual bool TextVarResolver(wxString *aToken) const
PROPERTY_BASE & SetChoicesFunc(std::function< wxPGChoices(INSPECTABLE *)> aFunc)
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetIsHiddenFromDesignEditors(bool aIsHidden=true)
PROPERTY_BASE & SetIsHiddenFromLibraryEditors(bool aIsHidden=true)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Holds all the data relating to one schematic.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
CONNECTION_GRAPH * ConnectionGraph() const
static bool m_IsSchematicExists
True if a SCHEMATIC exists, false if not.
SCH_SHEET_PATH & CurrentSheet() const
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void Reset()
Clears connectivity information.
wxString Name(bool aIgnoreSheet=false) const
void SetGraph(CONNECTION_GRAPH *aGraph)
void SetSheet(const SCH_SHEET_PATH &aSheet)
Base class for any item which can be embedded within the SCHEMATIC container class,...
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
friend class CONNECTION_GRAPH
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
virtual bool IsConnectable() const
void SetLocked(bool aLocked) override
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual int GetPenWidth() const
SCH_ITEM & operator=(const SCH_ITEM &aPin)
std::map< SCH_SHEET_PATH, std::vector< SCH_ITEM * >, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
const std::vector< wxString > * GetEmbeddedFonts() override
const SYMBOL * GetParentSymbol() const
virtual wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const
void SetPrivate(bool aPrivate)
virtual void swapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
virtual const wxString & GetCachedDriverName() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
bool IsLocked() const override
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
virtual bool HasHypertext() const
Indicates that the item has at least one hypertext action.
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
virtual bool operator==(const SCH_ITEM &aOther) const
bool m_connectivity_dirty
virtual void ClearCaches()
const std::vector< SCH_ITEM * > & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
virtual bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
virtual wxString GetBodyStyleProp() const
bool RenderAsBitmap(double aWorldScale) const override
const wxString & GetDefaultFont(const RENDER_SETTINGS *aSettings) const
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Update the connection graph for all connections in this item.
AUTOPLACE_ALGO m_fieldsAutoplaced
std::unordered_set< SCH_RULE_AREA * > m_rule_areas_cache
Store pointers to rule areas which this item is contained within.
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
virtual void SetUnitString(const wxString &aUnit)
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
virtual bool operator<(const SCH_ITEM &aItem) const
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
wxString GetClass() const override
Return the class name.
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
const KIFONT::METRICS & GetFontMetrics() const
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual wxString GetUnitString() const
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
bool IsGroupableType() const
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const
Resolve any references to system tokens supported by the label.
int m_SymbolLineWidth
Override line widths for symbol drawing objects set to default line width.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
A base class for LIB_SYMBOL and SCH_SYMBOL.
wxString ResolveTextVars(const wxString &aSource, const std::function< bool(wxString *)> *aResolver, int &aDepth)
Multi-pass text variable expansion and math expression evaluation.
#define BRIGHTENED
item is drawn with a bright contour
#define SELECTED
Item was manually selected by the user.
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
std::uint32_t EDA_ITEM_FLAGS
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
#define UNIMPLEMENTED_FOR(type)
#define IMPLEMENT_ENUM_TO_WXANY(type)
static const std::vector< KICAD_T > labelTypes
Class to handle a set of SCH_ITEMs.
static bool lessYX(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
#define BITMAP_FONT_SIZE_THRESHOLD
static bool lessType(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
static struct SCH_ITEM_DESC _SCH_ITEM_DESC
T * GetAppSettings(const char *aFilename)
bool operator()(const SCH_ITEM *aFirst, const SCH_ITEM *aSecond) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
VECTOR2< int32_t > VECTOR2I