Browse Source

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
6.0.7
david-beinder 4 years ago
committed by jean-pierre charras
parent
commit
64cd401bdb
  1. 11
      eeschema/tools/sch_edit_tool.cpp
  2. 10
      pcbnew/tools/pcb_control.cpp
  3. 3
      pcbnew/tools/pcb_control.h

11
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<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*/ );

10
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<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();

3
pcbnew/tools/pcb_control.h

@ -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
Loading…
Cancel
Save