Commit 20dfe9ca authored by jean-pierre charras's avatar jean-pierre charras

Minor fixes: dialog_create_array.* files: clean code ( remove useless...

Minor fixes: dialog_create_array.*  files:  clean code ( remove useless declarations and functions ). 
fix a few coverity warnings about not initialized members in ctors.
parent e637493e
...@@ -133,12 +133,6 @@ void DIALOG_CREATE_ARRAY::OnParameterChanged( wxCommandEvent& event ) ...@@ -133,12 +133,6 @@ void DIALOG_CREATE_ARRAY::OnParameterChanged( wxCommandEvent& event )
} }
void DIALOG_CREATE_ARRAY::OnCancelClick( wxCommandEvent& event )
{
EndModal( CREATE_ARRAY_ABORT );
}
static const std::string& alphabetFromNumberingScheme( static const std::string& alphabetFromNumberingScheme(
DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T type ) DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T type )
{ {
...@@ -318,7 +312,7 @@ void DIALOG_CREATE_ARRAY::OnOkClick( wxCommandEvent& event ) ...@@ -318,7 +312,7 @@ void DIALOG_CREATE_ARRAY::OnOkClick( wxCommandEvent& event )
ReadConfigFromControls(); ReadConfigFromControls();
EndModal( CREATE_ARRAY_OK ); EndModal( wxID_OK );
} }
} }
...@@ -359,11 +353,10 @@ void DIALOG_CREATE_ARRAY::calculateCircularArrayProperties() ...@@ -359,11 +353,10 @@ void DIALOG_CREATE_ARRAY::calculateCircularArrayProperties()
centre.x = DoubleValueFromString( g_UserUnit, m_entryCentreX->GetValue() ); centre.x = DoubleValueFromString( g_UserUnit, m_entryCentreX->GetValue() );
centre.y = DoubleValueFromString( g_UserUnit, m_entryCentreY->GetValue() ); centre.y = DoubleValueFromString( g_UserUnit, m_entryCentreY->GetValue() );
// FInd the radius, etc of the circle // Find the radius, etc of the circle
centre -= m_originalItemPosition; centre -= m_originalItemPosition;
const double radius = VECTOR2I(centre.x, centre.y).EuclideanNorm(); const double radius = VECTOR2I(centre.x, centre.y).EuclideanNorm();
m_labelCircRadiusValue->SetLabelText( StringFromValue( g_UserUnit, int(radius), true ) ); m_labelCircRadiusValue->SetLabelText( StringFromValue( g_UserUnit, int(radius), true ) );
} }
......
...@@ -172,12 +172,6 @@ class DIALOG_CREATE_ARRAY : public DIALOG_CREATE_ARRAY_BASE, ...@@ -172,12 +172,6 @@ class DIALOG_CREATE_ARRAY : public DIALOG_CREATE_ARRAY_BASE,
{ {
public: public:
enum CREATE_ARRAY_EDIT_T
{
CREATE_ARRAY_ABORT, ///< if not changed or error
CREATE_ARRAY_OK, ///< if successfully changed
};
enum ARRAY_TYPE_T enum ARRAY_TYPE_T
{ {
ARRAY_GRID, ///< A grid (x*y) array ARRAY_GRID, ///< A grid (x*y) array
...@@ -312,7 +306,6 @@ private: ...@@ -312,7 +306,6 @@ private:
// Event callbacks // Event callbacks
void OnParameterChanged( wxCommandEvent& event ); void OnParameterChanged( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
// Internal callback handlers // Internal callback handlers
......
...@@ -314,7 +314,6 @@ DIALOG_CREATE_ARRAY_BASE::DIALOG_CREATE_ARRAY_BASE( wxWindow* parent, wxWindowID ...@@ -314,7 +314,6 @@ DIALOG_CREATE_ARRAY_BASE::DIALOG_CREATE_ARRAY_BASE( wxWindow* parent, wxWindowID
m_entryCentreY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this ); m_entryCentreY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this );
m_entryCircAngle->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this ); m_entryCircAngle->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this );
m_entryCircCount->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this ); m_entryCircCount->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this );
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnOkClick ), NULL, this ); m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnOkClick ), NULL, this );
} }
...@@ -335,7 +334,6 @@ DIALOG_CREATE_ARRAY_BASE::~DIALOG_CREATE_ARRAY_BASE() ...@@ -335,7 +334,6 @@ DIALOG_CREATE_ARRAY_BASE::~DIALOG_CREATE_ARRAY_BASE()
m_entryCentreY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this ); m_entryCentreY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this );
m_entryCircAngle->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this ); m_entryCircAngle->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this );
m_entryCircCount->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this ); m_entryCircCount->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnParameterChanged ), NULL, this );
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnOkClick ), NULL, this ); m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CREATE_ARRAY_BASE::OnOkClick ), NULL, this );
} }
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_CREATE_ARRAY_BASE</property> <property name="name">DIALOG_CREATE_ARRAY_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">576,528</property> <property name="size">576,428</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Create array</property> <property name="title">Create array</property>
...@@ -4950,7 +4950,7 @@ ...@@ -4950,7 +4950,7 @@
<property name="name">m_stdButtons</property> <property name="name">m_stdButtons</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<event name="OnApplyButtonClick"></event> <event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event> <event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event> <event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event> <event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event> <event name="OnNoButtonClick"></event>
......
...@@ -107,13 +107,12 @@ class DIALOG_CREATE_ARRAY_BASE : public DIALOG_SHIM ...@@ -107,13 +107,12 @@ class DIALOG_CREATE_ARRAY_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnParameterChanged( wxCommandEvent& event ) { event.Skip(); } virtual void OnParameterChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_CREATE_ARRAY_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_CREATE_ARRAY, const wxString& title = _("Create array"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 576,528 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_CREATE_ARRAY_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_CREATE_ARRAY, const wxString& title = _("Create array"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 576,428 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_CREATE_ARRAY_BASE(); ~DIALOG_CREATE_ARRAY_BASE();
}; };
......
...@@ -1612,7 +1612,7 @@ void PCB_BASE_EDIT_FRAME::createArray() ...@@ -1612,7 +1612,7 @@ void PCB_BASE_EDIT_FRAME::createArray()
DIALOG_CREATE_ARRAY dialog( this, rotPoint, &array_opts ); DIALOG_CREATE_ARRAY dialog( this, rotPoint, &array_opts );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
if( ret == DIALOG_CREATE_ARRAY::CREATE_ARRAY_OK && array_opts != NULL ) if( ret == wxID_OK && array_opts != NULL )
{ {
PICKED_ITEMS_LIST newItemsList; PICKED_ITEMS_LIST newItemsList;
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <pcb_netlist.h> #include <pcb_netlist.h>
#include <netlist_reader.h> #include <netlist_reader.h>
void LEGACY_NETLIST_READER::LoadNetlist() throw ( IO_ERROR, PARSE_ERROR, boost::bad_pointer ) void LEGACY_NETLIST_READER::LoadNetlist() throw ( IO_ERROR, PARSE_ERROR, boost::bad_pointer )
{ {
int state = 0; int state = 0;
......
...@@ -263,13 +263,32 @@ public: ...@@ -263,13 +263,32 @@ public:
typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC; typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
PNS_DIFF_PAIR ( ) : PNS_ITEM ( DIFF_PAIR ), m_hasVias (false) {} PNS_DIFF_PAIR ( ) : PNS_ITEM ( DIFF_PAIR ), m_hasVias (false)
{
// Initialize some members, to avoid uninitialized variables.
m_net_p = 0;
m_net_n = 0;;
m_width = 0;
m_gap = 0;
m_viaGap = 0;
m_maxUncoupledLength = 0;
m_chamferLimit = 0;
}
PNS_DIFF_PAIR ( int aGap ) : PNS_DIFF_PAIR ( int aGap ) :
PNS_ITEM ( DIFF_PAIR ), PNS_ITEM ( DIFF_PAIR ),
m_hasVias (false) m_hasVias (false)
{ {
m_gapConstraint = aGap; m_gapConstraint = aGap;
// Initialize other members, to avoid uninitialized variables.
m_net_p = 0;
m_net_n = 0;;
m_width = 0;
m_gap = 0;
m_viaGap = 0;
m_maxUncoupledLength = 0;
m_chamferLimit = 0;
} }
PNS_DIFF_PAIR ( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ): PNS_DIFF_PAIR ( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
...@@ -279,6 +298,15 @@ public: ...@@ -279,6 +298,15 @@ public:
m_hasVias (false) m_hasVias (false)
{ {
m_gapConstraint = aGap; m_gapConstraint = aGap;
// Initialize other members, to avoid uninitialized variables.
m_net_p = 0;
m_net_n = 0;;
m_width = 0;
m_gap = 0;
m_viaGap = 0;
m_maxUncoupledLength = 0;
m_chamferLimit = 0;
} }
PNS_DIFF_PAIR ( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ): PNS_DIFF_PAIR ( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ):
......
...@@ -42,6 +42,11 @@ public: ...@@ -42,6 +42,11 @@ public:
m_forceWinding = false; m_forceWinding = false;
m_cursorApproachMode = false; m_cursorApproachMode = false;
m_itemMask = PNS_ITEM::ANY; m_itemMask = PNS_ITEM::ANY;
// Initialize other members, to avoid uninitialized variables.
m_recursiveBlockageCount = 0;
m_iteration = 0;
m_forceCw = false;
} }
~PNS_WALKAROUND() {}; ~PNS_WALKAROUND() {};
......
...@@ -848,7 +848,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) ...@@ -848,7 +848,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
DIALOG_CREATE_ARRAY dialog( editFrame, rotPoint, &array_opts ); DIALOG_CREATE_ARRAY dialog( editFrame, rotPoint, &array_opts );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
if( ret == DIALOG_CREATE_ARRAY::CREATE_ARRAY_OK && array_opts != NULL ) if( ret == wxID_OK && array_opts != NULL )
{ {
PICKED_ITEMS_LIST newItemList; PICKED_ITEMS_LIST newItemList;
......
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