Enable magnetic pads in Modedit.
Also fixes a bug where a FOOTPRINT_EDIT_FRAME was being passed in to a PCB_EDIT_FRAME. Also tidies up Modedit settings handling for settings which can't be edited in Modedit's preferences dialog. They're now copied from Pcbnew. Fixes: lp:1768477 * https://bugs.launchpad.net/kicad/+bug/1768477
This commit is contained in:
parent
037f7a1698
commit
2f157f9b23
|
@ -42,7 +42,7 @@
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
|
|
||||||
//external functions used here:
|
//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 );
|
wxSize aGridSize, wxPoint on_grid, wxPoint* curpos );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,14 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||||
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true );
|
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()
|
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
|
||||||
// initialize parameters in m_LayersManager
|
// initialize parameters in m_LayersManager
|
||||||
LoadSettings( config() );
|
LoadSettings( config() );
|
||||||
|
|
|
@ -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.
|
* @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.
|
* @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 )
|
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 doCheckNet = frame->Settings().m_magneticPads != CAPTURE_ALWAYS && frame->Settings().m_legacyDrcOn;
|
||||||
|
bool doCheckLayer = aCurrentTool == ID_TRACK_BUTT;
|
||||||
bool doTrack = false;
|
bool doTrack = false;
|
||||||
bool doPad = false;
|
bool doPad = false;
|
||||||
bool amMovingVia = false;
|
bool amMovingVia = false;
|
||||||
|
|
||||||
BOARD* m_Pcb = frame->GetBoard();
|
BOARD* m_Pcb = frame->GetBoard();
|
||||||
TRACK* currTrack = g_CurrentTrackSegment;
|
TRACK* currTrack = g_CurrentTrackSegment;
|
||||||
BOARD_ITEM* currItem = frame->GetCurItem();
|
BOARD_ITEM* currItem = frame->GetCurItem();
|
||||||
PCB_SCREEN* screen = frame->GetScreen();
|
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
|
// The search precedence order is pads, then tracks/vias
|
||||||
if( doPad )
|
if( doPad )
|
||||||
{
|
{
|
||||||
LSET layer_mask( screen->m_Active_Layer );
|
D_PAD* pad;
|
||||||
D_PAD* pad = m_Pcb->GetPad( pos, layer_mask );
|
if( doCheckLayer )
|
||||||
|
pad = m_Pcb->GetPad( pos, LSET( screen->m_Active_Layer ) );
|
||||||
|
else
|
||||||
|
pad = m_Pcb->GetPad( pos );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,8 +40,12 @@ PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FRAME_PCB_MODULE_EDITOR:
|
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( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false);
|
||||||
|
Add( "MagneticPads", reinterpret_cast<int*>( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL );
|
||||||
Add( "DragSelects", &m_dragSelects, true );
|
Add( "DragSelects", &m_dragSelects, true );
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -72,7 +72,7 @@ using namespace std::placeholders;
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
|
|
||||||
|
|
||||||
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 );
|
wxSize aGridSize, wxPoint on_grid, wxPoint* curpos );
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue