From ddef0a729d16005d04fddf0a9d7736bf9e4450e1 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 17 Feb 2012 20:43:43 +0100 Subject: [PATCH] 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. --- common/drawframe.cpp | 3 + eeschema/viewlib_frame.cpp | 5 - gerbview/class_gerbview_layer_widget.cpp | 19 ++- gerbview/class_gerbview_layer_widget.h | 5 +- pcbnew/class_module.h | 22 +++- pcbnew/class_pcb_layer_widget.cpp | 14 ++- pcbnew/class_pcb_layer_widget.h | 5 +- pcbnew/dialogs/dialog_design_rules_base.cpp | 28 ++++- pcbnew/dialogs/dialog_design_rules_base.fbp | 130 +++++++++++++++++++- pcbnew/dialogs/dialog_design_rules_base.h | 13 +- pcbnew/modview_frame.cpp | 5 - pcbnew/netlist.cpp | 2 +- pcbnew/netlist_reader_common.cpp | 55 ++++++--- 13 files changed, 245 insertions(+), 61 deletions(-) diff --git a/common/drawframe.cpp b/common/drawframe.cpp index fa5dfc124e..47e6bf21dc 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -823,6 +823,9 @@ void EDA_DRAW_FRAME::UpdateStatusBar() // We already decided the formatter above Line.Printf( locformatter, dXpos, dYpos ); SetStatusText( Line, 3 ); + + // refresh units display + DisplayUnitsMsg(); } diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 9818c3b6bb..0400f388ce 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -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. 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 ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index a805a6a9ba..2f1edad9cb 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -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() // 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 ); // install the right click handler into each control at end of ReFill() @@ -143,10 +143,13 @@ void GERBER_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) // menu text is capitalized: // 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 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, - _( "Hide All Layers" ) ) ); + _( "Hide All Layers" ) ) ); PopupMenu( &menu ); @@ -164,12 +167,18 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) { case ID_SHOW_ALL_COPPERS: case ID_SHOW_NO_COPPERS: + case ID_SHOW_NO_COPPERS_BUT_ACTIVE: rowCount = GetLayerRowCount(); 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 ); - cb->SetValue( visible ); - if( visible ) + cb->SetValue( loc_visible ); + if( loc_visible ) visibleLayers |= (1 << row); else visibleLayers &= ~(1 << row); diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h index c595f52b71..3c93e73571 100644 --- a/gerbview/class_gerbview_layer_widget.h +++ b/gerbview/class_gerbview_layer_widget.h @@ -44,8 +44,9 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET GERBVIEW_FRAME* myframe; // popup menu ids. -#define ID_SHOW_ALL_COPPERS wxID_HIGHEST -#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) +#define ID_SHOW_ALL_COPPERS wxID_HIGHEST +#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) +#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2) /** * Function OnRightDownLayers diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 68379b7a15..b1387c5289 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -78,12 +78,6 @@ public: wxString m_LibRef; /* Name of the module in library (and * the default value when loading a * 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 flag; /* Use to trace ratsnest and auto routing. */ @@ -340,6 +334,14 @@ public: 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 @@ -350,6 +352,14 @@ public: 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 diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index b3a7249c00..e0268d1516 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -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() // 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 ); // install the right click handler into each control at end of ReFill() @@ -121,7 +121,7 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) // menu text is capitalized: // 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_NO_COPPERS_BUT_ACTIVE, _( "Hide All Copper Layers But Active" ) ) ); menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, _( "Hide All Copper Layers" ) ) ); PopupMenu( &menu ); @@ -142,6 +142,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) visible = true; goto L_change_coppers; + case ID_SHOW_NO_COPPERS_BUT_ACTIVE: case ID_SHOW_NO_COPPERS: visible = false; L_change_coppers: @@ -165,11 +166,16 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) 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); - OnLayerVisible( layer, visible, isLastCopperLayer ); + OnLayerVisible( layer, loc_visible, isLastCopperLayer ); if( isLastCopperLayer ) break; diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h index d9c65d7a1e..10e10fbd80 100644 --- a/pcbnew/class_pcb_layer_widget.h +++ b/pcbnew/class_pcb_layer_widget.h @@ -89,8 +89,9 @@ protected: PCB_EDIT_FRAME* myframe; // popup menu ids. -#define ID_SHOW_ALL_COPPERS wxID_HIGHEST -#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) +#define ID_SHOW_ALL_COPPERS wxID_HIGHEST +#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) +#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2) /** * Function OnRightDownLayers diff --git a/pcbnew/dialogs/dialog_design_rules_base.cpp b/pcbnew/dialogs/dialog_design_rules_base.cpp index 94350bf42a..db20706cb5 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.cpp +++ b/pcbnew/dialogs/dialog_design_rules_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 17 2010) +// C++ code generated with wxFormBuilder (version Jun 30 2011) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -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 ); // Grid - m_gridViaSizeList->CreateGrid( 7, 2 ); + m_gridViaSizeList->CreateGrid( 12, 2 ); m_gridViaSizeList->EnableEditing( true ); m_gridViaSizeList->EnableGridLines( true ); m_gridViaSizeList->EnableDragGridSize( false ); @@ -274,6 +274,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_gridViaSizeList->SetRowLabelValue( 4, _("Via 5") ); m_gridViaSizeList->SetRowLabelValue( 5, _("Via 6") ); 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 ); // Label Appearance @@ -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 ); // Grid - m_gridTrackWidthList->CreateGrid( 7, 1 ); + m_gridTrackWidthList->CreateGrid( 12, 1 ); m_gridTrackWidthList->EnableEditing( true ); m_gridTrackWidthList->EnableGridLines( true ); m_gridTrackWidthList->EnableDragGridSize( false ); @@ -308,6 +313,18 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_gridTrackWidthList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // 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->SetRowLabelSize( 80 ); m_gridTrackWidthList->SetRowLabelValue( 0, _("Track 1") ); @@ -317,6 +334,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_gridTrackWidthList->SetRowLabelValue( 4, _("Track 5") ); m_gridTrackWidthList->SetRowLabelValue( 5, _("Track 6") ); 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 ); // Label Appearance diff --git a/pcbnew/dialogs/dialog_design_rules_base.fbp b/pcbnew/dialogs/dialog_design_rules_base.fbp index d4df936588..d8f1ee15d0 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.fbp +++ b/pcbnew/dialogs/dialog_design_rules_base.fbp @@ -7,6 +7,7 @@ 1 source_name 0 + res UTF-8 connect dialog_design_rules_base @@ -28,6 +29,7 @@ 1 0 + 1 @@ -50,8 +52,10 @@ 0 wxID_ANY + 0 + 0 -1,-1 1 @@ -65,7 +69,7 @@ Resizable 1 - 777,640 + 777,697 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Design Rules Editor @@ -80,6 +84,12 @@ + + + + + + @@ -123,6 +133,7 @@ 1 1 + @@ -143,8 +154,10 @@ 0 wxID_ANY + 0 + 0 1 @@ -206,6 +219,7 @@ 1 1 + 1 @@ -225,8 +239,10 @@ 0 wxID_ANY + 0 + 0 1 @@ -304,6 +320,7 @@ 0 1 + 1 @@ -346,8 +363,10 @@ 0 0 + 0 + 0 -1,-1 1 @@ -455,6 +474,7 @@ 1 1 + 1 @@ -476,8 +496,10 @@ wxID_ADD_NETCLASS Add + 0 + 0 1 @@ -540,6 +562,7 @@ 1 1 + 1 @@ -561,8 +584,10 @@ wxID_REMOVE_NETCLASS Remove + 0 + 0 1 @@ -625,6 +650,7 @@ 1 1 + 1 @@ -646,8 +672,10 @@ wxID_ANY Move Up + 0 + 0 1 @@ -735,6 +763,7 @@ 1 1 + 1 @@ -755,8 +784,10 @@ 0 wxID_ANY + 0 + 0 1 @@ -822,6 +853,7 @@ 1 1 + 1 @@ -841,8 +873,10 @@ 0 wxID_ANY + 0 + 0 220,200 1 @@ -935,6 +969,7 @@ 1 1 + 1 @@ -956,8 +991,10 @@ ID_LEFT_TO_RIGHT_COPY <<< + 0 + 0 1 @@ -1020,6 +1057,7 @@ 1 1 + 1 @@ -1041,8 +1079,10 @@ ID_RIGHT_TO_LEFT_COPY >>> + 0 + 0 1 @@ -1105,6 +1145,7 @@ 1 1 + 1 @@ -1126,8 +1167,10 @@ wxID_ANY << Select All + 0 + 0 1 @@ -1190,6 +1233,7 @@ 1 1 + 1 @@ -1211,8 +1255,10 @@ wxID_ANY Select All >> + 0 + 0 1 @@ -1286,6 +1332,7 @@ 1 1 + 1 @@ -1306,8 +1353,10 @@ 0 wxID_ANY + 0 + 0 1 @@ -1373,6 +1422,7 @@ 1 1 + 1 @@ -1392,8 +1442,10 @@ 0 wxID_ANY + 0 + 0 220,-1 1 @@ -1482,6 +1534,7 @@ 1 1 + 1 @@ -1501,8 +1554,10 @@ 0 wxID_ANY + 0 + 0 1 @@ -1587,6 +1642,7 @@ 1 1 + 1 @@ -1609,8 +1665,10 @@ Default Via Type 1 + 0 + 0 1 @@ -1674,6 +1732,7 @@ 1 1 + 1 @@ -1696,8 +1755,10 @@ Micro Vias: 1 + 0 + 0 1 @@ -1791,6 +1852,7 @@ 1 1 + 1 @@ -1811,8 +1873,10 @@ wxID_ANY Min track width + 0 + 0 1 @@ -1875,6 +1939,7 @@ 1 1 + 1 @@ -1894,9 +1959,11 @@ 0 wxID_ANY + 0 0 + 0 1 @@ -1963,6 +2030,7 @@ 1 1 + 1 @@ -1983,8 +2051,10 @@ wxID_ANY Min via diameter + 0 + 0 1 @@ -2047,6 +2117,7 @@ 1 1 + 1 @@ -2066,9 +2137,11 @@ 0 wxID_ANY + 0 0 + 0 1 @@ -2135,6 +2208,7 @@ 1 1 + 1 @@ -2155,8 +2229,10 @@ wxID_ANY Min via drill dia + 0 + 0 1 @@ -2219,6 +2295,7 @@ 1 1 + 1 @@ -2238,9 +2315,11 @@ 0 wxID_ANY + 0 0 + 0 1 @@ -2307,6 +2386,7 @@ 1 1 + 1 @@ -2327,8 +2407,10 @@ wxID_ANY Min uvia diameter + 0 + 0 1 @@ -2391,6 +2473,7 @@ 1 1 + 1 @@ -2410,9 +2493,11 @@ 0 wxID_ANY + 0 6 + 0 1 @@ -2479,6 +2564,7 @@ 1 1 + 1 @@ -2499,8 +2585,10 @@ wxID_ANY Min uvia drill dia + 0 + 0 1 @@ -2563,6 +2651,7 @@ 1 1 + 1 @@ -2582,9 +2671,11 @@ 0 wxID_ANY + 0 6 + 0 1 @@ -2657,6 +2748,7 @@ 1 1 + 1 @@ -2676,8 +2768,10 @@ 0 wxID_ANY + 0 + 0 1 @@ -2739,6 +2833,7 @@ 1 1 + 1 @@ -2759,8 +2854,10 @@ wxID_ANY Specific via diameters and track widths, which can be used to replace default Netclass values on demand, for arbitrary via or track segments. + 0 + 0 1 @@ -2844,6 +2941,7 @@ 1 1 + 1 @@ -2864,8 +2962,10 @@ wxID_ANY Drill value: a blank or 0 => default Netclass value + 0 + 0 1 @@ -2930,6 +3030,7 @@ 0 0 + 1 @@ -2972,8 +3073,10 @@ 0 0 + 0 + 0 1 @@ -2989,10 +3092,10 @@ wxALIGN_CENTRE 80 - "Via 1" "Via 2" "Via 3" "Via 4" "Via 5" "Via 6" "Via 7" + "Via 1" "Via 2" "Via 3" "Via 4" "Via 5" "Via 6" "Via 7" "Via 8" "Via 9" "Via 10" "Via 11" "Via 12" wxALIGN_CENTRE - 7 + 12 1 @@ -3086,6 +3189,7 @@ 1 1 + 1 @@ -3106,8 +3210,10 @@ wxID_ANY + 0 + 0 1 @@ -3172,6 +3278,7 @@ 0 0 + 1 @@ -3214,8 +3321,10 @@ 0 0 + 0 + 0 1 @@ -3231,10 +3340,10 @@ wxALIGN_CENTRE 80 - "Track 1" "Track 2" "Track 3" "Track 4" "Track 5" "Track 6" "Track 7" + "Track 1" "Track 2" "Track 3" "Track 4" "Track 5" "Track 6" "Track 7" "Track 8" "Track 9" "Track 10" "Track 11" "Track 12" wxALIGN_CENTRE - - 7 + 17,17,17,17,17,17,17,17,17,17,17,17 + 12 1 @@ -3335,6 +3444,7 @@ 1 1 + 1 @@ -3354,8 +3464,10 @@ 0 wxID_ANY + 0 + 0 -1,90 1 @@ -3429,6 +3541,7 @@ 1 1 + 1 @@ -3450,8 +3563,10 @@ wxID_OK OK + 0 + 0 1 @@ -3514,6 +3629,7 @@ 1 1 + 1 @@ -3535,8 +3651,10 @@ wxID_CANCEL Cancel + 0 + 0 1 diff --git a/pcbnew/dialogs/dialog_design_rules_base.h b/pcbnew/dialogs/dialog_design_rules_base.h index abed4f8d8b..b29df0fa9c 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.h +++ b/pcbnew/dialogs/dialog_design_rules_base.h @@ -1,15 +1,16 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 17 2010) +// C++ code generated with wxFormBuilder (version Jun 30 2011) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __dialog_design_rules_base__ -#define __dialog_design_rules_base__ +#ifndef __DIALOG_DESIGN_RULES_BASE_H__ +#define __DIALOG_DESIGN_RULES_BASE_H__ +#include +#include #include - class NETS_LIST_CTRL; #include @@ -108,9 +109,9 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog 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(); }; -#endif //__dialog_design_rules_base__ +#endif //__DIALOG_DESIGN_RULES_BASE_H__ diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index f7ef62e78a..4735f038ed 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -139,11 +139,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s GetScreen()->m_Center = true; // Center coordinate origins on screen. 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 ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 8b96bb998d..a38a04bf7e 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -169,7 +169,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, netList_Reader.m_UseCmpFile = useCmpfile; 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 ); bool success = netList_Reader.ReadNetList( netfile ); diff --git a/pcbnew/netlist_reader_common.cpp b/pcbnew/netlist_reader_common.cpp index 1fc8454efb..b20baad8c1 100644 --- a/pcbnew/netlist_reader_common.cpp +++ b/pcbnew/netlist_reader_common.cpp @@ -166,8 +166,8 @@ bool NETLIST_READER::InitializeModules() if( module ) { // Update current module ( reference, value and "Time Stamp") - module->m_Reference->m_Text = currcmp_info->m_Reference; - module->m_Value->m_Text = currcmp_info->m_Value; + module->SetReference( currcmp_info->m_Reference ); + module->SetValue(currcmp_info->m_Value ); module->SetPath( currcmp_info->m_TimeStamp ); } else // not existing @@ -176,11 +176,33 @@ bool NETLIST_READER::InitializeModules() } // 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( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() ) pad->SetNetname( wxEmptyString ); } +#endif return success; } @@ -310,7 +332,7 @@ void NETLIST_READER::RemoveExtraFootprints() for( ii = 0; ii < m_componentsInNetlist.size(); 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. } @@ -337,7 +359,7 @@ MODULE* NETLIST_READER::FindModule( const wxString& aId ) } else // identification by Reference { - if( aId.CmpNoCase( module->m_Reference->m_Text ) == 0 ) + if( aId.CmpNoCase( module->GetReference() ) == 0 ) return module; } } @@ -483,7 +505,7 @@ bool NETLIST_READER::loadNewModules() { bool success = true; #ifdef PCBNEW - COMPONENT_INFO* ref, * cmp; + COMPONENT_INFO* ref_info, * cmp_info; MODULE* Module = NULL; wxPoint ModuleBestPosition; BOARD* pcb = m_pcbframe->GetBoard(); @@ -502,17 +524,18 @@ bool NETLIST_READER::loadNewModules() ModuleBestPosition.y += 5000; } - ref = cmp = m_newModulesList[0]; + ref_info = cmp_info = m_newModulesList[0]; 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 - Module = m_pcbframe->GetModuleLibrary( wxEmptyString, cmp->m_Footprint, false ); - ref = cmp; + Module = m_pcbframe->GetModuleLibrary( wxEmptyString, + cmp_info->m_Footprint, false ); + ref_info = cmp_info; if( Module == NULL ) { @@ -521,8 +544,8 @@ bool NETLIST_READER::loadNewModules() { wxString msg; msg.Printf( _( "Component [%s]: footprint <%s> not found" ), - GetChars( cmp->m_Reference ), - GetChars( cmp->m_Footprint ) ); + GetChars( cmp_info->m_Reference ), + GetChars( cmp_info->m_Footprint ) ); msg += wxT("\n"); m_messageWindow->AppendText( msg ); @@ -534,9 +557,9 @@ bool NETLIST_READER::loadNewModules() /* Update schematic links : reference "Time Stamp" and schematic * hierarchical path */ - Module->m_Reference->m_Text = cmp->m_Reference; + Module->SetReference( cmp_info->m_Reference ); Module->SetTimeStamp( GetNewTimeStamp() ); - Module->SetPath( cmp->m_TimeStamp ); + Module->SetPath( cmp_info->m_TimeStamp ); } else { @@ -550,9 +573,9 @@ bool NETLIST_READER::loadNewModules() pcb->Add( newmodule, ADD_APPEND ); Module = newmodule; - Module->m_Reference->m_Text = cmp->m_Reference; + Module->SetReference( cmp_info->m_Reference ); Module->SetTimeStamp( GetNewTimeStamp() ); - Module->SetPath( cmp->m_TimeStamp ); + Module->SetPath( cmp_info->m_TimeStamp ); } } #endif