Delete Tool: Fix missing "Item Locked" popup

Fixes problem identified in https://gitlab.com/kicad/code/kicad/-/issues/8392
Removes same popup from schematic tool because SCH_ITEM can not be locked
This commit is contained in:
david-beinder 2021-05-26 02:18:34 +02:00 committed by jean-pierre charras
parent 71b3ab432c
commit 64cd401bdb
3 changed files with 9 additions and 15 deletions

View File

@ -1007,17 +1007,6 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
{
if( m_pickerItem )
{
SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( 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<EE_SELECTION_TOOL>();
selectionTool->UnbrightenItem( m_pickerItem );
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );

View File

@ -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<PCB_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
m_statusPopup.reset();
// Ensure the cursor gets changed&updated
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
m_frame->GetCanvas()->Refresh();

View File

@ -30,6 +30,7 @@
#include <io_mgr.h>
#include <memory>
#include <tools/pcb_tool_base.h>
#include <status_popup.h>
namespace KIGFX {
class ORIGIN_VIEWITEM;
@ -122,6 +123,8 @@ private:
std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_gridOrigin;
BOARD_ITEM* m_pickerItem;
std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
};
#endif