Adds necessary structure to implement and test Eagle schematich plugin
This commit is contained in:
parent
22063dc5a5
commit
2403f2b558
|
@ -168,6 +168,7 @@ set( EESCHEMA_SRCS
|
|||
sch_bus_entry.cpp
|
||||
sch_collectors.cpp
|
||||
sch_component.cpp
|
||||
sch_eagle_plugin.cpp
|
||||
sch_field.cpp
|
||||
sch_io_mgr.cpp
|
||||
sch_item_struct.cpp
|
||||
|
@ -299,7 +300,7 @@ target_link_libraries( eeschema
|
|||
)
|
||||
|
||||
# the DSO (KIFACE) housing the main eeschema code:
|
||||
add_library( eeschema_kiface MODULE
|
||||
add_library( eeschema_kiface STATIC
|
||||
${EESCHEMA_SRCS}
|
||||
${EESCHEMA_COMMON_SRCS}
|
||||
)
|
||||
|
@ -437,3 +438,4 @@ add_custom_target(
|
|||
add_dependencies( eeschema_kiface dialog_bom_cfg_lexer_source_files )
|
||||
|
||||
add_subdirectory( plugins )
|
||||
add_subdirectory( qa )
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# This program source code file is part of KiCad, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2017 CERN
|
||||
# @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
|
||||
#
|
||||
# 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
|
||||
|
||||
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
|
||||
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
add_executable( qa_eagle_plugin
|
||||
test_module.cpp
|
||||
test_basic.cpp
|
||||
)
|
||||
|
||||
add_dependencies( qa_eagle_plugin eeschema )
|
||||
|
||||
target_link_libraries( qa_eagle_plugin
|
||||
eeschema
|
||||
eeschema_kiface
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
||||
${wxWidgets_LIBRARIES}
|
||||
)
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE eagle SYSTEM "eagle.dtd">
|
||||
<eagle version="8.0.0">
|
||||
<drawing>
|
||||
<settings>
|
||||
<setting alwaysvectorfont="no"/>
|
||||
<setting verticaltext="up"/>
|
||||
</settings>
|
||||
<grid distance="0.1" unitdist="inch" unit="inch" style="lines" multiple="1" display="no" altdistance="0.01" altunitdist="inch" altunit="inch"/>
|
||||
<layers>
|
||||
<layer number="90" name="Modules" color="5" fill="1" visible="yes" active="yes"/>
|
||||
<layer number="91" name="Nets" color="2" fill="1" visible="yes" active="yes"/>
|
||||
<layer number="92" name="Busses" color="1" fill="1" visible="yes" active="yes"/>
|
||||
<layer number="93" name="Pins" color="2" fill="1" visible="no" active="yes"/>
|
||||
<layer number="94" name="Symbols" color="4" fill="1" visible="yes" active="yes"/>
|
||||
<layer number="95" name="Names" color="7" fill="1" visible="yes" active="yes"/>
|
||||
<layer number="96" name="Values" color="7" fill="1" visible="yes" active="yes"/>
|
||||
<layer number="97" name="Info" color="7" fill="1" visible="yes" active="yes"/>
|
||||
<layer number="98" name="Guide" color="6" fill="1" visible="yes" active="yes"/>
|
||||
</layers>
|
||||
<schematic xreflabel="%F%N/%S.%C%R" xrefpart="/%S.%C%R">
|
||||
<libraries>
|
||||
</libraries>
|
||||
<attributes>
|
||||
</attributes>
|
||||
<variantdefs>
|
||||
</variantdefs>
|
||||
<classes>
|
||||
<class number="0" name="default" width="0" drill="0">
|
||||
</class>
|
||||
</classes>
|
||||
<parts>
|
||||
</parts>
|
||||
<sheets>
|
||||
<sheet>
|
||||
<plain>
|
||||
</plain>
|
||||
<instances>
|
||||
</instances>
|
||||
<busses>
|
||||
</busses>
|
||||
<nets>
|
||||
</nets>
|
||||
</sheet>
|
||||
</sheets>
|
||||
</schematic>
|
||||
</drawing>
|
||||
</eagle>
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
|
||||
*
|
||||
* 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 <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
#include <sch_eagle_plugin.h>
|
||||
|
||||
#include <data/fixtures_eagle_plugin.h>
|
||||
|
||||
// /**
|
||||
// * Declares the IteratorFixture as the boost test suite fixture.
|
||||
// */
|
||||
// BOOST_FIXTURE_TEST_SUITE( SegmentReference, CommonTestData )
|
||||
|
||||
/**
|
||||
* Checks the XML tree load
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE( Load )
|
||||
{
|
||||
SCH_EAGLE_PLUGIN plugin;
|
||||
//
|
||||
// plugin.Load( "data/eagle_schematics/empty.sch", NULL );
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main file for the schematic eagle plugin tests to be compiled
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#define BOOST_TEST_MODULE "Schematic Eagle plugin"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
*
|
||||
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <properties.h>
|
||||
|
||||
#include <wx/filename.h>
|
||||
|
||||
// #include <richio.h>
|
||||
#include <sch_eagle_plugin.h>
|
||||
|
||||
|
||||
SCH_EAGLE_PLUGIN::SCH_EAGLE_PLUGIN()
|
||||
{
|
||||
}
|
||||
|
||||
SCH_EAGLE_PLUGIN::~SCH_EAGLE_PLUGIN()
|
||||
{
|
||||
}
|
||||
|
||||
const wxString SCH_EAGLE_PLUGIN::GetName() const
|
||||
{
|
||||
return wxT( "EAGLE" );
|
||||
}
|
||||
|
||||
|
||||
const wxString SCH_EAGLE_PLUGIN::GetFileExtension() const
|
||||
{
|
||||
return wxT( "sch" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SCH_EAGLE_PLUGIN::GetModifyHash() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::SaveLibrary( const wxString& aFileName, const PROPERTIES* aProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway,
|
||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||
{
|
||||
wxASSERT( !aFileName || aKiway != NULL );
|
||||
|
||||
SCH_SHEET* sheet = nullptr;
|
||||
|
||||
wxFileName fn = aFileName;
|
||||
|
||||
// if( !m_xmlTree.Load( fn.GetFullPath() ) )
|
||||
// THROW_IO_ERROR( wxString::Format( _( "Unable to read file '%s'" ), fn.GetFullPath() ) );
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::Save( const wxString& aFileName, SCH_SCREEN* aSchematic, KIWAY* aKiway,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
size_t SCH_EAGLE_PLUGIN::GetSymbolLibCount( const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::EnumerateSymbolLib( wxArrayString& aAliasNameList,
|
||||
const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LIB_ALIAS* SCH_EAGLE_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::DeleteSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::CreateSymbolLib( const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool SCH_EAGLE_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_EAGLE_PLUGIN::IsSymbolLibWritable( const wxString& aLibraryPath )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SCH_EAGLE_PLUGIN::SymbolLibOptions( PROPERTIES* aListToAppendTo ) const
|
||||
{
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
*
|
||||
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SCH_EAGLE_PLUGIN_H_
|
||||
#define _SCH_EAGLE_PLUGIN_H_
|
||||
|
||||
#include <wx/xml/xml.h>
|
||||
|
||||
#include <sch_io_mgr.h>
|
||||
|
||||
// class KIWAY;
|
||||
// class LINE_READER;
|
||||
// class SCH_SCREEN;
|
||||
// class SCH_SHEET;
|
||||
// class SCH_BITMAP;
|
||||
// class SCH_JUNCTION;
|
||||
// class SCH_NO_CONNECT;
|
||||
// class SCH_LINE;
|
||||
// class SCH_BUS_ENTRY_BASE;
|
||||
// class SCH_TEXT;
|
||||
// class SCH_COMPONENT;
|
||||
// class SCH_FIELD;
|
||||
// class PROPERTIES;
|
||||
// class SCH_EAGLE_PLUGIN_CACHE;
|
||||
// class LIB_PART;
|
||||
// class PART_LIB;
|
||||
// class LIB_ALIAS;
|
||||
|
||||
|
||||
/**
|
||||
* Class SCH_EAGLE_PLUGIN
|
||||
* is a #SCH_PLUGIN derivation for loading Autodesk Eagle schematic files.
|
||||
*
|
||||
*
|
||||
* As with all SCH_PLUGINs there is no UI dependencies i.e. windowing
|
||||
* calls allowed.
|
||||
*/
|
||||
class SCH_EAGLE_PLUGIN : public SCH_PLUGIN
|
||||
{
|
||||
public:
|
||||
|
||||
SCH_EAGLE_PLUGIN();
|
||||
~SCH_EAGLE_PLUGIN();
|
||||
|
||||
const wxString GetName() const override;
|
||||
|
||||
const wxString GetFileExtension() const override;
|
||||
|
||||
int GetModifyHash() const override;
|
||||
|
||||
void SaveLibrary( const wxString& aFileName, const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
SCH_SHEET* Load( const wxString& aFileName, KIWAY* aKiway, SCH_SHEET* aAppendToMe = NULL,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
void Save( const wxString& aFileName, SCH_SCREEN* aSchematic, KIWAY* aKiway,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
size_t GetSymbolLibCount( const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
LIB_ALIAS* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
void SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
void DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
void CreateSymbolLib( const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
bool DeleteSymbolLib( const wxString& aLibraryPath,
|
||||
const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override;
|
||||
|
||||
void SymbolLibOptions( PROPERTIES* aListToAppendTo ) const override;
|
||||
|
||||
|
||||
private:
|
||||
wxXmlDocument m_xmlTree;
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // _SCH_EAGLE_PLUGIN_H_
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <sch_io_mgr.h>
|
||||
#include <sch_legacy_plugin.h>
|
||||
#include <sch_eagle_plugin.h>
|
||||
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
|
@ -54,6 +55,8 @@ SCH_PLUGIN* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
|
|||
{
|
||||
case SCH_LEGACY:
|
||||
return new SCH_LEGACY_PLUGIN();
|
||||
case SCH_EAGLE:
|
||||
return new SCH_EAGLE_PLUGIN();
|
||||
case SCH_KICAD:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -85,6 +88,9 @@ const wxString SCH_IO_MGR::ShowType( SCH_FILE_T aType )
|
|||
|
||||
case SCH_LEGACY:
|
||||
return wxString( wxT( "Legacy" ) );
|
||||
|
||||
case SCH_EAGLE:
|
||||
return wxString( wxT( "EAGLE" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +103,8 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::EnumFromStr( const wxString& aType )
|
|||
|
||||
if( aType == wxT( "Legacy" ) )
|
||||
return SCH_LEGACY;
|
||||
else if( aType == wxT( "EAGLE" ) )
|
||||
return SCH_EAGLE;
|
||||
|
||||
// wxASSERT( blow up here )
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
{
|
||||
SCH_LEGACY, ///< Legacy Eeschema file formats prior to s-expression.
|
||||
SCH_KICAD, ///< The s-expression version of the schematic file formats.
|
||||
SCH_EAGLE, ///< Autodesk Eagle file format
|
||||
// Add your schematic type here.
|
||||
|
||||
// ALTIUM,
|
||||
|
|
Loading…
Reference in New Issue