From 90378c47cc3198363ad10f9965cfcd6fafb632e2 Mon Sep 17 00:00:00 2001 From: charras Date: Mon, 1 Mar 2010 17:48:17 +0000 Subject: [PATCH] Try to fix bug 2960683 in build_BOM.cpp Pad edit dialog uses now default layers names in modedit and the current board layers names in board editor --- eeschema/build_BOM.cpp | 7 ++++--- pcbnew/class_board.cpp | 1 + pcbnew/dialog_pad_properties.cpp | 21 ++++++++++++++++++++- pcbnew/globaleditpad.cpp | 6 +++--- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/eeschema/build_BOM.cpp b/eeschema/build_BOM.cpp index 651bc15f8b..a5d6c9a196 100644 --- a/eeschema/build_BOM.cpp +++ b/eeschema/build_BOM.cpp @@ -845,9 +845,10 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( NxtName[0] = 0; - // Store fields. try to store non empty fields. - if( (int)cmpFields.GetCount() < DrawLibItem->GetFieldCount() ) - cmpFields.Alloc(DrawLibItem->GetFieldCount()); + // Store fields. try to find and store non empty fields. + int needed_size = DrawLibItem->GetFieldCount() - cmpFields.GetCount(); + if( needed_size > 0 ) + cmpFields.Add(wxEmptyString, needed_size); for( int jj = FIELD1; jj < DrawLibItem->GetFieldCount(); jj++ ) { if( cmpFields[jj].IsEmpty() ) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 1a7c54b555..e09c1e8460 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -498,6 +498,7 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) case PAD_FR_VISIBLE: case PAD_BK_VISIBLE: case GRID_VISIBLE: + case RATSNEST_VISIBLE: GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor ); break; diff --git a/pcbnew/dialog_pad_properties.cpp b/pcbnew/dialog_pad_properties.cpp index 28b48c1a60..386ff32aaa 100644 --- a/pcbnew/dialog_pad_properties.cpp +++ b/pcbnew/dialog_pad_properties.cpp @@ -53,12 +53,14 @@ static long Std_Pad_Layers[NBTYPES] = /********************************************************************/ class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE { -public: +private: WinEDA_BasePcbFrame* m_Parent; D_PAD* m_CurrentPad; + BOARD * m_Board; public: DIALOG_PAD_PROPERTIES( WinEDA_BasePcbFrame* parent, D_PAD* Pad ); +private: void InitDialog( ); void OnPadShapeSelection( wxCommandEvent& event ); void OnDrillShapeSelected( wxCommandEvent& event ); @@ -77,6 +79,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( WinEDA_BasePcbFrame* parent, D_PAD { m_Parent = parent; m_CurrentPad = Pad; + m_Board = m_Parent->GetBoard(); if( m_CurrentPad ) { @@ -258,6 +261,22 @@ void DIALOG_PAD_PROPERTIES::InitDialog( ) cmd_event.SetId( m_PadType->GetSelection() ); PadTypeSelected( cmd_event ); } + + // Setup layers names from board + m_PadLayerCu->SetLabel(m_Board->GetLayerName(LAYER_N_BACK)); + m_PadLayerCmp->SetLabel(m_Board->GetLayerName(LAYER_N_FRONT)); + + m_PadLayerAdhCmp->SetLabel(m_Board->GetLayerName( ADHESIVE_N_FRONT )); + m_PadLayerAdhCu->SetLabel(m_Board->GetLayerName( ADHESIVE_N_BACK )); + m_PadLayerPateCmp->SetLabel(m_Board->GetLayerName( SOLDERPASTE_N_FRONT )); + m_PadLayerPateCu->SetLabel(m_Board->GetLayerName(SOLDERPASTE_N_BACK )); + m_PadLayerSilkCmp->SetLabel(m_Board->GetLayerName( SILKSCREEN_N_FRONT )); + m_PadLayerSilkCu->SetLabel(m_Board->GetLayerName( SILKSCREEN_N_BACK )); + m_PadLayerMaskCmp->SetLabel(m_Board->GetLayerName( SOLDERMASK_N_FRONT )); + m_PadLayerMaskCu->SetLabel(m_Board->GetLayerName( SOLDERMASK_N_BACK )); + m_PadLayerECO1->SetLabel(m_Board->GetLayerName( ECO1_N )); + m_PadLayerECO2->SetLabel(m_Board->GetLayerName( ECO2_N)); + m_PadLayerDraft->SetLabel(m_Board->GetLayerName( DRAW_N )); } diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index 9bd5644209..d6e3f9727a 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -148,7 +148,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) Module_Ref = Module; int pad_orient = aPad->m_Orient - Module_Ref->m_Orient; - // Prepare une undo list: + // Prepare an undo list: PICKED_ITEMS_LIST itemsList; Module = (MODULE*) m_Pcb->m_Modules; for( ; Module != NULL; Module = Module->Next() ) @@ -156,7 +156,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) if( !edit_Same_Modules && (Module != Module_Ref) ) continue; - if( Module->m_LibRef != Module->m_LibRef ) + if( Module->m_LibRef != Module_Ref->m_LibRef ) continue; bool saveMe = false; @@ -196,7 +196,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) if( !edit_Same_Modules && (Module != Module_Ref) ) continue; - if( Module->m_LibRef != Module->m_LibRef ) + if( Module->m_LibRef != Module_Ref->m_LibRef ) continue; /* Erase module on screen */