diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index ad64e8f5d4..53382250fa 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -350,6 +352,8 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() } } + bool wasLocked = m_item->IsLocked(); + m_item->SetFilled( m_filledCtrl->GetValue() ); m_item->SetLocked( m_locked->GetValue() ); m_item->SetWidth( m_thickness.GetValue() ); @@ -359,6 +363,10 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() commit.Push( _( "Modify drawing properties" ) ); + // Notify clients which treat locked and unlocked items differently (ie: POINT_EDITOR) + if( wasLocked != m_item->IsLocked() ) + m_parent->GetToolManager()->PostEvent( EVENTS::SelectedEvent ); + m_parent->UpdateMsgPanel(); return true; diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 73eaa1d309..bb956003d8 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -391,31 +391,27 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) if( !m_selectionTool || aEvent.Matches( EVENTS::InhibitSelectionEditing ) ) return 0; + PCB_BASE_EDIT_FRAME* editFrame = getEditFrame(); const PCB_SELECTION& selection = m_selectionTool->GetSelection(); if( selection.Size() != 1 || selection.Front()->GetEditFlags() ) return 0; - Activate(); - - KIGFX::VIEW_CONTROLS* controls = getViewControls(); - KIGFX::VIEW* view = getView(); - PCB_BASE_EDIT_FRAME* editFrame = getEditFrame(); - - controls->ShowCursor( true ); - - PCB_GRID_HELPER grid( m_toolMgr, editFrame->GetMagneticItemsSettings() ); BOARD_ITEM* item = static_cast( selection.Front() ); - if( !item ) + if( !item || item->IsLocked() ) return 0; + Activate(); + getViewControls()->ShowCursor( true ); + + PCB_GRID_HELPER grid( m_toolMgr, editFrame->GetMagneticItemsSettings() ); m_editPoints = makePoints( item ); if( !m_editPoints ) return 0; - view->Add( m_editPoints.get() ); + getView()->Add( m_editPoints.get() ); setEditedPoint( nullptr ); updateEditedPoint( aEvent ); m_refill = false; @@ -431,7 +427,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) while( TOOL_EVENT* evt = Wait() ) { grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( view->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); if( !m_editPoints || evt->IsSelectionEvent() || evt->Matches( EVENTS::InhibitSelectionEditing ) ) @@ -455,9 +451,9 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) commit.StageItems( selection, CHT_MODIFY ); - controls->ForceCursorPosition( false ); + getViewControls()->ForceCursorPosition( false ); m_original = *m_editedPoint; // Save the original position - controls->SetAutoPan( true ); + getViewControls()->SetAutoPan( true ); inDrag = true; if( m_editedPoint->GetGridConstraint() != SNAP_BY_GRID ) @@ -518,7 +514,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) m_editedPoint->SetPosition( grid.BestSnapAnchor( pos, snapLayers, { item } ) ); updateItem(); - controls->ForceCursorPosition( true, m_editedPoint->GetPosition() ); + getViewControls()->ForceCursorPosition( true, m_editedPoint->GetPosition() ); updatePoints(); } else if( m_editedPoint && evt->Action() == TA_MOUSE_DOWN && evt->Buttons() == BUT_LEFT ) @@ -534,7 +530,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) getView()->Update( m_editPoints.get() ); } - controls->SetAutoPan( false ); + getViewControls()->SetAutoPan( false ); setAltConstraint( false ); commit.Push( _( "Drag a corner" ) ); @@ -574,7 +570,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) if( m_editPoints ) { - view->Remove( m_editPoints.get() ); + getView()->Remove( m_editPoints.get() ); finishItem(); m_editPoints.reset();