From 63d4051059fedadb075d1d8c50cf153e420686f5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 24 Apr 2014 20:54:49 +0200 Subject: [PATCH] Pcbnew: fix Bug #1304418 . Fix also a related issue which crashes Pcbnew in some corner cases. (for instance, when a footprint from the currently edited board is loaded in the footprint editor, and when the board is cleared or reloaded) In footprint editor, the net names are no more shown od modifiable (becuase the footprint editor does not know anything about net names. This change should allow the changes planned in pcbnew. --- common/dialog_about/dialog_about.cpp | 9 +- common/dialog_about/dialog_about_base.cpp | 5 +- common/dialog_about/dialog_about_base.fbp | 987 +++++++++++++--------- common/dialog_about/dialog_about_base.h | 15 +- pcbnew/class_netinfo.h | 4 +- pcbnew/class_netinfolist.cpp | 3 +- pcbnew/class_pad_draw_functions.cpp | 6 +- pcbnew/dialogs/dialog_pad_properties.cpp | 110 ++- pcbnew/loadcmp.cpp | 19 +- pcbnew/moduleframe.cpp | 1 - 10 files changed, 703 insertions(+), 456 deletions(-) diff --git a/common/dialog_about/dialog_about.cpp b/common/dialog_about/dialog_about.cpp index 13ab08a9a3..d4deb7122f 100644 --- a/common/dialog_about/dialog_about.cpp +++ b/common/dialog_about/dialog_about.cpp @@ -29,16 +29,9 @@ dialog_about::dialog_about(wxWindow *parent, AboutAppInfo& appInfo) m_staticTextBuildVersion->SetLabel( info.GetBuildVersion() ); m_staticTextLibVersion->SetLabel( info.GetLibVersion() ); - /* Affects m_titlepanel the parent of some wxStaticText. - * Changing the text afterwards makes it under Windows necessary to call 'Layout()' - * so that the new text gets properly layout. - */ -/* m_staticTextCopyright->GetParent()->Layout(); - m_staticTextBuildVersion->GetParent()->Layout(); - m_staticTextLibVersion->GetParent()->Layout(); -*/ DeleteNotebooks(); CreateNotebooks(); + GetSizer()->SetSizeHints(this); m_auiNotebook->Update(); SetFocus(); diff --git a/common/dialog_about/dialog_about_base.cpp b/common/dialog_about/dialog_about_base.cpp index de343ab237..66cb2f05a2 100644 --- a/common/dialog_about/dialog_about_base.cpp +++ b/common/dialog_about/dialog_about_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Nov 6 2013) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -46,11 +46,13 @@ dialog_about_base::dialog_about_base( wxWindow* parent, wxWindowID id, const wxS m_staticTextLibVersion->Wrap( -1 ); b_apptitleSizer->Add( m_staticTextLibVersion, 0, wxALIGN_CENTER|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + bSizer3->Add( b_apptitleSizer, 10, wxEXPAND, 5 ); bSizer3->Add( 0, 0, 2, wxEXPAND, 5 ); + bSizer1->Add( bSizer3, 0, wxEXPAND, 5 ); wxStaticLine* m_staticline1; @@ -67,6 +69,7 @@ dialog_about_base::dialog_about_base( wxWindow* parent, wxWindowID id, const wxS m_buttonOK->SetDefault(); bSizer1->Add( m_buttonOK, 0, wxALIGN_CENTER|wxALL, 5 ); + this->SetSizer( bSizer1 ); this->Layout(); diff --git a/common/dialog_about/dialog_about_base.fbp b/common/dialog_about/dialog_about_base.fbp index 2f6951303c..ce0bf7d57d 100644 --- a/common/dialog_about/dialog_about_base.fbp +++ b/common/dialog_about/dialog_about_base.fbp @@ -2,11 +2,13 @@ - + C++ 1 source_name + 0 0 + res UTF-8 connect dialog_about_base @@ -14,73 +16,80 @@ none 1 MyProject - + . - + 1 + 1 + 1 1 + UI 1 0 - - - + 0 + wxAUI_MGR_DEFAULT + + + 1 1 impl_virtual - - - + + + 0 wxID_ANY - + -1,-1 dialog_about_base - + 750,450 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP - + About... - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - + + + + + + + + + + + + + OnClose - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + bSizer1 wxVERTICAL none @@ -89,7 +98,7 @@ wxEXPAND 0 - + bSizer3 wxHORIZONTAL none @@ -108,53 +117,80 @@ wxALIGN_CENTER|wxALL 1 - - - + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY - - + + 0 + + + 0 + + 1 m_bitmapApp + 1 + + protected - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -162,7 +198,7 @@ wxEXPAND 10 - + b_apptitleSizer wxVERTICAL none @@ -171,55 +207,82 @@ wxALIGN_CENTER|wxALL 0 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - + + 1 ,90,92,14,70,0 + 0 0 wxID_ANY App Title - - + + 0 + + + 0 + + 1 m_staticTextAppTitle + 1 + + protected - - + 1 + + Resizable + 1 + wxALIGN_CENTRE - - - - wxFILTER_NONE - wxDefaultValidator - - - - + + 0 + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -227,55 +290,82 @@ wxALIGN_CENTER|wxALL 0 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY Copyright Info - - + + 0 + + + 0 + + 1 m_staticTextCopyright + 1 + + protected - - + 1 + + Resizable + 1 + wxALIGN_CENTRE - - - - wxFILTER_NONE - wxDefaultValidator - - - - + + 0 + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -283,55 +373,82 @@ wxALIGN_CENTER|wxLEFT|wxRIGHT|wxTOP 0 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY Build Version Info - - + + 0 + + + 0 + + 1 m_staticTextBuildVersion + 1 + + protected - - + 1 + + Resizable + 1 + wxALIGN_CENTRE - - - - wxFILTER_NONE - wxDefaultValidator - - - - + + 0 + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -339,55 +456,82 @@ wxALIGN_CENTER|wxBOTTOM|wxLEFT|wxRIGHT 0 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY Lib Version Info - - + + 0 + + + 0 + + 1 m_staticTextLibVersion + 1 + + protected - - + 1 + + Resizable + 1 + wxALIGN_CENTRE - - - - wxFILTER_NONE - wxDefaultValidator - - - - + + 0 + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -409,53 +553,80 @@ wxEXPAND | wxALL 0 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY - - + + 0 + + + 0 + + 1 m_staticline1 + 1 + + none - - + 1 + + Resizable + 1 + wxLI_HORIZONTAL - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -463,63 +634,90 @@ wxEXPAND | wxALL 2 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY - + + 0 + + + 0 750,350 + 1 m_auiNotebook + 1 + + protected - - + 1 + + Resizable + 1 + wxAUI_NB_SCROLL_BUTTONS|wxAUI_NB_TAB_FIXED_WIDTH - + -1 - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -527,56 +725,87 @@ wxALIGN_CENTER|wxALL 0 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_CANCEL OK - - + + 0 + + + 0 + + 1 m_buttonOK + 1 + + private - - - - - - + 1 + + Resizable + 1 + + + + 0 + + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnOkClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/dialog_about/dialog_about_base.h b/common/dialog_about/dialog_about_base.h index 79253e9973..d0485f3575 100644 --- a/common/dialog_about/dialog_about_base.h +++ b/common/dialog_about/dialog_about_base.h @@ -1,15 +1,16 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Nov 6 2013) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __dialog_about_base__ -#define __dialog_about_base__ +#ifndef __DIALOG_ABOUT_BASE_H__ +#define __DIALOG_ABOUT_BASE_H__ +#include +#include #include - #include #include #include @@ -37,13 +38,11 @@ class dialog_about_base : public wxDialog wxButton* m_buttonOK; protected: - wxStaticBitmap* m_bitmapApp; wxStaticText* m_staticTextAppTitle; wxStaticText* m_staticTextCopyright; wxStaticText* m_staticTextBuildVersion; wxStaticText* m_staticTextLibVersion; - wxAuiNotebook* m_auiNotebook; // Virtual event handlers, overide them in your derived class @@ -53,9 +52,9 @@ class dialog_about_base : public wxDialog public: - dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,350 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP ); + dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP ); ~dialog_about_base(); }; -#endif //__dialog_about_base__ +#endif //__DIALOG_ABOUT_BASE_H__ diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 64e6e9f8b8..88e77df440 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -1,7 +1,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) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -234,7 +234,7 @@ private: /** - * Class NETINFO + * Class NETINFO_LIST * is a container class for NETINFO_ITEM elements, which are the nets. That makes * this class a container for the nets. */ diff --git a/pcbnew/class_netinfolist.cpp b/pcbnew/class_netinfolist.cpp index da3bd875d1..5f73ca0a98 100644 --- a/pcbnew/class_netinfolist.cpp +++ b/pcbnew/class_netinfolist.cpp @@ -1,8 +1,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-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2014 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 diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index dfa489041a..78fcaf457c 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -499,10 +499,10 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) wxPoint tpos0 = shape_pos; // Position of the centre of text wxPoint tpos = tpos0; wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x - int shortname_len = GetShortNetname().Len(); + int shortname_len = 0; - if( !aDrawInfo.m_Display_netname ) - shortname_len = 0; + if( aDrawInfo.m_Display_netname ) + shortname_len = GetShortNetname().Len(); if( GetShape() == PAD_CIRCLE ) angle = 0; diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 21c306b66f..fe5faeba66 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -97,11 +97,17 @@ private: PCB_BASE_FRAME* m_parent; D_PAD* m_currentPad; // pad currently being edited D_PAD* m_dummyPad; // a working copy used to show changes - BOARD* m_board; - D_PAD& m_padMaster; + D_PAD* m_padMaster; // The pad used to create new pads in board or + // footprint editor + BOARD* m_board; // the main board: this is the board handled by + // the PCB editor, if running or the dummy + // board used by the footprint editor + // (could happen when the Footprint editor will be run + // alone, outside the board editor bool m_isFlipped; // true if the parent footprint (therefore pads) is flipped (mirrored) // in this case, some Y coordinates values must be negated bool m_canUpdate; + bool m_canEditNetName; // true only if the called is the board editor private: void initValues(); @@ -139,25 +145,31 @@ private: void PadPropertiesAccept( wxCommandEvent& event ); }; +void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad ) +{ + DIALOG_PAD_PROPERTIES dlg( this, aPad ); + + dlg.ShowModal(); +} + DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad ) : - DIALOG_PAD_PROPERTIES_BASE( aParent ), - // use aParent's parent, which is the original BOARD, not the dummy module editor BOARD, - // since FOOTPRINT_EDIT_FRAME::GetDesignSettings() is tricked out to use the PCB_EDIT_FRAME's - // BOARD, not its own BOARD. - m_padMaster( aParent->GetDesignSettings().m_Pad_Master ) + DIALOG_PAD_PROPERTIES_BASE( aParent ) { m_canUpdate = false; m_parent = aParent; m_currentPad = aPad; // aPad can be NULL, if the dialog is called // from the module editor to set default pad characteristics + m_board = m_parent->GetBoard(); + + m_padMaster = &m_parent->GetDesignSettings().m_Pad_Master; m_dummyPad = new D_PAD( (MODULE*) NULL ); if( aPad ) m_dummyPad->Copy( aPad ); - else - m_dummyPad->Copy( &m_padMaster ); + else // We are editing a "master" pad, i.e. a pad used to create new pads + m_dummyPad->Copy( m_padMaster ); initValues(); @@ -238,19 +250,16 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) } -void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad ) -{ - DIALOG_PAD_PROPERTIES dlg( this, aPad ); - - dlg.ShowModal(); -} - - void DIALOG_PAD_PROPERTIES::initValues() { wxString msg; double angle; + // Disable pad net name wxTextCtrl if the caller is the footprint editor + // because nets are living only in the board managed by the board editor + m_canEditNetName = m_parent->IsType( FRAME_PCB ); + + // Setup layers names from board // Should be made first, before calling m_rbCopperLayersSel->SetSelection() m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( LAYER_N_FRONT ) ); @@ -471,7 +480,7 @@ void DIALOG_PAD_PROPERTIES::initValues() bool enable = m_dummyPad->GetAttribute() != PAD_HOLE_NOT_PLATED; m_PadNumCtrl->Enable( enable ); - m_PadNetNameCtrl->Enable( enable ); + m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL ); m_LengthPadToDieCtrl->Enable( enable ); if( m_dummyPad->GetDrillShape() != PAD_DRILL_OBLONG ) @@ -593,7 +602,7 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event ) void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event ) { - unsigned ii = m_PadType->GetSelection(); + unsigned ii = m_PadType->GetSelection(); if( ii >= NBTYPES ) // catches < 0 also ii = 0; @@ -614,7 +623,7 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event ) // (disable for NPTH pads (mechanical pads) bool enable = ii != 3; m_PadNumCtrl->Enable( enable ); - m_PadNetNameCtrl->Enable( enable ); + m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL ); m_LengthPadToDieCtrl->Enable( enable ); } @@ -752,7 +761,9 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) bool rastnestIsChanged = false; int isign = m_isFlipped ? -1 : 1; - transferDataToPad( &m_padMaster ); + transferDataToPad( m_padMaster ); + // m_padMaster is a pattern: ensure there is no net for this pad: + m_padMaster->SetNetCode( NETINFO_LIST::UNCONNECTED ); if( m_currentPad ) // Set current Pad parameters { @@ -768,12 +779,12 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) m_currentPad->ClearFlags( DO_NOT_DRAW ); // Update values - m_currentPad->SetShape( m_padMaster.GetShape() ); - m_currentPad->SetAttribute( m_padMaster.GetAttribute() ); + m_currentPad->SetShape( m_padMaster->GetShape() ); + m_currentPad->SetAttribute( m_padMaster->GetAttribute() ); - if( m_currentPad->GetPosition() != m_padMaster.GetPosition() ) + if( m_currentPad->GetPosition() != m_padMaster->GetPosition() ) { - m_currentPad->SetPosition( m_padMaster.GetPosition() ); + m_currentPad->SetPosition( m_padMaster->GetPosition() ); rastnestIsChanged = true; } @@ -785,54 +796,62 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) m_currentPad->SetPos0( pt ); - m_currentPad->SetOrientation( m_padMaster.GetOrientation() * isign + module->GetOrientation() ); + m_currentPad->SetOrientation( m_padMaster->GetOrientation() * isign + module->GetOrientation() ); - m_currentPad->SetSize( m_padMaster.GetSize() ); + m_currentPad->SetSize( m_padMaster->GetSize() ); - size = m_padMaster.GetDelta(); + size = m_padMaster->GetDelta(); size.y *= isign; m_currentPad->SetDelta( size ); - m_currentPad->SetDrillSize( m_padMaster.GetDrillSize() ); - m_currentPad->SetDrillShape( m_padMaster.GetDrillShape() ); + m_currentPad->SetDrillSize( m_padMaster->GetDrillSize() ); + m_currentPad->SetDrillShape( m_padMaster->GetDrillShape() ); - wxPoint offset = m_padMaster.GetOffset(); + wxPoint offset = m_padMaster->GetOffset(); offset.y *= isign; m_currentPad->SetOffset( offset ); - m_currentPad->SetPadToDieLength( m_padMaster.GetPadToDieLength() ); + m_currentPad->SetPadToDieLength( m_padMaster->GetPadToDieLength() ); - if( m_currentPad->GetLayerMask() != m_padMaster.GetLayerMask() ) + if( m_currentPad->GetLayerMask() != m_padMaster->GetLayerMask() ) { rastnestIsChanged = true; - m_currentPad->SetLayerMask( m_padMaster.GetLayerMask() ); + m_currentPad->SetLayerMask( m_padMaster->GetLayerMask() ); } if( m_isFlipped ) m_currentPad->SetLayerMask( FlipLayerMask( m_currentPad->GetLayerMask() ) ); - m_currentPad->SetPadName( m_padMaster.GetPadName() ); + m_currentPad->SetPadName( m_padMaster->GetPadName() ); - if( m_currentPad->GetNetname() != m_PadNetNameCtrl->GetValue() ) + wxString padNetname; + + // For PAD_HOLE_NOT_PLATED, ensure there is no net name selected + if( m_padMaster->GetAttribute() != PAD_HOLE_NOT_PLATED ) + padNetname = m_PadNetNameCtrl->GetValue(); + + if( m_currentPad->GetNetname() != padNetname ) { - if( !m_PadNetNameCtrl->GetValue().IsEmpty() && m_padMaster.GetNetCode() == 0 ) + const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname ); + + if( !padNetname.IsEmpty() && netinfo == NULL ) { DisplayError( NULL, _( "Unknown netname, netname not changed" ) ); } else { rastnestIsChanged = true; - m_currentPad->SetNetCode( m_padMaster.GetNetCode() ); + m_currentPad->SetNetCode( netinfo->GetNet() ); } } - m_currentPad->SetLocalClearance( m_padMaster.GetLocalClearance() ); - m_currentPad->SetLocalSolderMaskMargin( m_padMaster.GetLocalSolderMaskMargin() ); - m_currentPad->SetLocalSolderPasteMargin( m_padMaster.GetLocalSolderPasteMargin() ); - m_currentPad->SetLocalSolderPasteMarginRatio( m_padMaster.GetLocalSolderPasteMarginRatio() ); - m_currentPad->SetZoneConnection( m_padMaster.GetZoneConnection() ); - m_currentPad->SetThermalWidth( m_padMaster.GetThermalWidth() ); - m_currentPad->SetThermalGap( m_padMaster.GetThermalGap() ); + m_currentPad->SetLocalClearance( m_padMaster->GetLocalClearance() ); + m_currentPad->SetLocalSolderMaskMargin( m_padMaster->GetLocalSolderMaskMargin() ); + m_currentPad->SetLocalSolderPasteMargin( m_padMaster->GetLocalSolderPasteMargin() ); + m_currentPad->SetLocalSolderPasteMarginRatio( m_padMaster->GetLocalSolderPasteMarginRatio() ); + m_currentPad->SetZoneConnection( m_padMaster->GetZoneConnection() ); + m_currentPad->SetThermalWidth( m_padMaster->GetThermalWidth() ); + m_currentPad->SetThermalGap( m_padMaster->GetThermalGap() ); module->CalculateBoundingBox(); m_parent->SetMsgPanel( m_currentPad ); @@ -984,6 +1003,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) // Check if user has set an existing net name const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() ); + if( netinfo != NULL ) aPad->SetNetCode( netinfo->GetNet() ); else diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 2db1223087..6c324b4d65 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -87,23 +87,28 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) aModule = newModule; - GetBoard()->Add( aModule ); + GetBoard()->Add( newModule ); - aModule->ClearFlags(); + newModule->ClearFlags(); - GetBoard()->BuildListOfNets(); + // Clear references to net info, because the footprint editor + // does know any thing about nets handled by the current edited board. + // Morever the main board can change or the net info relative to this main board + // can change while editing this footprint in the footprint editor + for( D_PAD* pad = newModule->Pads(); pad; pad = pad->Next() ) + pad->SetNetCode( NETINFO_LIST::UNCONNECTED ); SetCrossHairPosition( wxPoint( 0, 0 ) ); - PlaceModule( aModule, NULL ); + PlaceModule( newModule, NULL ); // Put it on FRONT layer, // because this is the default in ModEdit, and in libs - if( aModule->GetLayer() != LAYER_N_FRONT ) - aModule->Flip( aModule->GetPosition() ); + if( newModule->GetLayer() != LAYER_N_FRONT ) + newModule->Flip( newModule->GetPosition() ); // Put it in orientation 0, // because this is the default orientation in ModEdit, and in libs - Rotate_Module( NULL, aModule, 0, false ); + Rotate_Module( NULL, newModule, 0, false ); GetScreen()->ClrModify(); Zoom_Automatique( false ); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index bf2983ccd0..cb7a0425fc 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -46,7 +46,6 @@ #include #include -#include #include #include #include