47 wxCHECK( aItem && aUnitsProvider, retv );
49 switch( aItem->
Type() )
57 retv.Printf(
_(
"Wire from %s, %s to %s, %s" ),
65 retv.Printf(
_(
"Bus from %s, %s to %s, %s" ),
73 retv =
_(
"Graphic line not connectable" );
82 if(
const SYMBOL* symbol =
pin->GetParentSymbol() )
84 retv.Printf(
_(
"Symbol '%s' pin '%s'" ),
85 symbol->GetRef( &aSheetPath,
true ),
88 if( wxString pinName =
UnescapeString(
pin->GetShownName() ); !pinName.IsEmpty() )
90 retv += wxString::Format(
" (%s)", pinName );
102 retv.Printf(
_(
"Sheet '%s' pin '%s'" ),
113 retv.Printf(
_(
"Label '%s' at %s, %s" ),
123 retv.Printf(
_(
"Global label '%s' at %s, %s" ),
133 retv.Printf(
_(
"Hierarchical label '%s' at %s, %s" ),
143 retv.Printf(
_(
"Junction at %s, %s" ),
152 retv.Printf(
_(
"No-Connect at %s, %s" ),
161 retv.Printf(
_(
"Bus to wire entry from %s, %s to %s, %s" ),
172 retv.Printf(
_(
"Bus to bus entry from %s, %s to %s, %s" ),
183 retv.Printf(
_(
"Netclass label '%s' at %s, %s" ),
190 retv.Printf(
_(
"Unhandled item type %d" ), aItem->
Type() );
199 bool aSingleSheetSchematic )
201 wxCHECK( !aNetName.IsEmpty(), );
205 wxTreeItemId expandId = aParentId;
208 wxCHECK( connectionGraph, );
210 wxString sheetPathPrefix;
211 std::set<CONNECTION_SUBGRAPH*> subgraphs;
214 const std::vector<CONNECTION_SUBGRAPH*>& tmp = connectionGraph->
GetAllSubgraphs( aNetName );
215 subgraphs.insert( tmp.begin(), tmp.end() );
220 for(
const auto& [
_, bus_sgs] : sg->GetBusParents() )
224 const std::vector<CONNECTION_SUBGRAPH*>& tmp =
226 subgraphs.insert( tmp.begin(), tmp.end() );
231 std::map<wxString, wxTreeItemId> sheetIds;
238 wxCHECK2( subGraph && sheetPath.
Last(),
continue );
240 if( subGraph->GetItems().empty() )
248 wxTreeItemId sheetId;
250 if(
auto sheetIdIt = sheetIds.find( txt ); sheetIdIt != sheetIds.end() )
252 sheetId = sheetIdIt->second;
256 sheetIds[txt] =
m_netNavigator->AppendItem( aParentId, txt, -1, -1, itemData );
257 sheetId = sheetIds[txt];
260 if( aSelection && *aSelection == *itemData )
264 if( aSingleSheetSchematic )
267 for(
const SCH_ITEM* item : subGraph->GetItems() )
282 if( aSelection && *aSelection == *itemData )
322 for(
const auto& net : netMap )
325 if( net.first.Name.IsEmpty() )
356 if( selection.IsOk() )
378 wxLogTrace(
traceUiProfile, wxS(
"Adding %zu nodes to net navigator took %s." ),
397 std::vector<wxTreeItemId> netItems;
398 std::list<wxTreeItemId> itemList;
399 itemList.push_back( netNode );
401 while( !itemList.empty() )
403 wxTreeItemId current = itemList.front();
404 itemList.pop_front();
406 wxTreeItemIdValue cookie;
407 wxTreeItemId child =
m_netNavigator->GetFirstChild( current, cookie );
409 while( child.IsOk() )
412 itemList.push_back( child );
414 netItems.push_back( child );
421 auto it = std::find( netItems.begin(), netItems.end(),
id );
423 if( it != netItems.end() )
428 if( it == netItems.end() )
429 it = netItems.begin();
433 if( it == netItems.begin() )
452 if( data && data->GetItem() )
469 wxTreeItemIdValue sheetCookie;
472 wxTreeItemId sheetId =
m_netNavigator->GetFirstChild( rootId, sheetCookie );
474 while( sheetId.IsOk() )
478 wxTreeItemIdValue itemCookie;
479 wxTreeItemId itemId =
m_netNavigator->GetFirstChild( sheetId, itemCookie );
481 while( itemId.IsOk() )
485 wxCHECK2( itemData,
continue );
487 if( *itemData == *aSelection )
520 wxCHECK( itemData,
nullptr );
522 return itemData->GetItem();
530 wxTreeItemId
id = aEvent.GetItem();
545 &itemData->GetSheetPath() );
550 && itemData->GetItem() )
553 const SCH_ITEM* item = itemData->GetItem();
560 const SCH_SCREEN* screen = itemData->GetSheetPath().LastScreen();
588 netNavigatorPane.Show( !netNavigatorPane.IsShown() );
593 if( netNavigatorPane.IsShown() )
595 if( netNavigatorPane.IsFloating() )
613 if( selection.IsOk() )
618 if( netNavigatorPane.IsFloating() )
657 if( netNavigatorPane.rect.width > 50 )
660 netNavigatorPane.best_size.x = netNavigatorPane.rect.width;
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Calculate the connectivity of a schematic and generates netlists.
const NET_MAP & GetNetMap() const
const std::vector< CONNECTION_SUBGRAPH * > & GetAllSubgraphs(const wxString &aNetName) const
A subgraph is a set of items that are electrically connected on a single sheet.
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * GetParent() const
virtual const wxString & GetText() const
Return the string associated with the text object.
bool contains(const SCH_ITEM *aItem, bool aRobust=false) const
Determine if a given item exists in the tree.
APP_SETTINGS_BASE * KifaceSettings() const
Tree view item data for the net navigator.
const SCH_ITEM * GetItem() const
A small class to help profiling.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
CONNECTION_GRAPH * ConnectionGraph() const
static TOOL_ACTION changeSheet
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EESCHEMA_SETTINGS * eeconfig() const
Class for a bus to bus entry.
VECTOR2I GetPosition() const override
Class for a wire to bus entry.
wxTreeCtrl * m_netNavigator
void ToggleNetNavigator()
void onResizeNetNavigator(wxSizeEvent &aEvent)
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
void onNetNavigatorSelChanging(wxTreeEvent &aEvent)
void MakeNetNavigatorNode(const wxString &aNetName, wxTreeItemId aParentId, const NET_NAVIGATOR_ITEM_DATA *aSelection, bool aSingleSheetSchematic)
SCHEMATIC * m_schematic
The currently loaded schematic.
SCH_SHEET_PATH & GetCurrentSheet() const
const SCH_ITEM * GetSelectedNetNavigatorItem() const
void RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
const SCH_ITEM * SelectNextPrevNetNavigatorItem(bool aNext)
void SelectNetNavigatorItem(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
wxString m_highlightedConn
The highlighted net or bus or empty string.
static const wxString NetNavigatorPaneName()
void onNetNavigatorSelection(wxTreeEvent &aEvent)
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
VECTOR2I GetPosition() const override
Segment description base class to describe items which have 2 end points (track, wire,...
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
VECTOR2I GetPosition() const override
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const SCH_SHEET * GetSheet(unsigned aIndex) const
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
Return the sheet path in a human readable form made from the sheet names.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
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.
VECTOR2I GetPosition() const override
A base class for LIB_SYMBOL and SCH_SYMBOL.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
std::unordered_map< NET_NAME_CODE_CACHE_KEY, std::vector< CONNECTION_SUBGRAPH * > > NET_MAP
Associate a #NET_CODE_NAME with all the subgraphs in that net.
const wxChar *const traceUiProfile
Flag to enable user interface profile tracing.
static wxString GetNetNavigatorItemText(const SCH_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath, UNITS_PROVIDER *aUnitsProvider)
wxString UnescapeString(const wxString &aSource)
wxSize net_nav_panel_float_size
wxSize net_nav_panel_docked_size
wxLogTrace helper definitions.
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.