diff --git a/3d-viewer/3d_read_mesh.cpp b/3d-viewer/3d_read_mesh.cpp index 11f356f8e9..24046f9e9c 100644 --- a/3d-viewer/3d_read_mesh.cpp +++ b/3d-viewer/3d_read_mesh.cpp @@ -62,52 +62,43 @@ S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster, int S3D_MASTER::ReadData() { - wxFileName fn; - wxString FullFilename; - if( m_Shape3DName.IsEmpty() ) { return 1; } - wxString shape3DNname = m_Shape3DName; + // Expand any environment variables embedded in footprint's m_Shape3DName field. + wxString filename = wxExpandEnvVars( m_Shape3DName ); #ifdef __WINDOWS__ - shape3DNname.Replace( wxT( "/" ), wxT( "\\" ) ); + filename.Replace( wxT( "/" ), wxT( "\\" ) ); #else - shape3DNname.Replace( wxT( "\\" ), wxT( "/" ) ); + filename.Replace( wxT( "\\" ), wxT( "/" ) ); #endif - if( wxFileName::FileExists( shape3DNname ) ) + if( !wxFileName::FileExists( filename ) ) { - FullFilename = shape3DNname; - fn.Assign( FullFilename ); + wxLogDebug( wxT( "3D shape '%s' not found, even tried '%s' after env var substitution." ), + GetChars( m_Shape3DName ), + GetChars( filename ) + ); + return -1; } - else - { - fn = shape3DNname; - FullFilename = wxGetApp().FindLibraryPath( fn ); - if( FullFilename.IsEmpty() ) - { - wxLogDebug( wxT( "3D part library <%s> could not be found." ), - GetChars( fn.GetFullPath() ) ); - return -1; - } - } + wxFileName fn( filename ); wxString extension = fn.GetExt(); S3D_MODEL_PARSER* parser = S3D_MODEL_PARSER::Create( this, extension ); if( parser ) { - parser->Load( FullFilename ); + parser->Load( filename ); delete parser; return 0; } else { - wxLogDebug( wxT( "Unknown file type <%s>" ), GetChars( extension ) ); + wxLogDebug( wxT( "Unknown file type '%s'" ), GetChars( extension ) ); } return -1; diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 917ff1381a..e69e9ecae7 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -27,7 +27,7 @@ add_custom_target( DEPENDS gal/opengl/shader_src.h ) -set(GAL_SRCS +set( GAL_SRCS # Common part drawpanel_gal.cpp painter.cpp @@ -54,13 +54,13 @@ set(GAL_SRCS gal/cairo/cairo_compositor.cpp ) -add_library(gal STATIC ${GAL_SRCS}) -add_dependencies(gal shader_headers) +add_library( gal STATIC ${GAL_SRCS} ) +add_dependencies( gal shader_headers ) # Only for win32 cross compilation using MXE -if(WIN32 AND MSYS) -add_definitions(-DGLEW_STATIC) -endif(WIN32 AND MSYS) +if( WIN32 AND MSYS ) + add_definitions( -DGLEW_STATIC ) +endif() set( COMMON_ABOUT_DLG_SRCS dialog_about/AboutDialog_main.cpp @@ -120,7 +120,6 @@ set( COMMON_SRCS drawpanel.cpp drawtxt.cpp dsnlexer.cpp - edaappl.cpp eda_dde.cpp eda_doc.cpp filter_reader.cpp @@ -150,8 +149,13 @@ set( COMMON_SRCS zoom.cpp ) +# We will not want edaappl.cpp linked into the KIFACE, only into the KIWAY. +if( TRUE OR NOT USE_KIWAY_DLLS ) + list( APPEND COMMON_SRCS edaappl.cpp ) +endif() + if( NOT HAVE_STRTOKR ) - set( COMMON_SRCS ${COMMON_SRCS} strtok_r.c ) + list( APPEND COMMON_SRCS strtok_r.c ) endif() diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index b57c5da27d..9002657d19 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -1149,26 +1149,18 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule bool isFlipped = aModule->GetLayer() == LAYER_N_BACK; // Export the object VRML model(s) - for( S3D_MASTER* vrmlm = aModule->Models(); vrmlm != 0; vrmlm = vrmlm->Next() ) + for( S3D_MASTER* vrmlm = aModule->Models(); vrmlm; vrmlm = vrmlm->Next() ) { if( !vrmlm->Is3DType( S3D_MASTER::FILE3D_VRML ) ) continue; - wxString fname = vrmlm->GetShape3DName(); - - if( !wxFileName::FileExists( fname ) ) - { - wxFileName fn = fname; - fname = wxGetApp().FindLibraryPath( fn ); - - if( fname.IsEmpty() ) // keep "short" name if full filename not found - fname = vrmlm->GetShape3DName(); - } + // expand environment variables + wxString fname = wxExpandEnvVars( vrmlm->GetShape3DName() ); fname.Replace( wxT( "\\" ), wxT( "/" ) ); wxString source_fname = fname; - if( aExport3DFiles ) // Change illegal characters in short filename + if( aExport3DFiles ) // Change illegal characters { ChangeIllegalCharacters( fname, true ); fname = a3D_Subdir + wxT( "/" ) + fname; @@ -1267,9 +1259,9 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, const wxString& a3D_Subdir ) { - wxString msg; - FILE* output_file; - BOARD* pcb = GetBoard(); + wxString msg; + FILE* output_file; + BOARD* pcb = GetBoard(); MODEL_VRML model3d; @@ -1295,6 +1287,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, // Global VRML scale to export to a different scale. model3d.scale = aMMtoWRMLunit / MM_PER_IU; + // Set the mechanical deviation limit (in this case 0.02mm) // XXX - NOTE: the value should be set via the GUI model3d.SetMaxDev( 20000 * model3d.scale ); diff --git a/pcbnew/exporters/idf.cpp b/pcbnew/exporters/idf.cpp index e609d96ad1..510c0100db 100644 --- a/pcbnew/exporters/idf.cpp +++ b/pcbnew/exporters/idf.cpp @@ -1146,7 +1146,7 @@ bool IDF_COMP::PlaceComponent( const wxString aComponentFile, const std::string componentFile = aComponentFile; refdes = aRefDes; - if( refdes.empty() || !refdes.compare("~") || !refdes.compare("0") ) + if( refdes.empty() || !refdes.compare( "~" ) || !refdes.compare( "0" ) ) refdes = "NOREFDES"; loc_x = aXLoc; @@ -1155,16 +1155,12 @@ bool IDF_COMP::PlaceComponent( const wxString aComponentFile, const std::string rotation = aRotation; top = isOnTop; - if( !wxFileName::FileExists( aComponentFile ) ) - { - wxFileName fn = aComponentFile; - wxString fname = wxGetApp().FindLibraryPath( fn ); + wxString fname = wxExpandEnvVars( aComponentFile ); - if( fname.IsEmpty() ) - return false; - else - componentFile = fname; - } + if( !wxFileName::FileExists( fname ) ) + return false; + + componentFile = fname; return true; }