Commit 70de08f3 authored by jean-pierre charras's avatar jean-pierre charras

Bug fixes:

Pcbnew: refresh issue with dialog designe rules under wxWidgets 2.9.2 under WINDOWS (replace wxChoiceBox by wxComboBox, should not change anything for users)
Eeschema: some  issues in libedit (when editing a pin )
parent 0e8dbc80
......@@ -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;
......
......@@ -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();
}
......
......@@ -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 );
......
......@@ -1041,7 +1041,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......@@ -1087,7 +1087,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
......@@ -1126,7 +1126,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......@@ -1172,7 +1172,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnCBpartSelection</event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
......@@ -1271,7 +1271,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
......
......@@ -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(); }
......
......@@ -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 )
......
......@@ -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.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;
}
......
......@@ -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 )
......
......@@ -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 );
......
......@@ -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( 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;
}
if( pin && aEndPointOnly && ( component->GetPinPhysicalPosition( pin ) != aPosition ) )
else
{
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;
pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T );
if( pin )
break;
}
}
if( aComponent )
if( pin && aComponent )
*aComponent = component;
return pin;
......
......@@ -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 );
......
This diff is collapsed.
......@@ -21,7 +21,7 @@ class NETS_LIST_CTRL;
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/combobox.h>
#include <wx/listctrl.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
......@@ -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;
......
......@@ -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("<noref>") );
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++;
}
}
......
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