Commit 82735251 authored by jean-pierre charras's avatar jean-pierre charras

Layers manager: add in popup menu option to hide all coppers layers but active layer.

Design rules: increase number of vias and tracks sizes
Pcbnew: netlist reader: change from my recent commits to keep netnames in pads for footprints not in netlist
(allow an user to place some footprints by hand, set pads netnames and do not lost these netnames when loading a netlsit)
Fix other very minor issues.
parent ba689c10
...@@ -823,6 +823,9 @@ void EDA_DRAW_FRAME::UpdateStatusBar() ...@@ -823,6 +823,9 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
// We already decided the formatter above // We already decided the formatter above
Line.Printf( locformatter, dXpos, dYpos ); Line.Printf( locformatter, dXpos, dYpos );
SetStatusText( Line, 3 ); SetStatusText( Line, 3 );
// refresh units display
DisplayUnitsMsg();
} }
......
...@@ -129,11 +129,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph ...@@ -129,11 +129,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
GetScreen()->m_Center = true; // Center coordinate origins on screen. GetScreen()->m_Center = true; // Center coordinate origins on screen.
LoadSettings(); LoadSettings();
// Initialize grid id to a default value if not found in config or bad:
if( ( m_LastGridSizeId <= 0 ) ||
( m_LastGridSizeId < ( ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000 ) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
......
...@@ -67,7 +67,7 @@ GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFo ...@@ -67,7 +67,7 @@ GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFo
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect() // since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect() // and not m_LayerScrolledWindow->Connect()
Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS, wxEVT_COMMAND_MENU_SELECTED, Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS_BUT_ACTIVE, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( GERBER_LAYER_WIDGET::onPopupSelection ), NULL, this ); wxCommandEventHandler( GERBER_LAYER_WIDGET::onPopupSelection ), NULL, this );
// install the right click handler into each control at end of ReFill() // install the right click handler into each control at end of ReFill()
...@@ -145,6 +145,9 @@ void GERBER_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) ...@@ -145,6 +145,9 @@ void GERBER_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS,
_("Show All Layers") ) ); _("Show All Layers") ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS_BUT_ACTIVE,
_( "Hide All Layers But Active" ) ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS,
_( "Hide All Layers" ) ) ); _( "Hide All Layers" ) ) );
...@@ -164,12 +167,18 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -164,12 +167,18 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{ {
case ID_SHOW_ALL_COPPERS: case ID_SHOW_ALL_COPPERS:
case ID_SHOW_NO_COPPERS: case ID_SHOW_NO_COPPERS:
case ID_SHOW_NO_COPPERS_BUT_ACTIVE:
rowCount = GetLayerRowCount(); rowCount = GetLayerRowCount();
for( int row=0; row < rowCount; ++row ) for( int row=0; row < rowCount; ++row )
{ {
bool loc_visible = visible;
if( (menuId == ID_SHOW_NO_COPPERS_BUT_ACTIVE ) &&
(row == m_CurrentRow ) )
loc_visible = true;
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
cb->SetValue( visible ); cb->SetValue( loc_visible );
if( visible ) if( loc_visible )
visibleLayers |= (1 << row); visibleLayers |= (1 << row);
else else
visibleLayers &= ~(1 << row); visibleLayers &= ~(1 << row);
......
...@@ -46,6 +46,7 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET ...@@ -46,6 +46,7 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET
// popup menu ids. // popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST #define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) #define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2)
/** /**
* Function OnRightDownLayers * Function OnRightDownLayers
......
...@@ -78,12 +78,6 @@ public: ...@@ -78,12 +78,6 @@ public:
wxString m_LibRef; /* Name of the module in library (and wxString m_LibRef; /* Name of the module in library (and
* the default value when loading a * the default value when loading a
* module from the library) */ * module from the library) */
wxString m_AlternateReference; /* Used when m_Reference cannot
* be used to identify the
* footprint ( after a full
* reannotation of the schematic */
int m_Attributs; ///< Flag bits ( see Mod_Attribut ) int m_Attributs; ///< Flag bits ( see Mod_Attribut )
int flag; /* Use to trace ratsnest and auto routing. */ int flag; /* Use to trace ratsnest and auto routing. */
...@@ -340,6 +334,14 @@ public: ...@@ -340,6 +334,14 @@ public:
return m_Reference->m_Text; return m_Reference->m_Text;
} }
/**
* Function SetReference
* @param const wxString& - the reference designator text.
*/
void SetReference( const wxString& aReference)
{
m_Reference->m_Text = aReference;
}
/** /**
* Function GetValue * Function GetValue
...@@ -350,6 +352,14 @@ public: ...@@ -350,6 +352,14 @@ public:
return m_Value->m_Text; return m_Value->m_Text;
} }
/**
* Function SetValue
* @param const wxString& - the value text.
*/
void SetValue( const wxString& aValue )
{
m_Value->m_Text = aValue;
}
/** /**
* Function FindPadByName * Function FindPadByName
......
...@@ -90,7 +90,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn ...@@ -90,7 +90,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect() // since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect() // and not m_LayerScrolledWindow->Connect()
Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS, wxEVT_COMMAND_MENU_SELECTED, Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS_BUT_ACTIVE, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this ); wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
// install the right click handler into each control at end of ReFill() // install the right click handler into each control at end of ReFill()
...@@ -121,7 +121,7 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) ...@@ -121,7 +121,7 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
// menu text is capitalized: // menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, _( "Show All Copper Layers" ) ) ); menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, _( "Show All Copper Layers" ) ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS_BUT_ACTIVE, _( "Hide All Copper Layers But Active" ) ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, _( "Hide All Copper Layers" ) ) ); menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, _( "Hide All Copper Layers" ) ) );
PopupMenu( &menu ); PopupMenu( &menu );
...@@ -142,6 +142,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -142,6 +142,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
visible = true; visible = true;
goto L_change_coppers; goto L_change_coppers;
case ID_SHOW_NO_COPPERS_BUT_ACTIVE:
case ID_SHOW_NO_COPPERS: case ID_SHOW_NO_COPPERS:
visible = false; visible = false;
L_change_coppers: L_change_coppers:
...@@ -165,11 +166,16 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -165,11 +166,16 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
if( IsValidCopperLayerIndex( layer ) ) if( IsValidCopperLayerIndex( layer ) )
{ {
cb->SetValue( visible ); bool loc_visible = visible;
if( (menuId == ID_SHOW_NO_COPPERS_BUT_ACTIVE ) &&
(layer == myframe->getActiveLayer() ) )
loc_visible = true;
cb->SetValue( loc_visible );
bool isLastCopperLayer = (row==lastCu); bool isLastCopperLayer = (row==lastCu);
OnLayerVisible( layer, visible, isLastCopperLayer ); OnLayerVisible( layer, loc_visible, isLastCopperLayer );
if( isLastCopperLayer ) if( isLastCopperLayer )
break; break;
......
...@@ -91,6 +91,7 @@ protected: ...@@ -91,6 +91,7 @@ protected:
// popup menu ids. // popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST #define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) #define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2)
/** /**
* Function OnRightDownLayers * Function OnRightDownLayers
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010) // C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -250,7 +250,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -250,7 +250,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_gridViaSizeList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_gridViaSizeList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid // Grid
m_gridViaSizeList->CreateGrid( 7, 2 ); m_gridViaSizeList->CreateGrid( 12, 2 );
m_gridViaSizeList->EnableEditing( true ); m_gridViaSizeList->EnableEditing( true );
m_gridViaSizeList->EnableGridLines( true ); m_gridViaSizeList->EnableGridLines( true );
m_gridViaSizeList->EnableDragGridSize( false ); m_gridViaSizeList->EnableDragGridSize( false );
...@@ -274,6 +274,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -274,6 +274,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_gridViaSizeList->SetRowLabelValue( 4, _("Via 5") ); m_gridViaSizeList->SetRowLabelValue( 4, _("Via 5") );
m_gridViaSizeList->SetRowLabelValue( 5, _("Via 6") ); m_gridViaSizeList->SetRowLabelValue( 5, _("Via 6") );
m_gridViaSizeList->SetRowLabelValue( 6, _("Via 7") ); m_gridViaSizeList->SetRowLabelValue( 6, _("Via 7") );
m_gridViaSizeList->SetRowLabelValue( 7, _("Via 8") );
m_gridViaSizeList->SetRowLabelValue( 8, _("Via 9") );
m_gridViaSizeList->SetRowLabelValue( 9, _("Via 10") );
m_gridViaSizeList->SetRowLabelValue( 10, _("Via 11") );
m_gridViaSizeList->SetRowLabelValue( 11, _("Via 12") );
m_gridViaSizeList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); m_gridViaSizeList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance // Label Appearance
...@@ -294,7 +299,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -294,7 +299,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_gridTrackWidthList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_gridTrackWidthList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid // Grid
m_gridTrackWidthList->CreateGrid( 7, 1 ); m_gridTrackWidthList->CreateGrid( 12, 1 );
m_gridTrackWidthList->EnableEditing( true ); m_gridTrackWidthList->EnableEditing( true );
m_gridTrackWidthList->EnableGridLines( true ); m_gridTrackWidthList->EnableGridLines( true );
m_gridTrackWidthList->EnableDragGridSize( false ); m_gridTrackWidthList->EnableDragGridSize( false );
...@@ -308,6 +313,18 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -308,6 +313,18 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_gridTrackWidthList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); m_gridTrackWidthList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows // Rows
m_gridTrackWidthList->SetRowSize( 0, 17 );
m_gridTrackWidthList->SetRowSize( 1, 17 );
m_gridTrackWidthList->SetRowSize( 2, 17 );
m_gridTrackWidthList->SetRowSize( 3, 17 );
m_gridTrackWidthList->SetRowSize( 4, 17 );
m_gridTrackWidthList->SetRowSize( 5, 17 );
m_gridTrackWidthList->SetRowSize( 6, 17 );
m_gridTrackWidthList->SetRowSize( 7, 17 );
m_gridTrackWidthList->SetRowSize( 8, 17 );
m_gridTrackWidthList->SetRowSize( 9, 17 );
m_gridTrackWidthList->SetRowSize( 10, 17 );
m_gridTrackWidthList->SetRowSize( 11, 17 );
m_gridTrackWidthList->EnableDragRowSize( true ); m_gridTrackWidthList->EnableDragRowSize( true );
m_gridTrackWidthList->SetRowLabelSize( 80 ); m_gridTrackWidthList->SetRowLabelSize( 80 );
m_gridTrackWidthList->SetRowLabelValue( 0, _("Track 1") ); m_gridTrackWidthList->SetRowLabelValue( 0, _("Track 1") );
...@@ -317,6 +334,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -317,6 +334,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_gridTrackWidthList->SetRowLabelValue( 4, _("Track 5") ); m_gridTrackWidthList->SetRowLabelValue( 4, _("Track 5") );
m_gridTrackWidthList->SetRowLabelValue( 5, _("Track 6") ); m_gridTrackWidthList->SetRowLabelValue( 5, _("Track 6") );
m_gridTrackWidthList->SetRowLabelValue( 6, _("Track 7") ); m_gridTrackWidthList->SetRowLabelValue( 6, _("Track 7") );
m_gridTrackWidthList->SetRowLabelValue( 7, _("Track 8") );
m_gridTrackWidthList->SetRowLabelValue( 8, _("Track 9") );
m_gridTrackWidthList->SetRowLabelValue( 9, _("Track 10") );
m_gridTrackWidthList->SetRowLabelValue( 10, _("Track 11") );
m_gridTrackWidthList->SetRowLabelValue( 11, _("Track 12") );
m_gridTrackWidthList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); m_gridTrackWidthList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance // Label Appearance
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010) // C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_design_rules_base__ #ifndef __DIALOG_DESIGN_RULES_BASE_H__
#define __dialog_design_rules_base__ #define __DIALOG_DESIGN_RULES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class NETS_LIST_CTRL; class NETS_LIST_CTRL;
#include <wx/colour.h> #include <wx/colour.h>
...@@ -108,9 +109,9 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog ...@@ -108,9 +109,9 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
public: public:
DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 777,640 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 777,697 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DESIGN_RULES_BASE(); ~DIALOG_DESIGN_RULES_BASE();
}; };
#endif //__dialog_design_rules_base__ #endif //__DIALOG_DESIGN_RULES_BASE_H__
...@@ -139,11 +139,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s ...@@ -139,11 +139,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s
GetScreen()->m_Center = true; // Center coordinate origins on screen. GetScreen()->m_Center = true; // Center coordinate origins on screen.
LoadSettings(); LoadSettings();
// Initialize grid id to a default value if not found in config or bad:
if( ( m_LastGridSizeId <= 0 ) ||
( m_LastGridSizeId < ( ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000 ) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
......
...@@ -169,7 +169,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, ...@@ -169,7 +169,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename,
netList_Reader.m_UseCmpFile = useCmpfile; netList_Reader.m_UseCmpFile = useCmpfile;
netList_Reader.SetFilesnames( aNetlistFullFilename, aCmpFullFileName ); netList_Reader.SetFilesnames( aNetlistFullFilename, aCmpFullFileName );
// True to read footprint filters section: true for CvPcb, false pro Pcbnew // True to read footprint filters section: true for CvPcb, false for Pcbnew
netList_Reader.ReadLibpartSectionSetOpt( false ); netList_Reader.ReadLibpartSectionSetOpt( false );
bool success = netList_Reader.ReadNetList( netfile ); bool success = netList_Reader.ReadNetList( netfile );
......
...@@ -166,8 +166,8 @@ bool NETLIST_READER::InitializeModules() ...@@ -166,8 +166,8 @@ bool NETLIST_READER::InitializeModules()
if( module ) if( module )
{ {
// Update current module ( reference, value and "Time Stamp") // Update current module ( reference, value and "Time Stamp")
module->m_Reference->m_Text = currcmp_info->m_Reference; module->SetReference( currcmp_info->m_Reference );
module->m_Value->m_Text = currcmp_info->m_Value; module->SetValue(currcmp_info->m_Value );
module->SetPath( currcmp_info->m_TimeStamp ); module->SetPath( currcmp_info->m_TimeStamp );
} }
else // not existing else // not existing
...@@ -176,11 +176,33 @@ bool NETLIST_READER::InitializeModules() ...@@ -176,11 +176,33 @@ bool NETLIST_READER::InitializeModules()
} }
// clear pads netnames // clear pads netnames
#if 1
// Clear only footprints found in netlist:
// This allow to have some footprints added by hand to the board
// left initialized
for( unsigned ii = 0; ii < m_componentsInNetlist.size(); ii++ )
{
COMPONENT_INFO* currcmp_info = m_componentsInNetlist[ii];
// We can used the reference to find the footprint, because
// it is now updated
wxString * idMod = &currcmp_info->m_Reference;
MODULE* module = FindModule( *idMod );
if( module )
{
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
pad->SetNetname( wxEmptyString );
}
}
#else
// Clear all footprints
for( MODULE* module = m_pcbframe->GetBoard()->m_Modules; module; module = module->Next() ) for( MODULE* module = m_pcbframe->GetBoard()->m_Modules; module; module = module->Next() )
{ {
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
pad->SetNetname( wxEmptyString ); pad->SetNetname( wxEmptyString );
} }
#endif
return success; return success;
} }
...@@ -310,7 +332,7 @@ void NETLIST_READER::RemoveExtraFootprints() ...@@ -310,7 +332,7 @@ void NETLIST_READER::RemoveExtraFootprints()
for( ii = 0; ii < m_componentsInNetlist.size(); ii++ ) for( ii = 0; ii < m_componentsInNetlist.size(); ii++ )
{ {
COMPONENT_INFO* cmp_info = m_componentsInNetlist[ii]; COMPONENT_INFO* cmp_info = m_componentsInNetlist[ii];
if( module->m_Reference->m_Text.CmpNoCase( cmp_info->m_Reference ) == 0 ) if( module->GetReference().CmpNoCase( cmp_info->m_Reference ) == 0 )
break; // Module is found in net list. break; // Module is found in net list.
} }
...@@ -337,7 +359,7 @@ MODULE* NETLIST_READER::FindModule( const wxString& aId ) ...@@ -337,7 +359,7 @@ MODULE* NETLIST_READER::FindModule( const wxString& aId )
} }
else // identification by Reference else // identification by Reference
{ {
if( aId.CmpNoCase( module->m_Reference->m_Text ) == 0 ) if( aId.CmpNoCase( module->GetReference() ) == 0 )
return module; return module;
} }
} }
...@@ -483,7 +505,7 @@ bool NETLIST_READER::loadNewModules() ...@@ -483,7 +505,7 @@ bool NETLIST_READER::loadNewModules()
{ {
bool success = true; bool success = true;
#ifdef PCBNEW #ifdef PCBNEW
COMPONENT_INFO* ref, * cmp; COMPONENT_INFO* ref_info, * cmp_info;
MODULE* Module = NULL; MODULE* Module = NULL;
wxPoint ModuleBestPosition; wxPoint ModuleBestPosition;
BOARD* pcb = m_pcbframe->GetBoard(); BOARD* pcb = m_pcbframe->GetBoard();
...@@ -502,17 +524,18 @@ bool NETLIST_READER::loadNewModules() ...@@ -502,17 +524,18 @@ bool NETLIST_READER::loadNewModules()
ModuleBestPosition.y += 5000; ModuleBestPosition.y += 5000;
} }
ref = cmp = m_newModulesList[0]; ref_info = cmp_info = m_newModulesList[0];
for( unsigned ii = 0; ii < m_newModulesList.size(); ii++ ) for( unsigned ii = 0; ii < m_newModulesList.size(); ii++ )
{ {
cmp = m_newModulesList[ii]; cmp_info = m_newModulesList[ii];
if( (ii == 0) || ( ref->m_Footprint != cmp->m_Footprint) ) if( (ii == 0) || ( ref_info->m_Footprint != cmp_info->m_Footprint) )
{ {
// New footprint : must be loaded from a library // New footprint : must be loaded from a library
Module = m_pcbframe->GetModuleLibrary( wxEmptyString, cmp->m_Footprint, false ); Module = m_pcbframe->GetModuleLibrary( wxEmptyString,
ref = cmp; cmp_info->m_Footprint, false );
ref_info = cmp_info;
if( Module == NULL ) if( Module == NULL )
{ {
...@@ -521,8 +544,8 @@ bool NETLIST_READER::loadNewModules() ...@@ -521,8 +544,8 @@ bool NETLIST_READER::loadNewModules()
{ {
wxString msg; wxString msg;
msg.Printf( _( "Component [%s]: footprint <%s> not found" ), msg.Printf( _( "Component [%s]: footprint <%s> not found" ),
GetChars( cmp->m_Reference ), GetChars( cmp_info->m_Reference ),
GetChars( cmp->m_Footprint ) ); GetChars( cmp_info->m_Footprint ) );
msg += wxT("\n"); msg += wxT("\n");
m_messageWindow->AppendText( msg ); m_messageWindow->AppendText( msg );
...@@ -534,9 +557,9 @@ bool NETLIST_READER::loadNewModules() ...@@ -534,9 +557,9 @@ bool NETLIST_READER::loadNewModules()
/* Update schematic links : reference "Time Stamp" and schematic /* Update schematic links : reference "Time Stamp" and schematic
* hierarchical path */ * hierarchical path */
Module->m_Reference->m_Text = cmp->m_Reference; Module->SetReference( cmp_info->m_Reference );
Module->SetTimeStamp( GetNewTimeStamp() ); Module->SetTimeStamp( GetNewTimeStamp() );
Module->SetPath( cmp->m_TimeStamp ); Module->SetPath( cmp_info->m_TimeStamp );
} }
else else
{ {
...@@ -550,9 +573,9 @@ bool NETLIST_READER::loadNewModules() ...@@ -550,9 +573,9 @@ bool NETLIST_READER::loadNewModules()
pcb->Add( newmodule, ADD_APPEND ); pcb->Add( newmodule, ADD_APPEND );
Module = newmodule; Module = newmodule;
Module->m_Reference->m_Text = cmp->m_Reference; Module->SetReference( cmp_info->m_Reference );
Module->SetTimeStamp( GetNewTimeStamp() ); Module->SetTimeStamp( GetNewTimeStamp() );
Module->SetPath( cmp->m_TimeStamp ); Module->SetPath( cmp_info->m_TimeStamp );
} }
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment