diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 2172f02faa..f3153cea8a 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -1371,8 +1371,8 @@ LIB_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, { /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const * wxPoint& pt ) to search items. - * because this function uses DefaultTransformMatrix as orient/mirror matrix - * we temporary copy aTransMat in DefaultTransformMatrix + * because this function uses DefaultTransform as orient/mirror matrix + * we temporary copy aTransform in DefaultTransform */ LIB_ITEM* item; TRANSFORM transform = DefaultTransform; diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp index bc5997518c..78780c5375 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp @@ -16,6 +16,10 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : DIALOG_LIB_EDIT_PIN_BASE( parent ) { m_dummyPin = new LIB_PIN( *aPin ); + + // m_dummyPin changes do not proparagte to a parent, so set parent to null + m_dummyPin->SetParent( NULL ); + m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); /* Required to make escape key work correctly in wxGTK. */ @@ -54,6 +58,12 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) wxSize dc_size = dc.GetSize(); dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 ); + // Give a parent to m_dummyPin only from draw purpose. + // In fact m_dummyPin should not have a parent, but draw functions need a parent + // to know some options + LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); + m_dummyPin->SetParent( libframe->GetComponent() ); + // Calculate a suitable scale to fit the available draw area EDA_RECT bBox = m_dummyPin->GetBoundingBox(); double xscale = (double) dc_size.x / bBox.GetWidth(); @@ -69,9 +79,12 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) NEGATE( offset.y ); GRResetPenAndBrush( &dc ); + m_dummyPin->SetVisible( true ); // TODO find a better way to show invisible pin here m_dummyPin->Draw( NULL, &dc, offset, -1, wxCOPY, NULL, DefaultTransform ); + m_dummyPin->SetParent(NULL); + event.Skip(); } @@ -116,6 +129,7 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) m_dummyPin->SetOrientation( pinOrient ); m_dummyPin->SetLength( pinLength ); m_dummyPin->SetShape( pinShape ); + m_dummyPin->SetVisible( GetVisible() ); m_panelShowPin->Refresh(); } diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp index f5af53b66d..e13159def3 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp @@ -78,10 +78,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID sbSizerPinSharing = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pin Sharing") ), wxVERTICAL ); m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Add to all &parts in package"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkApplyToAllParts->SetValue(true); sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Add to all alternate &body styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkApplyToAllConversions->SetValue(true); sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); boarderSizer->Add( sbSizerPinSharing, 0, wxEXPAND|wxALL, 5 ); @@ -175,7 +175,9 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); - m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCBpartSelection ), NULL, this ); + m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); + m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); + m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_textPinNameTextSize->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_textPadNameTextSize->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_textLength->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); @@ -193,7 +195,9 @@ DIALOG_LIB_EDIT_PIN_BASE::~DIALOG_LIB_EDIT_PIN_BASE() m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); - m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCBpartSelection ), NULL, this ); + m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); + m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); + m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_textPinNameTextSize->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_textPadNameTextSize->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); m_textLength->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this ); diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp index 6088d45d1a..7820d2c5af 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp +++ b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp @@ -1041,7 +1041,7 @@ 1 0 - 1 + 0 1 1 @@ -1087,7 +1087,7 @@ - + OnPropertiesChange @@ -1126,7 +1126,7 @@ 1 0 - 0 + 1 1 1 @@ -1172,7 +1172,7 @@ - OnCBpartSelection + OnPropertiesChange @@ -1271,7 +1271,7 @@ - + OnPropertiesChange diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.h b/eeschema/dialogs/dialog_lib_edit_pin_base.h index 08362a91f5..2f39eae75b 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_base.h +++ b/eeschema/dialogs/dialog_lib_edit_pin_base.h @@ -85,7 +85,6 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog // Virtual event handlers, overide them in your derived class virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); } virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCBpartSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); } virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index db89bae335..2dd98d9d48 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -924,7 +924,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, break; case HK_EDIT: - if( itemInEdit ) + if( ! itemInEdit ) m_drawItem = LocateItemUsingCursor( aPosition ); if( m_drawItem ) diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 073d80ef37..6cdf5c8363 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -531,9 +531,15 @@ bool LIB_PIN::HitTest( const wxPoint& aPosition ) bool LIB_PIN::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform ) { + TRANSFORM transform = DefaultTransform; + DefaultTransform = aTransform; + EDA_RECT rect = GetBoundingBox(); rect.Inflate( aThreshold ); + //Restore matrix + DefaultTransform = transform; + return rect.Contains( aPosition ); } @@ -829,8 +835,12 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, * box calculation. */ #if 0 EDA_RECT* clipbox = aPanel ? &aPanel->m_ClipBox : NULL; + TRANSFORM transform = DefaultTransform; + DefaultTransform = aTransform; EDA_RECT bBox = GetBoundingBox(); bBox.Move( aOffset ); + //Restore matrix + DefaultTransform = transform; GRRect( clipbox, aDC, bBox, 0, LIGHTMAGENTA ); #endif } @@ -1731,7 +1741,7 @@ void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* frame ) /** * Function GetBoundingBox * @return the boundary box for this, in schematic coordinates - * for a not rotated, not mirrored component + * Uses DefaultTransform as transform matrix */ EDA_RECT LIB_PIN::GetBoundingBox() const { @@ -1741,6 +1751,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const wxPoint end; int nameTextOffset = 0; bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" )); + bool showNum = m_number != 0; int symbolX = TARGET_PIN_DIAM / 2; int symbolY = TARGET_PIN_DIAM / 2; @@ -1750,14 +1761,15 @@ EDA_RECT LIB_PIN::GetBoundingBox() const nameTextOffset = entry->GetPinNameOffset(); else showName = false; + + showNum = entry->ShowPinNumbers(); } // First, calculate boundary box corners position - int numberTextLength = m_PinNumSize * GetNumberString().Len(); + int numberTextLength = showNum ? m_PinNumSize * GetNumberString().Len() : 0; // Actual text height are bigger than text size - int nameTextHeight = wxRound( m_PinNameSize * 1.1 ); - int numberTextHeight = wxRound( m_PinNumSize * 1.1 ); + int numberTextHeight = showNum ? wxRound( m_PinNumSize * 1.1 ) : 0; if( m_shape & INVERT ) symbolX = symbolY = INVERT_PIN_RADIUS; @@ -1769,6 +1781,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const // calculate bottom right corner position and adjust top left corner position int nameTextLength = 0; + int nameTextHeight = 0; if( showName ) { @@ -1779,18 +1792,15 @@ EDA_RECT LIB_PIN::GetBoundingBox() const length -= 1; nameTextLength = ( m_PinNameSize * length ) + nameTextOffset; + // Actual text height are bigger than text size + nameTextHeight = wxRound( m_PinNameSize * 1.1 ); } - if( showName ) - { - end.y = -nameTextHeight / 2; - end.x = m_length + nameTextLength; - } - else - { + end.x = m_length + nameTextLength; + + end.y = -nameTextHeight / 2; + if( end.y > -symbolY ) end.y = -symbolY; - end.x = m_length; - } // Now, calculate boundary box corners position for the actual pin orientation switch( m_orientation ) @@ -1820,14 +1830,13 @@ EDA_RECT LIB_PIN::GetBoundingBox() const break; } - bbox.SetOrigin( m_position + begin ); - bbox.SetEnd( m_position + end ); - bbox.Inflate( GetPenSize() / 2 ); - - NEGATE( bbox.m_Pos.y ); // Reverse the Y axis, according to the schematic orientation - NEGATE( bbox.m_Size.y ); // Reverse the Y axis, according to the schematic orientation + begin = DefaultTransform.TransformCoordinate( begin + m_position); + end = DefaultTransform.TransformCoordinate( end + m_position); + bbox.SetOrigin( begin ); + bbox.SetEnd( end ); bbox.Normalize(); + bbox.Inflate( GetPenSize() / 2 ); return bbox; } diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 826e5794e8..eb25fef4d4 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -226,14 +226,14 @@ EDA_RECT LIB_RECTANGLE::GetBoundingBox() const rect.SetOrigin( m_Pos.x, m_Pos.y * -1 ); rect.SetEnd( m_End.x, m_End.y * -1 ); - rect.Inflate( m_Width / 2, m_Width / 2 ); + rect.Inflate( (GetPenSize() / 2) + 1 ); return rect; } bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition ) { - int mindist = ( m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2 ) + 1; + int mindist = ( GetPenSize() / 2 ) + 1; // Have a minimal tolerance for hit test if( mindist < MINIMUM_SELECTION_DISTANCE ) diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 1a613eac50..261c388841 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -65,6 +65,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, pin->m_PinNumSize, m_InternalUnits ) ); + dlg.SetPadNameTextSizeUnits( units ); dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength(), m_InternalUnits ) ); dlg.SetLengthUnits( units ); @@ -368,7 +369,8 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC ) pin->SetConvert( LastPinCommonConvert ? 0 : m_convert ); pin->SetUnit( LastPinCommonUnit ? 0 : m_unit ); pin->SetVisible( LastPinVisible ); - +//PlacePin( DC ); +//m_drawItem = pin; PinPreviousPos = pin->GetPosition(); DrawPanel->m_IgnoreMouseEvents = true; wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 1531a6105e..d9db462bc3 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -610,21 +610,36 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen component = (SCH_COMPONENT*) item; - pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T ); - - if( pin ) - break; + if( aEndPointOnly ) + { + pin = NULL; + LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() ); + if( entry == NULL ) + continue; + for( pin = entry->GetNextPin(); pin != NULL; pin = entry->GetNextPin( pin ) ) + { + // Skip items not used for this part. + if( component->GetUnit() && pin->GetUnit() && + ( pin->GetUnit() != component->GetUnit() ) ) + continue; + if( component->GetConvert() && pin->GetConvert() && + ( pin->GetConvert() != component->GetConvert() ) ) + continue; + if(component->GetPinPhysicalPosition( pin ) == aPosition ) + break; + } + if( pin ) + break; + } + else + { + pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T ); + if( pin ) + break; + } } - if( pin && aEndPointOnly && ( component->GetPinPhysicalPosition( pin ) != aPosition ) ) - { - wxPoint endpt = component->GetPinPhysicalPosition( pin ); - wxLogDebug( wxString::Format( wxT( "Pin end point at (%d, %d) not (%d, %d )." ), - endpt.x, endpt.y, aPosition.x, aPosition.y ) ); - pin = NULL; - } - - if( aComponent ) + if( pin && aComponent ) *aComponent = component; return pin; diff --git a/pcbnew/dialogs/dialog_design_rules_base.cpp b/pcbnew/dialogs/dialog_design_rules_base.cpp index b9fb6b34a7..94350bf42a 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.cpp +++ b/pcbnew/dialogs/dialog_design_rules_base.cpp @@ -23,8 +23,8 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID wxBoxSizer* bpanelNetClassesSizer; bpanelNetClassesSizer = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* sbSizer1; - sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_panelNetClassesEditor, wxID_ANY, _("Net Classes:") ), wxVERTICAL ); + wxStaticBoxSizer* sbSizerUpper; + sbSizerUpper = new wxStaticBoxSizer( new wxStaticBox( m_panelNetClassesEditor, wxID_ANY, _("Net Classes:") ), wxVERTICAL ); m_grid = new wxGrid( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxVSCROLL ); @@ -66,7 +66,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_grid->SetToolTip( _("Net Class parameters") ); - sbSizer1->Add( m_grid, 1, wxEXPAND, 5 ); + sbSizerUpper->Add( m_grid, 1, wxEXPAND, 5 ); wxBoxSizer* buttonBoxSizer; buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -86,19 +86,17 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID buttonBoxSizer->Add( m_moveUpButton, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - sbSizer1->Add( buttonBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); + sbSizerUpper->Add( buttonBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 ); - bpanelNetClassesSizer->Add( sbSizer1, 1, wxRIGHT|wxLEFT|wxEXPAND, 5 ); + bpanelNetClassesSizer->Add( sbSizerUpper, 1, wxRIGHT|wxLEFT|wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizer4; - sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelNetClassesEditor, wxID_ANY, _("Membership:") ), wxHORIZONTAL ); + wxStaticBoxSizer* sbSizerNetSelectMain; + sbSizerNetSelectMain = new wxStaticBoxSizer( new wxStaticBox( m_panelNetClassesEditor, wxID_ANY, _("Membership:") ), wxHORIZONTAL ); wxBoxSizer* leftNetSelectBoxSizer; leftNetSelectBoxSizer = new wxBoxSizer( wxVERTICAL ); - wxArrayString m_leftClassChoiceChoices; - m_leftClassChoice = new wxChoice( m_panelNetClassesEditor, ID_LEFT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_leftClassChoiceChoices, 0 ); - m_leftClassChoice->SetSelection( 0 ); + m_leftClassChoice = new wxComboBox( m_panelNetClassesEditor, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxEXPAND, 5 ); m_leftListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER ); @@ -106,7 +104,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxEXPAND|wxTOP, 5 ); - sbSizer4->Add( leftNetSelectBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + sbSizerNetSelectMain->Add( leftNetSelectBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bmiddleSizerNetSelect; bmiddleSizerNetSelect = new wxBoxSizer( wxVERTICAL ); @@ -131,14 +129,12 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID bmiddleSizerNetSelect->Add( m_buttonRightSelAll, 0, wxALIGN_BOTTOM|wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - sbSizer4->Add( bmiddleSizerNetSelect, 0, wxALIGN_CENTER_VERTICAL, 5 ); + sbSizerNetSelectMain->Add( bmiddleSizerNetSelect, 0, wxALIGN_CENTER_VERTICAL, 5 ); wxBoxSizer* rghtNetSelectBoxSizer; rghtNetSelectBoxSizer = new wxBoxSizer( wxVERTICAL ); - wxArrayString m_rightClassChoiceChoices; - m_rightClassChoice = new wxChoice( m_panelNetClassesEditor, ID_RIGHT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_rightClassChoiceChoices, 0 ); - m_rightClassChoice->SetSelection( 0 ); + m_rightClassChoice = new wxComboBox( m_panelNetClassesEditor, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxEXPAND, 5 ); m_rightListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER ); @@ -146,14 +142,14 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxEXPAND|wxTOP, 5 ); - sbSizer4->Add( rghtNetSelectBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + sbSizerNetSelectMain->Add( rghtNetSelectBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - bpanelNetClassesSizer->Add( sbSizer4, 2, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bpanelNetClassesSizer->Add( sbSizerNetSelectMain, 2, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_panelNetClassesEditor->SetSizer( bpanelNetClassesSizer ); m_panelNetClassesEditor->Layout(); bpanelNetClassesSizer->Fit( m_panelNetClassesEditor ); - m_DRnotebook->AddPage( m_panelNetClassesEditor, _("Net Classes Editor"), false ); + m_DRnotebook->AddPage( m_panelNetClassesEditor, _("Net Classes Editor"), true ); m_panelGolbalDesignRules = new wxPanel( m_DRnotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); wxBoxSizer* bpanelGlobRulesSizer; bpanelGlobRulesSizer = new wxBoxSizer( wxVERTICAL ); @@ -336,7 +332,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_panelGolbalDesignRules->SetSizer( bpanelGlobRulesSizer ); m_panelGolbalDesignRules->Layout(); bpanelGlobRulesSizer->Fit( m_panelGolbalDesignRules ); - m_DRnotebook->AddPage( m_panelGolbalDesignRules, _("Global Design Rules"), true ); + m_DRnotebook->AddPage( m_panelGolbalDesignRules, _("Global Design Rules"), false ); bMainSizer->Add( m_DRnotebook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); @@ -371,12 +367,12 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this ); m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this ); m_moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveUpSelectedNetClass ), NULL, this ); - m_leftClassChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this ); + m_leftClassChoice->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this ); m_buttonRightToLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightToLeftCopyButton ), NULL, this ); m_buttonLeftToRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftToRightCopyButton ), NULL, this ); m_buttonLeftSelAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftSelectAllButton ), NULL, this ); m_buttonRightSelAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightSelectAllButton ), NULL, this ); - m_rightClassChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this ); + m_rightClassChoice->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this ); m_buttonOk->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnOkButtonClick ), NULL, this ); m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnCancelButtonClick ), NULL, this ); } @@ -389,12 +385,12 @@ DIALOG_DESIGN_RULES_BASE::~DIALOG_DESIGN_RULES_BASE() m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this ); m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this ); m_moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveUpSelectedNetClass ), NULL, this ); - m_leftClassChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this ); + m_leftClassChoice->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this ); m_buttonRightToLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightToLeftCopyButton ), NULL, this ); m_buttonLeftToRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftToRightCopyButton ), NULL, this ); m_buttonLeftSelAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftSelectAllButton ), NULL, this ); m_buttonRightSelAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightSelectAllButton ), NULL, this ); - m_rightClassChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this ); + m_rightClassChoice->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this ); m_buttonOk->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnOkButtonClick ), NULL, this ); m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnCancelButtonClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_design_rules_base.fbp b/pcbnew/dialogs/dialog_design_rules_base.fbp index 8e1edde4d7..d4df936588 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.fbp +++ b/pcbnew/dialogs/dialog_design_rules_base.fbp @@ -199,7 +199,7 @@ Net Classes Editor - 0 + 1 1 1 @@ -288,7 +288,7 @@ wxID_ANY Net Classes: - sbSizer1 + sbSizerUpper wxVERTICAL none @@ -712,7 +712,7 @@ wxID_ANY Membership: - sbSizer4 + sbSizerNetSelectMain wxHORIZONTAL none @@ -729,7 +729,7 @@ 5 wxEXPAND 0 - + 1 1 1 @@ -753,7 +753,7 @@ 0 0 - ID_LEFT_CHOICE_CLICK + wxID_ANY 0 @@ -770,9 +770,9 @@ Resizable - 0 1 + wxCB_READONLY 0 @@ -780,11 +780,12 @@ wxFILTER_NONE wxDefaultValidator + - OnLeftCBSelection + OnLeftCBSelection @@ -806,6 +807,8 @@ + + @@ -1277,7 +1280,7 @@ 5 wxEXPAND 0 - + 1 1 1 @@ -1301,7 +1304,7 @@ 0 0 - ID_RIGHT_CHOICE_CLICK + wxID_ANY 0 @@ -1318,9 +1321,9 @@ Resizable - 0 1 + wxCB_READONLY 0 @@ -1328,11 +1331,12 @@ wxFILTER_NONE wxDefaultValidator + - OnRightCBSelection + OnRightCBSelection @@ -1354,6 +1358,8 @@ + + @@ -1469,7 +1475,7 @@ Global Design Rules - 1 + 0 1 1 diff --git a/pcbnew/dialogs/dialog_design_rules_base.h b/pcbnew/dialogs/dialog_design_rules_base.h index 3a0014741f..abed4f8d8b 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.h +++ b/pcbnew/dialogs/dialog_design_rules_base.h @@ -21,7 +21,7 @@ class NETS_LIST_CTRL; #include #include #include -#include +#include #include #include #include @@ -49,10 +49,8 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog { wxID_ADD_NETCLASS = 1000, wxID_REMOVE_NETCLASS, - ID_LEFT_CHOICE_CLICK, ID_LEFT_TO_RIGHT_COPY, ID_RIGHT_TO_LEFT_COPY, - ID_RIGHT_CHOICE_CLICK, }; wxNotebook* m_DRnotebook; @@ -61,13 +59,13 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog wxButton* m_addButton; wxButton* m_removeButton; wxButton* m_moveUpButton; - wxChoice* m_leftClassChoice; + wxComboBox* m_leftClassChoice; NETS_LIST_CTRL* m_leftListCtrl; wxButton* m_buttonRightToLeft; wxButton* m_buttonLeftToRight; wxButton* m_buttonLeftSelAll; wxButton* m_buttonRightSelAll; - wxChoice* m_rightClassChoice; + wxComboBox* m_rightClassChoice; NETS_LIST_CTRL* m_rightListCtrl; wxPanel* m_panelGolbalDesignRules; wxRadioBox* m_OptViaType; diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 12bf67dbb0..423417377e 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -42,7 +42,7 @@ #include "dialog_netlist.h" -// constants used by ReadPcbNetlist(): +// constants used by ReadNetlistModuleDescr(): #define TESTONLY true #define READMODULE false @@ -565,10 +565,10 @@ MODULE* NETLIST_READER::ReadNetlistModuleDescr( char* aText, bool aTstOnly ) } if( found ) // The footprint corresponding to the component is already on board { - // We do do load the footprint, because it is already on board - // but we compare m_LibRef (existing footprint name) and the footprint name from netlist - // and change this footprint if differs from netlist (only on demand). - if( aTstOnly != TESTONLY ) + // This footprint is already on board + // but if m_LibRef (existing footprint name) and the footprint name from netlist + // do not match, change this footprint on demand. + if( ! aTstOnly ) { cmpFootprintName = textFootprintName; // Use footprint name from netlist if( m_useCmpFile ) // Try to get footprint name from .cmp file @@ -622,7 +622,7 @@ MODULE* NETLIST_READER::ReadNetlistModuleDescr( char* aText, bool aTstOnly ) m_useCmpFile = readModuleComponentLinkfile( identMod, cmpFootprintName ); } - if( aTstOnly == TESTONLY ) + if( aTstOnly ) { MODULE_INFO* newMod; newMod = new MODULE_INFO( cmpFootprintName, textCmpReference, timeStampPath ); @@ -785,16 +785,19 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( /* Search for duplicate footprints. */ list.Add( _( "Duplicates" ) ); - MODULE* Module = GetBoard()->m_Modules; - for( ; Module != NULL; Module = Module->Next() ) + MODULE* module = GetBoard()->m_Modules; + for( ; module != NULL; module = module->Next() ) { - MODULE* pt_aux = Module->Next(); + MODULE* altmodule = module->Next(); - for( ; pt_aux != NULL; pt_aux = pt_aux->Next() ) + for( ; altmodule != NULL; altmodule = altmodule->Next() ) { - if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference->m_Text ) == 0 ) + if( module->m_Reference->m_Text.CmpNoCase( altmodule->m_Reference->m_Text ) == 0 ) { - list.Add( Module->m_Reference->m_Text ); + if( module->m_Reference->m_Text.IsEmpty() ) + list.Add( wxT("") ); + else + list.Add( module->m_Reference->m_Text ); nberr++; break; } @@ -806,17 +809,17 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( for( ii = 0; ii < NbModulesNetListe; ii++ ) { - Module = (MODULE*) GetBoard()->m_Modules; + module = (MODULE*) GetBoard()->m_Modules; - for( ; Module != NULL; Module = Module->Next() ) + for( ; module != NULL; module = module->Next() ) { - if( Module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 ) + if( module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 ) { break; } } - if( Module == NULL ) // Module missing, not found in board + if( module == NULL ) // Module missing, not found in board { list.Add( tmp[ii] ); nberr++; @@ -826,12 +829,12 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( /* Search for modules not in net list. */ list.Add( _( "Not in Netlist:" ) ); - Module = GetBoard()->m_Modules; - for( ; Module != NULL; Module = Module->Next() ) + module = GetBoard()->m_Modules; + for( ; module != NULL; module = module->Next() ) { for( ii = 0; ii < NbModulesNetListe; ii++ ) { - if( Module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 ) + if( module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 ) { break; /* Module is in net list. */ } @@ -839,7 +842,7 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( if( ii == NbModulesNetListe ) /* Module not found in netlist */ { - list.Add( Module->m_Reference->m_Text ); + list.Add( module->m_Reference->m_Text ); nberr++; } }