Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM. Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h. Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h. I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew. Performed tests: - changed pad's net name from empty to existent - ok, name was changed - changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty - changed pad's net name from existent to empty - ok, net name became empty - changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed - (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept - loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct - imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct - saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
This commit is contained in:
parent
bf80cc770e
commit
654e7e556e
|
@ -2546,10 +2546,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aNetlist.IsDryRun() )
|
if( !aNetlist.IsDryRun() )
|
||||||
{
|
|
||||||
pad->SetNetname( wxEmptyString );
|
|
||||||
pad->SetNet( 0 );
|
pad->SetNet( 0 );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Footprint pad has a net.
|
else // Footprint pad has a net.
|
||||||
|
@ -2570,8 +2567,6 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
|
|
||||||
if( !aNetlist.IsDryRun() )
|
if( !aNetlist.IsDryRun() )
|
||||||
{
|
{
|
||||||
pad->SetNetname( net.GetNetName() );
|
|
||||||
|
|
||||||
NETINFO_ITEM* netinfo = FindNet( net.GetNetName() );
|
NETINFO_ITEM* netinfo = FindNet( net.GetNetName() );
|
||||||
if( netinfo == NULL )
|
if( netinfo == NULL )
|
||||||
{
|
{
|
||||||
|
@ -2653,7 +2648,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
GetChars( previouspad->GetPadName() ) );
|
GetChars( previouspad->GetPadName() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
}
|
}
|
||||||
previouspad->SetNetname( wxEmptyString );
|
|
||||||
previouspad->SetNet( 0 );
|
previouspad->SetNet( 0 );
|
||||||
}
|
}
|
||||||
netname = pad->GetNetname();
|
netname = pad->GetNetname();
|
||||||
|
@ -2667,10 +2662,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
|
|
||||||
// Examine last pad
|
// Examine last pad
|
||||||
if( pad && count == 1 )
|
if( pad && count == 1 )
|
||||||
{
|
|
||||||
pad->SetNetname( wxEmptyString );
|
|
||||||
pad->SetNet( 0 );
|
pad->SetNet( 0 );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last step: Some tests:
|
// Last step: Some tests:
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
/**
|
|
||||||
* @file class_board_connected_item.cpp
|
|
||||||
* @brief BOARD_CONNECTED_ITEM class functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
|
@ -28,6 +23,11 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file class_board_connected_item.cpp
|
||||||
|
* @brief BOARD_CONNECTED_ITEM class functions.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
|
|
||||||
|
@ -36,68 +36,32 @@
|
||||||
|
|
||||||
|
|
||||||
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
||||||
BOARD_ITEM( aParent, idtype )
|
BOARD_ITEM( aParent, idtype ), m_NetCode( 0 ), m_Subnet( 0 ), m_ZoneSubnet( 0 )
|
||||||
{
|
{
|
||||||
m_NetCode = 0;
|
|
||||||
m_Subnet = 0;
|
|
||||||
m_ZoneSubnet = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) :
|
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) :
|
||||||
BOARD_ITEM( aItem )
|
BOARD_ITEM( aItem ), m_NetCode( aItem.m_NetCode ), m_Subnet( aItem.m_Subnet ),
|
||||||
|
m_ZoneSubnet( aItem.m_ZoneSubnet )
|
||||||
{
|
{
|
||||||
m_NetCode = aItem.m_NetCode;
|
|
||||||
m_Subnet = aItem.m_Subnet;
|
|
||||||
m_ZoneSubnet = aItem.m_ZoneSubnet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
const wxString& BOARD_CONNECTED_ITEM::GetNetname() const
|
||||||
* Function GetNet
|
|
||||||
* @return int - the net code.
|
|
||||||
*/
|
|
||||||
int BOARD_CONNECTED_ITEM::GetNet() const
|
|
||||||
{
|
{
|
||||||
return m_NetCode;
|
BOARD* board = GetBoard();
|
||||||
|
NETINFO_ITEM* netinfo = board->FindNet( m_NetCode );
|
||||||
|
|
||||||
|
return netinfo->GetNetname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BOARD_CONNECTED_ITEM::SetNet( int aNetCode )
|
const wxString& BOARD_CONNECTED_ITEM::GetShortNetname() const
|
||||||
{
|
{
|
||||||
m_NetCode = aNetCode;
|
NETINFO_ITEM* netinfo = GetBoard()->FindNet( m_NetCode );
|
||||||
}
|
|
||||||
|
|
||||||
|
return netinfo->GetShortNetname();
|
||||||
/**
|
|
||||||
* Function GetSubNet
|
|
||||||
* @return int - the sub net code.
|
|
||||||
*/
|
|
||||||
int BOARD_CONNECTED_ITEM::GetSubNet() const
|
|
||||||
{
|
|
||||||
return m_Subnet;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BOARD_CONNECTED_ITEM::SetSubNet( int aSubNetCode )
|
|
||||||
{
|
|
||||||
m_Subnet = aSubNetCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetZoneSubNet
|
|
||||||
* @return int - the sub net code in zone connections.
|
|
||||||
*/
|
|
||||||
int BOARD_CONNECTED_ITEM::GetZoneSubNet() const
|
|
||||||
{
|
|
||||||
return m_ZoneSubnet;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BOARD_CONNECTED_ITEM::SetZoneSubNet( int aSubNetCode )
|
|
||||||
{
|
|
||||||
m_ZoneSubnet = aSubNetCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,11 +96,6 @@ int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** return a pointer to the netclass of the zone
|
|
||||||
* if the net is not found (can happen when a netlist is reread,
|
|
||||||
* and the net name is not existant, return the default net class
|
|
||||||
* So should not return a null pointer
|
|
||||||
*/
|
|
||||||
NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
|
NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
|
||||||
{
|
{
|
||||||
// It is important that this be implemented without any sequential searching.
|
// It is important that this be implemented without any sequential searching.
|
||||||
|
@ -176,10 +135,7 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
|
||||||
return board->m_NetClasses.GetDefault();
|
return board->m_NetClasses.GetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetNetClassName
|
|
||||||
* @return the Net Class name of this item
|
|
||||||
*/
|
|
||||||
wxString BOARD_CONNECTED_ITEM::GetNetClassName() const
|
wxString BOARD_CONNECTED_ITEM::GetNetClassName() const
|
||||||
{
|
{
|
||||||
wxString name;
|
wxString name;
|
||||||
|
|
|
@ -1,3 +1,28 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||||
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
|
* Copyright (C) 1992-2012 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
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file class_board_connected_item.h
|
* @file class_board_connected_item.h
|
||||||
* @brief Class BOARD_CONNECTED_ITEM.
|
* @brief Class BOARD_CONNECTED_ITEM.
|
||||||
|
@ -6,7 +31,6 @@
|
||||||
#ifndef BOARD_CONNECTED_ITEM_H
|
#ifndef BOARD_CONNECTED_ITEM_H
|
||||||
#define BOARD_CONNECTED_ITEM_H
|
#define BOARD_CONNECTED_ITEM_H
|
||||||
|
|
||||||
|
|
||||||
#include <class_board_item.h>
|
#include <class_board_item.h>
|
||||||
|
|
||||||
class NETCLASS;
|
class NETCLASS;
|
||||||
|
@ -48,22 +72,55 @@ public:
|
||||||
* Function GetNet
|
* Function GetNet
|
||||||
* @return int - the net code.
|
* @return int - the net code.
|
||||||
*/
|
*/
|
||||||
int GetNet() const;
|
int GetNet() const
|
||||||
virtual void SetNet( int aNetCode );
|
{
|
||||||
|
return m_NetCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void SetNet( int aNetCode )
|
||||||
|
{
|
||||||
|
m_NetCode = aNetCode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetSubNet
|
* Function GetSubNet
|
||||||
* @return int - the sub net code.
|
* @return int - the sub net code.
|
||||||
*/
|
*/
|
||||||
int GetSubNet() const;
|
int GetSubNet() const
|
||||||
void SetSubNet( int aSubNetCode );
|
{
|
||||||
|
return m_Subnet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetSubNet( int aSubNetCode )
|
||||||
|
{
|
||||||
|
m_Subnet = aSubNetCode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetZoneSubNet
|
* Function GetZoneSubNet
|
||||||
* @return int - the sub net code in zone connections.
|
* @return int - the sub net code in zone connections.
|
||||||
*/
|
*/
|
||||||
int GetZoneSubNet() const;
|
int GetZoneSubNet() const
|
||||||
void SetZoneSubNet( int aSubNetCode );
|
{
|
||||||
|
return m_ZoneSubnet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetZoneSubNet( int aSubNetCode )
|
||||||
|
{
|
||||||
|
m_ZoneSubnet = aSubNetCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetNetname
|
||||||
|
* @return const wxString& - the full netname
|
||||||
|
*/
|
||||||
|
const wxString& GetNetname() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetShortNetname
|
||||||
|
* @return const wxString& - the short netname
|
||||||
|
*/
|
||||||
|
const wxString& GetShortNetname() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetClearance
|
* Function GetClearance
|
||||||
|
@ -84,6 +141,10 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetNetClassName
|
* Function GetNetClassName
|
||||||
|
* returns a pointer to the netclass of the zone.
|
||||||
|
* If the net is not found (can happen when a netlist is reread,
|
||||||
|
* and the net name does not exist, return the default net class
|
||||||
|
* (should not return a null pointer).
|
||||||
* @return the Net Class name of this item
|
* @return the Net Class name of this item
|
||||||
*/
|
*/
|
||||||
wxString GetNetClassName() const;
|
wxString GetNetClassName() const;
|
||||||
|
|
|
@ -364,13 +364,6 @@ void D_PAD::SetPadName( const wxString& name )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D_PAD::SetNetname( const wxString& aNetname )
|
|
||||||
{
|
|
||||||
m_Netname = aNetname;
|
|
||||||
m_ShortNetname = m_Netname.AfterLast( '/' );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D_PAD::Copy( D_PAD* source )
|
void D_PAD::Copy( D_PAD* source )
|
||||||
{
|
{
|
||||||
if( source == NULL )
|
if( source == NULL )
|
||||||
|
@ -402,8 +395,6 @@ void D_PAD::Copy( D_PAD* source )
|
||||||
|
|
||||||
SetSubRatsnest( 0 );
|
SetSubRatsnest( 0 );
|
||||||
SetSubNet( 0 );
|
SetSubNet( 0 );
|
||||||
m_Netname = source->m_Netname;
|
|
||||||
m_ShortNetname = source->m_ShortNetname;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,7 +403,6 @@ void D_PAD::CopyNetlistSettings( D_PAD* aPad )
|
||||||
// Don't do anything foolish like trying to copy to yourself.
|
// Don't do anything foolish like trying to copy to yourself.
|
||||||
wxCHECK_RET( aPad != NULL && aPad != this, wxT( "Cannot copy to NULL or yourself." ) );
|
wxCHECK_RET( aPad != NULL && aPad != this, wxT( "Cannot copy to NULL or yourself." ) );
|
||||||
|
|
||||||
aPad->SetNetname( GetNetname() );
|
|
||||||
aPad->SetNet( GetNet() );
|
aPad->SetNet( GetNet() );
|
||||||
|
|
||||||
aPad->SetLocalClearance( m_LocalClearance );
|
aPad->SetLocalClearance( m_LocalClearance );
|
||||||
|
@ -578,7 +568,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), m_Netname, DARKCYAN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), GetNetname(), DARKCYAN ) );
|
||||||
|
|
||||||
/* For test and debug only: display m_physical_connexion and
|
/* For test and debug only: display m_physical_connexion and
|
||||||
* m_logical_connexion */
|
* m_logical_connexion */
|
||||||
|
|
|
@ -118,30 +118,6 @@ public:
|
||||||
return m_NumPadName == other->m_NumPadName; // hide tricks behind sensible API
|
return m_NumPadName == other->m_NumPadName; // hide tricks behind sensible API
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetNetname
|
|
||||||
* @param aNetname: the new netname
|
|
||||||
*/
|
|
||||||
void SetNetname( const wxString& aNetname );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetNetname
|
|
||||||
* @return const wxString& - the full netname
|
|
||||||
*/
|
|
||||||
const wxString& GetNetname() const
|
|
||||||
{
|
|
||||||
assert( ( GetNet() == 0 ) == m_Netname.IsEmpty() );
|
|
||||||
// assert( GetBoard()->FindNet( GetNet() ) == GetBoard()->FindNet( m_Netname ) );
|
|
||||||
|
|
||||||
return m_Netname;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetShortNetname
|
|
||||||
* @return const wxString& - the short netname
|
|
||||||
*/
|
|
||||||
const wxString& GetShortNetname() const { return m_ShortNetname; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetShape
|
* Function GetShape
|
||||||
* @return the shape of this pad.
|
* @return the shape of this pad.
|
||||||
|
@ -475,10 +451,6 @@ private:
|
||||||
|
|
||||||
int m_boundingRadius; ///< radius of the circle containing the pad shape
|
int m_boundingRadius; ///< radius of the circle containing the pad shape
|
||||||
|
|
||||||
|
|
||||||
wxString m_Netname; ///< Full net name like /mysheet/mysubsheet/vout used by Eeschema
|
|
||||||
wxString m_ShortNetname; ///< short net name, like vout from /mysheet/mysubsheet/vout
|
|
||||||
|
|
||||||
/// Pad name (4 char) or a long identifier (used in pad name
|
/// Pad name (4 char) or a long identifier (used in pad name
|
||||||
/// comparisons because this is faster than string comparison)
|
/// comparisons because this is faster than string comparison)
|
||||||
union
|
union
|
||||||
|
|
|
@ -473,7 +473,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
GRSetDrawMode( aDC, aDrawInfo.m_DrawMode );
|
GRSetDrawMode( aDC, aDrawInfo.m_DrawMode );
|
||||||
|
|
||||||
// Draw "No connect" ( / or \ or cross X ) if necessary
|
// Draw "No connect" ( / or \ or cross X ) if necessary
|
||||||
if( m_Netname.IsEmpty() && aDrawInfo.m_ShowNCMark )
|
if( GetNet() == 0 && aDrawInfo.m_ShowNCMark )
|
||||||
{
|
{
|
||||||
int dx0 = std::min( halfsize.x, halfsize.y );
|
int dx0 = std::min( halfsize.x, halfsize.y );
|
||||||
EDA_COLOR_T nc_color = BLUE;
|
EDA_COLOR_T nc_color = BLUE;
|
||||||
|
@ -499,7 +499,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
wxPoint tpos0 = shape_pos; // Position of the centre of text
|
wxPoint tpos0 = shape_pos; // Position of the centre of text
|
||||||
wxPoint tpos = tpos0;
|
wxPoint tpos = tpos0;
|
||||||
wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x
|
wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x
|
||||||
int shortname_len = m_ShortNetname.Len();
|
int shortname_len = GetShortNetname().Len();
|
||||||
|
|
||||||
if( !aDrawInfo.m_Display_netname )
|
if( !aDrawInfo.m_Display_netname )
|
||||||
shortname_len = 0;
|
shortname_len = 0;
|
||||||
|
@ -583,7 +583,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
tsize = ( tsize * 7 ) / 10;
|
tsize = ( tsize * 7 ) / 10;
|
||||||
DrawGraphicHaloText( clipBox, aDC, tpos,
|
DrawGraphicHaloText( clipBox, aDC, tpos,
|
||||||
aDrawInfo.m_Color, BLACK, WHITE,
|
aDrawInfo.m_Color, BLACK, WHITE,
|
||||||
m_ShortNetname, t_angle,
|
GetShortNetname(), t_angle,
|
||||||
wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER,
|
wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false );
|
GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false );
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,8 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
|
||||||
m_parent = aParent;
|
m_parent = aParent;
|
||||||
m_currentPad = aPad;
|
m_currentPad = aPad;
|
||||||
m_board = m_parent->GetBoard();
|
m_board = m_parent->GetBoard();
|
||||||
m_dummyPad = new D_PAD( (MODULE*) NULL );
|
m_dummyPad = new D_PAD( aPad->GetParent() );
|
||||||
|
m_padMaster.SetParent( aPad->GetParent() );
|
||||||
|
|
||||||
if( aPad )
|
if( aPad )
|
||||||
m_dummyPad->Copy( aPad );
|
m_dummyPad->Copy( aPad );
|
||||||
|
@ -809,25 +810,16 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
||||||
|
|
||||||
m_currentPad->SetPadName( m_padMaster.GetPadName() );
|
m_currentPad->SetPadName( m_padMaster.GetPadName() );
|
||||||
|
|
||||||
if( m_currentPad->GetNetname() != m_padMaster.GetNetname() )
|
if( m_currentPad->GetNetname() != m_PadNetNameCtrl->GetValue() )
|
||||||
{
|
{
|
||||||
if( m_padMaster.GetNetname().IsEmpty() )
|
if( !m_PadNetNameCtrl->GetValue().IsEmpty() && m_padMaster.GetNet() == 0 )
|
||||||
{
|
{
|
||||||
rastnestIsChanged = true;
|
DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
|
||||||
m_currentPad->SetNet( 0 );
|
|
||||||
m_currentPad->SetNetname( wxEmptyString );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const NETINFO_ITEM* net = m_board->FindNet( m_padMaster.GetNetname() );
|
rastnestIsChanged = true;
|
||||||
if( net )
|
m_currentPad->SetNet( m_padMaster.GetNet() );
|
||||||
{
|
|
||||||
rastnestIsChanged = true;
|
|
||||||
m_currentPad->SetNetname( m_padMaster.GetNetname() );
|
|
||||||
m_currentPad->SetNet( net->GetNet() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -986,7 +978,13 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
|
||||||
|
|
||||||
msg = m_PadNumCtrl->GetValue().Left( 4 );
|
msg = m_PadNumCtrl->GetValue().Left( 4 );
|
||||||
aPad->SetPadName( msg );
|
aPad->SetPadName( msg );
|
||||||
aPad->SetNetname( m_PadNetNameCtrl->GetValue() );
|
|
||||||
|
// Check if user has set an existing net name
|
||||||
|
const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
|
||||||
|
if( netinfo != NULL )
|
||||||
|
aPad->SetNet( netinfo->GetNet() );
|
||||||
|
else
|
||||||
|
aPad->SetNet( 0 );
|
||||||
|
|
||||||
// Clear some values, according to the pad type and shape
|
// Clear some values, according to the pad type and shape
|
||||||
switch( aPad->GetShape() )
|
switch( aPad->GetShape() )
|
||||||
|
@ -1034,7 +1032,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
|
||||||
// no offset, no net name, no pad name allowed
|
// no offset, no net name, no pad name allowed
|
||||||
aPad->SetOffset( wxPoint( 0, 0 ) );
|
aPad->SetOffset( wxPoint( 0, 0 ) );
|
||||||
aPad->SetPadName( wxEmptyString );
|
aPad->SetPadName( wxEmptyString );
|
||||||
aPad->SetNetname( wxEmptyString );
|
aPad->SetNet( 0 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1696,7 +1696,6 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements )
|
||||||
if( ni != m_pads_to_nets.end() )
|
if( ni != m_pads_to_nets.end() )
|
||||||
{
|
{
|
||||||
const ENET* enet = &ni->second;
|
const ENET* enet = &ni->second;
|
||||||
pad->SetNetname( FROM_UTF8( enet->netname.c_str() ) );
|
|
||||||
pad->SetNet( enet->netcode );
|
pad->SetNet( enet->netcode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1303,7 +1303,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
|
||||||
|
|
||||||
// read Netname
|
// read Netname
|
||||||
ReadDelimitedText( buf, data, sizeof(buf) );
|
ReadDelimitedText( buf, data, sizeof(buf) );
|
||||||
pad->SetNetname( FROM_UTF8( StrPurge( buf ) ) );
|
assert( m_board->FindNet( netcode )->GetNetname() == FROM_UTF8( StrPurge( buf ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( TESTLINE( "Po" ) ) // (Po)sition
|
else if( TESTLINE( "Po" ) ) // (Po)sition
|
||||||
|
|
|
@ -141,7 +141,6 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
|
||||||
|
|
||||||
// Update the pad properties.
|
// Update the pad properties.
|
||||||
Import_Pad_Settings( pad, false );
|
Import_Pad_Settings( pad, false );
|
||||||
pad->SetNetname( wxEmptyString );
|
|
||||||
pad->SetNet( 0 );
|
pad->SetNet( 0 );
|
||||||
|
|
||||||
pad->SetPosition( GetCrossHairPosition() );
|
pad->SetPosition( GetCrossHairPosition() );
|
||||||
|
|
|
@ -914,17 +914,17 @@ void PCB::AddToBoard()
|
||||||
|
|
||||||
m_board->SetCopperLayerCount( m_layersStackup.GetCount() );
|
m_board->SetCopperLayerCount( m_layersStackup.GetCount() );
|
||||||
|
|
||||||
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
|
|
||||||
{
|
|
||||||
m_pcbComponents[i]->AddToBoard();
|
|
||||||
}
|
|
||||||
|
|
||||||
for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ )
|
for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
net = m_pcbNetlist[i];
|
net = m_pcbNetlist[i];
|
||||||
|
|
||||||
m_board->AppendNet( new NETINFO_ITEM( m_board, net->m_name, net->m_netCode ) );
|
m_board->AppendNet( new NETINFO_ITEM( m_board, net->m_name, net->m_netCode ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
m_pcbComponents[i]->AddToBoard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace PCAD2KICAD
|
} // namespace PCAD2KICAD
|
||||||
|
|
|
@ -273,8 +273,16 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
|
||||||
|
|
||||||
pad->SetAttribute( padType );
|
pad->SetAttribute( padType );
|
||||||
|
|
||||||
pad->SetNet( 0 );
|
// Set the proper net code
|
||||||
pad->SetNetname( m_net );
|
NETINFO_ITEM* netinfo = m_board->FindNet( m_net );
|
||||||
|
if( netinfo == NULL ) // I believe this should not happen, but just in case
|
||||||
|
{
|
||||||
|
// It is a new net
|
||||||
|
netinfo = new NETINFO_ITEM( m_board, m_net, m_board->GetNetCount() );
|
||||||
|
m_board->AppendNet( netinfo );
|
||||||
|
}
|
||||||
|
|
||||||
|
pad->SetNet( netinfo->GetNet() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aEncapsulatedPad )
|
if( !aEncapsulatedPad )
|
||||||
|
|
|
@ -2191,7 +2191,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
|
||||||
case T_net:
|
case T_net:
|
||||||
pad->SetNet( parseInt( "net number" ) );
|
pad->SetNet( parseInt( "net number" ) );
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
pad->SetNetname( FromUTF8() );
|
assert( FromUTF8() == m_board->FindNet( pad->GetNet() )->GetNetname() );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -455,17 +455,13 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
|
||||||
// Update pad netnames ( when possible)
|
// Update pad netnames ( when possible)
|
||||||
for( D_PAD* pad = aNewModule->Pads(); pad != NULL; pad = pad->Next() )
|
for( D_PAD* pad = aNewModule->Pads(); pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
pad->SetNetname( wxEmptyString );
|
|
||||||
pad->SetNet( 0 );
|
pad->SetNet( 0 );
|
||||||
D_PAD* old_pad = aOldModule->Pads();
|
D_PAD* old_pad = aOldModule->Pads();
|
||||||
|
|
||||||
for( ; old_pad != NULL; old_pad = old_pad->Next() )
|
for( ; old_pad != NULL; old_pad = old_pad->Next() )
|
||||||
{
|
{
|
||||||
if( pad->PadNameEqual( old_pad ) )
|
if( pad->PadNameEqual( old_pad ) )
|
||||||
{
|
|
||||||
pad->SetNetname( old_pad->GetNetname() );
|
|
||||||
pad->SetNet( old_pad->GetNet() );
|
pad->SetNet( old_pad->GetNet() );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue