From 7356f9568d2435e3835661b680f04157e51eb714 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 9 May 2021 20:17:01 +0100 Subject: [PATCH] Move grid disable modifier from ALT to CTRL. Also had to move the H/V/45 disable modifier from CTRL to SHIFT. Fixes https://gitlab.com/kicad/code/kicad/issues/8124 --- common/hotkey_store.cpp | 3 +- eeschema/tools/ee_point_editor.cpp | 4 +-- eeschema/tools/sch_drawing_tools.cpp | 10 +++---- eeschema/tools/sch_edit_tool.cpp | 2 +- eeschema/tools/sch_editor_control.cpp | 4 +-- eeschema/tools/sch_line_wire_bus_tool.cpp | 4 +-- eeschema/tools/sch_move_tool.cpp | 2 +- .../tools/symbol_editor_drawing_tools.cpp | 6 ++-- gerbview/tools/gerbview_inspection_tool.cpp | 2 +- include/tool/tool_event.h | 5 ++++ pagelayout_editor/tools/pl_drawing_tools.cpp | 4 +-- pagelayout_editor/tools/pl_point_editor.cpp | 2 +- pcbnew/microwave/microwave_tool.cpp | 2 +- pcbnew/router/pns_tool_base.cpp | 4 +-- pcbnew/router/router_tool.cpp | 8 +++--- pcbnew/tools/board_editor_control.cpp | 4 +-- pcbnew/tools/drawing_tool.cpp | 28 +++++++++---------- pcbnew/tools/edit_tool.cpp | 2 +- pcbnew/tools/pcb_picker_tool.cpp | 2 +- pcbnew/tools/pcb_point_editor.cpp | 4 +-- pcbnew/tools/pcb_viewer_tools.cpp | 4 +-- 21 files changed, 56 insertions(+), 50 deletions(-) diff --git a/common/hotkey_store.cpp b/common/hotkey_store.cpp index d89e597633..53a085798b 100644 --- a/common/hotkey_store.cpp +++ b/common/hotkey_store.cpp @@ -54,8 +54,9 @@ static GESTURE_PSEUDO_ACTION* g_gesturePseudoActions[] = { new GESTURE_PSEUDO_ACTION( _( "Toggle Selection State" ), MD_ALT + PSEUDO_WXK_CLICK ), new GESTURE_PSEUDO_ACTION( _( "Remove from Selection" ), MD_SHIFT + MD_ALT + PSEUDO_WXK_CLICK ), #endif - new GESTURE_PSEUDO_ACTION( _( "Ignore Grid Snaps" ), MD_ALT ), + new GESTURE_PSEUDO_ACTION( _( "Ignore Grid Snaps" ), MD_CTRL ), new GESTURE_PSEUDO_ACTION( _( "Ignore Other Snaps" ), MD_SHIFT ), + new GESTURE_PSEUDO_ACTION( _( "Ignore H/V/45 Constraints" ), MD_SHIFT ) }; diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index c10b966925..77e05b53b6 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -310,7 +310,7 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent ) modified = true; } - bool snap = !evt->Modifier( MD_ALT ); + bool snap = !evt->DisableGridSnapping(); if( item->Type() == LIB_ARC_T && getEditedPointIndex() == ARC_CENTER ) snap = false; @@ -833,7 +833,7 @@ int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) if( !polyLine ) return false; - VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() ); polyLine->AddCorner( mapCoords( cursorPos ) ); updateItem( polyLine, true ); diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index d1de48d3b2..f4112cc00e 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -186,7 +186,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) while( TOOL_EVENT* evt = Wait() ) { setCursor(); - VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); if( evt->IsCancelInteractive() ) { @@ -418,7 +418,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) while( TOOL_EVENT* evt = Wait() ) { setCursor(); - cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); if( evt->IsCancelInteractive() ) { @@ -684,7 +684,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) { setCursor(); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); cursorPos = evt->IsPrime() ? (wxPoint) evt->Position() : (wxPoint) controls->GetMousePosition(); @@ -1042,7 +1042,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) { setCursor(); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); VECTOR2I cursorPos = evt->IsPrime() ? evt->Position() : controls->GetMousePosition(); cursorPos = grid.BestSnapAnchor( cursorPos, snapLayer, item ); @@ -1272,7 +1272,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) { setCursor(); - VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); if( evt->IsCancelInteractive() ) { diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 57059e3ab0..78e951d2fb 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1709,7 +1709,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent ) int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent ) { - wxPoint cursorPos = wxPoint( getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ) ); + wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() ); EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::WiresOnly ); std::vector lines; diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index d6d9eb6cdb..4fec70277a 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -887,7 +887,7 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) int SCH_EDITOR_CONTROL::HighlightNet( const TOOL_EVENT& aEvent ) { KIGFX::VIEW_CONTROLS* controls = getViewControls(); - VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ); + VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.DisableGridSnapping() ); highlightNet( m_toolMgr, cursorPos ); @@ -907,7 +907,7 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent ) { EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); KIGFX::VIEW_CONTROLS* controls = getViewControls(); - VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ); + VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.DisableGridSnapping() ); // TODO remove once real-time connectivity is a given if( !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime ) diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index eff9502f5e..199829eac8 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -288,7 +288,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent ) { EE_GRID_HELPER grid( m_toolMgr ); grid.SetSnap( !aEvent.Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !aEvent.Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !aEvent.DisableGridSnapping() ); VECTOR2D cursorPos = grid.BestSnapAnchor( aEvent.Position(), LAYER_CONNECTABLE, nullptr ); startSegments( params->layer, cursorPos ); @@ -535,7 +535,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, setCursor(); grid.SetMask( GRID_HELPER::ALL ); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); if( segment ) { diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index c75c5a906c..e52af5438c 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -160,7 +160,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) { m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING ); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); if( evt->IsAction( &EE_ACTIONS::moveActivate ) || evt->IsAction( &EE_ACTIONS::restartMove ) diff --git a/eeschema/tools/symbol_editor_drawing_tools.cpp b/eeschema/tools/symbol_editor_drawing_tools.cpp index eff1a259ee..b63303c8cd 100644 --- a/eeschema/tools/symbol_editor_drawing_tools.cpp +++ b/eeschema/tools/symbol_editor_drawing_tools.cpp @@ -107,7 +107,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) { setCursor(); - cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); auto cleanup = [&] () @@ -295,7 +295,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) { setCursor(); - VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); auto cleanup = [&] () @@ -458,7 +458,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent ) if( !part ) continue; - VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); wxPoint offset( -cursorPos.x, cursorPos.y ); part->SetOffset( offset ); diff --git a/gerbview/tools/gerbview_inspection_tool.cpp b/gerbview/tools/gerbview_inspection_tool.cpp index 981bf86479..dcb5b34aef 100644 --- a/gerbview/tools/gerbview_inspection_tool.cpp +++ b/gerbview/tools/gerbview_inspection_tool.cpp @@ -290,7 +290,7 @@ int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) // move or drag when origin set updates rules else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) ) { - twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) ); + twoPtMgr.SetAngleSnap( evt->Modifier( MD_SHIFT ) ); twoPtMgr.SetEnd( cursorPos ); view.SetVisible( &ruler, true ); diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h index e61771364f..6908e3c7d5 100644 --- a/include/tool/tool_event.h +++ b/include/tool/tool_event.h @@ -354,6 +354,11 @@ public: return m_modifiers & aMask; } + bool DisableGridSnapping() const + { + return Modifier( MD_CTRL ); + } + int KeyCode() const { return m_keyCode; diff --git a/pagelayout_editor/tools/pl_drawing_tools.cpp b/pagelayout_editor/tools/pl_drawing_tools.cpp index 67573b80a0..483f8609aa 100644 --- a/pagelayout_editor/tools/pl_drawing_tools.cpp +++ b/pagelayout_editor/tools/pl_drawing_tools.cpp @@ -107,7 +107,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent ) { setCursor(); - cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); auto cleanup = [&] () @@ -251,7 +251,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) { setCursor(); - VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() ); if( evt->IsCancelInteractive() || evt->IsActivate() ) { diff --git a/pagelayout_editor/tools/pl_point_editor.cpp b/pagelayout_editor/tools/pl_point_editor.cpp index 62a9a67f54..4e9fdd1be9 100644 --- a/pagelayout_editor/tools/pl_point_editor.cpp +++ b/pagelayout_editor/tools/pl_point_editor.cpp @@ -206,7 +206,7 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent ) modified = true; } - m_editedPoint->SetPosition( controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ) ); + m_editedPoint->SetPosition( controls->GetCursorPosition( !evt->DisableGridSnapping() ) ); updateItem(); updatePoints(); diff --git a/pcbnew/microwave/microwave_tool.cpp b/pcbnew/microwave/microwave_tool.cpp index 28cd1e0eb7..62d32e1b42 100644 --- a/pcbnew/microwave/microwave_tool.cpp +++ b/pcbnew/microwave/microwave_tool.cpp @@ -214,7 +214,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent ) // the end point else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) ) { - tpGeomMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) ); + tpGeomMgr.SetAngleSnap( evt->Modifier( MD_SHIFT ) ); tpGeomMgr.SetEnd( cursorPos ); view.SetVisible( &previewRect, true ); diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index cf6a3efa1a..78b82fcbfa 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -264,7 +264,7 @@ void TOOL_BASE::updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads ) GAL* gal = m_toolMgr->GetView()->GetGAL(); controls()->ForceCursorPosition( false ); - m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.Modifier( MD_ALT ) ); + m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.DisableGridSnapping() ); m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) ); if( aEvent.IsMotion() || aEvent.IsClick() ) @@ -289,7 +289,7 @@ void TOOL_BASE::updateEndItem( const TOOL_EVENT& aEvent ) int layer; GAL* gal = m_toolMgr->GetView()->GetGAL(); - m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.Modifier( MD_ALT ) ); + m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.DisableGridSnapping() ); m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) ); controls()->ForceCursorPosition( false ); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index e1c9d9ca13..c991e5171b 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -1100,7 +1100,7 @@ void ROUTER_TOOL::performRouting() if( evt->IsMotion() ) { - m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) ); + m_router->SetOrthoMode( evt->Modifier( MD_SHIFT ) ); updateEndItem( *evt ); m_router->Move( m_endSnapPoint, m_endItem ); } @@ -1339,7 +1339,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent ) if( evt->HasPosition() ) { - if( evt->Modifier( MD_CTRL ) ) + if( evt->Modifier( MD_SHIFT ) ) performDragging( PNS::DM_ANY ); else performRouting(); @@ -1598,7 +1598,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) VECTOR2I p0 = controls()->GetCursorPosition( false ); VECTOR2I p = p0; - m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.Modifier( MD_ALT ) ); + m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.DisableGridSnapping() ); m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) ); if( startItem ) @@ -1797,7 +1797,7 @@ int ROUTER_TOOL::InlineBreakTrack( const TOOL_EVENT& aEvent ) TOOL_MANAGER* toolManager = frame()->GetToolManager(); GAL* gal = toolManager->GetView()->GetGAL(); - m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.Modifier( MD_ALT ) ); + m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.DisableGridSnapping() ); m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) ); if( toolManager->IsContextMenuActive() ) diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index 8b71603ff2..d44c6d2962 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -951,7 +951,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent ) while( TOOL_EVENT* evt = Wait() ) { setCursor(); - cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() ); if( reselect && fp ) m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp ); @@ -1191,7 +1191,7 @@ int BOARD_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent ) while( TOOL_EVENT* evt = Wait() ) { setCursor(); - cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() ); if( evt->IsCancelInteractive() ) { diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 7369b87077..3779f88aa2 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -254,7 +254,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent ) line->SetFlags( IS_NEW ); if( aEvent.HasPosition() ) - startingPoint = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ); + startingPoint = getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() ); std::string tool = aEvent.GetCommandStr().get(); m_frame->PushTool( tool ); @@ -301,7 +301,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent ) rect->SetFlags(IS_NEW ); if( aEvent.HasPosition() ) - startingPoint = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ); + startingPoint = getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() ); std::string tool = aEvent.GetCommandStr().get(); m_frame->PushTool( tool ); @@ -347,7 +347,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent ) circle->SetFlags( IS_NEW ); if( aEvent.HasPosition() ) - startingPoint = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) ); + startingPoint = getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() ); std::string tool = aEvent.GetCommandStr().get(); m_frame->PushTool( tool ); @@ -719,7 +719,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) setCursor(); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : m_controls->GetMousePosition(); @@ -860,7 +860,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) dimension->SetEnd( (wxPoint) cursorPos ); dimension->Update(); - if( !!evt->Modifier( MD_CTRL ) || dimension->Type() == PCB_DIM_CENTER_T ) + if( !!evt->Modifier( MD_SHIFT ) || dimension->Type() == PCB_DIM_CENTER_T ) constrainDimension( dimension ); // Dimensions that have origin and end in the same spot are not valid @@ -941,7 +941,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) dimension->Update(); - if( !!evt->Modifier( MD_CTRL ) || dimension->Type() == PCB_DIM_CENTER_T ) + if( !!evt->Modifier( MD_SHIFT ) || dimension->Type() == PCB_DIM_CENTER_T ) constrainDimension( dimension ); break; @@ -1272,7 +1272,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent ) setCursor(); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); VECTOR2I cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), LSET::AllLayersMask() ); m_controls->ForceCursorPosition( true, cursorPos ); @@ -1407,14 +1407,14 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic, m_frame->SetMsgPanel( graphic ); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), drawingLayer ); m_controls->ForceCursorPosition( true, cursorPos ); // 45 degree angle constraint enabled with an option and toggled with Ctrl bool limit45 = frame()->Settings().m_Use45DegreeGraphicSegments; - if( evt->Modifier( MD_CTRL ) ) + if( evt->Modifier( MD_SHIFT ) ) limit45 = !limit45; if( evt->IsCancelInteractive() ) @@ -1581,7 +1581,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic, // 45 degree lines if( started && ( ( limit45 && shape == PCB_SHAPE_TYPE::SEGMENT ) - || ( evt->Modifier( MD_CTRL ) && shape == PCB_SHAPE_TYPE::RECT ) ) ) + || ( evt->Modifier( MD_SHIFT ) && shape == PCB_SHAPE_TYPE::RECT ) ) ) { const VECTOR2I lineVector( cursorPos - VECTOR2I( twoPointManager.GetOrigin() ) ); @@ -1731,7 +1731,7 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool graphic->SetLayer( drawingLayer ); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); VECTOR2I cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), graphic ); m_controls->ForceCursorPosition( true, cursorPos ); @@ -1805,7 +1805,7 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool else if( evt->IsMotion() ) { // set angle snap - arcManager.SetAngleSnap( evt->Modifier( MD_CTRL ) ); + arcManager.SetAngleSnap( evt->Modifier( MD_SHIFT ) ); // update, but don't step the manager state arcManager.AddPoint( cursorPos, false ); @@ -2040,14 +2040,14 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent ) LSET layers( m_frame->GetActiveLayer() ); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : m_controls->GetMousePosition(); cursorPos = grid.BestSnapAnchor( cursorPos, layers ); m_controls->ForceCursorPosition( true, cursorPos ); - if( ( sourceZone && sourceZone->GetHV45() ) || constrainAngle || evt->Modifier( MD_CTRL ) ) + if( ( sourceZone && sourceZone->GetHV45() ) || constrainAngle || evt->Modifier( MD_SHIFT ) ) polyGeomMgr.SetLeaderMode( POLYGON_GEOM_MANAGER::LEADER_MODE::DEG45 ); else polyGeomMgr.SetLeaderMode( POLYGON_GEOM_MANAGER::LEADER_MODE::DIRECT ); diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 3463179e16..4e4b3d8ecb 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -840,7 +840,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) VECTOR2I movement; editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING ); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) hasMouseMoved = true; diff --git a/pcbnew/tools/pcb_picker_tool.cpp b/pcbnew/tools/pcb_picker_tool.cpp index 536882a2ae..965f544e5c 100644 --- a/pcbnew/tools/pcb_picker_tool.cpp +++ b/pcbnew/tools/pcb_picker_tool.cpp @@ -71,7 +71,7 @@ int PCB_PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) if( m_snap ) { grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); cursorPos = grid.BestSnapAnchor( cursorPos, nullptr ); controls->ForceCursorPosition( true, cursorPos ); } diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 3a8e6aca2f..73eaa1d309 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -431,7 +431,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->Modifier( MD_ALT ) ); + grid.SetUseGrid( view->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); if( !m_editPoints || evt->IsSelectionEvent() || evt->Matches( EVENTS::InhibitSelectionEditing ) ) @@ -507,7 +507,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) } // The alternative constraint limits to 45 degrees - bool enableAltConstraint = !!evt->Modifier( MD_CTRL ); + bool enableAltConstraint = !!evt->Modifier( MD_SHIFT ); if( enableAltConstraint ) m_altConstraint->Apply(); diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp index f821f329b4..ca8ac32796 100644 --- a/pcbnew/tools/pcb_viewer_tools.cpp +++ b/pcbnew/tools/pcb_viewer_tools.cpp @@ -236,7 +236,7 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent ) { setCursor(); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); - grid.SetUseGrid( view.GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) ); + grid.SetUseGrid( view.GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); const VECTOR2I cursorPos = grid.BestSnapAnchor( controls.GetMousePosition(), nullptr ); controls.ForceCursorPosition(true, cursorPos ); @@ -297,7 +297,7 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent ) // move or drag when origin set updates rules else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) ) { - twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) ); + twoPtMgr.SetAngleSnap( evt->Modifier( MD_SHIFT ) ); twoPtMgr.SetEnd( cursorPos ); view.SetVisible( &ruler, true );