diff --git a/3d-viewer/3d_aux.cpp b/3d-viewer/3d_aux.cpp index e78229a296..aee7d99922 100644 --- a/3d-viewer/3d_aux.cpp +++ b/3d-viewer/3d_aux.cpp @@ -84,7 +84,6 @@ void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices ) } /* adjust offset position (offset is given in UNIT 3D (0.1 inch) */ -#define SCALE_3D_CONV ((IU_PER_MILS * 1000) / UNITS3D_TO_UNITSPCB) aVertices[ii].x += m_MatPosition.x * SCALE_3D_CONV; aVertices[ii].y += m_MatPosition.y * SCALE_3D_CONV; aVertices[ii].z += m_MatPosition.z * SCALE_3D_CONV; diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index 22b12ce56e..c64d3d8655 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -42,6 +42,14 @@ */ #define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100) +/** + * scaling factor for 3D shape offset ( S3D_MASTER::m_MatPosition member ) + * Was in inches in legacy version, and, due to a mistake, still in inches + * in .kicad_pcb files (which are using mm) + * so this scaling convert file units (inch) to 3D units (0.1 inch), only + * for S3D_MASTER::m_MatPosition parameter + */ +#define SCALE_3D_CONV 10 class S3D_MASTER; class STRUCT_3D_SHAPE; diff --git a/3d-viewer/vrml_v1_modelparser.cpp b/3d-viewer/vrml_v1_modelparser.cpp index 814daf3e46..ee7a2fd8c6 100644 --- a/3d-viewer/vrml_v1_modelparser.cpp +++ b/3d-viewer/vrml_v1_modelparser.cpp @@ -75,9 +75,6 @@ void VRML1_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3 glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y, GetMaster()->m_MatPosition.z ); - -#define SCALE_3D_CONV ( (IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB ) - // glPushMatrix(); glTranslatef( matPos.x * SCALE_3D_CONV, matPos.y * SCALE_3D_CONV, matPos.z * SCALE_3D_CONV ); diff --git a/3d-viewer/x3dmodelparser.cpp b/3d-viewer/x3dmodelparser.cpp index d6a1d106f7..8a71777fae 100644 --- a/3d-viewer/x3dmodelparser.cpp +++ b/3d-viewer/x3dmodelparser.cpp @@ -79,10 +79,6 @@ void X3D_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3Du glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y, GetMaster()->m_MatPosition.z ); - -#define SCALE_3D_CONV ( (IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB ) - - glTranslatef( matPos.x * SCALE_3D_CONV, matPos.y * SCALE_3D_CONV, matPos.z * SCALE_3D_CONV ); glRotatef( -matRot.z, 0.0f, 0.0f, 1.0f ); diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index 553b45dd67..1d7fd54783 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -489,9 +489,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, DPOINT pos_dev = userToDeviceCoordinates( pos ); int delta = KiROUND( penDiameter - penOverlap ); - int radius = diametre / 2; - - radius = ( diametre - KiROUND( penDiameter ) ) / 2; + int radius = ( diametre - KiROUND( penDiameter ) ) / 2; if( radius < 0 ) radius = 0; diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index a7901dc515..29c0858afe 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -489,7 +489,7 @@ void OPENGL_GAL::DrawPolygon( const std::deque& aPointList ) boost::shared_array points( new GLdouble[3 * aPointList.size()] ); int v = 0; - for( std::deque::const_iterator it = aPointList.begin(); it != aPointList.end(); it++ ) + for( std::deque::const_iterator it = aPointList.begin(); it != aPointList.end(); ++it ) { points[v] = it->x; points[v + 1] = it->y; diff --git a/common/gal/opengl/shader.cpp b/common/gal/opengl/shader.cpp index 8edb1c350b..04157ae0c4 100644 --- a/common/gal/opengl/shader.cpp +++ b/common/gal/opengl/shader.cpp @@ -55,7 +55,7 @@ SHADER::~SHADER() { // Delete the shaders and the program for( std::deque::iterator it = shaderNumbers.begin(); it != shaderNumbers.end(); - it++ ) + ++it ) { glDeleteShader( *it ); } diff --git a/common/string.cpp b/common/string.cpp index f801a8748c..2e169d1ae9 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -231,13 +231,13 @@ int StrNumCmp( const wxString& aString1, const wxString& aString2, int aLength, while( isdigit( *str1 ) ) { nb1 = nb1 * 10 + (int) *str1 - '0'; - str1++; + ++str1; } while( isdigit( *str2 ) ) { nb2 = nb2 * 10 + (int) *str2 - '0'; - str2++; + ++str2; } if( nb1 < nb2 ) @@ -270,8 +270,8 @@ int StrNumCmp( const wxString& aString1, const wxString& aString2, int aLength, return 0; } - str1++; - str2++; + ++str1; + ++str2; } return 0; diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 51c1cfc292..fc81b547e4 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -142,6 +142,8 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString { m_gerbview_frame = aFrame; m_pcb_file_name = aFileName; + m_fp = NULL; + m_pcbCopperLayersCount = 2; } diff --git a/pcb_calculator/transline/rectwaveguide.cpp b/pcb_calculator/transline/rectwaveguide.cpp index fb14959367..d325331fba 100644 --- a/pcb_calculator/transline/rectwaveguide.cpp +++ b/pcb_calculator/transline/rectwaveguide.cpp @@ -358,7 +358,7 @@ void RECTWAVEGUIDE::show_results() continue; if( f >= ( fc( m, n ) ) ) { - sprintf( txt, "H(%u,%u) ", m, n ); + sprintf( txt, "H(%d,%d) ", m, n ); if( (strlen( text ) + strlen( txt ) + 5) < MAXSTRLEN ) strcat( text, txt ); else @@ -384,7 +384,7 @@ void RECTWAVEGUIDE::show_results() { if( f >= fc( m, n ) ) { - sprintf( txt, "E(%u,%u) ", m, n ); + sprintf( txt, "E(%d,%d) ", m, n ); if( (strlen( text ) + strlen( txt ) + 5) < MAXSTRLEN ) strcat( text, txt ); else diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 4f0320abb3..66c01bc43a 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2404,20 +2404,17 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, if( !net.IsValid() ) // Footprint pad had no net. { - if( !pad->GetNetname().IsEmpty() ) + if( aReporter && aReporter->ReportAll() ) { - if( aReporter && aReporter->ReportAll() ) - { - msg.Printf( _( "Clearing component \"%s:%s\" pin \"%s\" net name.\n" ), - GetChars( footprint->GetReference() ), - GetChars( footprint->GetPath() ), - GetChars( pad->GetPadName() ) ); - aReporter->Report( msg ); - } - - if( !aNetlist.IsDryRun() ) - pad->SetNetCode( NETINFO_LIST::UNCONNECTED ); + msg.Printf( _( "Clearing component \"%s:%s\" pin \"%s\" net name.\n" ), + GetChars( footprint->GetReference() ), + GetChars( footprint->GetPath() ), + GetChars( pad->GetPadName() ) ); + aReporter->Report( msg ); } + + if( !aNetlist.IsDryRun() ) + pad->SetNetCode( NETINFO_LIST::UNCONNECTED ); } else // Footprint pad has a net. { diff --git a/pcbnew/class_board_connected_item.cpp b/pcbnew/class_board_connected_item.cpp index dfe4e96f3e..797e2ee158 100644 --- a/pcbnew/class_board_connected_item.cpp +++ b/pcbnew/class_board_connected_item.cpp @@ -50,7 +50,10 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode ) { -// assert( aNetCode >= 0 ); + // if aNetCode < 0 ( typically NETINFO_LIST::FORCE_ORPHANED ) + // or no parent board, + // set the m_netinfo to the dummy NETINFO_LIST::ORPHANED + BOARD* board = GetBoard(); if( ( aNetCode >= 0 ) && board ) diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 2ff4342e29..d137c479b6 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -529,8 +529,11 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const return true; break; + case S_POLYGON: // not yet handled + break; + default: - wxASSERT( 0 ); + wxASSERT_MSG( 0, wxString::Format( "unknown DRAWSEGMENT shape: %d", m_Shape ) ); break; } @@ -582,9 +585,15 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy break; + case S_CURVE: + case S_POLYGON: // not yet handled + break; + default: - ; + wxASSERT_MSG( 0, wxString::Format( "unknown DRAWSEGMENT shape: %d", m_Shape ) ); + break; } + return false; } diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 4248cc52db..c6e0b5d5e5 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -112,8 +112,6 @@ MODULE::MODULE( const MODULE& aModule ) : m_Value->SetParent( this ); // Copy auxiliary data: Pads - // m_Pads.DeleteAll(); - for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() ) { D_PAD* newpad = new D_PAD( *pad ); diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 8d8f3df89c..3cddf198e0 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -320,9 +320,14 @@ public: return NULL; } - ///> Constant that holds the unconnected net number (typically 0) + ///> Constant that holds the "unconnected net" number (typically 0) + ///> all items "connected" to this net are actually not connected items static const int UNCONNECTED; + ///> Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED + ///> (typically -1) when calling SetNetCode od board connected items + static const int FORCE_ORPHANED; + ///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no ///> board storing net list available. static NETINFO_ITEM ORPHANED; diff --git a/pcbnew/class_netinfolist.cpp b/pcbnew/class_netinfolist.cpp index 45e1915e9f..2e03c86b50 100644 --- a/pcbnew/class_netinfolist.cpp +++ b/pcbnew/class_netinfolist.cpp @@ -292,4 +292,6 @@ NETINFO_ITEM* NETINFO_MAPPING::iterator::operator->() const const int NETINFO_LIST::UNCONNECTED = 0; +const int NETINFO_LIST::FORCE_ORPHANED = -1; + NETINFO_ITEM NETINFO_LIST::ORPHANED = NETINFO_ITEM( NULL, wxEmptyString, NETINFO_LIST::UNCONNECTED ); diff --git a/pcbnew/dialogs/dialog_footprint_wizard_list.fbp b/pcbnew/dialogs/dialog_footprint_wizard_list.fbp index a90927a424..354cfde36f 100644 --- a/pcbnew/dialogs/dialog_footprint_wizard_list.fbp +++ b/pcbnew/dialogs/dialog_footprint_wizard_list.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 0 0 @@ -236,7 +238,88 @@ 5 - wxEXPAND + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL 0 0 diff --git a/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp b/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp index a669fab58b..2f350a936c 100644 --- a/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp +++ b/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -51,6 +51,9 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* bSizerMain->Add( m_footprintWizardsGrid, 1, wxALL|wxEXPAND, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizer->AddButton( m_sdbSizerOK ); @@ -58,7 +61,7 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - bSizerMain->Add( m_sdbSizer, 0, wxEXPAND, 5 ); + bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bSizerMain ); diff --git a/pcbnew/dialogs/dialog_footprint_wizard_list_base.h b/pcbnew/dialogs/dialog_footprint_wizard_list_base.h index ed7a8564dd..6d0c1cba4c 100644 --- a/pcbnew/dialogs/dialog_footprint_wizard_list_base.h +++ b/pcbnew/dialogs/dialog_footprint_wizard_list_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -20,6 +20,7 @@ class DIALOG_SHIM; #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM protected: wxGrid* m_footprintWizardsGrid; + wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; diff --git a/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp b/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp index a48a01c5bf..d68086a08c 100644 --- a/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp +++ b/pcbnew/dialogs/dialog_fp_plugin_options_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -44,7 +44,7 @@ DIALOG_FP_PLUGIN_OPTIONS_BASE - -1,-1 + 678,342 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 30ab1f9ad0..db846f0080 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -96,12 +96,13 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) newModule->ClearFlags(); - // Clear references to net info, because the footprint editor + // Clear references to any net info, because the footprint editor // does know any thing about nets handled by the current edited board. - // Morever the main board can change or the net info relative to this main board - // can change while editing this footprint in the footprint editor + // Morever we do not want to save any reference to an unknown net when + // saving the footprint in lib cache + // so we force the ORPHANED dummy net info for all pads for( D_PAD* pad = newModule->Pads(); pad; pad = pad->Next() ) - pad->SetNetCode( NETINFO_LIST::UNCONNECTED ); + pad->SetNetCode( NETINFO_LIST::FORCE_ORPHANED ); SetCrossHairPosition( wxPoint( 0, 0 ) ); PlaceModule( newModule, NULL ); @@ -269,6 +270,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, if( module ) { GetBoard()->Add( module, ADD_APPEND ); + lastComponentName = moduleName; AddHistoryComponentName( HistoryList, moduleName ); @@ -328,7 +330,14 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId ) wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up FPID in NULL FP_LIB_TABLE." ) ); - return fptbl->FootprintLoadWithOptionalNickname( aFootprintId ); + MODULE* module = fptbl->FootprintLoadWithOptionalNickname( aFootprintId ); + + // Clear all references to any net info, to be sure there is no broken links + // to any netinfo list (This should be the case, but...) + for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + pad->SetNetCode( NETINFO_LIST::FORCE_ORPHANED ); + + return module; } diff --git a/utils/idftools/idf_cylinder.cpp b/utils/idftools/idf_cylinder.cpp index 3c164f7ead..de39d045b4 100644 --- a/utils/idftools/idf_cylinder.cpp +++ b/utils/idftools/idf_cylinder.cpp @@ -426,14 +426,13 @@ void make_vcyl( bool inch, bool axial, double dia, double length, void make_hcyl( bool inch, bool axial, double dia, double length, double z, double wireDia ) { - bool ok = false; stringstream tstr; string line; double pitch = 0.0; double lead = 0.0; // lead length for radial leads - ok = false; + bool ok = false; while( !ok ) { if( axial )