Bitmap2component: old .emp output format removed (patch from Cirilo Bernardo)
This commit is contained in:
parent
4c20fb4c4b
commit
eec819a274
|
@ -31,6 +31,7 @@
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
|
|
||||||
#include <bitmap2cmp_gui_base.h>
|
#include <bitmap2cmp_gui_base.h>
|
||||||
|
#include <bitmap2component.h>
|
||||||
|
|
||||||
#include <potracelib.h>
|
#include <potracelib.h>
|
||||||
#include <bitmap_io.h>
|
#include <bitmap_io.h>
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
#define DEFAULT_DPI 300 // Default resolution in Bit per inches
|
#define DEFAULT_DPI 300 // Default resolution in Bit per inches
|
||||||
|
|
||||||
extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||||
int aFormat, int aDpi_X, int aDpi_Y );
|
OUTPUT_FMT_ID aFormat, int aDpi_X, int aDpi_Y );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BM2CMP_FRAME_BASE
|
* Class BM2CMP_FRAME_BASE
|
||||||
|
@ -98,11 +99,9 @@ private:
|
||||||
void OnExportEeschema();
|
void OnExportEeschema();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Depending on the option:
|
* Generate a module in S expr format
|
||||||
* Legacy format: generate a module library which comtains one component
|
|
||||||
* New kicad_mod format: generate a module in S expr format
|
|
||||||
*/
|
*/
|
||||||
void OnExportPcbnew( bool aLegacyFormat );
|
void OnExportPcbnew();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a postscript file
|
* Generate a postscript file
|
||||||
|
@ -129,13 +128,14 @@ private:
|
||||||
{
|
{
|
||||||
m_DPIValueX->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.x ) );
|
m_DPIValueX->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDPITextValueY( wxMouseEvent& event )
|
void UpdateDPITextValueY( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
m_DPIValueY->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.y ) );
|
m_DPIValueY->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NegateGreyscaleImage( );
|
void NegateGreyscaleImage( );
|
||||||
void ExportFile( FILE* aOutfile, int aFormat );
|
void ExportFile( FILE* aOutfile, OUTPUT_FMT_ID aFormat );
|
||||||
void updateImageInfo();
|
void updateImageInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -160,8 +160,13 @@ BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
if( m_config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
|
if( m_config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
|
||||||
m_rbOptions->SetSelection( tmp ? 1 : 0 );
|
m_rbOptions->SetSelection( tmp ? 1 : 0 );
|
||||||
|
|
||||||
m_config->Read( KEYWORD_LAST_FORMAT, &tmp );
|
if( m_config->Read( KEYWORD_LAST_FORMAT, &tmp ) )
|
||||||
m_radioBoxFormat->SetSelection( tmp );
|
{
|
||||||
|
if( tmp < 0 || tmp > FINAL_FMT )
|
||||||
|
tmp = PCBNEW_KICAD_MOD;
|
||||||
|
|
||||||
|
m_radioBoxFormat->SetSelection( tmp );
|
||||||
|
}
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
|
@ -430,27 +435,25 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
|
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int sel = m_radioBoxFormat->GetSelection();
|
// choices of m_radioBoxFormat are expected to be in same order as
|
||||||
|
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||||
|
OUTPUT_FMT_ID sel = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection();
|
||||||
|
|
||||||
switch( sel )
|
switch( sel )
|
||||||
{
|
{
|
||||||
case 0:
|
case EESCHEMA_FMT:
|
||||||
OnExportEeschema();
|
OnExportEeschema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case PCBNEW_KICAD_MOD:
|
||||||
OnExportPcbnew( true );
|
OnExportPcbnew();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case POSTSCRIPT_FMT:
|
||||||
OnExportPcbnew( false );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
OnExportPostScript();
|
OnExportPostScript();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case KICAD_LOGO:
|
||||||
OnExportLogo();
|
OnExportLogo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -476,6 +479,15 @@ void BM2CMP_FRAME::OnExportLogo()
|
||||||
|
|
||||||
m_ConvertedFileName = fileDlg.GetPath();
|
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" );
|
||||||
|
}
|
||||||
|
|
||||||
FILE* outfile;
|
FILE* outfile;
|
||||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
|
|
||||||
|
@ -487,7 +499,7 @@ void BM2CMP_FRAME::OnExportLogo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportFile( outfile, 4 );
|
ExportFile( outfile, KICAD_LOGO );
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,6 +524,15 @@ void BM2CMP_FRAME::OnExportPostScript()
|
||||||
|
|
||||||
m_ConvertedFileName = fileDlg.GetPath();
|
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" );
|
||||||
|
}
|
||||||
|
|
||||||
FILE* outfile;
|
FILE* outfile;
|
||||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
|
|
||||||
|
@ -523,7 +544,7 @@ void BM2CMP_FRAME::OnExportPostScript()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportFile( outfile, 3 );
|
ExportFile( outfile, POSTSCRIPT_FMT );
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,6 +570,15 @@ void BM2CMP_FRAME::OnExportEeschema()
|
||||||
|
|
||||||
m_ConvertedFileName = fileDlg.GetPath();
|
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" );
|
||||||
|
}
|
||||||
|
|
||||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
|
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
|
@ -559,12 +589,12 @@ void BM2CMP_FRAME::OnExportEeschema()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportFile( outfile, 2 );
|
ExportFile( outfile, EESCHEMA_FMT );
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
void BM2CMP_FRAME::OnExportPcbnew()
|
||||||
{
|
{
|
||||||
wxFileName fn( m_ConvertedFileName );
|
wxFileName fn( m_ConvertedFileName );
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
@ -572,9 +602,7 @@ void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
||||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||||
path = ::wxGetCwd();
|
path = ::wxGetCwd();
|
||||||
|
|
||||||
wxString msg = aLegacyFormat ?
|
wxString msg = _( "Footprint file (*.kicad_mod)|*.kicad_mod" );
|
||||||
_( "Footprint file (*.emp)|*.emp" ) :
|
|
||||||
_( "Footprint file (*.kicad_mod)|*.kicad_mod" );
|
|
||||||
|
|
||||||
wxFileDialog fileDlg( this, _( "Create a footprint file for PcbNew" ),
|
wxFileDialog fileDlg( this, _( "Create a footprint file for PcbNew" ),
|
||||||
path, wxEmptyString,
|
path, wxEmptyString,
|
||||||
|
@ -588,6 +616,15 @@ void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
||||||
|
|
||||||
m_ConvertedFileName = fileDlg.GetPath();
|
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" );
|
||||||
|
}
|
||||||
|
|
||||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||||
|
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
|
@ -598,12 +635,12 @@ void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportFile( outfile, aLegacyFormat ? 0 : 1 );
|
ExportFile( outfile, PCBNEW_KICAD_MOD );
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
|
void BM2CMP_FRAME::ExportFile( FILE* aOutfile, OUTPUT_FMT_ID aFormat )
|
||||||
{
|
{
|
||||||
// Create a potrace bitmap
|
// Create a potrace bitmap
|
||||||
int h = m_NB_Image.GetHeight();
|
int h = m_NB_Image.GetHeight();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Nov 5 2013)
|
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -126,10 +126,10 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
||||||
|
|
||||||
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
wxString m_radioBoxFormatChoices[] = { _("Eeschema"), _("Pcbnew old fmt (.emp)"), _("Pcbnew kicad_mod"), _("Postscript"), _("Logo for title block") };
|
wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") };
|
||||||
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
|
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
|
||||||
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
|
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
|
||||||
m_radioBoxFormat->SetSelection( 2 );
|
m_radioBoxFormat->SetSelection( 1 );
|
||||||
brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 );
|
brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
|
wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
|
||||||
|
|
|
@ -2003,7 +2003,7 @@
|
||||||
<property name="caption"></property>
|
<property name="caption"></property>
|
||||||
<property name="caption_visible">1</property>
|
<property name="caption_visible">1</property>
|
||||||
<property name="center_pane">0</property>
|
<property name="center_pane">0</property>
|
||||||
<property name="choices">"Eeschema" "Pcbnew old fmt (.emp)" "Pcbnew kicad_mod" "Postscript" "Logo for title block"</property>
|
<property name="choices">"Eeschema (.lib file)" "Pcbnew (.kicad_mod file)" "Postscript (.ps file)" "Logo for title block (.kicad_wks file)"</property>
|
||||||
<property name="close_button">1</property>
|
<property name="close_button">1</property>
|
||||||
<property name="context_help"></property>
|
<property name="context_help"></property>
|
||||||
<property name="context_menu">1</property>
|
<property name="context_menu">1</property>
|
||||||
|
@ -2035,7 +2035,7 @@
|
||||||
<property name="pin_button">1</property>
|
<property name="pin_button">1</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="resize">Resizable</property>
|
<property name="resize">Resizable</property>
|
||||||
<property name="selection">2</property>
|
<property name="selection">1</property>
|
||||||
<property name="show">1</property>
|
<property name="show">1</property>
|
||||||
<property name="size"></property>
|
<property name="size"></property>
|
||||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Nov 5 2013)
|
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include <potracelib.h>
|
#include <potracelib.h>
|
||||||
#include <auxiliary.h>
|
#include <auxiliary.h>
|
||||||
|
|
||||||
|
#include <bitmap2component.h>
|
||||||
|
|
||||||
|
|
||||||
// Define some types used here from boost::polygon
|
// Define some types used here from boost::polygon
|
||||||
namespace bpl = boost::polygon; // bpl = boost polygon library
|
namespace bpl = boost::polygon; // bpl = boost polygon library
|
||||||
|
@ -50,14 +52,6 @@ typedef std::vector<KPolygon> KPolygonSet; // define a set of p
|
||||||
|
|
||||||
typedef bpl::point_data<coordinate_type> KPolyPoint; // define a corner of a polygon
|
typedef bpl::point_data<coordinate_type> KPolyPoint; // define a corner of a polygon
|
||||||
|
|
||||||
enum output_format {
|
|
||||||
POSTSCRIPT_FMT = 1,
|
|
||||||
PCBNEW_LEGACY_EMP,
|
|
||||||
PCBNEW_KICAD_MOD,
|
|
||||||
EESCHEMA_FMT,
|
|
||||||
KICAD_LOGO
|
|
||||||
};
|
|
||||||
|
|
||||||
/* free a potrace bitmap */
|
/* free a potrace bitmap */
|
||||||
static void bm_free( potrace_bitmap_t* bm )
|
static void bm_free( potrace_bitmap_t* bm )
|
||||||
{
|
{
|
||||||
|
@ -75,7 +69,7 @@ static void bm_free( potrace_bitmap_t* bm )
|
||||||
class BITMAPCONV_INFO
|
class BITMAPCONV_INFO
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum output_format m_Format; // File format
|
enum OUTPUT_FMT_ID m_Format; // File format
|
||||||
int m_PixmapWidth;
|
int m_PixmapWidth;
|
||||||
int m_PixmapHeight; // the bitmap size in pixels
|
int m_PixmapHeight; // the bitmap size in pixels
|
||||||
double m_ScaleX;
|
double m_ScaleX;
|
||||||
|
@ -139,7 +133,7 @@ BITMAPCONV_INFO::BITMAPCONV_INFO()
|
||||||
|
|
||||||
|
|
||||||
int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||||
int aFormat, int aDpi_X, int aDpi_Y )
|
OUTPUT_FMT_ID aFormat, int aDpi_X, int aDpi_Y )
|
||||||
{
|
{
|
||||||
potrace_param_t* param;
|
potrace_param_t* param;
|
||||||
potrace_state_t* st;
|
potrace_state_t* st;
|
||||||
|
@ -169,14 +163,14 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||||
|
|
||||||
switch( aFormat )
|
switch( aFormat )
|
||||||
{
|
{
|
||||||
case 4:
|
case KICAD_LOGO:
|
||||||
info.m_Format = KICAD_LOGO;
|
info.m_Format = KICAD_LOGO;
|
||||||
info.m_ScaleX = 1e3 * 25.4 / aDpi_X; // the conversion scale from PPI to micro
|
info.m_ScaleX = 1e3 * 25.4 / aDpi_X; // the conversion scale from PPI to micro
|
||||||
info.m_ScaleY = 1e3 * 25.4 / aDpi_Y; // Y axis is top to bottom
|
info.m_ScaleY = 1e3 * 25.4 / aDpi_Y; // Y axis is top to bottom
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case POSTSCRIPT_FMT:
|
||||||
info.m_Format = POSTSCRIPT_FMT;
|
info.m_Format = POSTSCRIPT_FMT;
|
||||||
info.m_ScaleX = 1.0; // the conversion scale
|
info.m_ScaleX = 1.0; // the conversion scale
|
||||||
info.m_ScaleY = info.m_ScaleX;
|
info.m_ScaleY = info.m_ScaleX;
|
||||||
|
@ -184,27 +178,20 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case EESCHEMA_FMT:
|
||||||
info.m_Format = EESCHEMA_FMT;
|
info.m_Format = EESCHEMA_FMT;
|
||||||
info.m_ScaleX = 1000.0 / aDpi_X; // the conversion scale from PPI to UI
|
info.m_ScaleX = 1000.0 / aDpi_X; // the conversion scale from PPI to UI
|
||||||
info.m_ScaleY = -1000.0 / aDpi_Y; // Y axis is bottom to Top for components in libs
|
info.m_ScaleY = -1000.0 / aDpi_Y; // Y axis is bottom to Top for components in libs
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case PCBNEW_KICAD_MOD:
|
||||||
info.m_Format = PCBNEW_KICAD_MOD;
|
info.m_Format = PCBNEW_KICAD_MOD;
|
||||||
info.m_ScaleX = 1e6 * 25.4 / aDpi_X; // the conversion scale from PPI to UI
|
info.m_ScaleX = 1e6 * 25.4 / aDpi_X; // the conversion scale from PPI to UI
|
||||||
info.m_ScaleY = 1e6 * 25.4 / aDpi_Y; // Y axis is top to bottom in modedit
|
info.m_ScaleY = 1e6 * 25.4 / aDpi_Y; // Y axis is top to bottom in modedit
|
||||||
info.CreateOutputFile();
|
info.CreateOutputFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
|
||||||
info.m_Format = PCBNEW_LEGACY_EMP;
|
|
||||||
info.m_ScaleX = 10000.0 / aDpi_X; // the conversion scale
|
|
||||||
info.m_ScaleY = 10000.0 / aDpi_Y; // Y axis is top to bottom in modedit
|
|
||||||
info.CreateOutputFile();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -233,25 +220,6 @@ void BITMAPCONV_INFO::OuputFileHeader()
|
||||||
fprintf( m_Outfile, "gsave\n" );
|
fprintf( m_Outfile, "gsave\n" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCBNEW_LEGACY_EMP:
|
|
||||||
#define FIELD_LAYER 21
|
|
||||||
fieldSize = 600; // fields text size = 60 mils
|
|
||||||
Ypos += fieldSize / 2;
|
|
||||||
fprintf( m_Outfile, "PCBNEW-LibModule-V1\n" );
|
|
||||||
fprintf( m_Outfile, "$INDEX\n%s\n$EndINDEX\n", m_CmpName );
|
|
||||||
|
|
||||||
fprintf( m_Outfile, "#\n# %s\n", m_CmpName );
|
|
||||||
fprintf( m_Outfile, "# pixmap w = %d, h = %d\n#\n",
|
|
||||||
m_PixmapWidth, m_PixmapHeight );
|
|
||||||
fprintf( m_Outfile, "$MODULE %s\n", m_CmpName );
|
|
||||||
fprintf( m_Outfile, "Po 0 0 0 15 00000000 00000000 ~~\n" );
|
|
||||||
fprintf( m_Outfile, "Li %s\n", m_CmpName );
|
|
||||||
fprintf( m_Outfile, "T0 0 %d %d %d 0 %d N I %d \"G***\"\n",
|
|
||||||
Ypos, fieldSize, fieldSize, fieldSize / 5, FIELD_LAYER );
|
|
||||||
fprintf( m_Outfile, "T1 0 %d %d %d 0 %d N I %d \"%s\"\n",
|
|
||||||
-Ypos, fieldSize, fieldSize, fieldSize / 5, FIELD_LAYER, m_CmpName );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PCBNEW_KICAD_MOD:
|
case PCBNEW_KICAD_MOD:
|
||||||
// fields text size = 1.5 mm
|
// fields text size = 1.5 mm
|
||||||
// fields text thickness = 1.5 / 5 = 0.3mm
|
// fields text thickness = 1.5 / 5 = 0.3mm
|
||||||
|
@ -295,11 +263,6 @@ void BITMAPCONV_INFO::OuputFileEnd()
|
||||||
fprintf( m_Outfile, "%%EOF\n" );
|
fprintf( m_Outfile, "%%EOF\n" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCBNEW_LEGACY_EMP:
|
|
||||||
fprintf( m_Outfile, "$EndMODULE %s\n", m_CmpName );
|
|
||||||
fprintf( m_Outfile, "$EndLIBRARY\n" );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PCBNEW_KICAD_MOD:
|
case PCBNEW_KICAD_MOD:
|
||||||
fprintf( m_Outfile, ")\n" );
|
fprintf( m_Outfile, ")\n" );
|
||||||
break;
|
break;
|
||||||
|
@ -353,27 +316,6 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
|
||||||
fprintf( m_Outfile, "\nclosepath fill\n" );
|
fprintf( m_Outfile, "\nclosepath fill\n" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCBNEW_LEGACY_EMP:
|
|
||||||
{
|
|
||||||
LAYER_NUM layer = F_SilkS;
|
|
||||||
int width = 1;
|
|
||||||
fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
|
|
||||||
0, 0, 0, 0,
|
|
||||||
(int) aPolygon.size() + 1, width, layer );
|
|
||||||
|
|
||||||
for( ii = 0; ii < aPolygon.size(); ii++ )
|
|
||||||
{
|
|
||||||
currpoint = *( aPolygon.begin() + ii );
|
|
||||||
fprintf( m_Outfile, "Dl %d %d\n",
|
|
||||||
currpoint.x() - offsetX, currpoint.y() - offsetY );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close polygon
|
|
||||||
fprintf( m_Outfile, "Dl %d %d\n",
|
|
||||||
startpoint.x() - offsetX, startpoint.y() - offsetY );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PCBNEW_KICAD_MOD:
|
case PCBNEW_KICAD_MOD:
|
||||||
{
|
{
|
||||||
double width = 0.1;
|
double width = 0.1;
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992-2014 Kicad Developers, see change_log.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BITMAP2COMPONENT_H
|
||||||
|
#define BITMAP2COMPONENT_H
|
||||||
|
|
||||||
|
// for consistency this enum should conform to the
|
||||||
|
// indices in m_radioBoxFormat from bitmap2cmp_gui.cpp
|
||||||
|
enum OUTPUT_FMT_ID
|
||||||
|
{
|
||||||
|
EESCHEMA_FMT = 0,
|
||||||
|
PCBNEW_KICAD_MOD,
|
||||||
|
POSTSCRIPT_FMT,
|
||||||
|
KICAD_LOGO,
|
||||||
|
FINAL_FMT = KICAD_LOGO
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BITMAP2COMPONENT_H
|
Loading…
Reference in New Issue