Commit 6ad94a49 authored by Dick Hollenbeck's avatar Dick Hollenbeck

merge in evolving fp lib_table work

parents cace69a6 e0cc8a2f
common/netlist_keywords.*
common/netlist_lexer.h
common/pcb_plot_params_lexer.h
common/fp_lib_table_keywords.*
include/fp_lib_table_lexer.h
include/netlist_lexer.h
eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.*
......
......@@ -124,6 +124,9 @@ set(PCB_COMMON_SRCS
pcb_plot_params_keywords.cpp
pcb_keywords.cpp
../pcbnew/pcb_parser.cpp
fp_lib_table_keywords.cpp
fp_lib_id.cpp
fp_lib_table.cpp
)
......@@ -155,9 +158,15 @@ make_lexer(
make_lexer( ${CMAKE_CURRENT_SOURCE_DIR}/pcb.keywords
${PROJECT_SOURCE_DIR}/include/pcb_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_keywords.cpp
PCB
PCB_KEYS_T
)
# auto-generate pcbnew s-expression footprint library table code.
make_lexer( ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table.keywords
${PROJECT_SOURCE_DIR}/include/fp_lib_table_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table_keywords.cpp
FP_LIB_TABLE_T
)
# The dsntest may not build properly using MS Visual Studio.
if(NOT MSVC)
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2010 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
*/
#include <cstring>
#include <wx/wx.h> // _()
#include <fp_lib_id.h>
static inline bool isDigit( char c )
{
return c >= '0' && c <= '9';
}
const char* EndsWithRev( const char* start, const char* tail, char separator )
{
bool sawDigit = false;
while( tail > start && isDigit( *--tail ) )
{
sawDigit = true;
}
// if sawDigit, tail points to the 'v' here.
if( sawDigit && tail-3 >= start )
{
tail -= 3;
if( tail[0]==separator && tail[1]=='r' && tail[2]=='e' && tail[3]=='v' )
{
return tail+1; // omit separator, return "revN[N..]"
}
}
return 0;
}
int RevCmp( const char* s1, const char* s2 )
{
int r = strncmp( s1, s2, 3 );
if( r || strlen(s1)<4 || strlen(s2)<4 )
{
return r;
}
int rnum1 = atoi( s1+3 );
int rnum2 = atoi( s2+3 );
return -(rnum1 - rnum2); // swap the sign, higher revs first
}
//----<Policy and field test functions>-------------------------------------
static inline int okLogical( const std::string& aField )
{
// std::string::npos is largest positive number, casting to int makes it -1.
// Returning that means success.
return int( aField.find_first_of( ":" ) );
}
static int okRevision( const std::string& aField )
{
char rev[32]; // C string for speed
if( aField.size() >= 4 )
{
strcpy( rev, "x/" );
strcat( rev, aField.c_str() );
if( EndsWithRev( rev, rev + strlen(rev) ) == rev+2 )
return -1; // success
}
return 0; // first character position "is in error", is best we can do.
}
//----</Policy and field test functions>-------------------------------------
void FP_LIB_ID::clear()
{
logical.clear();
footprintName.clear();
revision.clear();
}
int FP_LIB_ID::Parse( const std::string& aId )
{
clear();
const char* rev = EndsWithRev( aId );
size_t revNdx;
size_t partNdx;
int offset;
//=====<revision>=========================================
if( rev )
{
revNdx = rev - aId.c_str();
// no need to check revision, EndsWithRev did that.
revision = aId.substr( revNdx );
--revNdx; // back up to omit the '/' which precedes the rev
}
else
{
revNdx = aId.size();
}
//=====<logical>==========================================
if( ( partNdx = aId.find( ':' ) ) != aId.npos )
{
offset = SetLogicalLib( aId.substr( 0, partNdx ) );
if( offset > -1 )
{
return offset;
}
++partNdx; // skip ':'
}
else
{
partNdx = 0;
}
return -1;
}
FP_LIB_ID::FP_LIB_ID( const std::string& aId ) throw( PARSE_ERROR )
{
int offset = Parse( aId );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in FP_LIB_ID string" ),
wxString::FromUTF8( aId.c_str() ),
aId.c_str(),
0,
offset );
}
}
int FP_LIB_ID::SetLogicalLib( const std::string& aLogical )
{
int offset = okLogical( aLogical );
if( offset == -1 )
{
logical = aLogical;
}
return offset;
}
int FP_LIB_ID::SetFootprintName( const std::string& aFootprintName )
{
int separation = int( aFootprintName.find_first_of( "/" ) );
if( separation != -1 )
{
logical = aFootprintName.substr( separation+1 );
return separation + (int) logical.size() + 1;
}
else
{
footprintName = aFootprintName;
}
return -1;
}
int FP_LIB_ID::SetRevision( const std::string& aRevision )
{
int offset = okRevision( aRevision );
if( offset == -1 )
{
revision = aRevision;
}
return offset;
}
std::string FP_LIB_ID::Format() const
{
std::string ret;
if( logical.size() )
{
ret += logical;
ret += ':';
}
if( revision.size() )
{
ret += '/';
ret += revision;
}
return ret;
}
std::string FP_LIB_ID::GetFootprintNameAndRev() const
{
std::string ret;
if( revision.size() )
{
ret += '/';
ret += revision;
}
return ret;
}
std::string FP_LIB_ID::Format( const std::string& aLogicalLib, const std::string& aFootprintName,
const std::string& aRevision )
throw( PARSE_ERROR )
{
std::string ret;
int offset;
if( aLogicalLib.size() )
{
offset = okLogical( aLogicalLib );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in logical library name" ),
wxString::FromUTF8( aLogicalLib.c_str() ),
aLogicalLib.c_str(),
0,
offset );
}
ret += aLogicalLib;
ret += ':';
}
if( aRevision.size() )
{
offset = okRevision( aRevision );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in revision" ),
wxString::FromUTF8( aRevision.c_str() ),
aRevision.c_str(),
0,
offset );
}
ret += '/';
ret += aRevision;
}
return ret;
}
#if 0 && defined(DEBUG)
// build this with Debug CMAKE_BUILD_TYPE
void FP_LIB_ID::Test()
{
static const char* lpids[] = {
"smt:R_0805/rev0",
"mysmt:R_0805/rev2",
"device:AXIAL-0500",
};
for( unsigned i=0; i<sizeof(lpids)/sizeof(lpids[0]); ++i )
{
// test some round tripping
FP_LIB_ID lpid( lpids[i] ); // parse
// format
printf( "input:'%s' full:'%s' logical: %s footprintName:'%s' rev:'%s'\n",
lpids[i],
lpid.Format().c_str(),
lpid.GetLogicalLib().c_str(),
lpid.GetFootprintName().c_str(),
lpid.GetRevision().c_str() );
}
}
int main( int argc, char** argv )
{
FP_LIB_ID::Test();
return 0;
}
#endif
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-12 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2012 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
*/
#include <set>
#include <io_mgr.h>
#include <fp_lib_table_lexer.h>
#include <fp_lib_table.h>
using namespace FP_LIB_TABLE_T;
FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) :
fallBack( aFallBackTable )
{
// not copying fall back, simply search aFallBackTable separately
// if "nickName not found".
}
void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR )
{
T tok;
while( ( tok = in->NextTok() ) != T_RIGHT )
{
// (lib (name "LOGICAL")(type "TYPE")(full_uri "FULL_URI")(options "OPTIONS"))
if( tok == T_EOF )
in->Expecting( T_RIGHT );
if( tok != T_LEFT )
in->Expecting( T_LEFT );
if( ( tok = in->NextTok() ) != T_fp_lib )
in->Expecting( T_fp_lib );
// (name "LOGICAL_NAME")
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_name )
in->Expecting( T_name );
in->NeedSYMBOLorNUMBER();
ROW row;
row.SetNickName( in->FromUTF8() );
in->NeedRIGHT();
// (uri "FULL_URI")
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_full_uri )
in->Expecting( T_full_uri );
in->NeedSYMBOLorNUMBER();
row.SetFullURI( in->FromUTF8() );
in->NeedRIGHT();
// (type "TYPE")
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_type )
in->Expecting( T_type );
in->NeedSYMBOLorNUMBER();
row.SetType( in->FromUTF8() );
in->NeedRIGHT();
// (options "OPTIONS")
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_options )
in->Expecting( T_options );
in->NeedSYMBOLorNUMBER();
row.SetOptions( in->FromUTF8() );
in->NeedRIGHT();
in->NeedRIGHT(); // terminate the (lib..)
// all nickNames within this table fragment must be unique, so we do not
// use doReplace in InsertRow(). (However a fallBack table can have a
// conflicting nickName and ours will supercede that one since in
// FindLib() we search this table before any fall back.)
if( !InsertRow( row ) )
{
wxString msg = wxString::Format(
_( "'%s' is a duplicate footprint library nickName" ),
GetChars( row.nickName )
);
THROW_IO_ERROR( msg );
}
}
}
void FP_LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR )
{
out->Print( nestLevel, "(fp_lib_table\n" );
for( ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
it->Format( out, nestLevel+1 );
out->Print( nestLevel, ")\n" );
}
void FP_LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR )
{
out->Print( nestLevel, "(lib (name %s)(full_uri %s)(type %s)(options %s))\n",
out->Quotew( GetNickName() ).c_str(),
out->Quotew( GetFullURI() ).c_str(),
out->Quotew( GetType() ).c_str(),
out->Quotew( GetOptions() ).c_str()
);
}
std::vector<wxString> FP_LIB_TABLE::GetLogicalLibs()
{
// Only return unique logical library names. Use std::set::insert() to
// quietly reject any duplicates, which can happen when encountering a duplicate
// nickname from one of the fall back table(s).
std::set<wxString> unique;
std::vector<wxString> ret;
const FP_LIB_TABLE* cur = this;
do
{
for( ROWS_CITER it = cur->rows.begin(); it!=cur->rows.end(); ++it )
{
unique.insert( it->nickName );
}
} while( ( cur = cur->fallBack ) != 0 );
// return a sorted, unique set of nicknames in a std::vector<wxString> to caller
for( std::set<wxString>::const_iterator it = unique.begin(); it!=unique.end(); ++it )
ret.push_back( *it );
return ret;
}
const FP_LIB_TABLE::ROW* FP_LIB_TABLE::findRow( const wxString& aNickName )
{
FP_LIB_TABLE* cur = this;
do
{
cur->ensureIndex();
INDEX_CITER it = cur->nickIndex.find( aNickName );
if( it != cur->nickIndex.end() )
{
return &cur->rows[it->second]; // found
}
// not found, search fall back table(s), if any
} while( ( cur = cur->fallBack ) != 0 );
return 0; // not found
}
bool FP_LIB_TABLE::InsertRow( const ROW& aRow, bool doReplace )
{
ensureIndex();
INDEX_CITER it = nickIndex.find( aRow.nickName );
if( it == nickIndex.end() )
{
rows.push_back( aRow );
nickIndex.insert( INDEX_VALUE( aRow.nickName, rows.size() - 1 ) );
return true;
}
if( doReplace )
{
rows[it->second] = aRow;
return true;
}
return false;
}
const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aLibraryNickName )
throw( IO_ERROR )
{
const ROW* row = findRow( aLibraryNickName );
if( !row )
{
wxString msg = wxString::Format( _("lib table contains no logical lib '%s'" ),
GetChars( aLibraryNickName ) );
THROW_IO_ERROR( msg );
}
return row;
}
PLUGIN* FP_LIB_TABLE::PluginFind( const wxString& aLibraryNickName )
throw( IO_ERROR )
{
const ROW* row = FindRow( aLibraryNickName );
// row will never be NULL here.
PLUGIN* plugin = IO_MGR::PluginFind( row->type );
return plugin;
}
#if 0 // don't know that this is needed yet
MODULE* FP_LIB_TABLE::LookupFootprint( const FP_LIB_ID& aFootprintId )
throw( IO_ERROR )
{
const ROW* row = FindRow( aFootprintId.GetLibraryNickName() );
// row will never be NULL here.
PLUGIN::RELEASER pi( PluginFind( row->type ) );
return pi->FootprintLoad( aLibraryPath->GetFullURI() ),
aFootprintId.GetFootprintName(),
// fetch a PROPERTIES instance on stack here
row->GetPropertiesFromOptions()
);
}
#endif
fp_lib_table
name
type
kicad
legacy
eagle
full_uri
options
fp_lib
......@@ -17,7 +17,7 @@
COMPONENTS_LISTBOX::COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
const wxPoint& loc, const wxSize& size,
int nbitems, wxString choice[] ) :
ITEMS_LISTBOX_BASE( parent, id, loc, size, LISTB_STYLE&(~wxLC_SINGLE_SEL))
ITEMS_LISTBOX_BASE( parent, id, loc, size, LISTB_STYLE & ~wxLC_SINGLE_SEL )
{
}
......
......@@ -19,8 +19,7 @@
#define FILTERFOOTPRINTKEY "FilterFootprint"
#define LISTB_STYLE wxSUNKEN_BORDER | wxLC_NO_HEADER | \
wxLC_REPORT | wxLC_VIRTUAL
#define LISTB_STYLE (wxSUNKEN_BORDER | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL)
#include <netlist_reader.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2010 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 _FP_LIB_ID_H_
#define _FP_LIB_ID_H_
#include <richio.h>
/**
* Class FP_LIB_ID
* is a Logical Footprint ID and consists of various portions much like a URI.
* It is a container for the separated portions of a logical footprint id so they
* can be accessed individually. The various portions of an FP_LIB_ID are:
* logicalLibraryName (nick name), footprint name, and revision. The logical library
* name and the footprint name are mandatory. The revision is optional and currently is
* not used.
*
* Example FP_LIB_ID string:
* "smt:R_0805/rev0".
*
* <p>
* <ul>
* <li> "smt" is the logical library name used to look up library information saved in the
* #FP_LIB_TABLE.
* <li> "R" is the name of the footprint within the library.
* <li> "rev0" is the revision, which is optional. If missing then its
* / delimiter should also not be present. A revision must begin with
* "rev" and be followed by at least one or more decimal digits.
* </ul>
*
* @author Dick Hollenbeck
*/
class FP_LIB_ID // aka GUID
{
public:
FP_LIB_ID() {}
/**
* Constructor FP_LIB_ID
* takes \a aId string and parses it. A typical FP_LIB_ID string consists of a logical
* library name followed by a footprint name.
* e.g.: "smt:R_0805", or
* e.g.: "mylib:R_0805"
*
* @param aId is a string to be parsed into the FP_LIB_ID object.
*/
FP_LIB_ID( const std::string& aId ) throw( PARSE_ERROR );
/**
* Function Parse
* [re-]stuffs this FP_LIB_ID with the information from @a aId.
*
* @param aId is the string to populate the #FP_LIB_ID object.
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into
* aId at which an error was detected.
*/
int Parse( const std::string& aId );
/**
* Function GetLogicalLib
* returns the logical library name portion of a FP_LIB_ID.
*/
const std::string& GetLogicalLib() const
{
return logical;
}
/**
* Function SetLogicalLib
* overrides the logical footprint library name portion of the FP_LIB_ID to @a aLogical.
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset
* into the parameter at which an error was detected, usually because it
* contained '/' or ':'.
*/
int SetLogicalLib( const std::string& aLogical );
/**
* Function GetFootprintName
* returns the footprint name, i.e. footprintName part without revision.
*/
const std::string& GetFootprintName() const
{
return footprintName;
}
/**
* Function GetFootprintNameAndRev
* returns the part name with revision if any, i.e. footprintName[/revN..]
*/
std::string GetFootprintNameAndRev() const;
/**
* Function SetFootprintName
* overrides the footprint name portion of the FP_LIB_ID to @a aFootprintName
*
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset
* into the parameter at which an error was detected, usually because it contained
* more than one '/', or one or more ':', or is blank.
*/
int SetFootprintName( const std::string& aFootprintName );
/**
* Function GetRevision
* returns the revision portion of the FP_LIB_ID.
*/
const std::string& GetRevision() const
{
return revision;
}
/**
* Function SetRevision
* overrides the revision portion of the FP_LIB_ID to @a aRevision and must
* be in the form "rev<num>" where "<num>" is "1", "2", etc.
*
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset*
* into the parameter at which an error was detected,because it did not
* look like "rev23"
*/
int SetRevision( const std::string& aRevision );
/**
* Function Format
* returns the fully formatted text of the FP_LIB_ID.
*/
std::string Format() const;
/**
* Function Format
* returns a std::string in the proper format as an FP_LIB_ID for a combination of
* aLogicalLib, aFootprintName, and aRevision.
*
* @throw PARSE_ERROR if any of the pieces are illegal.
*/
static std::string Format( const std::string& aLogicalLib, const std::string& aFootprintName,
const std::string& aRevision="" )
throw( PARSE_ERROR );
void clear();
#if defined(DEBUG)
static void Test();
#endif
protected:
std::string logical; ///< logical lib name or empty
std::string revision; ///< "revN[N..]" or empty
std::string footprintName; ///< The name of the footprint in the logical library.
};
/**
* Function EndsWithRev
* returns a pointer to the final string segment: "revN[N..]" or NULL if none.
* @param start is the beginning of string segment to test, the partname or
* any middle portion of it.
* @param tail is a pointer to the terminating nul, or one past inclusive end of
* segment, i.e. the string segment of interest is [start,tail)
* @param separator is the separating byte, expected: '.' or '/', depending on context.
*/
const char* EndsWithRev( const char* start, const char* tail, char separator = '/' );
static inline const char* EndsWithRev( const std::string& aFootprintName, char separator = '/' )
{
return EndsWithRev( aFootprintName.c_str(), aFootprintName.c_str()+aFootprintName.size(),
separator );
}
/**
* Function RevCmp
* compares two rev strings in a way like strcmp() except that the highest numbered
* revision is considered first in the sort order. The function probably won't work
* unless you give it two rev strings.
* @param s1 is a rev string like "rev10"
* @param s2 is a rev string like "rev1".
* @return int - either negative, zero, or positive depending on whether the revision
* is greater, equal, or less on the left hand side.
*/
int RevCmp( const char* s1, const char* s2 );
#endif // _FP_LIB_ID_H_
This diff is collapsed.
......@@ -26,8 +26,8 @@
* @file wxPcbStruct.h
*/
#ifndef WXPCB_STRUCT_H
#define WXPCB_STRUCT_H
#ifndef WXPCB_STRUCT_H_
#define WXPCB_STRUCT_H_
#include <wxBasePcbFrame.h>
......@@ -1604,4 +1604,16 @@ public:
};
#endif /* WXPCB_STRUCT_H */
class FP_LIB_TABLE;
/**
* Function InvokePcbLibTableEditor
* shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib tables.
*
* @return int - bits 0 and 1 tell whether a change was made to the @a aGlobal
* and/or the @a aProject table, respectively. If set, table was modified.
*/
int InvokePcbLibTableEditor( wxFrame* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject );
#endif // WXPCB_STRUCT_H_
......@@ -50,6 +50,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_export_3Dfiles_base.cpp
dialogs/dialog_find_base.cpp
dialogs/dialog_find.cpp
dialogs/dialog_fp_lib_table_base.cpp
dialogs/dialog_fp_lib_table.cpp
dialogs/dialog_freeroute_exchange.cpp
dialogs/dialog_freeroute_exchange_base.cpp
dialogs/dialog_gendrill.cpp
......@@ -247,11 +249,11 @@ set(PCBNEW_SCRIPTING_PYTHON_HELPERS
)
if (KICAD_SCRIPTING)
set(PCBNEW_SCRIPTING_SRCS
${PCBNEW_SCRIPTING_DIALOGS}
pcbnew_wrap.cxx
${PCBNEW_SCRIPTING_PYTHON_HELPERS}
)
set(PCBNEW_SCRIPTING_SRCS
${PCBNEW_SCRIPTING_DIALOGS}
pcbnew_wrap.cxx
${PCBNEW_SCRIPTING_PYTHON_HELPERS}
)
endif(KICAD_SCRIPTING)
##
......@@ -260,34 +262,34 @@ endif(KICAD_SCRIPTING)
if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting )
if (DEBUG)
set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG)
endif(DEBUG)
# collect CFLAGS , and pass them to swig later
set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting )
if (DEBUG)
set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG)
endif(DEBUG)
# collect CFLAGS , and pass them to swig later
get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS )
foreach( d ${DirDefs} )
SET(SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
endforeach()
get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS )
foreach( d ${DirDefs} )
SET(SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
endforeach()
# check if we have IO_MGR and KICAD_PLUGIN available
if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE )
SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN)
endif(USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE)
# check if we have IO_MGR and KICAD_PLUGIN available
if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE )
SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN)
endif(USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE)
if ( USE_PCBNEW_NANOMETRES )
SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES)
endif( USE_PCBNEW_NANOMETRES )
if ( USE_PCBNEW_NANOMETRES )
SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES)
endif( USE_PCBNEW_NANOMETRES )
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
if (KICAD_SCRIPTING)
SET(SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
SET(SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
DEPENDS scripting/pcbnew.i
DEPENDS scripting/board.i
DEPENDS scripting/board_item.i
......@@ -299,10 +301,10 @@ if (KICAD_SCRIPTING)
DEPENDS ../scripting/wx.i
DEPENDS ../scripting/kicadplugins.i
COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif(KICAD_SCRIPTING)
......@@ -430,7 +432,7 @@ install(TARGETS pcbnew
COMPONENT binary)
if(KICAD_SCRIPTING)
add_custom_target(FixSwigImportsScripting ALL
add_custom_target(FixSwigImportsScripting ALL
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pcbnew
COMMENT "Fixing swig_import_helper in Kicad scripting"
......@@ -442,7 +444,7 @@ if(KICAD_SCRIPTING)
endif(KICAD_SCRIPTING)
if (KICAD_SCRIPTING_MODULES)
add_custom_target(FixSwigImportsModuleScripting ALL
add_custom_target(FixSwigImportsModuleScripting ALL
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew
COMMENT "Fixing swig_import_helper in Kicad scripting modules"
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_fp_lib_table_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
m_splitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH );
m_splitter->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this );
m_splitter->SetMinimumPaneSize( 10 );
m_top = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxStaticBoxSizer* m_top_sizer;
m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( m_top, wxID_ANY, _("Library Tables by Scope") ), wxVERTICAL );
m_auinotebook = new wxAuiNotebook( m_top, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM );
m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_global_panel->SetToolTip( _("Module libraries which are visible for all projects") );
wxBoxSizer* m_global_sizer;
m_global_sizer = new wxBoxSizer( wxVERTICAL );
m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_global_grid->CreateGrid( 1, 4 );
m_global_grid->EnableEditing( true );
m_global_grid->EnableGridLines( true );
m_global_grid->EnableDragGridSize( true );
m_global_grid->SetMargins( 0, 0 );
// Columns
m_global_grid->AutoSizeColumns();
m_global_grid->EnableDragColMove( false );
m_global_grid->EnableDragColSize( true );
m_global_grid->SetColLabelSize( 30 );
m_global_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_global_grid->EnableDragRowSize( true );
m_global_grid->SetRowLabelSize( 40 );
m_global_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_global_sizer->Add( m_global_grid, 1, wxALL|wxEXPAND, 5 );
m_global_panel->SetSizer( m_global_sizer );
m_global_panel->Layout();
m_global_sizer->Fit( m_global_panel );
m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), true, wxNullBitmap );
m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_project_sizer;
m_project_sizer = new wxBoxSizer( wxVERTICAL );
m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_project_grid->CreateGrid( 1, 4 );
m_project_grid->EnableEditing( true );
m_project_grid->EnableGridLines( true );
m_project_grid->EnableDragGridSize( true );
m_project_grid->SetMargins( 0, 0 );
// Columns
m_project_grid->AutoSizeColumns();
m_project_grid->EnableDragColMove( false );
m_project_grid->EnableDragColSize( true );
m_project_grid->SetColLabelSize( 30 );
m_project_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_project_grid->EnableDragRowSize( true );
m_project_grid->SetRowLabelSize( 40 );
m_project_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_project_sizer->Add( m_project_grid, 1, wxALL|wxEXPAND, 5 );
m_project_panel->SetSizer( m_project_sizer );
m_project_panel->Layout();
m_project_sizer->Fit( m_project_panel );
m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap );
m_top_sizer->Add( m_auinotebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer51;
bSizer51 = new wxBoxSizer( wxHORIZONTAL );
m_append_button = new wxButton( m_top, wxID_ANY, _("Append Row"), wxDefaultPosition, wxDefaultSize, 0 );
m_append_button->SetToolTip( _("Add a pcb library row to this table") );
bSizer51->Add( m_append_button, 0, wxALL, 5 );
m_delete_button = new wxButton( m_top, wxID_ANY, _("Delete Row"), wxDefaultPosition, wxDefaultSize, 0 );
m_delete_button->SetToolTip( _("Remove a PCB library from this library table") );
bSizer51->Add( m_delete_button, 0, wxALL, 5 );
m_move_up_button = new wxButton( m_top, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_up_button->SetToolTip( _("Move the currently selected row up one position") );
bSizer51->Add( m_move_up_button, 0, wxALL, 5 );
m_move_down_button = new wxButton( m_top, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
m_move_down_button->SetToolTip( _("Move the currently selected row down one position") );
bSizer51->Add( m_move_down_button, 0, wxALL, 5 );
m_top_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 );
m_top->SetSizer( m_top_sizer );
m_top->Layout();
m_top_sizer->Fit( m_top );
m_bottom = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_bottom_sizer;
m_bottom_sizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_bottom, wxID_ANY, _("Path Substitutions") ), wxVERTICAL );
m_path_subs_grid = new wxGrid( m_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_path_subs_grid->CreateGrid( 2, 2 );
m_path_subs_grid->EnableEditing( true );
m_path_subs_grid->EnableGridLines( true );
m_path_subs_grid->EnableDragGridSize( false );
m_path_subs_grid->SetMargins( 0, 0 );
// Columns
m_path_subs_grid->SetColSize( 0, 150 );
m_path_subs_grid->SetColSize( 1, 500 );
m_path_subs_grid->AutoSizeColumns();
m_path_subs_grid->EnableDragColMove( false );
m_path_subs_grid->EnableDragColSize( true );
m_path_subs_grid->SetColLabelSize( 30 );
m_path_subs_grid->SetColLabelValue( 0, _("Category") );
m_path_subs_grid->SetColLabelValue( 1, _("Path Segment") );
m_path_subs_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_path_subs_grid->EnableDragRowSize( true );
m_path_subs_grid->SetRowLabelSize( 40 );
m_path_subs_grid->SetRowLabelValue( 0, _("%S") );
m_path_subs_grid->SetRowLabelValue( 1, _("%P") );
m_path_subs_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbSizer1->Add( m_path_subs_grid, 1, wxALL|wxEXPAND, 5 );
m_bottom_sizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( m_bottom, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( m_bottom, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
m_bottom->SetSizer( m_bottom_sizer );
m_bottom->Layout();
m_bottom_sizer->Fit( m_bottom );
m_splitter->SplitHorizontally( m_top, m_bottom, 343 );
bSizer1->Add( m_splitter, 2, wxEXPAND, 5 );
this->SetSizer( bSizer1 );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
}
DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
{
// Disconnect Events
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_FP_LIB_TABLE_BASE_H__
#define __DIALOG_FP_LIB_TABLE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/aui/auibook.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/splitter.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_FP_LIB_TABLE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
{
private:
protected:
wxSplitterWindow* m_splitter;
wxPanel* m_top;
wxAuiNotebook* m_auinotebook;
wxPanel* m_global_panel;
wxGrid* m_global_grid;
wxPanel* m_project_panel;
wxGrid* m_project_grid;
wxButton* m_append_button;
wxButton* m_delete_button;
wxButton* m_move_up_button;
wxButton* m_move_down_button;
wxPanel* m_bottom;
wxGrid* m_path_subs_grid;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); }
virtual void appendRowHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void deleteRowHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void moveUpHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void moveDownHandler( wxMouseEvent& event ) { event.Skip(); }
virtual void onCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 864,652 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FP_LIB_TABLE_BASE();
void m_splitterOnIdle( wxIdleEvent& )
{
m_splitter->SetSashPosition( 343 );
m_splitter->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this );
}
};
#endif //__DIALOG_FP_LIB_TABLE_BASE_H__
......@@ -80,22 +80,50 @@ void IO_MGR::PluginRelease( PLUGIN* aPlugin )
}
const wxString IO_MGR::ShowType( PCB_FILE_T aFileType )
const wxString IO_MGR::ShowType( PCB_FILE_T aType )
{
switch( aFileType )
// keep this function in sync with EnumFromStr() relative to the
// text spellings. If you change the spellings, you will obsolete
// library tables, so don't do change, only additions are ok.
switch( aType )
{
default:
return wxString::Format( _( "Unknown PCB_FILE_T value: %d" ), aFileType );
return wxString::Format( _( "Unknown PCB_FILE_T value: %d" ), aType );
case LEGACY:
return wxString( wxT( "KiCad Legacy" ) );
return wxString( wxT( "Legacy" ) );
case KICAD:
return wxString( wxT( "KiCad" ) );
case EAGLE:
return wxString( wxT( "Eagle" ) );
}
}
IO_MGR::PCB_FILE_T IO_MGR::EnumFromStr( const wxString& aType )
{
// keep this function in sync with ShowType() relative to the
// text spellings. If you change the spellings, you will obsolete
// library tables, so don't do change, only additions are ok.
if( aType == wxT( "KiCad" ) )
return KICAD;
if( aType == wxT( "Legacy" ) )
return LEGACY;
if( aType == wxT( "Eagle" ) )
return EAGLE;
// wxASSERT( blow up here )
return PCB_FILE_T( -1 );
}
const wxString IO_MGR::GetFileExtension( PCB_FILE_T aFileType )
{
wxString ext = wxEmptyString;
......
......@@ -87,6 +87,12 @@ public:
*/
static const wxString ShowType( PCB_FILE_T aFileType );
/**
* Function EnumFromStr
* returns the PCB_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
*/
static PCB_FILE_T EnumFromStr( const wxString& aFileType );
/**
* Function GetFileExtension
* returns the file extension for \a aFileType.
......
......@@ -426,6 +426,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Li&brary" ), _( "Setting libraries, directories and others..." ),
KiBitmap( library_xpm ) );
AddMenuItem( configmenu, ID_PCB_LIB_TABLE_EDIT,
_( "Li&brary Tables" ), _( "Setup footprint libraries" ),
KiBitmap( library_xpm ) );
// Colors and Visibility are also handled by the layers manager toolbar
AddMenuItem( configmenu, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
m_show_layer_manager_tools ?
......
......@@ -32,7 +32,7 @@
#include <pcb_lexer.h>
#include <hashtables.h>
using namespace PCB;
using namespace PCB_KEYS_T;
class BOARD;
......
......@@ -109,6 +109,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// menu Config
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, PCB_EDIT_FRAME::OnConfigurePcbOptions )
EVT_MENU( ID_CONFIG_REQ, PCB_EDIT_FRAME::Process_Config )
EVT_MENU( ID_PCB_LIB_TABLE_EDIT, PCB_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, PCB_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, PCB_EDIT_FRAME::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
......
......@@ -43,6 +43,7 @@
#include <dialog_hotkeys_editor.h>
#include <class_board.h>
#include <fp_lib_table.h>
#include <pcbplot.h>
#include <pcbnew.h>
......@@ -58,8 +59,8 @@
void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
wxFileName fn;
int id = event.GetId();
wxFileName fn;
switch( id )
{
......@@ -81,6 +82,37 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
InstallConfigFrame();
break;
case ID_PCB_LIB_TABLE_EDIT:
{
// scaffolding: dummy up some data into tables, until actual load/save are in place.
FP_LIB_TABLE gbl;
FP_LIB_TABLE prj;
gbl.InsertRow( FP_LIB_TABLE::ROW(
wxT( "passives" ), wxT( "%G/passives" ), wxT( "KiCad" ), wxT( "speed=fast,purpose=testing" ) ) );
gbl.InsertRow( FP_LIB_TABLE::ROW(
wxT( "micros" ), wxT( "%P/micros" ), wxT( "Legacy" ), wxT( "speed=fast,purpose=testing" ) ) );
prj.InsertRow( FP_LIB_TABLE::ROW(
wxT( "micros" ), wxT( "%P/potato_chips" ), wxT( "Eagle" ), wxT( "speed=fast,purpose=testing" ) ) );
int r = InvokePcbLibTableEditor( this, &gbl, &prj );
if( r & 1 )
{
// save global table to disk and apply it
D( printf( "global has changed\n" );)
}
if( r & 2 )
{
// save project table to disk and apply it
D( printf( "project has changed\n" );)
}
}
break;
case ID_PCB_MASK_CLEARANCE:
{
DIALOG_PADS_MASK_CLEARANCE dlg( this );
......
#ifndef __PCBNEW_ID_H__
#define __PCBNEW_ID_H__
#ifndef PCBNEW_ID_H_
#define PCBNEW_ID_H_
#include <id.h>
......@@ -250,6 +250,7 @@ enum pcbnew_ids
ID_MENU_PCB_SHOW_3D_FRAME,
ID_PCB_USER_GRID_SETUP,
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
ID_PCB_LIB_TABLE_EDIT,
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
......@@ -330,7 +331,7 @@ enum pcbnew_ids
ID_MODVIEW_NEXT,
ID_MODVIEW_SHOW_3D_VIEW,
ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD,
ID_FOOTPRINT_WIZARD_WINDOW,
ID_FOOTPRINT_WIZARD_WINDOW,
ID_FOOTPRINT_WIZARD_PAGES,
ID_FOOTPRINT_WIZARD_PARAMETERS,
ID_FOOTPRINT_WIZARD_NEXT,
......@@ -343,7 +344,7 @@ enum pcbnew_ids
ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW,
ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD,
};
#endif /* __PCBNEW_IDS_H__ */
#endif // PCBNEW_ID_H_
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