3d-viewer: code cleaning; bitmap2component: minor fix and code cleanup
This commit is contained in:
parent
eec819a274
commit
a26449b3ef
|
@ -488,7 +488,7 @@ void EDA_3D_CANVAS::Redraw()
|
|||
glMateriali ( GL_FRONT_AND_BACK, GL_SHININESS, shininess_value );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
||||
|
||||
if( isEnabled( FL_RENDER_TEXTURES ) && isRealisticMode() )
|
||||
if( isRealisticMode() && isEnabled( FL_RENDER_TEXTURES ) )
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
@ -684,6 +684,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
bool remove_Holes = isEnabled( FL_RENDER_SHOW_HOLES_IN_ZONES );
|
||||
|
||||
bool realistic_mode = isRealisticMode();
|
||||
bool useTextures = isRealisticMode() && isEnabled( FL_RENDER_TEXTURES );
|
||||
|
||||
// Number of segments to convert a circle to polygon
|
||||
// Boost polygon (at least v 1.54, v1.55 and previous) in very rare cases crashes
|
||||
|
@ -886,7 +887,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
bufferPolys.ImportFrom( currLayerPolyset );
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||
thickness,
|
||||
GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
GetPrm3DVisu().m_BiuTo3Dunits, useTextures );
|
||||
|
||||
if( isEnabled( FL_USE_COPPER_THICKNESS ) == true )
|
||||
{
|
||||
|
@ -898,7 +899,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
if( bufferZonesPolys.GetCornersCount() )
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos,
|
||||
thickness,
|
||||
GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
GetPrm3DVisu().m_BiuTo3Dunits, useTextures );
|
||||
throughHolesListBuilt = true;
|
||||
}
|
||||
|
||||
|
@ -973,7 +974,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
if( bufferPcbOutlines.GetCornersCount() )
|
||||
{
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2.0,
|
||||
board_thickness, GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
board_thickness, GetPrm3DVisu().m_BiuTo3Dunits, useTextures );
|
||||
}
|
||||
|
||||
glEndList();
|
||||
|
@ -983,6 +984,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
void EDA_3D_CANVAS::BuildTechLayers3DView()
|
||||
{
|
||||
BOARD* pcb = GetBoard();
|
||||
bool useTextures = isRealisticMode() && isEnabled( FL_RENDER_TEXTURES );
|
||||
|
||||
// Number of segments to draw a circle using segments
|
||||
const int segcountforcircle = 18;
|
||||
|
@ -1185,7 +1187,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
setGLTechLayersColor( layer );
|
||||
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||
thickness, GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
thickness, GetPrm3DVisu().m_BiuTo3Dunits, useTextures );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1287,7 +1289,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
|
|||
setGLTechLayersColor( layer );
|
||||
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||
thickness, GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
thickness, GetPrm3DVisu().m_BiuTo3Dunits, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
#define CALLBACK
|
||||
#endif
|
||||
|
||||
// Variables used to pass a value to call back openGL functions
|
||||
static float s_textureScale;
|
||||
static double s_currentZpos;
|
||||
static double s_biuTo3Dunits;
|
||||
bool s_useTextures;
|
||||
|
||||
// CALLBACK functions for GLU_TESS
|
||||
static void CALLBACK tessBeginCB( GLenum which );
|
||||
static void CALLBACK tessEndCB();
|
||||
|
@ -136,13 +142,11 @@ void SetGLColor( S3D_COLOR& aColor, float aTransparency )
|
|||
}
|
||||
|
||||
|
||||
static float m_texture_scale;
|
||||
|
||||
void SetGLTexture( GLuint text_id, float scale )
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glBindTexture( GL_TEXTURE_2D, text_id );
|
||||
m_texture_scale = scale;
|
||||
s_textureScale = scale; // for Tess callback functions
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,8 +159,13 @@ void SetGLTexture( GLuint text_id, float scale )
|
|||
* The bottom side is located at aZpos - aThickness / 2
|
||||
*/
|
||||
void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits )
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits,
|
||||
bool aUseTextures )
|
||||
{
|
||||
// for Tess callback functions:
|
||||
s_biuTo3Dunits = aBiuTo3DUnits;
|
||||
s_useTextures = aUseTextures;
|
||||
|
||||
GLUtesselator* tess = gluNewTess();
|
||||
|
||||
gluTessCallback( tess, GLU_TESS_BEGIN, ( void (CALLBACK*) () )tessBeginCB );
|
||||
|
@ -166,7 +175,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
|||
|
||||
GLdouble v_data[3];
|
||||
double zpos = ( aZpos + (aThickness / 2.0) ) * aBiuTo3DUnits;
|
||||
g_Parm_3D_Visu.m_CurrentZpos = zpos;
|
||||
s_currentZpos = zpos; // for Tess callback functions
|
||||
v_data[2] = aZpos + (aThickness / 2.0);
|
||||
|
||||
// Set normal toward positive Z axis, for a solid object on the top side
|
||||
|
@ -219,7 +228,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
|||
|
||||
// Prepare the bottom side of solid areas
|
||||
zpos = ( aZpos - (aThickness / 2.0) ) * aBiuTo3DUnits;
|
||||
g_Parm_3D_Visu.m_CurrentZpos = zpos;
|
||||
s_currentZpos = zpos; // for Tess callback functions
|
||||
v_data[2] = zpos;
|
||||
// Set normal toward negative Z axis, for a solid object on bottom side
|
||||
SetNormalZneg();
|
||||
|
@ -249,12 +258,12 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
|||
*/
|
||||
void Draw3D_SolidHorizontalPolygonWithHoles( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness,
|
||||
double aBiuTo3DUnits )
|
||||
double aBiuTo3DUnits, bool aUseTextures )
|
||||
{
|
||||
CPOLYGONS_LIST polygon;
|
||||
|
||||
ConvertPolysListWithHolesToOnePolygon( aPolysList, polygon );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, aThickness, aBiuTo3DUnits );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, aThickness, aBiuTo3DUnits, aUseTextures );
|
||||
}
|
||||
|
||||
|
||||
|
@ -301,13 +310,13 @@ void Draw3D_ZaxisCylinder( wxPoint aCenterPos, int aRadius,
|
|||
|
||||
ConvertPolysListWithHolesToOnePolygon( outer_cornerBuffer, polygon );
|
||||
// draw top (front) horizontal ring
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos + aHeight, 0, aBiuTo3DUnits );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos + aHeight, 0, aBiuTo3DUnits, false );
|
||||
|
||||
if( aHeight )
|
||||
{
|
||||
// draw bottom (back) horizontal ring
|
||||
SetNormalZneg();
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, 0, aBiuTo3DUnits );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, 0, aBiuTo3DUnits, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,13 +370,13 @@ void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos,
|
|||
|
||||
// draw top (front) horizontal side (ring)
|
||||
SetNormalZpos();
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos + aHeight, 0, aBiuTo3DUnits );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos + aHeight, 0, aBiuTo3DUnits, false );
|
||||
|
||||
if( aHeight )
|
||||
{
|
||||
// draw bottom (back) horizontal side (ring)
|
||||
SetNormalZneg();
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, 0, aBiuTo3DUnits );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, 0, aBiuTo3DUnits, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,7 +398,7 @@ void Draw3D_SolidSegment( const wxPoint& aStart, const wxPoint& aEnd,
|
|||
|
||||
TransformRoundedEndsSegmentToPolygon( cornerBuffer, aStart, aEnd, slice, aWidth );
|
||||
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits );
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits, false );
|
||||
}
|
||||
|
||||
|
||||
|
@ -403,7 +412,7 @@ void Draw3D_ArcSegment( const wxPoint& aCenterPos, const wxPoint& aStartPoint,
|
|||
TransformArcToPolygon( cornerBuffer, aCenterPos, aStartPoint, aArcAngle,
|
||||
slice, aWidth );
|
||||
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits );
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits, false );
|
||||
}
|
||||
|
||||
|
||||
|
@ -428,15 +437,13 @@ void CALLBACK tessCPolyPt2Vertex( const GLvoid* data )
|
|||
// cast back to double type
|
||||
const CPolyPt* ptr = (const CPolyPt*) data;
|
||||
|
||||
if( g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) )
|
||||
if( s_useTextures )
|
||||
{
|
||||
glTexCoord2f( ptr->x* g_Parm_3D_Visu.m_BiuTo3Dunits * m_texture_scale,
|
||||
-ptr->y * g_Parm_3D_Visu.m_BiuTo3Dunits * m_texture_scale);
|
||||
glTexCoord2f( ptr->x * s_biuTo3Dunits * s_textureScale,
|
||||
-ptr->y * s_biuTo3Dunits * s_textureScale);
|
||||
}
|
||||
|
||||
glVertex3d( ptr->x * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
||||
-ptr->y * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
||||
g_Parm_3D_Visu.m_CurrentZpos );
|
||||
glVertex3d( ptr->x * s_biuTo3Dunits, -ptr->y * s_biuTo3Dunits, s_currentZpos );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,13 +36,15 @@
|
|||
* @param aZpos = z position in board internal units
|
||||
* @param aThickness = thickness in board internal units
|
||||
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
|
||||
* @param aUseTextures = true to use textxures for the polygons
|
||||
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
|
||||
* If aThickness > 0, a solid object is drawn.
|
||||
* The top side is located at aZpos + aThickness / 2
|
||||
* The bottom side is located at aZpos - aThickness / 2
|
||||
*/
|
||||
void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits );
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits,
|
||||
bool aUseTextures );
|
||||
|
||||
/** draw the solid polygon found in aPolysList
|
||||
* The first polygonj is the main polygon, others are holes
|
||||
|
@ -50,13 +52,15 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
|||
* @param aZpos = z position in board internal units
|
||||
* @param aThickness = thickness in board internal units
|
||||
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
|
||||
* @param aUseTextures = true to use textxures for the polygons
|
||||
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
|
||||
* If aThickness > 0, a solid object is drawn.
|
||||
* The top side is located at aZpos + aThickness / 2
|
||||
* The bottom side is located at aZpos - aThickness / 2
|
||||
*/
|
||||
void Draw3D_SolidHorizontalPolygonWithHoles( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits );
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits,
|
||||
bool aUseTextures );
|
||||
|
||||
/** draw a thick segment using 3D primitives, in a XY plane
|
||||
* @param aStart = YX position of start point in board units
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#ifdef USE_OPENMP
|
||||
#include <omp.h>
|
||||
#endif /* USE_OPENMP */
|
||||
#endif // USE_OPENMP
|
||||
|
||||
S3D_MESH::S3D_MESH()
|
||||
{
|
||||
|
|
|
@ -104,9 +104,7 @@ public:
|
|||
|
||||
double m_BiuTo3Dunits; // Normalization scale to convert board
|
||||
// internal units to 3D units
|
||||
// to scale 3D units between -1.0 and +1.0
|
||||
double m_CurrentZpos; // temporary storage of current value of Z position,
|
||||
// used in some calculation
|
||||
// to normalize 3D units between -1.0 and +1.0
|
||||
|
||||
double zpos_offset;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <wxstruct.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <bitmap2cmp_gui_base.h>
|
||||
#include <bitmap2component.h>
|
||||
|
@ -278,14 +279,7 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
|
|||
|
||||
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
||||
{
|
||||
/* LoadFile has its own UI, no need for further failure notification here
|
||||
wxString msg = wxString::Format(
|
||||
_( "Could not load image '%s'" ),
|
||||
GetChars( aFilename )
|
||||
);
|
||||
|
||||
wxMessageBox( msg );
|
||||
*/
|
||||
// LoadFile has its own UI, no need for further failure notification here
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -468,25 +462,18 @@ void BM2CMP_FRAME::OnExportLogo()
|
|||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxString msg = _( "Logo file (*.kicad_wks)|*.kicad_wks" );
|
||||
wxFileDialog fileDlg( this, _( "Create a logo file" ), path, wxEmptyString,
|
||||
msg,
|
||||
wxFileDialog fileDlg( this, _( "Create a logo file" ),
|
||||
path, wxEmptyString,
|
||||
wxGetTranslation( PageLayoutDescrFileWildcard ),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
if( m_ConvertedFileName.size() > 1
|
||||
&& m_ConvertedFileName.Right( 10 ).compare( _( ".kicad_wks") ) )
|
||||
{
|
||||
if( m_ConvertedFileName.Right( 1 ).compare( _( "." ) ) )
|
||||
m_ConvertedFileName += _( ".kicad_wks" );
|
||||
else
|
||||
m_ConvertedFileName += _( "kicad_wks" );
|
||||
}
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( PageLayoutDescrFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
@ -494,7 +481,7 @@ void BM2CMP_FRAME::OnExportLogo()
|
|||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
msg.Printf( _( "File '%s' could not be created" ), GetChars(m_ConvertedFileName) );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
@ -512,9 +499,9 @@ void BM2CMP_FRAME::OnExportPostScript()
|
|||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxString msg = _( "Postscript file (*.ps)|*.ps" );
|
||||
wxFileDialog fileDlg( this, _( "Create a Postscript file" ), path, wxEmptyString,
|
||||
msg,
|
||||
wxFileDialog fileDlg( this, _( "Create a Postscript file" ),
|
||||
path, wxEmptyString,
|
||||
wxGetTranslation( PSFileWildcard ),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
@ -522,16 +509,9 @@ void BM2CMP_FRAME::OnExportPostScript()
|
|||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
if( m_ConvertedFileName.size() > 1
|
||||
&& m_ConvertedFileName.Right( 3 ).compare( _( ".ps") ) )
|
||||
{
|
||||
if( m_ConvertedFileName.Right( 1 ).compare( _( "." ) ) )
|
||||
m_ConvertedFileName += _( ".ps" );
|
||||
else
|
||||
m_ConvertedFileName += _( "ps" );
|
||||
}
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( wxT( "ps" ) );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
@ -539,7 +519,7 @@ void BM2CMP_FRAME::OnExportPostScript()
|
|||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
msg.Printf( _( "File '%s' could not be created" ), GetChars( m_ConvertedFileName ) );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
@ -557,10 +537,9 @@ void BM2CMP_FRAME::OnExportEeschema()
|
|||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxString msg = _( "Schematic lib file (*.lib)|*.lib" );
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create a lib file for Eeschema" ), path, wxEmptyString,
|
||||
msg,
|
||||
wxFileDialog fileDlg( this, _( "Create a lib file for Eeschema" ),
|
||||
path, wxEmptyString,
|
||||
wxGetTranslation( SchematicLibraryFileWildcard ),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
@ -568,23 +547,16 @@ void BM2CMP_FRAME::OnExportEeschema()
|
|||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
if( m_ConvertedFileName.size() > 1
|
||||
&& m_ConvertedFileName.Right( 4 ).compare( _( ".lib") ) )
|
||||
{
|
||||
if( m_ConvertedFileName.Right( 1 ).compare( _( "." ) ) )
|
||||
m_ConvertedFileName += _( ".lib" );
|
||||
else
|
||||
m_ConvertedFileName += _( "lib" );
|
||||
}
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( SchematicLibraryFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
msg.Printf( _( "File '%s' could not be created" ), GetChars( m_ConvertedFileName ) );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
@ -602,11 +574,9 @@ void BM2CMP_FRAME::OnExportPcbnew()
|
|||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxString msg = _( "Footprint file (*.kicad_mod)|*.kicad_mod" );
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create a footprint file for PcbNew" ),
|
||||
path, wxEmptyString,
|
||||
msg,
|
||||
wxGetTranslation( KiCadFootprintLibFileWildcard ),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
@ -614,23 +584,16 @@ void BM2CMP_FRAME::OnExportPcbnew()
|
|||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
m_ConvertedFileName = fileDlg.GetPath();
|
||||
|
||||
if( m_ConvertedFileName.size() > 1
|
||||
&& m_ConvertedFileName.Right( 10 ).compare( _( ".kicad_mod") ) )
|
||||
{
|
||||
if( m_ConvertedFileName.Right( 1 ).compare( _( "." ) ) )
|
||||
m_ConvertedFileName += _( ".kicad_mod" );
|
||||
else
|
||||
m_ConvertedFileName += _( "kicad_mod" );
|
||||
}
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( KiCadFootprintFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
msg.Printf( _( "File '%s' could not be created" ), GetChars( m_ConvertedFileName ) );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.b
|
|||
const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) );
|
||||
const wxString PCadPcbFileWildcard( _( "P-Cad 200x ASCII PCB files (*.pcb)|*.pcb" ) );
|
||||
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
|
||||
const wxString KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) );
|
||||
const wxString KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre file (*.kicad_mod)|*.kicad_mod" ) );
|
||||
const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) );
|
||||
const wxString LegacyFootprintLibPathWildcard( _( "Legacy footprint library file (*.mod)|*.mod" ) );
|
||||
const wxString EagleFootprintLibPathWildcard( _( "Eagle ver. 6.x XML library files (*.lbr)|*.lbr" ) );
|
||||
|
|
Loading…
Reference in New Issue