Commit 1468a4ae authored by Wayne Stambaugh's avatar Wayne Stambaugh

Pcbnew s-experssion footprint library implementation.

* Add footprint methods to PCB_IO.
* Add FP_CACHE and FP_CACHE_ITEM for handling new footprint library design.
* Add code to save legacy libraries in new format.
* Change behavior of BOARD_ITEM::GetLayerName() to return the default layer
  name when the item does not have a BOARD as a parent.
* Minor changes to the module output formatter when writing to module library
  files (no BOARD as parent).
* Add new (and some that I forgot along the way) CMake flags to
  EDA_BASE_FRAME::CopyVersionInfoToClipboard().
* Add -Wno-narrowing to GCC flags to stop GCC 4.7 from complaining about
  a conversion from int to unsigned in the Boost polygon library.
* Add INPUT_STREAM_READER to richio.cpp to allow using any object derived
  from wxInputStream as a LINE_READER (needs to be validated).
parent 8031e512
......@@ -21,11 +21,14 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
#
option(USE_PCBNEW_SEXPR_FILE_FORMAT
"Use s-expression Pcbnew file format support (default OFF)." )
"Use Pcbnew s-expression file format support (default OFF)." )
option(USE_PCBNEW_NANOMETRES
"Use nanometers for Pcbnew internal units instead of deci-mils (default OFF).")
option(USE_PCBNEW_SEXPR_FOOTPRINT_LIBS
"Use Pcbnew s-expression footprint library format (default OFF).")
# Russian GOST patch
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
......@@ -100,15 +103,20 @@ endif( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
#================================================
if(CMAKE_COMPILER_IS_GNUCXX)
# Added -Wno-narrowing on 10/7/12 to prevent a huge number of warnings when
# compiling with GCC 4.7. This appears to be caused by and int to unsigned
# conversion in the Boost polygon library. At some point in the future when
# Boost is updated to the next version, -Wno-narrowing should be removed to
# see if the problem has been resolved. Wayne.
if(WIN32) # under Windows/mingw, -fPIC option is enabled by default
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-Wall -Wno-narrowing -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wno-narrowing -O2 -DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wno-narrowing -g3 -ggdb3 -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wno-narrowing -g3 -ggdb3 -DDEBUG")
else(WIN32)
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC")
......@@ -116,8 +124,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG -fPIC")
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wno-narrowing -g3 -ggdb3 -DDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wno-narrowing -g3 -ggdb3 -DDEBUG -fPIC")
endif(WIN32)
endif(CMAKE_COMPILER_IS_GNUCXX)
......
......@@ -55,8 +55,10 @@
#cmakedefine USE_IMAGES_IN_MENUS 1
/// Definitions to enable the s-expression file formats and nanometer units.
#cmakedefine USE_PCBNEW_NANOMETRES
#cmakedefine USE_PCBNEW_SEXPR_FILE_FORMAT
#cmakedefine USE_PCBNEW_SEXPR_FOOTPRINT_LIBS
/// The legacy file format revision of the *.brd file created by this build
#if defined(USE_PCBNEW_NANOMETRES)
......
......@@ -499,6 +499,27 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
tmp << wxT( "Options: " );
tmp << wxT( " USE_PCBNEW_SEXPR_FILE_FORMAT=" );
#ifdef USE_PCBNEW_SEXPR_FILE_FORMAT
tmp << wxT( "ON\n" );
#else
tmp << wxT( "OFF\n" );
#endif
tmp << wxT( " USE_PCBNEW_NANOMETRES=" );
#ifdef USE_PCBNEW_NANOMETRES
tmp << wxT( "ON\n" );
#else
tmp << wxT( "OFF\n" );
#endif
tmp << wxT( " USE_PCBNEW_SEXPR_FOOTPRINT_LIBS=" );
#ifdef USE_PCBNEW_SEXPR_FOOTPRINT_LIBS
tmp << wxT( "ON\n" );
#else
tmp << wxT( "OFF\n" );
#endif
tmp << wxT( " KICAD_GOST=" );
#ifdef KICAD_GOST
tmp << wxT( "ON\n" );
......
......@@ -185,6 +185,44 @@ unsigned STRING_LINE_READER::ReadLine() throw( IO_ERROR )
}
INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER( wxInputStream* aStream ) :
LINE_READER( LINE_READER_LINE_DEFAULT_MAX ),
m_stream( aStream )
{
}
unsigned INPUTSTREAM_LINE_READER::ReadLine() throw( IO_ERROR )
{
length = 0;
line[0] = 0;
while( !m_stream->Eof() )
{
if( length >= maxLineLength )
THROW_IO_ERROR( _( "Maximum line length exceeded" ) );
if( length + 1 > capacity )
expandCapacity( capacity * 2 );
line[ length ] = m_stream->GetC();
length++;
if( line[ length - 1 ] == '\n' )
break;
}
line[ length ] = 0;
length -= 1;
// lineNum is incremented even if there was no line read, because this
// leads to better error reporting when we hit an end of file.
++lineNum;
return length;
}
//-----<OUTPUTFORMATTER>----------------------------------------------------
// factor out a common GetQuoteChar
......
......@@ -51,6 +51,7 @@ const wxString DrillFileExtension( wxT( "drl" ) );
const wxString SVGFileExtension( wxT( "svg" ) );
const wxString ReportFileExtension( wxT( "rpt" ) );
const wxString FootprintPlaceFileExtension( wxT( "pos" ) );
const wxString FootprintFileExtension( wxT( "kicad_mod" ) );
// These strings are wildcards for file selection dialogs.
// Because thes are static, one should explicitely call wxGetTranslation
......@@ -64,7 +65,8 @@ const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) );
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
const wxString FootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) );
const wxString LegacyFootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
const wxString AllFilesWildcard( _( "All files (*)|*" ) );
......
......@@ -384,6 +384,28 @@ public:
};
/**
* Class INPUTSTREAM_LINE_READER
* is a LINE_READER that reads from a wxInputStream object.
*/
class INPUTSTREAM_LINE_READER : public LINE_READER
{
protected:
wxInputStream* m_stream; //< The input stream to read. No ownership of this pointer.
public:
/**
* Constructor WXINPUTSTREAM_LINE_READER
*
* @param aStream A pointer to a wxInputStream object to read.
*/
INPUTSTREAM_LINE_READER( wxInputStream* aStream );
unsigned ReadLine() throw( IO_ERROR ); // see LINE_READER::ReadLine() description
};
/**
* Class OUTPUTFORMATTER
* is an important interface (abstract) class used to output UTF8 text in
......
......@@ -60,6 +60,7 @@ extern const wxString DrillFileExtension;
extern const wxString SVGFileExtension;
extern const wxString ReportFileExtension;
extern const wxString FootprintPlaceFileExtension;
extern const wxString FootprintFileExtension;
/// Proper wxFileDialog wild card definitions.
extern const wxString SchematicSymbolFileWildcard;
......@@ -82,6 +83,7 @@ extern const wxString ReportFileWildcard;
extern const wxString FootprintPlaceFileWildcard;
extern const wxString VrmlFileWildcard;
extern const wxString DocModulesFileName;
extern const wxString LegacyFootprintLibFileWildcard;
extern const wxString FootprintLibFileWildcard;
#endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_
......@@ -365,28 +365,29 @@ public:
* (usually: true in Schematic editor, false in Module editor)
*/
void GlobalChange_PadSettings( D_PAD* aPad,
bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter,
bool aRedraw, bool aSaveForUndo );
bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter,
bool aRedraw,
bool aSaveForUndo );
// loading footprints
/**
* Function loadFootprintFromLibrary
* loads @a aFootprintName from @a aLibraryPath.
* If found add the module is also added to the BOARD, just for good measure.
*
* @param aLibraryPath - the full filename or the short name of the library to read.
* @param aLibraryPath - the full filename or the short name of the library to read.
* if it is a short name, the file is searched in all library valid paths
* @param aFootprintName is the footprint to load
* @param aDisplayError = true to display an error message if any.
* @param aFootprintName is the footprint to load
* @param aDisplayError = true to display an error message if any.
* @param aAddToBoard Set to true to add the footprint to the board if found.
*
* @return MODULE* - new module, or NULL
* @return MODULE* - new module, or NULL
*/
MODULE* loadFootprintFromLibrary( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aDisplayError );
MODULE* loadFootprintFromLibrary( const wxString& aLibraryPath, const wxString& aFootprintName,
bool aDisplayError, bool aAddToBoard = true );
/**
* Function loadFootprintFromLibraries
......
......@@ -82,10 +82,8 @@ wxString BOARD_ITEM::GetLayerName() const
if( board != NULL )
return board->GetLayerName( m_Layer ).Trim();
wxFAIL_MSG( wxT( "No board found for board item type " ) + GetClass() );
layerName = _( "** undefined layer **" );
return layerName;
// If no parent, return the default layer for the object.
return BOARD::GetDefaultLayerName( m_Layer, true );
}
......
This diff is collapsed.
......@@ -29,6 +29,7 @@
class BOARD;
class BOARD_ITEM;
class FP_CACHE;
/** Current s-expression file format version. 2 was the last legacy format version. */
......@@ -68,10 +69,28 @@ public:
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties = NULL );
wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL);
MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
PROPERTIES* aProperties = NULL );
void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint,
PROPERTIES* aProperties = NULL );
void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName );
void FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL);
void FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL );
bool IsFootprintLibWritable( const wxString& aLibraryPath );
//-----</PLUGIN API>--------------------------------------------------------
PCB_IO();
~PCB_IO();
/**
* Function Format
* outputs \a aItem to \a aFormatter in s-expression format.
......@@ -92,17 +111,19 @@ public:
return ret;
}
void SetOutputFormatter( OUTPUTFORMATTER* aFormatter ) { m_out = aFormatter; }
protected:
wxString m_error; ///< for throwing exceptions
BOARD* m_board; ///< which BOARD, no ownership here
PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL.
FP_CACHE* m_cache; ///< Footprint library cache.
LINE_READER* m_reader; ///< no ownership here.
wxString m_filename; ///< for saves only, name is in m_reader for loads
int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing?
int m_loading_format_version; ///< which #BOARD_FORMAT_VERSION should be Load()ed?
STRING_FORMATTER m_sf;
OUTPUTFORMATTER* m_out; ///< output any Format()s to this, no ownership
......@@ -144,6 +165,11 @@ private:
throw( IO_ERROR );
void formatLayer( const BOARD_ITEM* aItem ) const;
/// we only cache one footprint library for now, this determines which one.
void cacheLib( const wxString& aLibraryPath );
void init( PROPERTIES* aProperties );
};
#endif // KICAD_PLUGIN_H_
......@@ -4387,4 +4387,3 @@ LEGACY_PLUGIN::~LEGACY_PLUGIN()
{
delete m_cache;
}
......@@ -163,7 +163,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib )
config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path );
title = aCreateSysLib ? _( "Create New Library" ) : _( "Export Module" );
wildcard = aCreateSysLib ? FootprintLibFileWildcard : ModExportFileWildcard;
wildcard = aCreateSysLib ? LegacyFootprintLibFileWildcard : ModExportFileWildcard;
fn.SetPath( path );
......@@ -272,7 +272,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewM
{
wxFileDialog dlg( this, _( "Library" ), path,
wxEmptyString,
wxGetTranslation( FootprintLibFileWildcard ),
wxGetTranslation( LegacyFootprintLibFileWildcard ),
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
......@@ -562,4 +562,3 @@ int FOOTPRINT_EDIT_FRAME::CreateLibrary( const wxString& aLibName )
return 1; // remember how many times we succeeded
}
......@@ -284,7 +284,9 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryPath,
* if it is a short name, the file is searched in all library valid paths
*/
MODULE* PCB_BASE_FRAME::loadFootprintFromLibrary( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aDisplayError )
const wxString& aFootprintName,
bool aDisplayError,
bool aAddToBoard )
{
try
{
......@@ -309,7 +311,9 @@ MODULE* PCB_BASE_FRAME::loadFootprintFromLibrary( const wxString& aLibraryPath,
return NULL;
}
GetBoard()->Add( footprint, ADD_APPEND );
if( aAddToBoard )
GetBoard()->Add( footprint, ADD_APPEND );
SetStatusText( wxEmptyString );
return footprint;
}
......@@ -509,3 +513,86 @@ MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb )
return module;
}
void FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs( wxCommandEvent& aEvent )
{
wxFileName fn;
wxString msg, path, title;
FOOTPRINT_LIST fpInfoList;
title = _( "Save Footprint Library As" );
fn = wxFileName( wxEmptyString, GetCurrentLib(), FootprintLibFileExtension );
path = wxGetApp().FindLibraryPath( fn );
fn.SetPath( path );
wxDirDialog dlg( this, msg, fn.GetPath() );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fn.SetPath( dlg.GetPath() );
fn.AppendDir( GetCurrentLib() );
path = fn.GetPath();
try
{
// @todo : hard code this as IO_MGR::KICAD plugin, what would be the reason to "export"
// any other single footprint type, with clipboard support coming?
// Use IO_MGR::LEGACY for now, until the IO_MGR::KICAD plugin is ready.
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::KICAD ) );
try
{
// try to delete the library whether it exists or not, quietly.
pi->FootprintLibDelete( fn.GetPath() );
}
catch( IO_ERROR ioe )
{
// Ignore this, it will often happen and is not an error because
// the library may not exist. If library was in a read only directory,
// it will still exist as we get to the FootprintLibCreate() below.
}
pi->FootprintLibCreate( fn.GetPath() );
wxArrayString libNameList;
wxLogDebug( wxT( "Loading legacy footprint library '%s'." ), m_CurrentLib.GetData() );
wxFileName libFileName = m_CurrentLib;
libFileName.SetExt( FootprintLibFileExtension );
wxString libPath = wxGetApp().FindLibraryPath( libFileName );
libNameList.Add( m_CurrentLib );
fpInfoList.ReadFootprintFiles( libNameList );
for( unsigned i = 0; i < fpInfoList.GetCount(); i++ )
{
MODULE* module = loadFootprintFromLibrary( libFileName.GetFullPath(),
fpInfoList.GetItem( i ).m_Module,
true, false );
wxLogDebug( wxT( "Saving footprint %s as s-expression to path %s" ),
module->GetLibRef().GetData(), path.GetData() );
pi->FootprintSave( path, module );
}
}
catch( IO_ERROR ioe )
{
DisplayError( this, ioe.errorText );
return;
}
msg.Printf( _( "Footprint library type '%s' saved to <%s> as s-expression" ),
GetCurrentLib().GetData(), path.GetData() );
DisplayInfoMessage( this, msg );
}
......@@ -76,19 +76,19 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
// from File
AddMenuItem( openSubmenu, ID_MODEDIT_IMPORT_PART,
_( "Load from File (&Import)" ),
_( "Import Module from File (&Import)" ),
_( "Import a footprint from an existing file" ),
KiBitmap( import_module_xpm ) );
// from Library
AddMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE,
_( "Load from Li&brary" ),
_( "Load Module from Current Li&brary" ),
_( "Open a footprint module from a Library" ),
KiBitmap( module_xpm ) );
// from current Board
AddMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
_( "Load from &Current Board" ),
_( "Load Module from &Current Board" ),
_( "Load a footprint module from the current loaded board" ),
KiBitmap( load_module_board_xpm ) );
......@@ -99,6 +99,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( open_document_xpm ) );
fileMenu->AppendSeparator();
#ifdef USE_PCBNEW_SEXPR_FOOTPRINT_LIBS
// Save the currently loaded legacy library as an s-expression library.
AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBRARY_AS, _( "Save Library In S-Expression Format" ),
_( "Save currently loaded legacy library as an s-expression library." ),
wxNullBitmap );
#endif
// Save module
text = AddHotkeyName( _( "&Save Module in Active Library" ),
g_Module_Editor_Hokeys_Descr, HK_SAVE_MODULE );
......@@ -108,7 +115,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
// Save module in new lib
AddMenuItem( fileMenu, ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
_( "S&ave Module in a New Lib" ),
_( "S&ave Module in a New Library" ),
_( "Create new library and save current module" ),
KiBitmap( new_library_xpm ) );
......
......@@ -85,6 +85,15 @@ public:
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
/**
* Function OnSaveLibraryAs
* saves the current library to a new name and/or library type.
*
* @note Saving as a new library type requires the plug-in to support saving libraris.
* @see PLUGIN::FootprintSave and PLUGIN::FootprintLibCreate
*/
void OnSaveLibraryAs( wxCommandEvent& aEvent );
/**
* Function OnHotKey
* handle hot key events.
......
......@@ -67,6 +67,11 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_COMBOBOX( ID_ON_GRID_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectGrid )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
#ifdef USE_PCBNEW_SEXPR_FOOTPRINT_LIBS
EVT_TOOL( ID_MODEDIT_SAVE_LIBRARY_AS, FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs )
#endif
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
......@@ -109,9 +114,12 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_BODY_ITEM, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
// Module transformations
......@@ -126,6 +134,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_Frame )
EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected )
EVT_UPDATE_UI( ID_MODEDIT_SAVE_LIBRARY_AS, FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected )
EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
EVT_UPDATE_UI( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
......
......@@ -33,6 +33,7 @@
#include <trigo.h>
#include <3d_struct.h>
#include <class_title_block.h>
#include <class_board.h>
#include <class_dimension.h>
#include <class_drawsegment.h>
......@@ -43,9 +44,9 @@
#include <class_pad.h>
#include <class_track.h>
#include <class_zone.h>
#include <kicad_plugin.h>
#include <pcb_plot_params.h>
#include <zones.h>
#include <pcb_parser.h>
using namespace std;
......@@ -318,6 +319,10 @@ BOARD_ITEM* PCB_PARSER::Parse() throw( IO_ERROR, PARSE_ERROR )
item = (BOARD_ITEM*) parseBOARD();
break;
case T_module:
item = (BOARD_ITEM*) parseMODULE();
break;
default:
wxString err;
err.Printf( _( "unknown token \"%s\"" ), GetChars( FromUTF8() ) );
......
......@@ -47,8 +47,10 @@ class TEXTE_MODULE;
class TEXTE_PCB;
class MODULE;
class PCB_TARGET;
class PROPERTIES;
class S3D_MASTER;
class ZONE_CONTAINER;
class FPL_CACHE;
WX_DECLARE_STRING_HASH_MAP( int, LAYER_HASH_MAP );
......@@ -61,8 +63,8 @@ WX_DECLARE_STRING_HASH_MAP( int, LAYER_HASH_MAP );
*/
class PCB_PARSER : public PCB_LEXER
{
BOARD* m_board;
LAYER_HASH_MAP m_layerMap; //< Map layer name to it's index saved in BOARD::m_Layer.
BOARD* m_board;
LAYER_HASH_MAP m_layerMap; //< Map layer name to it's index saved in BOARD::m_Layer.
void parseHeader() throw( IO_ERROR, PARSE_ERROR );
void parseGeneralSection() throw( IO_ERROR, PARSE_ERROR );
......
......@@ -301,6 +301,7 @@ enum pcbnew_ids
ID_MODEDIT_CHECK,
ID_MODEDIT_SELECT_CURRENT_LIB,
ID_MODEDIT_SAVE_LIBMODULE,
ID_MODEDIT_SAVE_LIBRARY_AS,
ID_MODEDIT_DELETE_PART,
ID_MODEDIT_NEW_MODULE,
ID_MODEDIT_NEW_MODULE_FROM_WIZARD,
......
......@@ -77,12 +77,12 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, KiBitmap( new_footprint_xpm ),
_( "New module" ) );
m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, wxEmptyString,
KiBitmap( module_wizard_xpm ),
_( "New module from footprint wizard" ) );
m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString,
KiBitmap( load_module_lib_xpm ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment