Browse Source

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

Also fixes an undo bug when pick-component-rotate-place-undo.
pull/15/head
Jeff Young 7 years ago
parent
commit
a61bbea4bd
  1. 2
      eeschema/sch_edit_frame.cpp
  2. 2
      eeschema/sch_screen.cpp
  3. 3
      eeschema/tools/sch_drawing_tool.cpp
  4. 9
      include/base_struct.h

2
eeschema/sch_edit_frame.cpp

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

2
eeschema/sch_screen.cpp

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

3
eeschema/tools/sch_drawing_tool.cpp

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

9
include/base_struct.h

@ -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
// 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
@ -268,6 +269,12 @@ public:
return m_Flags & mask;
}
void ClearTempFlags()
{
ClearFlags( STARTPOINT | ENDPOINT | CANDIDATE |
SKIP_STRUCT | DO_NOT_DRAW | IS_CANCELLED );
}
/**
* Function IsType
* Checks whether the item is one of the listed types

Loading…
Cancel
Save