diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 75db987004..daafd02b77 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -42,7 +42,7 @@ #include //external functions used here: -extern bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, +extern bool Magnetize( PCB_BASE_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, wxPoint on_grid, wxPoint* curpos ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index b6a9546920..e593045d57 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -270,6 +270,14 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true ); + // We should probably allow editing of these in the Footprint Editor's preferences, but + // that's not the case at present so copy them from Pcbnew. + m_configSettings.m_use45DegreeGraphicSegments = pcbFrame->Settings().m_use45DegreeGraphicSegments; + m_configSettings.m_magneticPads = pcbFrame->Settings().m_magneticPads; + + // And this one needs to move to a suite-wide setting. + m_configSettings.m_dragSelects = pcbFrame->Settings().m_dragSelects; + // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager LoadSettings( config() ); diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp index cad4314a21..dce658490c 100644 --- a/pcbnew/magnetic_tracks_functions.cpp +++ b/pcbnew/magnetic_tracks_functions.cpp @@ -126,15 +126,19 @@ bool FindBestGridPointOnTrack( wxPoint* aNearPos, wxPoint on_grid, const TRACK* * @param curpos The initial position, and what to adjust if a change is needed. * @return bool - true if the position was adjusted magnetically, else false. */ -bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, +bool Magnetize( PCB_BASE_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, wxPoint on_grid, wxPoint* curpos ) { + // Note: only used for routing in the Legacy Toolset and for the measurement tool in the + // Modern Toolset. Can be greatly simplified when the Legacy Toolset is retired. + bool doCheckNet = frame->Settings().m_magneticPads != CAPTURE_ALWAYS && frame->Settings().m_legacyDrcOn; + bool doCheckLayer = aCurrentTool == ID_TRACK_BUTT; bool doTrack = false; bool doPad = false; bool amMovingVia = false; - BOARD* m_Pcb = frame->GetBoard(); + BOARD* m_Pcb = frame->GetBoard(); TRACK* currTrack = g_CurrentTrackSegment; BOARD_ITEM* currItem = frame->GetCurItem(); PCB_SCREEN* screen = frame->GetScreen(); @@ -175,8 +179,11 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, // The search precedence order is pads, then tracks/vias if( doPad ) { - LSET layer_mask( screen->m_Active_Layer ); - D_PAD* pad = m_Pcb->GetPad( pos, layer_mask ); + D_PAD* pad; + if( doCheckLayer ) + pad = m_Pcb->GetPad( pos, LSET( screen->m_Active_Layer ) ); + else + pad = m_Pcb->GetPad( pos ); if( pad ) { diff --git a/pcbnew/pcb_general_settings.cpp b/pcbnew/pcb_general_settings.cpp index 55e077696f..d949dd7dcc 100644 --- a/pcbnew/pcb_general_settings.cpp +++ b/pcbnew/pcb_general_settings.cpp @@ -40,8 +40,12 @@ PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) break; case FRAME_PCB_MODULE_EDITOR: + /* No point in reading/writing these when the user can't edit them. Fetch them from + * Pcbnew for now. Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false); + Add( "MagneticPads", reinterpret_cast( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL ); Add( "DragSelects", &m_dragSelects, true ); + */ break; default: diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index dfaf6c8c83..8829592dcd 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -72,7 +72,7 @@ using namespace std::placeholders; #include -extern bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, +extern bool Magnetize( PCB_BASE_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, wxPoint on_grid, wxPoint* curpos );