More undo cleanup.

The symbol editor has few enough items that it will still be performant
if we always send a selected-item-modifed event.  (As it turns out we
were doing that anyway as the check for child-modified flags didn't
also check for selected.)
This commit is contained in:
Jeff Young 2023-07-15 22:23:36 +01:00
parent cf0b719a4a
commit a09a5cb641
3 changed files with 3 additions and 27 deletions

View File

@ -69,8 +69,6 @@ COMMIT& SCH_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN
{
wxCHECK( aItem, *this );
aItem->ClearFlags( IS_MODIFIED_CHILD );
// If aItem belongs a symbol, sheet or label, the full parent will be saved because undo/redo
// does not handle "sub items" modifications.
if( aItem->Type() != SCH_SHEET_T
@ -78,7 +76,6 @@ COMMIT& SCH_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN
SCH_SHEET_T,
SCH_LABEL_LOCATE_ANY_T } ) )
{
aItem->SetFlags( IS_MODIFIED_CHILD );
aItem = aItem->GetParent();
aChangeType = CHT_MODIFY;
}
@ -121,7 +118,6 @@ void SCH_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
{
KIGFX::VIEW* view = m_toolMgr->GetView();
SYMBOL_EDIT_FRAME* frame = static_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
bool selectedModified = false;
if( Empty() )
return;
@ -132,16 +128,6 @@ void SCH_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
if( symbol )
{
if( symbol->IsSelected() )
selectedModified = true;
symbol->RunOnChildren(
[&selectedModified]( LIB_ITEM* aItem )
{
if( aItem->HasFlag( IS_MODIFIED_CHILD ) )
selectedModified = true;
} );
if( view )
{
view->Update( symbol );
@ -171,9 +157,7 @@ void SCH_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
}
m_toolMgr->PostEvent( { TC_MESSAGE, TA_MODEL_CHANGE, AS_GLOBAL } );
if( selectedModified )
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
if( !( aCommitFlags & SKIP_SET_DIRTY ) )
{

View File

@ -67,8 +67,8 @@
#define SHOW_ELEC_TYPE (1 << 25) ///< Show pin electrical type. Shared with IS_ROLLOVER.
#define BRIGHTENED (1 << 26) ///< item is drawn with a bright contour
#define IS_MODIFIED_CHILD (1 << 27)///< when a child is promoted to its parent for a COMMIT, this
///< flag indicates the modified child
// 27 is unused
#define UR_TRANSIENT (1 << 28) ///< indicates the item is owned by the undo/redo stack
#define IS_DANGLING (1 << 29) ///< indicates a pin is dangling

View File

@ -224,14 +224,6 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
for( PCB_VIA* via : connectedVias )
staleTeardropPadsAndVias.push_back( via );
}
else if( boardItem->Type() == PCB_FOOTPRINT_T )
{
for( PAD* pad : static_cast<FOOTPRINT*>( boardItem )->Pads() )
{
if( pad->GetFlags() & IS_MODIFIED_CHILD )
staleTeardropPadsAndVias.push_back( pad );
}
}
}
}