Performance optimizations.
This commit is contained in:
parent
3081023b5e
commit
aaf99eb0cc
|
@ -315,7 +315,7 @@ const wxString& CONNECTION_SUBGRAPH::GetNameForDriver( SCH_ITEM* aItem )
|
|||
if( it != m_driver_name_cache.end() )
|
||||
return it->second;
|
||||
|
||||
m_driver_name_cache[aItem] = driverName( aItem );
|
||||
m_driver_name_cache.emplace( aItem, driverName( aItem ) );
|
||||
|
||||
return m_driver_name_cache.at( aItem );
|
||||
}
|
||||
|
@ -1029,6 +1029,7 @@ void CONNECTION_GRAPH::processSubGraphs()
|
|||
[&suffix]( SCH_CONNECTION* aConn ) -> wxString
|
||||
{
|
||||
wxString newName;
|
||||
wxString suffixStr = std::to_wstring( suffix );
|
||||
|
||||
// For group buses with a prefix, we can add the suffix to the prefix.
|
||||
// If they don't have a prefix, we force the creation of a prefix so that
|
||||
|
@ -1042,14 +1043,14 @@ void CONNECTION_GRAPH::processSubGraphs()
|
|||
|
||||
wxString oldName = aConn->Name().AfterFirst( '{' );
|
||||
|
||||
newName = wxString::Format( "%s_%u{%s", prefix, suffix, oldName );
|
||||
newName << prefix << wxT( "_" ) << suffixStr << wxT( "{" ) << oldName;
|
||||
|
||||
aConn->ConfigureFromLabel( newName );
|
||||
}
|
||||
else
|
||||
{
|
||||
newName = wxString::Format( "%s_%u", aConn->Name(), suffix );
|
||||
aConn->SetSuffix( wxString::Format( "_%u", suffix ) );
|
||||
newName << aConn->Name() << wxT( "_" ) << suffixStr;
|
||||
aConn->SetSuffix( wxString( wxT( "_" ) ) << suffixStr );
|
||||
}
|
||||
|
||||
suffix++;
|
||||
|
@ -1724,8 +1725,14 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
|
|||
continue;
|
||||
}
|
||||
|
||||
const KIID& last_parent_uuid = aParent->m_sheet.Last()->m_Uuid;
|
||||
|
||||
for( SCH_SHEET_PIN* pin : candidate->m_hier_pins )
|
||||
{
|
||||
// If the last sheet UUIDs won't match, no need to check the full path
|
||||
if( pin->GetParent()->m_Uuid != last_parent_uuid )
|
||||
continue;
|
||||
|
||||
SCH_SHEET_PATH pin_path = path;
|
||||
pin_path.push_back( pin->GetParent() );
|
||||
|
||||
|
|
|
@ -91,7 +91,15 @@ HIERARCHY_NAVIG_PANEL::HIERARCHY_NAVIG_PANEL( SCH_EDIT_FRAME* aParent ) : WX_PAN
|
|||
|
||||
sizer->Add( m_tree, 1, wxEXPAND, wxBORDER_NONE, 0 );
|
||||
|
||||
m_events_bound = false;
|
||||
|
||||
UpdateHierarchyTree();
|
||||
|
||||
// Enable selection events
|
||||
Bind( wxEVT_TREE_ITEM_ACTIVATED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
Bind( wxEVT_TREE_SEL_CHANGED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
|
||||
m_events_bound = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,6 +135,17 @@ void HIERARCHY_NAVIG_PANEL::buildHierarchyTree( SCH_SHEET_PATH* aList, const wxT
|
|||
|
||||
void HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection()
|
||||
{
|
||||
bool eventsWereBound = m_events_bound;
|
||||
|
||||
if( eventsWereBound )
|
||||
{
|
||||
// Disable selection events
|
||||
Unbind( wxEVT_TREE_ITEM_ACTIVATED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
Unbind( wxEVT_TREE_SEL_CHANGED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
|
||||
m_events_bound = false;
|
||||
}
|
||||
|
||||
std::function<void( const wxTreeItemId& )> selectSheet = [&]( const wxTreeItemId& id )
|
||||
{
|
||||
wxCHECK_RET( id.IsOk(), wxT( "Invalid tree item" ) );
|
||||
|
@ -148,6 +167,15 @@ void HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection()
|
|||
};
|
||||
|
||||
selectSheet( m_tree->GetRootItem() );
|
||||
|
||||
if( eventsWereBound )
|
||||
{
|
||||
// Enable selection events
|
||||
Bind( wxEVT_TREE_ITEM_ACTIVATED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
Bind( wxEVT_TREE_SEL_CHANGED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
|
||||
m_events_bound = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,9 +183,16 @@ void HIERARCHY_NAVIG_PANEL::UpdateHierarchyTree()
|
|||
{
|
||||
Freeze();
|
||||
|
||||
// Disable selection events
|
||||
Unbind( wxEVT_TREE_ITEM_ACTIVATED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
Unbind( wxEVT_TREE_SEL_CHANGED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
bool eventsWereBound = m_events_bound;
|
||||
|
||||
if( eventsWereBound )
|
||||
{
|
||||
// Disable selection events
|
||||
Unbind( wxEVT_TREE_ITEM_ACTIVATED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
Unbind( wxEVT_TREE_SEL_CHANGED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
|
||||
m_events_bound = false;
|
||||
}
|
||||
|
||||
m_list.clear();
|
||||
m_list.push_back( &m_frame->Schematic().Root() );
|
||||
|
@ -173,9 +208,14 @@ void HIERARCHY_NAVIG_PANEL::UpdateHierarchyTree()
|
|||
|
||||
m_tree->ExpandAll();
|
||||
|
||||
// Enable selection events
|
||||
Bind( wxEVT_TREE_ITEM_ACTIVATED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
Bind( wxEVT_TREE_SEL_CHANGED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
if( eventsWereBound )
|
||||
{
|
||||
// Enable selection events
|
||||
Bind( wxEVT_TREE_ITEM_ACTIVATED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
Bind( wxEVT_TREE_SEL_CHANGED, &HIERARCHY_NAVIG_PANEL::onSelectSheetPath, this );
|
||||
|
||||
m_events_bound = true;
|
||||
}
|
||||
|
||||
Thaw();
|
||||
}
|
||||
|
|
|
@ -112,6 +112,8 @@ private:
|
|||
SCH_SHEET_PATH m_list;
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
HIERARCHY_TREE* m_tree;
|
||||
|
||||
bool m_events_bound;
|
||||
};
|
||||
|
||||
#endif // HIERARCH_H
|
||||
|
|
|
@ -350,7 +350,8 @@ wxString SCH_CONNECTION::Name( bool aIgnoreSheet ) const
|
|||
|
||||
void SCH_CONNECTION::recacheName()
|
||||
{
|
||||
m_cached_name = m_name.IsEmpty() ? "<NO NET>" : m_prefix + m_name + m_suffix;
|
||||
m_cached_name =
|
||||
m_name.IsEmpty() ? wxT( "<NO NET>" ) : wxString( m_prefix ) << m_name << m_suffix;
|
||||
|
||||
bool prepend_path = true;
|
||||
|
||||
|
@ -374,7 +375,7 @@ void SCH_CONNECTION::recacheName()
|
|||
}
|
||||
|
||||
m_cached_name_with_path =
|
||||
prepend_path ? m_sheet.PathHumanReadable() + m_cached_name : m_cached_name;
|
||||
prepend_path ? m_sheet.PathHumanReadable() << m_cached_name : m_cached_name;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -297,16 +297,20 @@ wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const
|
|||
if( !empty() && at( 0 )->GetScreen() )
|
||||
fileName = at( 0 )->GetScreen()->GetFileName();
|
||||
|
||||
wxFileName fn = fileName;
|
||||
|
||||
if( aUseShortRootName )
|
||||
s = wxT( "/" ); // Use only the short name in netlists
|
||||
{
|
||||
s = wxT( "/" ); // Use only the short name in netlists
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFileName fn = fileName;
|
||||
|
||||
s = fn.GetName() + wxT( "/" );
|
||||
}
|
||||
|
||||
// Start at 1 since we've already processed the root sheet.
|
||||
for( unsigned i = 1; i < size(); i++ )
|
||||
s = s + at( i )->GetFields()[ SHEETNAME ].GetShownText() + wxT( "/" );
|
||||
s << at( i )->GetFields()[SHEETNAME].GetShownText() << wxT( "/" );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -194,10 +194,9 @@ LSET PAD::ApertureMask()
|
|||
|
||||
bool PAD::IsFlipped() const
|
||||
{
|
||||
if( GetParent() && GetParent()->GetLayer() == B_Cu )
|
||||
return true;
|
||||
FOOTPRINT* parent = GetParent();
|
||||
|
||||
return false;
|
||||
return ( parent && parent->GetLayer() == B_Cu );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1437,7 +1436,7 @@ const BOX2I PAD::ViewBBox() const
|
|||
|
||||
FOOTPRINT* PAD::GetParent() const
|
||||
{
|
||||
return dynamic_cast<FOOTPRINT*>( m_parent );
|
||||
return dyn_cast<FOOTPRINT*>( m_parent );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -119,10 +119,6 @@ void PCB_POINT_EDITOR::Reset( RESET_REASON aReason )
|
|||
m_editPoints.reset();
|
||||
m_altConstraint.reset();
|
||||
getViewControls()->SetAutoPan( false );
|
||||
|
||||
m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
|
||||
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
|
||||
m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1616,18 +1612,22 @@ bool PCB_POINT_EDITOR::validatePolygon( SHAPE_POLY_SET& aPoly ) const
|
|||
{
|
||||
bool valid = !aPoly.IsSelfIntersecting();
|
||||
|
||||
if( m_statusPopup )
|
||||
if( !m_statusPopup )
|
||||
{
|
||||
if( valid )
|
||||
{
|
||||
m_statusPopup->Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
|
||||
m_statusPopup->Move( p );
|
||||
m_statusPopup->PopupFor( 1500 );
|
||||
}
|
||||
m_statusPopup.reset( new STATUS_TEXT_POPUP( getEditFrame<PCB_BASE_EDIT_FRAME>() ) );
|
||||
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
|
||||
m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
|
||||
}
|
||||
|
||||
if( valid )
|
||||
{
|
||||
m_statusPopup->Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
|
||||
m_statusPopup->Move( p );
|
||||
m_statusPopup->PopupFor( 1500 );
|
||||
}
|
||||
|
||||
return valid;
|
||||
|
|
|
@ -162,9 +162,9 @@ private:
|
|||
///< Change the edit method to an alternative method ( currently, arcs only )
|
||||
int changeEditMethod( const TOOL_EVENT& aEvent );
|
||||
|
||||
PCB_SELECTION_TOOL* m_selectionTool;
|
||||
std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
|
||||
std::shared_ptr<EDIT_POINTS> m_editPoints;
|
||||
PCB_SELECTION_TOOL* m_selectionTool;
|
||||
mutable std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
|
||||
std::shared_ptr<EDIT_POINTS> m_editPoints;
|
||||
|
||||
EDIT_POINT* m_editedPoint;
|
||||
EDIT_POINT* m_hoveredPoint;
|
||||
|
|
Loading…
Reference in New Issue