ADDED: CADSTAR Schematic Archive Importer
Initial commit to trigger the importer
This commit is contained in:
parent
1b20a2910a
commit
721cba32d5
|
@ -236,6 +236,12 @@ wxString AltiumSchematicFileWildcard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString CadstarSchematicArchiveFileWildcard()
|
||||||
|
{
|
||||||
|
return _( "CADSTAR Schematic Archive files" ) + AddFileExtListToFilter( { "csa" } );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString EagleSchematicFileWildcard()
|
wxString EagleSchematicFileWildcard()
|
||||||
{
|
{
|
||||||
return _( "Eagle XML schematic files" ) + AddFileExtListToFilter( { "sch" } );
|
return _( "Eagle XML schematic files" ) + AddFileExtListToFilter( { "sch" } );
|
||||||
|
|
|
@ -38,6 +38,13 @@ set( EESCHEMA_SCH_PLUGINS_ALTIUM
|
||||||
sch_plugins/altium/altium_parser_sch.cpp
|
sch_plugins/altium/altium_parser_sch.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
set( EESCHEMA_SCH_PLUGINS_CADSTAR
|
||||||
|
sch_plugins/cadstar/cadstar_sch_archive_plugin.cpp
|
||||||
|
sch_plugins/cadstar/cadstar_sch_archive_parser.cpp
|
||||||
|
sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
|
||||||
|
)
|
||||||
|
|
||||||
set( EESCHEMA_DLGS
|
set( EESCHEMA_DLGS
|
||||||
dialogs/dialog_annotate.cpp
|
dialogs/dialog_annotate.cpp
|
||||||
dialogs/dialog_annotate_base.cpp
|
dialogs/dialog_annotate_base.cpp
|
||||||
|
@ -145,6 +152,7 @@ set ( EESCHEMA_LIBEDIT_SRCS
|
||||||
)
|
)
|
||||||
set( EESCHEMA_SRCS
|
set( EESCHEMA_SRCS
|
||||||
${EESCHEMA_SCH_PLUGINS_ALTIUM}
|
${EESCHEMA_SCH_PLUGINS_ALTIUM}
|
||||||
|
${EESCHEMA_SCH_PLUGINS_CADSTAR}
|
||||||
${EESCHEMA_DLGS}
|
${EESCHEMA_DLGS}
|
||||||
${EESCHEMA_WIDGETS}
|
${EESCHEMA_WIDGETS}
|
||||||
${EESCHEMA_LIBEDIT_SRCS}
|
${EESCHEMA_LIBEDIT_SRCS}
|
||||||
|
|
|
@ -611,6 +611,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
|
||||||
if( ADVANCED_CFG::GetCfg().m_PluginAltiumSch )
|
if( ADVANCED_CFG::GetCfg().m_PluginAltiumSch )
|
||||||
loaders.emplace_back( AltiumSchematicFileWildcard(), SCH_IO_MGR::SCH_ALTIUM ); // Import Altium schematic files
|
loaders.emplace_back( AltiumSchematicFileWildcard(), SCH_IO_MGR::SCH_ALTIUM ); // Import Altium schematic files
|
||||||
|
|
||||||
|
loaders.emplace_back( CadstarSchematicArchiveFileWildcard(), SCH_IO_MGR::CADSTAR_SCH_ARCHIVE ); //Import CADSTAR Schematic Archive files
|
||||||
loaders.emplace_back( EagleSchematicFileWildcard(), SCH_IO_MGR::SCH_EAGLE ); // Import Eagle schematic files
|
loaders.emplace_back( EagleSchematicFileWildcard(), SCH_IO_MGR::SCH_EAGLE ); // Import Eagle schematic files
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
@ -867,6 +868,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
switch( (SCH_IO_MGR::SCH_FILE_T) aFileType )
|
switch( (SCH_IO_MGR::SCH_FILE_T) aFileType )
|
||||||
{
|
{
|
||||||
case SCH_IO_MGR::SCH_ALTIUM:
|
case SCH_IO_MGR::SCH_ALTIUM:
|
||||||
|
case SCH_IO_MGR::CADSTAR_SCH_ARCHIVE:
|
||||||
case SCH_IO_MGR::SCH_EAGLE:
|
case SCH_IO_MGR::SCH_EAGLE:
|
||||||
// We insist on caller sending us an absolute path, if it does not, we say it's a bug.
|
// We insist on caller sending us an absolute path, if it does not, we say it's a bug.
|
||||||
wxASSERT_MSG( wxFileName( aFileName ).IsAbsolute(),
|
wxASSERT_MSG( wxFileName( aFileName ).IsAbsolute(),
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <sch_sexpr_plugin.h>
|
#include <sch_sexpr_plugin.h>
|
||||||
|
|
||||||
#include <sch_plugins/altium/sch_altium_plugin.h>
|
#include <sch_plugins/altium/sch_altium_plugin.h>
|
||||||
|
#include <sch_plugins/cadstar/cadstar_sch_archive_plugin.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
#define FMT_UNIMPLEMENTED _( "Plugin \"%s\" does not implement the \"%s\" function." )
|
#define FMT_UNIMPLEMENTED _( "Plugin \"%s\" does not implement the \"%s\" function." )
|
||||||
|
@ -61,6 +62,8 @@ SCH_PLUGIN* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
|
||||||
return new SCH_SEXPR_PLUGIN();
|
return new SCH_SEXPR_PLUGIN();
|
||||||
case SCH_ALTIUM:
|
case SCH_ALTIUM:
|
||||||
return new SCH_ALTIUM_PLUGIN();
|
return new SCH_ALTIUM_PLUGIN();
|
||||||
|
case CADSTAR_SCH_ARCHIVE:
|
||||||
|
return new CADSTAR_SCH_ARCHIVE_PLUGIN();
|
||||||
case SCH_EAGLE:
|
case SCH_EAGLE:
|
||||||
return new SCH_EAGLE_PLUGIN();
|
return new SCH_EAGLE_PLUGIN();
|
||||||
default:
|
default:
|
||||||
|
@ -101,6 +104,9 @@ const wxString SCH_IO_MGR::ShowType( SCH_FILE_T aType )
|
||||||
case SCH_ALTIUM:
|
case SCH_ALTIUM:
|
||||||
return wxString( wxT( "Altium" ) );
|
return wxString( wxT( "Altium" ) );
|
||||||
|
|
||||||
|
case CADSTAR_SCH_ARCHIVE:
|
||||||
|
return wxString( wxT( "CADSTAR Schematic Archive" ) );
|
||||||
|
|
||||||
case SCH_EAGLE:
|
case SCH_EAGLE:
|
||||||
return wxString( wxT( "EAGLE" ) );
|
return wxString( wxT( "EAGLE" ) );
|
||||||
}
|
}
|
||||||
|
@ -119,6 +125,8 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::EnumFromStr( const wxString& aType )
|
||||||
return SCH_KICAD;
|
return SCH_KICAD;
|
||||||
else if( aType == wxT( "Altium" ) )
|
else if( aType == wxT( "Altium" ) )
|
||||||
return SCH_ALTIUM;
|
return SCH_ALTIUM;
|
||||||
|
else if( aType == wxT( "CADSTAR Schematic Archive" ) )
|
||||||
|
return CADSTAR_SCH_ARCHIVE;
|
||||||
else if( aType == wxT( "EAGLE" ) )
|
else if( aType == wxT( "EAGLE" ) )
|
||||||
return SCH_EAGLE;
|
return SCH_EAGLE;
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
SCH_LEGACY, ///< Legacy Eeschema file formats prior to s-expression.
|
SCH_LEGACY, ///< Legacy Eeschema file formats prior to s-expression.
|
||||||
SCH_KICAD, ///< The s-expression version of the schematic file formats.
|
SCH_KICAD, ///< The s-expression version of the schematic file formats.
|
||||||
SCH_ALTIUM, ///< Altium file format
|
SCH_ALTIUM, ///< Altium file format
|
||||||
|
CADSTAR_SCH_ARCHIVE, ///< CADSTAR Schematic Archive
|
||||||
SCH_EAGLE, ///< Autodesk Eagle file format
|
SCH_EAGLE, ///< Autodesk Eagle file format
|
||||||
// Add your schematic type here.
|
// Add your schematic type here.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||||
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cadstar_sch_archive_loader.cpp
|
||||||
|
* @brief Loads a csa file into a KiCad SCHEMATIC object
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sch_plugins/cadstar/cadstar_sch_archive_loader.h>
|
||||||
|
|
||||||
|
|
||||||
|
void CADSTAR_SCH_ARCHIVE_LOADER::Load( ::SCHEMATIC* aSchematic )
|
||||||
|
{
|
||||||
|
Parse();
|
||||||
|
|
||||||
|
mSchematic = aSchematic;
|
||||||
|
|
||||||
|
// Load everything!
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||||
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cadstar_sch_archive_loader.h
|
||||||
|
* @brief Loads a csa file into a KiCad SCHEMATIC object
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CADSTAR_SCH_ARCHIVE_LOADER_H_
|
||||||
|
#define CADSTAR_SCH_ARCHIVE_LOADER_H_
|
||||||
|
|
||||||
|
#include <sch_plugins/cadstar/cadstar_sch_archive_parser.h>
|
||||||
|
#include <schematic.h>
|
||||||
|
|
||||||
|
|
||||||
|
class CADSTAR_SCH_ARCHIVE_LOADER : public CADSTAR_SCH_ARCHIVE_PARSER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit CADSTAR_SCH_ARCHIVE_LOADER( wxString aFilename )
|
||||||
|
: CADSTAR_SCH_ARCHIVE_PARSER( aFilename )
|
||||||
|
{
|
||||||
|
mSchematic = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
~CADSTAR_SCH_ARCHIVE_LOADER()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Loads a CADSTAR PCB Archive file into the KiCad BOARD object given
|
||||||
|
* @param aBoard
|
||||||
|
*/
|
||||||
|
void Load( ::SCHEMATIC* aSchematic );
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
::SCHEMATIC* mSchematic;
|
||||||
|
|
||||||
|
}; // CADSTAR_SCH_ARCHIVE_LOADER
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CADSTAR_SCH_ARCHIVE_LOADER_H_
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||||
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cadstar_sch_archive_parser.cpp
|
||||||
|
* @brief Reads in a CADSTAR Schematic Archive (*.csa) file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sch_plugins/cadstar/cadstar_sch_archive_parser.h>
|
||||||
|
|
||||||
|
|
||||||
|
void CADSTAR_SCH_ARCHIVE_PARSER::Parse()
|
||||||
|
{
|
||||||
|
XNODE* fileRootNode = LoadArchiveFile( Filename, wxT( "CADSTARSCH" ) );
|
||||||
|
|
||||||
|
XNODE* cNode = fileRootNode->GetChildren();
|
||||||
|
|
||||||
|
if( !cNode )
|
||||||
|
THROW_MISSING_NODE_IO_ERROR( wxT( "HEADER" ), wxT( "CADSTARSCH" ) );
|
||||||
|
/*
|
||||||
|
for( ; cNode; cNode = cNode->GetNext() )
|
||||||
|
{
|
||||||
|
if( cNode->GetName() == wxT( "HEADER" ) )
|
||||||
|
{
|
||||||
|
Header.Parse( cNode );
|
||||||
|
|
||||||
|
switch( Header.Resolution )
|
||||||
|
{
|
||||||
|
case RESOLUTION::HUNDREDTH_MICRON:
|
||||||
|
KiCadUnitMultiplier = 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
wxASSERT_MSG( true, wxT( "Unknown File Resolution" ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( cNode->GetName() == wxT( "ASSIGNMENTS" ) )
|
||||||
|
Assignments.Parse( cNode );
|
||||||
|
else if( cNode->GetName() == wxT( "LIBRARY" ) )
|
||||||
|
Library.Parse( cNode );
|
||||||
|
else if( cNode->GetName() == wxT( "DEFAULTS" ) )
|
||||||
|
{
|
||||||
|
// No design information here (no need to parse)
|
||||||
|
// Only contains CADSTAR configuration data such as default shapes, text and units
|
||||||
|
// In future some of this could be converted to KiCad but limited value
|
||||||
|
}
|
||||||
|
else if( cNode->GetName() == wxT( "PARTS" ) )
|
||||||
|
Parts.Parse( cNode );
|
||||||
|
else if( cNode->GetName() == wxT( "LAYOUT" ) )
|
||||||
|
Layout.Parse( cNode );
|
||||||
|
else if( cNode->GetName() == wxT( "DISPLAY" ) )
|
||||||
|
{
|
||||||
|
// No design information here (no need to parse)
|
||||||
|
// Contains CADSTAR Display settings such as layer/element colours and visibility.
|
||||||
|
// In the future these settings could be converted to KiCad
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxT( "[root]" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
delete fileRootNode;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||||
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cadstar_pcb_archive_parser.cpp
|
||||||
|
* @brief Reads in a CADSTAR Schematic Archive (*.csa) file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CADSTAR_SCH_ARCHIVE_PARSER_H_
|
||||||
|
#define CADSTAR_SCH_ARCHIVE_PARSER_H_
|
||||||
|
|
||||||
|
#include <plugins/cadstar/cadstar_archive_parser.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Represents a CADSTAR Schematic Archive (*.csa) file
|
||||||
|
*/
|
||||||
|
class CADSTAR_SCH_ARCHIVE_PARSER : public CADSTAR_ARCHIVE_PARSER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit CADSTAR_SCH_ARCHIVE_PARSER( wxString aFilename )
|
||||||
|
: Filename( aFilename ), CADSTAR_ARCHIVE_PARSER()
|
||||||
|
{
|
||||||
|
// KiCadUnitMultiplier = 10; // assume hundredth micron
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Parses the file
|
||||||
|
* @throw IO_ERROR if file could not be opened or there was
|
||||||
|
* an error while parsing
|
||||||
|
*/
|
||||||
|
void Parse();
|
||||||
|
|
||||||
|
wxString Filename;
|
||||||
|
|
||||||
|
}; //CADSTAR_SCH_ARCHIVE_PARSER
|
||||||
|
|
||||||
|
#endif // CADSTAR_SCH_ARCHIVE_PARSER_H_
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||||
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cadstar_pcb_archive_plugin.cpp
|
||||||
|
* @brief Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format
|
||||||
|
* based on S-expressions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sch_plugins/cadstar/cadstar_sch_archive_loader.h>
|
||||||
|
#include <sch_plugins/cadstar/cadstar_sch_archive_plugin.h>
|
||||||
|
|
||||||
|
#include <properties.h>
|
||||||
|
#include <sch_screen.h>
|
||||||
|
#include <sch_sheet.h>
|
||||||
|
#include <schematic.h>
|
||||||
|
|
||||||
|
|
||||||
|
const wxString CADSTAR_SCH_ARCHIVE_PLUGIN::GetName() const
|
||||||
|
{
|
||||||
|
return wxT( "CADSTAR Schematic Archive" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString CADSTAR_SCH_ARCHIVE_PLUGIN::GetFileExtension() const
|
||||||
|
{
|
||||||
|
return wxT( "csa" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString CADSTAR_SCH_ARCHIVE_PLUGIN::GetLibraryFileExtension() const
|
||||||
|
{
|
||||||
|
return wxT( "lib" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CADSTAR_SCH_ARCHIVE_PLUGIN::GetModifyHash() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SCH_SHEET* CADSTAR_SCH_ARCHIVE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
|
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||||
|
{
|
||||||
|
wxASSERT( !aFileName || aSchematic != NULL );
|
||||||
|
|
||||||
|
mProperties = aProperties;
|
||||||
|
mSchematic = aSchematic;
|
||||||
|
|
||||||
|
// Delete on exception, if I own m_rootSheet, according to aAppendToMe
|
||||||
|
std::unique_ptr<SCH_SHEET> deleter( aAppendToMe ? nullptr : mRootSheet );
|
||||||
|
|
||||||
|
if( aAppendToMe )
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( aSchematic->IsValid(), nullptr, "Can't append to a schematic with no root!" );
|
||||||
|
mRootSheet = &aSchematic->Root();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mRootSheet = new SCH_SHEET( aSchematic );
|
||||||
|
mRootSheet->SetFileName( aFileName );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !mRootSheet->GetScreen() )
|
||||||
|
{
|
||||||
|
SCH_SCREEN* screen = new SCH_SCREEN( mSchematic );
|
||||||
|
screen->SetFileName( aFileName );
|
||||||
|
mRootSheet->SetScreen( screen );
|
||||||
|
}
|
||||||
|
|
||||||
|
return mRootSheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CADSTAR_SCH_ARCHIVE_PLUGIN::CheckHeader( const wxString& aFileName )
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||||
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cadstar_pcb_archive_plugin.h
|
||||||
|
* @brief Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format
|
||||||
|
* based on S-expressions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CADSTAR_SCH_ARCHIVE_PLUGIN_H_
|
||||||
|
#define CADSTAR_SCH_ARCHIVE_PLUGIN_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <sch_io_mgr.h>
|
||||||
|
|
||||||
|
class SCH_SHEET;
|
||||||
|
class SCH_SCREEN;
|
||||||
|
|
||||||
|
class CADSTAR_SCH_ARCHIVE_PLUGIN : public SCH_PLUGIN
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//-----<PUBLIC SCH_PLUGIN API>-------------------------------------------------
|
||||||
|
|
||||||
|
const wxString GetName() const override;
|
||||||
|
|
||||||
|
const wxString GetFileExtension() const override;
|
||||||
|
|
||||||
|
const wxString GetLibraryFileExtension() const override;
|
||||||
|
|
||||||
|
int GetModifyHash() const override;
|
||||||
|
|
||||||
|
SCH_SHEET* Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
|
SCH_SHEET* aAppendToMe = NULL, const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
|
bool CheckHeader( const wxString& aFileName ) override;
|
||||||
|
|
||||||
|
|
||||||
|
// unimplemented functions. Will trigger a not_implemented IO error.
|
||||||
|
//void SaveLibrary( const wxString& aFileName, const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
|
//void Save( const wxString& aFileName, SCH_SCREEN* aSchematic, KIWAY* aKiway,
|
||||||
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
|
//void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath,
|
||||||
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
|
//LIB_PART* 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;
|
||||||
|
|
||||||
|
//-----</PUBLIC SCH_PLUGIN API>------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
CADSTAR_SCH_ARCHIVE_PLUGIN()
|
||||||
|
{
|
||||||
|
mSchematic = nullptr;
|
||||||
|
mRootSheet = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
~CADSTAR_SCH_ARCHIVE_PLUGIN()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const PROPERTIES* mProperties;
|
||||||
|
SCHEMATIC* mSchematic;
|
||||||
|
SCH_SHEET* mRootSheet;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CADSTAR_SCH_ARCHIVE_PLUGIN_H_
|
|
@ -194,6 +194,7 @@ extern wxString LegacyPcbFileWildcard();
|
||||||
extern wxString PcbFileWildcard();
|
extern wxString PcbFileWildcard();
|
||||||
extern wxString EaglePcbFileWildcard();
|
extern wxString EaglePcbFileWildcard();
|
||||||
extern wxString AltiumSchematicFileWildcard();
|
extern wxString AltiumSchematicFileWildcard();
|
||||||
|
extern wxString CadstarSchematicArchiveFileWildcard();
|
||||||
extern wxString EagleSchematicFileWildcard();
|
extern wxString EagleSchematicFileWildcard();
|
||||||
extern wxString EagleFilesWildcard();
|
extern wxString EagleFilesWildcard();
|
||||||
extern wxString PCadPcbFileWildcard();
|
extern wxString PCadPcbFileWildcard();
|
||||||
|
|
Loading…
Reference in New Issue