Fix issue with selection being inadvertantly cleared via ClearFlags().

Also fixes an undo bug when pick-component-rotate-place-undo.
This commit is contained in:
Jeff Young 2019-05-01 12:37:35 +01:00
parent 59af079cbd
commit a61bbea4bd
4 changed files with 11 additions and 5 deletions

View File

@ -1269,7 +1269,7 @@ void SCH_EDIT_FRAME::AddItemToScreen( SCH_ITEM* aItem, bool aUndoAppend )
SaveUndoItemInUndoList( undoItem, aUndoAppend ); SaveUndoItemInUndoList( undoItem, aUndoAppend );
} }
aItem->ClearFlags(); aItem->ClearFlags( aItem->GetEditFlags() );
screen->SetModify(); screen->SetModify();
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );

View File

@ -594,7 +594,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
void SCH_SCREEN::ClearDrawingState() void SCH_SCREEN::ClearDrawingState()
{ {
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
item->ClearFlags(); item->ClearTempFlags();
} }

View File

@ -358,7 +358,6 @@ int SCH_DRAWING_TOOL::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTER
if( aComponent ) if( aComponent )
{ {
aComponent->SetFlags( IS_NEW | IS_MOVED ); aComponent->SetFlags( IS_NEW | IS_MOVED );
m_frame->SaveCopyInUndoList( aComponent, UR_NEW, false );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
m_toolMgr->RunAction( SCH_ACTIONS::addItemToSel, true, aComponent ); m_toolMgr->RunAction( SCH_ACTIONS::addItemToSel, true, aComponent );
@ -421,7 +420,6 @@ int SCH_DRAWING_TOOL::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTER
aComponent->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false ); aComponent->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
aComponent->SetFlags( IS_NEW | IS_MOVED ); aComponent->SetFlags( IS_NEW | IS_MOVED );
m_frame->SaveCopyInUndoList( aComponent, UR_NEW, false );
m_frame->SetRepeatItem( aComponent ); m_frame->SetRepeatItem( aComponent );
m_frame->GetScreen()->SetCurItem( aComponent ); m_frame->GetScreen()->SetCurItem( aComponent );
@ -436,6 +434,7 @@ int SCH_DRAWING_TOOL::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTER
{ {
m_view->ClearPreview(); m_view->ClearPreview();
// Will perform SaveCopyInUndoList():
m_frame->AddItemToScreen( aComponent ); m_frame->AddItemToScreen( aComponent );
aComponent = nullptr; aComponent = nullptr;

View File

@ -143,7 +143,8 @@ typedef const INSPECTOR_FUNC& INSPECTOR; /// std::function passed to nested u
#define IS_DANGLING (1 << 29) ///< indicates a pin is dangling #define IS_DANGLING (1 << 29) ///< indicates a pin is dangling
// WARNING: if you add flags, you'll probably need to adjust the mask in GetEditFlags() // WARNING: if you add flags, you'll probably need to adjust the masks in GetEditFlags() and
// ClearTempFlags().
#define EDA_ITEM_ALL_FLAGS -1 #define EDA_ITEM_ALL_FLAGS -1
@ -268,6 +269,12 @@ public:
return m_Flags & mask; return m_Flags & mask;
} }
void ClearTempFlags()
{
ClearFlags( STARTPOINT | ENDPOINT | CANDIDATE |
SKIP_STRUCT | DO_NOT_DRAW | IS_CANCELLED );
}
/** /**
* Function IsType * Function IsType
* Checks whether the item is one of the listed types * Checks whether the item is one of the listed types