switch to new s-expression format for footprint exports, use english layernames for naked footprints, dodge conflict with pythons HAVE_GETC_UNLOCKED
This commit is contained in:
parent
d378dcc734
commit
4612ef9d50
|
@ -80,7 +80,7 @@ macro(perform_feature_checks)
|
||||||
|
|
||||||
# Check for Posix getc_unlocked() for improved performance over getc(). Fall back to
|
# Check for Posix getc_unlocked() for improved performance over getc(). Fall back to
|
||||||
# getc() on platforms where getc_unlocked() doesn't exist.
|
# getc() on platforms where getc_unlocked() doesn't exist.
|
||||||
check_symbol_exists(getc_unlocked "stdio.h" HAVE_GETC_UNLOCKED)
|
check_symbol_exists(getc_unlocked "stdio.h" HAVE_FGETC_NOLOCK)
|
||||||
|
|
||||||
# Generate config.h.
|
# Generate config.h.
|
||||||
configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
|
configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Do not modify this file, it was automatically generated by CMake. */
|
// Do not modify this file, it was automatically generated by CMake.
|
||||||
|
|
||||||
#ifndef CONFIG_H_
|
#ifndef CONFIG_H_
|
||||||
#define CONFIG_H_
|
#define CONFIG_H_
|
||||||
|
@ -50,10 +50,10 @@
|
||||||
#define strnicmp _strnicmp
|
#define strnicmp _strnicmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Use Posix getc_unlocked() instead of getc() when it's available. */
|
// Use Posix getc_unlocked() instead of getc() when it's available.
|
||||||
#cmakedefine HAVE_GETC_UNLOCKED
|
#cmakedefine HAVE_FGETC_NOLOCK
|
||||||
|
|
||||||
/* Warning!!! Using wxGraphicContext for rendering is experimental. */
|
// Warning!!! Using wxGraphicContext for rendering is experimental.
|
||||||
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
|
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
|
||||||
|
|
||||||
#cmakedefine USE_IMAGES_IN_MENUS 1
|
#cmakedefine USE_IMAGES_IN_MENUS 1
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
|
|
||||||
// Fall back to getc() when getc_unlocked() is not available on the target platform.
|
// Fall back to getc() when getc_unlocked() is not available on the target platform.
|
||||||
#if !defined( HAVE_GETC_UNLOCKED )
|
#if !defined( HAVE_FGETC_NOLOCK )
|
||||||
#define getc_unlocked getc
|
#define getc_unlocked getc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -76,14 +76,13 @@ BOARD* BOARD_ITEM::GetBoard() const
|
||||||
|
|
||||||
wxString BOARD_ITEM::GetLayerName() const
|
wxString BOARD_ITEM::GetLayerName() const
|
||||||
{
|
{
|
||||||
wxString layerName;
|
BOARD* board = GetBoard();
|
||||||
BOARD* board = GetBoard();
|
|
||||||
|
|
||||||
if( board != NULL )
|
if( board )
|
||||||
return board->GetLayerName( m_Layer ).Trim();
|
return board->GetLayerName( m_Layer ).Trim();
|
||||||
|
|
||||||
// If no parent, return the default layer for the object.
|
// If no parent, return the untranslated layer name.
|
||||||
return BOARD::GetDefaultLayerName( m_Layer, true );
|
return BOARD::GetDefaultLayerName( m_Layer, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,15 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
|
||||||
|
|
||||||
void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
|
void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
|
||||||
{
|
{
|
||||||
m_out->Print( 0, " (layer %s)", m_out->Quotew( aItem->GetLayerName() ).c_str() );
|
if( m_ctl & CTL_UNTRANSLATED_LAYERS )
|
||||||
|
{
|
||||||
|
int layer = aItem->GetLayer();
|
||||||
|
|
||||||
|
// English layer names should never need quoting.
|
||||||
|
m_out->Print( 0, " (layer %s)", TO_UTF8( BOARD::GetDefaultLayerName( layer, false ) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_out->Print( 0, " (layer %s)", m_out->Quotew( aItem->GetLayerName() ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1048,7 +1056,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
|
||||||
{
|
{
|
||||||
if( layerMask & 1 )
|
if( layerMask & 1 )
|
||||||
{
|
{
|
||||||
if( m_board )
|
if( m_board && !(m_ctl & CTL_UNTRANSLATED_LAYERS) )
|
||||||
layerName = m_board->GetLayerName( layer );
|
layerName = m_board->GetLayerName( layer );
|
||||||
|
|
||||||
else // from FootprintSave()
|
else // from FootprintSave()
|
||||||
|
@ -1061,7 +1069,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
|
||||||
m_out->Print( 0, ")\n" );
|
m_out->Print( 0, ")\n" );
|
||||||
|
|
||||||
// Unconnected pad is default net so don't save it.
|
// Unconnected pad is default net so don't save it.
|
||||||
if( !(m_ctl & CTL_CLIPBOARD) && aPad->GetNet() != 0 )
|
if( !(m_ctl & CTL_OMIT_NETS) && aPad->GetNet() != 0 )
|
||||||
{
|
{
|
||||||
m_out->Print( aNestLevel+1, "(net %d %s)\n",
|
m_out->Print( aNestLevel+1, "(net %d %s)\n",
|
||||||
aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() );
|
aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() );
|
||||||
|
|
|
@ -33,11 +33,16 @@ class FP_CACHE;
|
||||||
class PCB_PARSER;
|
class PCB_PARSER;
|
||||||
|
|
||||||
|
|
||||||
/** Current s-expression file format version. 2 was the last legacy format version. */
|
/// Current s-expression file format version. 2 was the last legacy format version.
|
||||||
#define SEXPR_BOARD_FILE_VERSION 3
|
#define SEXPR_BOARD_FILE_VERSION 3
|
||||||
|
|
||||||
/** Format output for the clipboard instead of a file. */
|
/// Format output for the clipboard instead of a file.
|
||||||
#define CTL_CLIPBOARD (1 << 0)
|
#define CTL_UNTRANSLATED_LAYERS (1 << 0)
|
||||||
|
|
||||||
|
#define CTL_OMIT_NETS (1 << 1)
|
||||||
|
|
||||||
|
/// Format output for the clipboard instead of a file
|
||||||
|
#define CTL_CLIPBOARD (CTL_UNTRANSLATED_LAYERS | CTL_OMIT_NETS)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +55,6 @@ class PCB_IO : public PLUGIN
|
||||||
{
|
{
|
||||||
friend class FP_CACHE;
|
friend class FP_CACHE;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//-----<PLUGIN API>---------------------------------------------------------
|
//-----<PLUGIN API>---------------------------------------------------------
|
||||||
|
|
|
@ -240,7 +240,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib )
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if 0 // This *.kicad_mod export works fine. It is the import which is still broken.
|
#if 1 // This *.kicad_mod export works fine. It is the import which is still broken.
|
||||||
// The function PCB_PARSER::Parse() fails with due to the m_layerName[] table
|
// The function PCB_PARSER::Parse() fails with due to the m_layerName[] table
|
||||||
// being empty.
|
// being empty.
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
%ignore D_PAD::m_PadSketchModePenSize;
|
%ignore D_PAD::m_PadSketchModePenSize;
|
||||||
|
|
||||||
// rename the Add method of classes to Add native, so we will handle
|
// rename the Add method of classes to Add native, so we will handle
|
||||||
// the Add method in python
|
// the Add method in python
|
||||||
|
|
||||||
%rename(AddNative) *::Add;
|
%rename(AddNative) *::Add;
|
||||||
|
|
||||||
|
@ -50,16 +50,16 @@
|
||||||
}
|
}
|
||||||
catch( IO_ERROR e )
|
catch( IO_ERROR e )
|
||||||
{
|
{
|
||||||
char ExceptionError[256];
|
std::string str = TO_UTF8( e.errorText );
|
||||||
sprintf(ExceptionError, "%s\n", TO_UTF8(e.errorText) );
|
str += '\n';
|
||||||
PyErr_SetString(PyExc_IOError,ExceptionError);
|
PyErr_SetString( PyExc_IOError, str.c_str() );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
catch( std::exception &e )
|
catch( std::exception &e )
|
||||||
{
|
{
|
||||||
char ExceptionError[256];
|
std::string str = e.what();
|
||||||
sprintf( ExceptionError, "%s\n", e.what() );
|
str += '\n';
|
||||||
PyErr_SetString(PyExc_IOError,ExceptionError);
|
PyErr_SetString( PyExc_IOError, str.c_str() );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
|
@ -72,14 +72,14 @@
|
||||||
|
|
||||||
// this is what it must be included in the wrapper .cxx code to compile
|
// this is what it must be included in the wrapper .cxx code to compile
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <wx_python_helpers.h>
|
#include <wx_python_helpers.h>
|
||||||
#include <class_board_item.h>
|
#include <class_board_item.h>
|
||||||
#include <class_board_connected_item.h>
|
#include <class_board_connected_item.h>
|
||||||
#include <class_board_design_settings.h>
|
#include <class_board_design_settings.h>
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
#include <class_module.h>
|
#include <class_module.h>
|
||||||
#include <class_track.h>
|
#include <class_track.h>
|
||||||
#include <layers_id_colors_and_visibility.h>
|
#include <layers_id_colors_and_visibility.h>
|
||||||
#include <class_pad.h>
|
#include <class_pad.h>
|
||||||
#include <pad_shapes.h>
|
#include <pad_shapes.h>
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
#include <plotcontroller.h>
|
#include <plotcontroller.h>
|
||||||
#include <pcb_plot_params.h>
|
#include <pcb_plot_params.h>
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
|
|
||||||
BOARD *GetBoard(); /* get current editor board */
|
BOARD *GetBoard(); /* get current editor board */
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -151,4 +151,4 @@
|
||||||
%include "plugins.i"
|
%include "plugins.i"
|
||||||
%include "units.i"
|
%include "units.i"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue