diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index e664e3ce8d..82dd1bec66 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1007,17 +1007,6 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) { if( m_pickerItem ) { - SCH_ITEM* sch_item = dynamic_cast( m_pickerItem ); - - if( sch_item && sch_item->IsLocked() ) - { - STATUS_TEXT_POPUP statusPopup( m_frame ); - statusPopup.SetText( _( "Item locked." ) ); - statusPopup.PopupFor( 2000 ); - statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) ); - return true; - } - EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); selectionTool->UnbrightenItem( m_pickerItem ); selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ ); diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index ee0ee8f68f..8ae32321c8 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -486,10 +486,10 @@ int PCB_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent ) { if( m_pickerItem && m_pickerItem->IsLocked() ) { - STATUS_TEXT_POPUP statusPopup( m_frame ); - statusPopup.SetText( _( "Item locked." ) ); - statusPopup.PopupFor( 2000 ); - statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) ); + m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) ); + m_statusPopup->SetText( _( "Item locked." ) ); + m_statusPopup->PopupFor( 2000 ); + m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) ); return true; } @@ -548,6 +548,8 @@ int PCB_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent ) if( m_pickerItem ) m_toolMgr->GetTool()->UnbrightenItem( m_pickerItem ); + m_statusPopup.reset(); + // Ensure the cursor gets changed&updated m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW ); m_frame->GetCanvas()->Refresh(); diff --git a/pcbnew/tools/pcb_control.h b/pcbnew/tools/pcb_control.h index f24ce0ee60..0bff88fa5d 100644 --- a/pcbnew/tools/pcb_control.h +++ b/pcbnew/tools/pcb_control.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace KIGFX { class ORIGIN_VIEWITEM; @@ -122,6 +123,8 @@ private: std::unique_ptr m_gridOrigin; BOARD_ITEM* m_pickerItem; + + std::unique_ptr m_statusPopup; }; #endif