From 05483a06c61ebc1282d5bc197c54bb2747655971 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 29 Jan 2019 06:04:12 -0800 Subject: [PATCH] pcbnew: Re-attach snap options Snapping to item options were partially disconnected when unifying framework. This re-attaches the options and adds the additional option for graphical items. Fixes: lp:1801377 * https://bugs.launchpad.net/kicad/+bug/1801377 --- pcbnew/dialogs/panel_pcbnew_settings.cpp | 12 +- pcbnew/dialogs/panel_pcbnew_settings_base.cpp | 170 +-- pcbnew/dialogs/panel_pcbnew_settings_base.fbp | 1006 +++++++---------- pcbnew/dialogs/panel_pcbnew_settings_base.h | 30 +- pcbnew/pcb_general_settings.cpp | 1 + pcbnew/pcb_general_settings.h | 3 +- pcbnew/router/pns_tool_base.cpp | 2 +- pcbnew/tools/grid_helper.cpp | 44 +- pcbnew/tools/pcb_editor_control.cpp | 4 +- 9 files changed, 569 insertions(+), 703 deletions(-) diff --git a/pcbnew/dialogs/panel_pcbnew_settings.cpp b/pcbnew/dialogs/panel_pcbnew_settings.cpp index 4f2ff23e80..882fd00bbb 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings.cpp +++ b/pcbnew/dialogs/panel_pcbnew_settings.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -56,8 +56,9 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow() m_Track_45_Only_Ctrl->SetValue( m_Frame->Settings().m_legacyUse45DegreeTracks ); m_Segments_45_Only_Ctrl->SetValue( m_Frame->Settings().m_use45DegreeGraphicSegments ); m_Track_DoubleSegm_Ctrl->SetValue( m_Frame->Settings().m_legacyUseTwoSegmentTracks ); - m_MagneticPadOptCtrl->SetSelection( m_Frame->Settings().m_magneticPads ); - m_MagneticTrackOptCtrl->SetSelection( m_Frame->Settings().m_magneticTracks ); + m_magneticPadChoice->SetSelection( m_Frame->Settings().m_magneticPads ); + m_magneticTrackChoice->SetSelection( m_Frame->Settings().m_magneticTracks ); + m_magneticGraphicsChoice->SetSelection( !m_Frame->Settings().m_magneticGraphics ); m_UseEditKeyForWidth->SetValue( m_Frame->Settings().m_editActionChangesTrackWidth ); m_dragSelects->SetValue( m_Frame->Settings().m_dragSelects ); @@ -84,8 +85,9 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow() m_Frame->Settings().m_legacyUse45DegreeTracks = m_Track_45_Only_Ctrl->GetValue(); m_Frame->Settings().m_legacyUseTwoSegmentTracks = m_Track_DoubleSegm_Ctrl->GetValue(); - m_Frame->Settings().m_magneticPads = (MAGNETIC_PAD_OPTION_VALUES) m_MagneticPadOptCtrl->GetSelection(); - m_Frame->Settings().m_magneticTracks = (MAGNETIC_PAD_OPTION_VALUES) m_MagneticTrackOptCtrl->GetSelection(); + m_Frame->Settings().m_magneticPads = (MAGNETIC_PAD_OPTION_VALUES) m_magneticPadChoice->GetSelection(); + m_Frame->Settings().m_magneticTracks = (MAGNETIC_PAD_OPTION_VALUES) m_magneticTrackChoice->GetSelection(); + m_Frame->Settings().m_magneticGraphics = !m_magneticGraphicsChoice->GetSelection(); m_Frame->Settings().m_editActionChangesTrackWidth = m_UseEditKeyForWidth->GetValue(); m_Frame->Settings().m_dragSelects = m_dragSelects->GetValue(); diff --git a/pcbnew/dialogs/panel_pcbnew_settings_base.cpp b/pcbnew/dialogs/panel_pcbnew_settings_base.cpp index 4506dee89c..4642d64a5f 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings_base.cpp +++ b/pcbnew/dialogs/panel_pcbnew_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Jan 17 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,135 +9,175 @@ /////////////////////////////////////////////////////////////////////////// -PANEL_PCBNEW_SETTINGS_BASE::PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +PANEL_PCBNEW_SETTINGS_BASE::PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) { wxBoxSizer* bPanelSizer; bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); - + wxBoxSizer* bMargins; bMargins = new wxBoxSizer( wxHORIZONTAL ); - + wxBoxSizer* bMiddleLeftSizer; bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL ); - + wxString m_PolarDisplayChoices[] = { _("Cartesian coordinates"), _("Polar coordinates") }; int m_PolarDisplayNChoices = sizeof( m_PolarDisplayChoices ) / sizeof( wxString ); m_PolarDisplay = new wxRadioBox( this, wxID_POLAR_CTRL, _("Coordinates"), wxDefaultPosition, wxDefaultSize, m_PolarDisplayNChoices, m_PolarDisplayChoices, 1, wxRA_SPECIFY_COLS ); m_PolarDisplay->SetSelection( 0 ); m_PolarDisplay->SetToolTip( _("Set display of relative (dx/dy) coordinates to Cartesian (rectangular) or polar (angle/distance).") ); - + bMiddleLeftSizer->Add( m_PolarDisplay, 0, wxALL|wxEXPAND, 5 ); - + wxString m_UnitsSelectionChoices[] = { _("Inches"), _("Millimeters") }; int m_UnitsSelectionNChoices = sizeof( m_UnitsSelectionChoices ) / sizeof( wxString ); m_UnitsSelection = new wxRadioBox( this, wxID_UNITS, _("Units"), wxDefaultPosition, wxDefaultSize, m_UnitsSelectionNChoices, m_UnitsSelectionChoices, 1, wxRA_SPECIFY_COLS ); m_UnitsSelection->SetSelection( 0 ); m_UnitsSelection->SetToolTip( _("Set units used to display dimensions and positions.") ); - + bMiddleLeftSizer->Add( m_UnitsSelection, 0, wxALL|wxEXPAND, 5 ); - + wxStaticBoxSizer* bOptionsSizer; bOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Editing Options") ), wxVERTICAL ); - + m_Show_Page_Limits = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Show_Page_Limits->SetValue(true); + m_Show_Page_Limits->SetValue(true); bOptionsSizer->Add( m_Show_Page_Limits, 0, wxALL, 5 ); - + m_Segments_45_Only_Ctrl = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_SEGMENTS45, _("L&imit graphic lines to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); m_Segments_45_Only_Ctrl->SetToolTip( _("Force line segment directions to H, V or 45 degrees when drawing on technical layers.") ); - + bOptionsSizer->Add( m_Segments_45_Only_Ctrl, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - + m_UseEditKeyForWidth = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Edit action changes track width"), wxDefaultPosition, wxDefaultSize, 0 ); m_UseEditKeyForWidth->SetToolTip( _("When active, hitting Edit hotkey or double-clicking on a track or via changes its width/diameter to the one selected in the main toolbar. ") ); - + bOptionsSizer->Add( m_UseEditKeyForWidth, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - + m_dragSelects = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Prefer selection to dragging"), wxDefaultPosition, wxDefaultSize, 0 ); m_dragSelects->SetToolTip( _("When enabled and nothing is selected, drag gesture will draw a selection box, even if there are items under the cursor that could be immediately dragged.") ); - + bOptionsSizer->Add( m_dragSelects, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - + wxFlexGridSizer* fgSizer12; fgSizer12 = new wxFlexGridSizer( 0, 2, 0, 0 ); fgSizer12->AddGrowableCol( 1 ); fgSizer12->SetFlexibleDirection( wxBOTH ); fgSizer12->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextRotationAngle = new wxStaticText( bOptionsSizer->GetStaticBox(), wxID_ANY, _("&Rotation angle:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextRotationAngle->Wrap( -1 ); fgSizer12->Add( m_staticTextRotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_RotationAngle = new wxTextCtrl( bOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_RotationAngle->SetToolTip( _("Set increment (in degrees) for context menu and hotkey rotation.") ); - + fgSizer12->Add( m_RotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); - - + + bOptionsSizer->Add( fgSizer12, 1, wxEXPAND, 5 ); - - + + bMiddleLeftSizer->Add( bOptionsSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - + + bMargins->Add( bMiddleLeftSizer, 1, wxEXPAND|wxRIGHT, 5 ); - + wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); - - wxString m_MagneticPadOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; - int m_MagneticPadOptCtrlNChoices = sizeof( m_MagneticPadOptCtrlChoices ) / sizeof( wxString ); - m_MagneticPadOptCtrl = new wxRadioBox( this, wxID_ANY, _("Magnetic Pads"), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlNChoices, m_MagneticPadOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_MagneticPadOptCtrl->SetSelection( 2 ); - m_MagneticPadOptCtrl->SetToolTip( _("Control capture of the cursor when the mouse enters a pad area.") ); - - bRightSizer->Add( m_MagneticPadOptCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - wxString m_MagneticTrackOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; - int m_MagneticTrackOptCtrlNChoices = sizeof( m_MagneticTrackOptCtrlChoices ) / sizeof( wxString ); - m_MagneticTrackOptCtrl = new wxRadioBox( this, wxID_MAGNETIC_TRACKS, _("Magnetic Tracks"), wxDefaultPosition, wxDefaultSize, m_MagneticTrackOptCtrlNChoices, m_MagneticTrackOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_MagneticTrackOptCtrl->SetSelection( 0 ); - m_MagneticTrackOptCtrl->SetToolTip( _("Control capture of the cursor when the mouse approaches a track.") ); - - bRightSizer->Add( m_MagneticTrackOptCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); - + + wxStaticBoxSizer* sbMagnets; + sbMagnets = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Magnetic Points") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer2; + fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 15 ); + fgSizer2->SetFlexibleDirection( wxVERTICAL ); + fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText2 = new wxStaticText( sbMagnets->GetStaticBox(), wxID_ANY, _("Snap to Pads"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + m_staticText2->SetToolTip( _("Capture cursor when the mouse enters a pad area") ); + + fgSizer2->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + wxString m_magneticPadChoiceChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; + int m_magneticPadChoiceNChoices = sizeof( m_magneticPadChoiceChoices ) / sizeof( wxString ); + m_magneticPadChoice = new wxChoice( sbMagnets->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_magneticPadChoiceNChoices, m_magneticPadChoiceChoices, 0 ); + m_magneticPadChoice->SetSelection( 1 ); + m_magneticPadChoice->SetToolTip( _("Capture cursor when the mouse enters a pad area") ); + + fgSizer2->Add( m_magneticPadChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_staticText21 = new wxStaticText( sbMagnets->GetStaticBox(), wxID_ANY, _("Snap to Tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21->Wrap( -1 ); + m_staticText21->SetToolTip( _("Capture cursor when the mouse approaches a track") ); + + fgSizer2->Add( m_staticText21, 0, wxALL, 5 ); + + wxString m_magneticTrackChoiceChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; + int m_magneticTrackChoiceNChoices = sizeof( m_magneticTrackChoiceChoices ) / sizeof( wxString ); + m_magneticTrackChoice = new wxChoice( sbMagnets->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_magneticTrackChoiceNChoices, m_magneticTrackChoiceChoices, 0 ); + m_magneticTrackChoice->SetSelection( 1 ); + m_magneticTrackChoice->SetToolTip( _("Capture cursor when the mouse approaches a track") ); + + fgSizer2->Add( m_magneticTrackChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_staticText211 = new wxStaticText( sbMagnets->GetStaticBox(), wxID_ANY, _("Snap to Graphical"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText211->Wrap( -1 ); + m_staticText211->SetToolTip( _("Capture cursor when the mouse approaches graphical control points") ); + + fgSizer2->Add( m_staticText211, 0, wxALL, 5 ); + + wxString m_magneticGraphicsChoiceChoices[] = { _("Yes"), _("No") }; + int m_magneticGraphicsChoiceNChoices = sizeof( m_magneticGraphicsChoiceChoices ) / sizeof( wxString ); + m_magneticGraphicsChoice = new wxChoice( sbMagnets->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_magneticGraphicsChoiceNChoices, m_magneticGraphicsChoiceChoices, 0 ); + m_magneticGraphicsChoice->SetSelection( 0 ); + m_magneticGraphicsChoice->SetToolTip( _("Capture cursor when the mouse approaches graphical control points") ); + + fgSizer2->Add( m_magneticGraphicsChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + + sbMagnets->Add( fgSizer2, 1, wxEXPAND, 5 ); + + + bRightSizer->Add( sbMagnets, 1, wxEXPAND, 5 ); + wxStaticBoxSizer* bLegacyOptionsSizer; bLegacyOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Legacy Toolset Routing Options") ), wxVERTICAL ); - + m_DrcOn = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_DRC_ONOFF, _("&Enforce design rules when routing"), wxDefaultPosition, wxDefaultSize, 0 ); - m_DrcOn->SetValue(true); + m_DrcOn->SetValue(true); m_DrcOn->SetToolTip( _("Enable DRC control. When DRC control is disabled, all connections are allowed.") ); - + bLegacyOptionsSizer->Add( m_DrcOn, 0, wxEXPAND|wxALL, 5 ); - + m_TrackAutodel = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_TRACK_AUTODEL, _("Auto-delete old tracks"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TrackAutodel->SetValue(true); + m_TrackAutodel->SetValue(true); m_TrackAutodel->SetToolTip( _("Enable automatic track deletion when redrawing a track.") ); - + bLegacyOptionsSizer->Add( m_TrackAutodel, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - + m_Track_45_Only_Ctrl = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_TRACKS45, _("&Limit tracks to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Track_45_Only_Ctrl->SetValue(true); + m_Track_45_Only_Ctrl->SetValue(true); m_Track_45_Only_Ctrl->SetToolTip( _("Force track directions to H, V or 45 degrees when drawing a track.") ); - + bLegacyOptionsSizer->Add( m_Track_45_Only_Ctrl, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - + m_Track_DoubleSegm_Ctrl = new wxCheckBox( bLegacyOptionsSizer->GetStaticBox(), wxID_ANY, _("&Use double segmented tracks"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Track_DoubleSegm_Ctrl->SetValue(true); + m_Track_DoubleSegm_Ctrl->SetValue(true); m_Track_DoubleSegm_Ctrl->SetToolTip( _("Use two track segments, with 45 degrees angle between them, when drawing a new track") ); - + bLegacyOptionsSizer->Add( m_Track_DoubleSegm_Ctrl, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - - + + bRightSizer->Add( bLegacyOptionsSizer, 1, wxEXPAND|wxTOP|wxLEFT, 5 ); - - + + bMargins->Add( bRightSizer, 1, wxEXPAND|wxRIGHT, 5 ); - - + + bPanelSizer->Add( bMargins, 1, wxRIGHT, 5 ); - - + + this->SetSizer( bPanelSizer ); this->Layout(); bPanelSizer->Fit( this ); diff --git a/pcbnew/dialogs/panel_pcbnew_settings_base.fbp b/pcbnew/dialogs/panel_pcbnew_settings_base.fbp index e191a22014..3b2cb82731 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings_base.fbp +++ b/pcbnew/dialogs/panel_pcbnew_settings_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -49,43 +49,6 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bPanelSizer @@ -173,37 +136,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -270,37 +202,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -315,7 +216,6 @@ wxVERTICAL 1 none - 5 wxALL @@ -378,37 +278,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -473,37 +342,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -568,37 +406,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -663,37 +470,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -771,36 +547,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -865,40 +611,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -916,198 +628,411 @@ bRightSizer wxVERTICAL none - + 5 - wxEXPAND|wxTOP|wxBOTTOM|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Never" "When creating tracks" "Always" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxEXPAND + 1 + wxID_ANY - Magnetic Pads - 1 - - 0 - - - 0 + Magnetic Points - 1 - m_MagneticPadOptCtrl - 1 - - - protected - 1 - - Resizable - 2 - 1 - - wxRA_SPECIFY_COLS - - 0 - Control capture of the cursor when the mouse enters a pad area. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Never" "When creating tracks" "Always" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_MAGNETIC_TRACKS - Magnetic Tracks - 1 - - 0 - - - 0 - - 1 - m_MagneticTrackOptCtrl - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - Control capture of the cursor when the mouse approaches a track. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + sbMagnets + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 1 + + 2 + wxVERTICAL + + + 15 + + fgSizer2 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Snap to Pads + 0 + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Capture cursor when the mouse enters a pad area + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Never" "When creating tracks" "Always" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_magneticPadChoice + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + ; ; forward_declare + 0 + Capture cursor when the mouse enters a pad area + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Snap to Tracks + 0 + + 0 + + + 0 + + 1 + m_staticText21 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Capture cursor when the mouse approaches a track + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Never" "When creating tracks" "Always" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_magneticTrackChoice + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + ; ; forward_declare + 0 + Capture cursor when the mouse approaches a track + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Snap to Graphical + 0 + + 0 + + + 0 + + 1 + m_staticText211 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Capture cursor when the mouse approaches graphical control points + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Yes" "No" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_magneticGraphicsChoice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + Capture cursor when the mouse approaches graphical control points + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + @@ -1122,7 +1047,6 @@ wxVERTICAL 1 none - 5 wxEXPAND|wxALL @@ -1185,37 +1109,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1280,37 +1173,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1375,37 +1237,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1470,37 +1301,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pcbnew/dialogs/panel_pcbnew_settings_base.h b/pcbnew/dialogs/panel_pcbnew_settings_base.h index dd7e63cb26..bf0c0344a3 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings_base.h +++ b/pcbnew/dialogs/panel_pcbnew_settings_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Jan 17 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __PANEL_PCBNEW_SETTINGS_BASE_H__ -#define __PANEL_PCBNEW_SETTINGS_BASE_H__ +#pragma once #include #include @@ -22,6 +21,7 @@ #include #include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -29,22 +29,21 @@ /////////////////////////////////////////////////////////////////////////////// /// Class PANEL_PCBNEW_SETTINGS_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_PCBNEW_SETTINGS_BASE : public wxPanel +class PANEL_PCBNEW_SETTINGS_BASE : public wxPanel { private: - + protected: enum { wxID_POLAR_CTRL = 1000, wxID_UNITS, wxID_SEGMENTS45, - wxID_MAGNETIC_TRACKS, wxID_DRC_ONOFF, wxID_TRACK_AUTODEL, wxID_TRACKS45 }; - + wxRadioBox* m_PolarDisplay; wxRadioBox* m_UnitsSelection; wxCheckBox* m_Show_Page_Limits; @@ -53,18 +52,21 @@ class PANEL_PCBNEW_SETTINGS_BASE : public wxPanel wxCheckBox* m_dragSelects; wxStaticText* m_staticTextRotationAngle; wxTextCtrl* m_RotationAngle; - wxRadioBox* m_MagneticPadOptCtrl; - wxRadioBox* m_MagneticTrackOptCtrl; + wxStaticText* m_staticText2; + wxChoice* m_magneticPadChoice; + wxStaticText* m_staticText21; + wxChoice* m_magneticTrackChoice; + wxStaticText* m_staticText211; + wxChoice* m_magneticGraphicsChoice; wxCheckBox* m_DrcOn; wxCheckBox* m_TrackAutodel; wxCheckBox* m_Track_45_Only_Ctrl; wxCheckBox* m_Track_DoubleSegm_Ctrl; - + public: - - PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + + PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~PANEL_PCBNEW_SETTINGS_BASE(); - + }; -#endif //__PANEL_PCBNEW_SETTINGS_BASE_H__ diff --git a/pcbnew/pcb_general_settings.cpp b/pcbnew/pcb_general_settings.cpp index 96c525ad3a..271830ff43 100644 --- a/pcbnew/pcb_general_settings.cpp +++ b/pcbnew/pcb_general_settings.cpp @@ -36,6 +36,7 @@ PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false); Add( "MagneticPads", reinterpret_cast( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL ); Add( "MagneticTracks", reinterpret_cast( &m_magneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL ); + Add( "MagneticGraphics", &m_magneticGraphics, true ); Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false ); Add( "DragSelects", &m_dragSelects, true ); break; diff --git a/pcbnew/pcb_general_settings.h b/pcbnew/pcb_general_settings.h index fbcbe90ef1..a5ad24fdf1 100644 --- a/pcbnew/pcb_general_settings.h +++ b/pcbnew/pcb_general_settings.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2012-2017 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012-2019 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -65,6 +65,7 @@ public: MAGNETIC_PAD_OPTION_VALUES m_magneticPads = CAPTURE_CURSOR_IN_TRACK_TOOL; MAGNETIC_PAD_OPTION_VALUES m_magneticTracks = CAPTURE_CURSOR_IN_TRACK_TOOL; + bool m_magneticGraphics = true; #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU) std::vector< std::pair > m_pluginSettings; // Settings for action plugins diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 999f5fcfad..5e50288311 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -260,7 +260,7 @@ bool TOOL_BASE::checkSnap( ITEM *aItem ) void TOOL_BASE::updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads ) { int tl = getView()->GetTopLayer(); - VECTOR2I cp = controls()->GetCursorPosition(); + VECTOR2I cp = controls()->GetCursorPosition( !aEvent.Modifier( MD_SHIFT ) ); VECTOR2I p; controls()->ForceCursorPosition( false ); diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index 7a4433334d..46bf9c3927 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 CERN + * Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors. * @author Tomasz Wlostowski * * This program is free software; you can redistribute it and/or @@ -336,7 +337,8 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos ) for( auto pad : mod->Pads() ) { - if( pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) ) + if( m_frame->Settings().m_magneticPads == CAPTURE_ALWAYS && + pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) ) { addAnchor( pad->GetPosition(), CORNER | SNAPPABLE, pad ); break; @@ -350,14 +352,21 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos ) case PCB_PAD_T: { - D_PAD* pad = static_cast( aItem ); - addAnchor( pad->GetPosition(), CORNER | SNAPPABLE, pad ); + if( m_frame->Settings().m_magneticPads == CAPTURE_ALWAYS ) + { + D_PAD* pad = static_cast( aItem ); + addAnchor( pad->GetPosition(), CORNER | SNAPPABLE, pad ); + } + break; } case PCB_MODULE_EDGE_T: case PCB_LINE_T: { + if( !m_frame->Settings().m_magneticGraphics ) + break; + DRAWSEGMENT* dseg = static_cast( aItem ); VECTOR2I start = dseg->GetStart(); VECTOR2I end = dseg->GetEnd(); @@ -418,23 +427,34 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos ) case PCB_TRACE_T: { - TRACK* track = static_cast( aItem ); - VECTOR2I start = track->GetStart(); - VECTOR2I end = track->GetEnd(); - origin.x = start.x + ( start.x - end.x ) / 2; - origin.y = start.y + ( start.y - end.y ) / 2; - addAnchor( start, CORNER | SNAPPABLE, track ); - addAnchor( end, CORNER | SNAPPABLE, track ); - addAnchor( origin, ORIGIN, track); + if( m_frame->Settings().m_magneticTracks == CAPTURE_ALWAYS ) + { + TRACK* track = static_cast( aItem ); + VECTOR2I start = track->GetStart(); + VECTOR2I end = track->GetEnd(); + origin.x = start.x + ( start.x - end.x ) / 2; + origin.y = start.y + ( start.y - end.y ) / 2; + addAnchor( start, CORNER | SNAPPABLE, track ); + addAnchor( end, CORNER | SNAPPABLE, track ); + addAnchor( origin, ORIGIN, track); + } + break; } case PCB_MARKER_T: case PCB_TARGET_T: - case PCB_VIA_T: addAnchor( aItem->GetPosition(), ORIGIN | CORNER | SNAPPABLE, aItem ); break; + case PCB_VIA_T: + { + if( m_frame->Settings().m_magneticTracks == CAPTURE_ALWAYS ) + addAnchor( aItem->GetPosition(), ORIGIN | CORNER | SNAPPABLE, aItem ); + + break; + } + case PCB_ZONE_AREA_T: { const SHAPE_POLY_SET* outline = static_cast( aItem )->Outline(); diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 5d8d5ad666..3c4c2ce914 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -452,7 +452,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent ) // Main loop: keep receiving events while( OPT_TOOL_EVENT evt = Wait() ) { - cursorPos = controls->GetCursorPosition(); + cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ); if( reselect && module ) m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, module ); @@ -625,7 +625,7 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent ) // Main loop: keep receiving events while( OPT_TOOL_EVENT evt = Wait() ) { - cursorPos = controls->GetCursorPosition(); + cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ); if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) ) break;