Initial rename of file plugin infrastructure components to IO

This commit is contained in:
Ian McInerney 2023-12-19 17:39:26 +00:00
parent 3a90b729ea
commit d8b47d18d3
259 changed files with 5789 additions and 5667 deletions

View File

@ -117,7 +117,7 @@ set( KICOMMON_SRCS
trace_helpers.cpp
wx_filename.cpp
plugins/kicad/kicad_plugin_utils.cpp # needed by richio
io/kicad/kicad_io_utils.cpp # needed by richio
)
add_library( kicommon SHARED
@ -376,28 +376,28 @@ set( PLOTTERS_CONTROL_SRCS
plotters/common_plot_functions.cpp
)
set( PLUGINS_ALTIUM_SRCS
plugins/altium/altium_parser.cpp
plugins/altium/altium_parser_utils.cpp
)
set( COMMON_IO_SRCS
io/plugin_file_desc.cpp
io/io_utils.cpp
set( PLUGINS_CADSTAR_SRCS
plugins/cadstar/cadstar_archive_parser.cpp
plugins/cadstar/cadstar_parts_lib_parser.cpp
)
# Altium
io/altium/altium_parser.cpp
io/altium/altium_parser_utils.cpp
set( PLUGINS_EAGLE_SRCS
plugins/eagle/eagle_parser.cpp
)
# Cadstar
io/cadstar/cadstar_archive_parser.cpp
io/cadstar/cadstar_parts_lib_parser.cpp
set( PLUGINS_EASYEDA_SRCS
plugins/easyeda/easyeda_parser_base.cpp
plugins/easyeda/easyeda_parser_structs.cpp
)
# Eagle
io/eagle/eagle_parser.cpp
set( PLUGINS_EASYEDAPRO_SRCS
plugins/easyedapro/easyedapro_parser.cpp
plugins/easyedapro/easyedapro_import_utils.cpp
# EasyEDA
io/easyeda/easyeda_parser_base.cpp
io/easyeda/easyeda_parser_structs.cpp
# EasyEDA pro
io/easyedapro/easyedapro_parser.cpp
io/easyedapro/easyedapro_import_utils.cpp
)
set( COMMON_IMPORT_GFX_SRCS
@ -430,11 +430,7 @@ set( COMMON_SRCS
${COMMON_DRAWING_SHEET_SRCS}
${COMMON_PREVIEW_ITEMS_SRCS}
${PLOTTERS_CONTROL_SRCS}
${PLUGINS_ALTIUM_SRCS}
${PLUGINS_CADSTAR_SRCS}
${PLUGINS_EAGLE_SRCS}
${PLUGINS_EASYEDA_SRCS}
${PLUGINS_EASYEDAPRO_SRCS}
${COMMON_IO_SRCS}
${FONT_SRCS}
${COMMON_IMPORT_GFX_SRCS}
${COMMON_GIT_SRCS}
@ -493,8 +489,6 @@ set( COMMON_SRCS
notifications_manager.cpp
origin_transforms.cpp
page_info.cpp
plugin_file_desc.cpp
plugins/plugin_utils.cpp
printout.cpp
project.cpp
ptree.cpp
@ -702,28 +696,21 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/drc/drc_rule_condition.cpp
${CMAKE_SOURCE_DIR}/pcbnew/drc/drc_rule_parser.cpp
${CMAKE_SOURCE_DIR}/pcbnew/drc/drc_test_provider.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugins/eagle/eagle_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/footprint_editor_settings.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugins/geda/gpcb_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/io_mgr.cpp
${CMAKE_SOURCE_DIR}/pcbnew/generators_mgr.cpp
${CMAKE_SOURCE_DIR}/pcbnew/kicad_clipboard.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/kicad_netlist_reader.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugins/kicad/pcb_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/legacy_netlist_reader.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugins/legacy/legacy_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/netlist_reader.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pad_custom_shape_functions.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_draw_panel_gal.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/pcb_netlist.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_origin_transforms.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_painter.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugins/kicad/pcb_parser.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_plot_params.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_screen.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_view.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcbnew_settings.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/ratsnest/ratsnest_data.cpp
${CMAKE_SOURCE_DIR}/pcbnew/ratsnest/ratsnest_view_item.cpp
${CMAKE_SOURCE_DIR}/pcbnew/sel_layer.cpp
@ -732,6 +719,15 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/teardrop/teardrop_utils.cpp
${CMAKE_SOURCE_DIR}/pcbnew/zone_settings.cpp
# IO files
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/pcb_io.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/pcb_io_mgr.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/legacy/legacy_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/kicad/pcb_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/kicad/pcb_parser.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/eagle/eagle_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/geda/gpcb_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_grid_helper.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_actions.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_editor_conditions.cpp

View File

@ -21,7 +21,7 @@
#define DIALOG_IMPORT_CHOOSE_PROJECT_H
#include "dialog_import_choose_project_base.h"
#include <plugins/common/plugin_common_choose_project.h>
#include <io/common/plugin_common_choose_project.h>
class DIALOG_IMPORT_CHOOSE_PROJECT : public DIALOG_IMPORT_CHOOSE_PROJECT_BASE

View File

@ -56,10 +56,10 @@ bool FP_LIB_TABLE_ROW::operator==( const FP_LIB_TABLE_ROW& aRow ) const
void FP_LIB_TABLE_ROW::SetType( const wxString& aType )
{
type = IO_MGR::EnumFromStr( aType );
type = PCB_IO_MGR::EnumFromStr( aType );
if( IO_MGR::PCB_FILE_T( -1 ) == type )
type = IO_MGR::KICAD_SEXP;
if( PCB_IO_MGR::PCB_FILE_T( -1 ) == type )
type = PCB_IO_MGR::KICAD_SEXP;
plugin.release();
}
@ -303,7 +303,7 @@ void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxS
bool aBestEfforts )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ), aBestEfforts,
row->GetProperties() );
}
@ -312,7 +312,7 @@ void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxS
void FP_LIB_TABLE::PrefetchLib( const wxString& aNickname )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
row->plugin->PrefetchLib( row->GetFullURI( true ), row->GetProperties() );
}
@ -332,10 +332,10 @@ const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname, bool a
}
// We've been 'lazy' up until now, but it cannot be deferred any longer,
// instantiate a PLUGIN of the proper kind if it is not already in this
// instantiate a PCB_IO of the proper kind if it is not already in this
// FP_LIB_TABLE_ROW.
if( !row->plugin )
row->setPlugin( IO_MGR::PluginFind( row->type ) );
row->setPlugin( PCB_IO_MGR::PluginFind( row->type ) );
return row;
}
@ -369,7 +369,7 @@ const FOOTPRINT* FP_LIB_TABLE::GetEnumeratedFootprint( const wxString& aNickname
const wxString& aFootprintName )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
return row->plugin->GetEnumeratedFootprint( row->GetFullURI( true ), aFootprintName,
row->GetProperties() );
@ -381,7 +381,7 @@ bool FP_LIB_TABLE::FootprintExists( const wxString& aNickname, const wxString& a
try
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
return row->plugin->FootprintExists( row->GetFullURI( true ), aFootprintName,
row->GetProperties() );
@ -397,7 +397,7 @@ FOOTPRINT* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname,
const wxString& aFootprintName, bool aKeepUUID )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
FOOTPRINT* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName,
aKeepUUID, row->GetProperties() );
@ -412,7 +412,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
const FOOTPRINT* aFootprint, bool aOverwrite )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
if( !aOverwrite )
{
@ -438,7 +438,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
void FP_LIB_TABLE::FootprintDelete( const wxString& aNickname, const wxString& aFootprintName )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
return row->plugin->FootprintDelete( row->GetFullURI( true ), aFootprintName,
row->GetProperties() );
}
@ -447,7 +447,7 @@ void FP_LIB_TABLE::FootprintDelete( const wxString& aNickname, const wxString& a
bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
return row->plugin->IsFootprintLibWritable( row->GetFullURI( true ) );
}
@ -455,7 +455,7 @@ bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
void FP_LIB_TABLE::FootprintLibDelete( const wxString& aNickname )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
row->plugin->FootprintLibDelete( row->GetFullURI( true ), row->GetProperties() );
}
@ -463,7 +463,7 @@ void FP_LIB_TABLE::FootprintLibDelete( const wxString& aNickname )
void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxASSERT( (PLUGIN*) row->plugin );
wxASSERT( (PCB_IO*) row->plugin );
row->plugin->FootprintLibCreate( row->GetFullURI( true ), row->GetProperties() );
}

View File

@ -28,7 +28,7 @@
#include <dsnlexer.h>
#include <geometry/shape_poly_set.h>
#include <plugins/cadstar/cadstar_archive_parser.h>
#include <io/cadstar/cadstar_archive_parser.h>
#include <eda_item.h>
#include <eda_text.h>
#include <macros.h>

View File

@ -35,7 +35,7 @@
#include <xnode.h>
#include <math/vector2d.h>
#include <plugins/cadstar/cadstar_archive_objects.h>
#include <io/cadstar/cadstar_archive_objects.h>
// THROW_IO_ERROR definitions to ensure consistent wording is used in the error messages

View File

@ -25,7 +25,7 @@
#include <optional>
#include <string>
#include <vector>
#include <plugins/cadstar/cadstar_archive_objects.h>
#include <io/cadstar/cadstar_archive_objects.h>
struct CADSTAR_PART_ENTRY;
struct CADSTAR_SWAP_GROUP;

View File

@ -22,6 +22,7 @@
#include <functional>
#include <map>
#include <wx/string.h>
/**
* @brief Describes how non-KiCad boards and schematics should be imported as KiCad projects

View File

@ -25,7 +25,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <plugins/eagle/eagle_parser.h>
#include <io/eagle/eagle_parser.h>
#include <string_utils.h>
#include <richio.h>

View File

@ -25,7 +25,7 @@
#include "easyedapro_import_utils.h"
#include "easyedapro_parser.h"
#include <plugins/common/plugin_common_choose_project.h>
#include <io/common/plugin_common_choose_project.h>
#include <ki_exception.h>
#include <string_utils.h>

View File

@ -21,12 +21,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "plugin_utils.h"
#include "io_utils.h"
#include <wx/wfstream.h>
#include <wx/txtstrm.h>
namespace PLUGIN_UTILS
namespace IO_UTILS
{
bool fileStartsWithPrefix( const wxString& aFilePath, const wxString& aPrefix,

View File

@ -21,15 +21,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PLUGIN_UTILS_H
#define PLUGIN_UTILS_H
#ifndef IO_UTILS_H
#define IO_UTILS_H
#include <cstdint>
#include <vector>
#include <wx/string.h>
namespace PLUGIN_UTILS
namespace IO_UTILS
{
static const std::vector<uint8_t> COMPOUND_FILE_HEADER{ 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1};
@ -52,4 +52,4 @@ bool fileStartsWithBinaryHeader( const wxString& aFilePath, const std::vector<ui
}
#endif // PLUGIN_UTILS_H
#endif // IO_UTILS_H

View File

@ -20,7 +20,7 @@
#include <fmt/format.h>
#include <kiid.h>
#include <plugins/kicad/kicad_plugin_utils.h>
#include <io/kicad/kicad_io_utils.h>
#include <richio.h>
#include <string_utils.h>

View File

@ -30,7 +30,7 @@
#include <core/ignore.h>
#include <richio.h>
#include <errno.h>
#include <plugins/kicad/kicad_plugin_utils.h>
#include <io/kicad/kicad_io_utils.h>
#include <wx/file.h>
#include <wx/translation.h>

View File

@ -41,33 +41,53 @@ include_directories(
./widgets
)
set( EESCHEMA_SCH_PLUGINS_ALTIUM
sch_plugins/altium/altium_parser_sch.cpp
sch_plugins/altium/sch_altium_plugin.cpp
)
set( EESCHEMA_SCH_IO
sch_io/sch_lib_plugin_cache.cpp
sch_io/sch_io.cpp
sch_io/sch_io_mgr.cpp
set( EESCHEMA_SCH_PLUGINS_CADSTAR
sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
sch_plugins/cadstar/cadstar_sch_archive_parser.cpp
sch_plugins/cadstar/cadstar_sch_archive_plugin.cpp
)
# KiCad IO plugin
sch_io/kicad/sch_sexpr_lib_plugin_cache.cpp
sch_io/kicad/sch_sexpr_plugin_common.cpp
sch_io/kicad/sch_sexpr_parser.cpp
sch_io/kicad/sch_sexpr_plugin.cpp
# Legacy IO plugin
sch_io/legacy/sch_legacy_lib_plugin_cache.cpp
sch_io/legacy/sch_legacy_plugin.cpp
sch_io/legacy/sch_legacy_plugin_helpers.cpp
set( EESCHEMA_SCH_PLUGINS_LTSPICE
sch_plugins/ltspice/ltspice_schematic.cpp
sch_plugins/ltspice/ltspice_sch_parser.cpp
sch_plugins/ltspice/ltspice_sch_plugin.cpp
)
# HTTP IO plugin
sch_io/http_lib/sch_http_lib_plugin.cpp
set( EESCHEMA_SCH_PLUGINS_EASYEDA
sch_plugins/easyeda/sch_easyeda_parser.cpp
sch_plugins/easyeda/sch_easyeda_plugin.cpp
)
# Database IO plugin
sch_io/database/sch_database_plugin.cpp
set( EESCHEMA_SCH_PLUGINS_EASYEDAPRO
sch_plugins/easyedapro/sch_easyedapro_parser.cpp
sch_plugins/easyedapro/sch_easyedapro_plugin.cpp
# Eagle IO plugin
sch_io/eagle/sch_eagle_plugin.cpp
# Altium IO plugin
sch_io/altium/altium_parser_sch.cpp
sch_io/altium/sch_altium_plugin.cpp
# Cadstar IO plugin
sch_io/cadstar/cadstar_sch_archive_loader.cpp
sch_io/cadstar/cadstar_sch_archive_parser.cpp
sch_io/cadstar/cadstar_sch_archive_plugin.cpp
# LTSpice IO plugin
sch_io/ltspice/ltspice_schematic.cpp
sch_io/ltspice/ltspice_sch_parser.cpp
sch_io/ltspice/ltspice_sch_plugin.cpp
# EasyEDA IO plugin
sch_io/easyeda/sch_easyeda_parser.cpp
sch_io/easyeda/sch_easyeda_plugin.cpp
# EasyEDA Pro IO plugin
sch_io/easyedapro/sch_easyedapro_parser.cpp
sch_io/easyedapro/sch_easyedapro_plugin.cpp
)
set( EESCHEMA_DLGS
@ -295,11 +315,7 @@ set( EESCHEMA_PRINTING
set( EESCHEMA_SRCS
${EESCHEMA_DLGS}
${EESCHEMA_LIBEDIT_SRCS}
${EESCHEMA_SCH_PLUGINS_ALTIUM}
${EESCHEMA_SCH_PLUGINS_CADSTAR}
${EESCHEMA_SCH_PLUGINS_LTSPICE}
${EESCHEMA_SCH_PLUGINS_EASYEDA}
${EESCHEMA_SCH_PLUGINS_EASYEDAPRO}
${EESCHEMA_SCH_IO}
${EESCHEMA_SIM_SRCS}
${EESCHEMA_WIDGETS}
${EESCHEMA_IMPORT_GFX}
@ -347,7 +363,6 @@ set( EESCHEMA_SRCS
sch_draw_panel.cpp
sch_edit_frame.cpp
sch_field.cpp
sch_io_mgr.cpp
sch_item.cpp
sch_junction.cpp
sch_label.cpp
@ -357,7 +372,6 @@ set( EESCHEMA_SRCS
sch_painter.cpp
sch_pin.cpp
sch_plotter.cpp
sch_plugin.cpp
sch_preview_panel.cpp
sch_reference_list.cpp
sch_screen.cpp
@ -396,18 +410,6 @@ set( EESCHEMA_SRCS
netlist_exporters/netlist_exporter_xml.cpp
netlist_exporters/netlist_generator.cpp
sch_plugins/sch_lib_plugin_cache.cpp
sch_plugins/eagle/sch_eagle_plugin.cpp
sch_plugins/kicad/sch_sexpr_lib_plugin_cache.cpp
sch_plugins/kicad/sch_sexpr_plugin_common.cpp
sch_plugins/kicad/sch_sexpr_parser.cpp
sch_plugins/kicad/sch_sexpr_plugin.cpp
sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp
sch_plugins/legacy/sch_legacy_plugin.cpp
sch_plugins/legacy/sch_legacy_plugin_helpers.cpp
sch_plugins/database/sch_database_plugin.cpp
sch_plugins/http_lib/sch_http_lib_plugin.cpp
tools/assign_footprints.cpp
tools/backannotate.cpp
tools/ee_actions.cpp

View File

@ -19,7 +19,7 @@
*/
#include <dialogs/dialog_database_lib_settings.h>
#include <sch_plugins/database/sch_database_plugin.h>
#include <sch_io/database/sch_database_plugin.h>
#include <database/database_lib_settings.h>

View File

@ -560,7 +560,7 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
if( renameFile )
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
// If the associated screen is shared by more than one sheet, do not
// change the filename of the corresponding screen here.

View File

@ -36,7 +36,7 @@
#include <core/kicad_algo.h>
#include <symbol_viewer_frame.h>
#include <project_rescue.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <sch_symbol.h>
#include <sch_screen.h>
#include <sch_edit_frame.h>

View File

@ -172,7 +172,7 @@ protected:
STRING_UTF8_MAP choices;
SCH_IO_MGR::SCH_FILE_T pi_type = SCH_IO_MGR::EnumFromStr( row->GetType() );
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pi_type ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( pi_type ) );
pi->SymbolLibOptions( &choices );
DIALOG_PLUGIN_OPTIONS dlg( m_dialog, row->GetNickName(), choices, options, &result );
@ -256,7 +256,7 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
for( const SCH_IO_MGR::SCH_FILE_T& type : SCH_IO_MGR::SCH_FILE_T_vector )
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( type ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( type ) );
if( !pi )
continue;
@ -308,7 +308,7 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
auto* libTable = static_cast<SYMBOL_LIB_TABLE_GRID*>( grid->GetTable() );
auto* tableRow = static_cast<SYMBOL_LIB_TABLE_ROW*>( libTable->at( row ) );
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( tableRow->GetFileType() ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( tableRow->GetFileType() ) );
if( pi )
{
@ -585,7 +585,7 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
for( const SCH_IO_MGR::SCH_FILE_T& fileType : SCH_IO_MGR::SCH_FILE_T_vector )
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
if( !pi )
continue;
@ -936,8 +936,8 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( STRING_UTF8_MAP* aOldFileProps, const
if( oldFileType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
return false;
SCH_PLUGIN::SCH_PLUGIN_RELEASER oldFilePI( SCH_IO_MGR::FindPlugin( oldFileType ) );
SCH_PLUGIN::SCH_PLUGIN_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
SCH_IO::SCH_IO_RELEASER oldFilePI( SCH_IO_MGR::FindPlugin( oldFileType ) );
SCH_IO::SCH_IO_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
std::vector<LIB_SYMBOL*> symbols;
std::vector<LIB_SYMBOL*> newSymbols;
std::map<LIB_SYMBOL*, LIB_SYMBOL*> symbolMap;

View File

@ -26,7 +26,7 @@
#include <settings/settings_manager.h>
#include <wildcards_and_files_ext.h>
#include <schematic.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <locale_io.h>
#include <wx/app.h>
#include <sch_label.h>
@ -121,8 +121,8 @@ SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( wxString& aFileName, SCH_IO_MGR::SCH
if( !project )
project = GetDefaultProject();
SCH_PLUGIN* plugin = SCH_IO_MGR::FindPlugin( aFormat );
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( plugin );
SCH_IO* plugin = SCH_IO_MGR::FindPlugin( aFormat );
SCH_IO::SCH_IO_RELEASER pi( plugin );
SCHEMATIC* schematic = new SCHEMATIC( project );

View File

@ -25,7 +25,7 @@
#define EESCHEMA_HELPERS_H_
#include <wx/string.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
class SCHEMATIC;
class SCH_EDIT_FRAME;

View File

@ -50,7 +50,7 @@
#include <settings/settings_manager.h>
#include <sch_file_versions.h>
#include <sch_plugins/kicad/sch_sexpr_lib_plugin_cache.h>
#include <sch_io/kicad/sch_sexpr_lib_plugin_cache.h>
#include <netlist.h>
#include <netlist_exporter_base.h>

View File

@ -42,13 +42,13 @@
#include <project_rescue.h>
#include <project_sch.h>
#include <dialog_HTML_reporter_base.h>
#include <plugins/common/plugin_common_choose_project.h>
#include <io/common/plugin_common_choose_project.h>
#include <reporter.h>
#include <richio.h>
#include <sch_bus_entry.h>
#include <sch_commit.h>
#include <sch_edit_frame.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <sch_file_versions.h>
#include <sch_line.h>
#include <sch_sheet.h>
@ -248,8 +248,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SetScreen( nullptr );
SCH_PLUGIN* plugin = SCH_IO_MGR::FindPlugin( schFileType );
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( plugin );
SCH_IO* plugin = SCH_IO_MGR::FindPlugin( schFileType );
SCH_IO::SCH_IO_RELEASER pi( plugin );
pi->SetProgressReporter( &progressReporter );
@ -669,7 +669,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
if( fileType == SCH_IO_MGR::SCH_KICAD || fileType == SCH_IO_MGR::SCH_LEGACY )
continue; // this is "Import non-KiCad schematic"
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
if( !pi )
continue;
@ -724,7 +724,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
for( const SCH_IO_MGR::SCH_FILE_T& fileType : SCH_IO_MGR::SCH_FILE_T_vector )
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
if( !pi )
continue;
@ -797,7 +797,7 @@ bool SCH_EDIT_FRAME::saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSave
if( pluginType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
pluginType = SCH_IO_MGR::SCH_KICAD;
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
try
{
@ -1329,12 +1329,12 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
try
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
DIALOG_HTML_REPORTER errorReporter( this );
WX_PROGRESS_REPORTER progressReporter( this, _( "Importing Schematic" ), 1 );
PROJECT_CHOOSER_PLUGIN* projectChooserPlugin =
dynamic_cast<PROJECT_CHOOSER_PLUGIN*>( (SCH_PLUGIN*) pi );
dynamic_cast<PROJECT_CHOOSER_PLUGIN*>( (SCH_IO*) pi );
if( projectChooserPlugin )
{

View File

@ -862,7 +862,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
try
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
for( const std::unique_ptr<LIB_SYMBOL>& symbol : m_rescueLibSymbols )
pi->SaveSymbol( fn.GetFullPath(), new LIB_SYMBOL( *symbol.get() ), m_properties.get() );

View File

@ -41,7 +41,7 @@
#include <string_utf8_map.h>
#include <lib_symbol.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <class_draw_panel_gal.h>

View File

@ -18,28 +18,28 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ALTIUM_LIB_PLUGIN_CACHE_
#define _ALTIUM_LIB_PLUGIN_CACHE_
#ifndef ALTIUM_LIB_IO_CACHE_
#define ALTIUM_LIB_IO_CACHE_
#include "../sch_lib_plugin_cache.h"
#include "sch_io/sch_lib_plugin_cache.h"
class FILE_LINE_READER;
class SCH_SEXPR_PLUGIN;
class SCH_SEXPR_IO;
/**
* A cache assistant for Altium symbol libraries.
*/
class ALTIUM_LIB_PLUGIN_CACHE : public SCH_LIB_PLUGIN_CACHE
class ALTIUM_LIB_IO_CACHE : public SCH_LIB_IO_CACHE
{
public:
ALTIUM_LIB_PLUGIN_CACHE( const wxString& aLibraryPath );
virtual ~ALTIUM_LIB_PLUGIN_CACHE();
ALTIUM_LIB_IO_CACHE( const wxString& aLibraryPath );
virtual ~ALTIUM_LIB_IO_CACHE();
void Load() override;
private:
friend SCH_SEXPR_PLUGIN;
friend SCH_SEXPR_IO;
};
#endif // _ALTIUM_LIB_PLUGIN_CACHE_
#endif // ALTIUM_LIB_IO_CACHE_

View File

@ -30,8 +30,8 @@
#include <wx/log.h>
#include "plugins/altium/altium_parser.h"
#include "sch_plugins/altium/altium_parser_sch.h"
#include "io/altium/altium_parser.h"
#include "sch_io/altium/altium_parser_sch.h"
ALTIUM_SCH_RECORD ReadRecord( const std::map<wxString, wxString>& aProps )

View File

@ -26,10 +26,10 @@
#include "altium_parser_sch.h"
#include "sch_shape.h"
#include <plugins/plugin_utils.h>
#include <plugins/altium/altium_parser.h>
#include <plugins/altium/altium_parser_utils.h>
#include <sch_plugins/altium/sch_altium_plugin.h>
#include <io/io_utils.h>
#include <io/altium/altium_parser.h>
#include <io/altium/altium_parser_utils.h>
#include <sch_io/altium/sch_altium_plugin.h>
#include <schematic.h>
#include <project_sch.h>
@ -262,13 +262,13 @@ int SCH_ALTIUM_PLUGIN::GetModifyHash() const
bool SCH_ALTIUM_PLUGIN::checkFileHeader( const wxString& aFileName )
{
// Compound File Binary Format header
return PLUGIN_UTILS::fileStartsWithBinaryHeader( aFileName, PLUGIN_UTILS::COMPOUND_FILE_HEADER );
return IO_UTILS::fileStartsWithBinaryHeader( aFileName, IO_UTILS::COMPOUND_FILE_HEADER );
}
bool SCH_ALTIUM_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadSchematicFile( aFileName ) )
if( !SCH_IO::CanReadSchematicFile( aFileName ) )
return false;
return checkFileHeader( aFileName );
@ -277,7 +277,7 @@ bool SCH_ALTIUM_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
bool SCH_ALTIUM_PLUGIN::CanReadLibrary( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadLibrary( aFileName ) )
if( !SCH_IO::CanReadLibrary( aFileName ) )
return false;
return checkFileHeader( aFileName );

View File

@ -27,7 +27,8 @@
#include <memory>
#include <vector>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <wx/filename.h>
#include <wx/gdicmn.h>
@ -42,14 +43,16 @@ class ALTIUM_COMPOUND_FILE;
/**
* SCH_ALTIUM_PLUGIN
* is a #SCH_PLUGIN derivation for loading Altium .SchDoc schematic files.
* is a #SCH_IO derivation for loading Altium .SchDoc schematic files.
*
* As with all SCH_PLUGINs there is no UI dependencies i.e. windowing calls allowed.
* As with all SCH_IO there is no UI dependencies i.e. windowing calls allowed.
*/
static std::vector<LIB_SYMBOL*> nullsym;
static std::vector<int> nullint;
class SCH_ALTIUM_PLUGIN : public SCH_PLUGIN
class SCH_ALTIUM_PLUGIN : public SCH_IO
{
public:
SCH_ALTIUM_PLUGIN();
@ -192,7 +195,7 @@ private:
wxString m_libName; // Library name to save symbols
bool m_isIntLib; // Flag to indicate Integrated Library
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi; // Plugin to create KiCad symbol library.
SCH_IO::SCH_IO_RELEASER m_pi; // Plugin to create KiCad symbol library.
std::unique_ptr<STRING_UTF8_MAP> m_properties; // Library plugin properties.
std::unique_ptr<TITLE_BLOCK> m_currentTitleBlock; // Will be assigned at the end of parsing

View File

@ -23,8 +23,8 @@
* @brief Loads a csa file into a KiCad SCHEMATIC object
*/
#include <sch_plugins/cadstar/cadstar_sch_archive_loader.h>
#include <plugins/cadstar/cadstar_parts_lib_parser.h>
#include <sch_io/cadstar/cadstar_sch_archive_loader.h>
#include <io/cadstar/cadstar_parts_lib_parser.h>
#include <bus_alias.h>
#include <core/mirror.h>
@ -37,7 +37,7 @@
#include <string_utils.h>
#include <sch_bus_entry.h>
#include <sch_edit_frame.h> //SYMBOL_ORIENTATION_T
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_screen.h>

View File

@ -26,7 +26,7 @@
#ifndef CADSTAR_SCH_ARCHIVE_LOADER_H_
#define CADSTAR_SCH_ARCHIVE_LOADER_H_
#include <sch_plugins/cadstar/cadstar_sch_archive_parser.h>
#include <sch_io/cadstar/cadstar_sch_archive_parser.h>
#include <layer_ids.h> // SCH_LAYER_ID
#include <plotters/plotter.h> // LINE_STYLE

View File

@ -25,7 +25,7 @@
#include <base_units.h>
#include <macros.h>
#include <sch_plugins/cadstar/cadstar_sch_archive_parser.h>
#include <sch_io/cadstar/cadstar_sch_archive_parser.h>
#include <progress_reporter.h>
#include <wx/translation.h>

View File

@ -26,7 +26,7 @@
#ifndef CADSTAR_SCH_ARCHIVE_PARSER_H_
#define CADSTAR_SCH_ARCHIVE_PARSER_H_
#include <plugins/cadstar/cadstar_archive_parser.h>
#include <io/cadstar/cadstar_archive_parser.h>
/**

View File

@ -24,9 +24,9 @@
* based on S-expressions.
*/
#include <sch_plugins/cadstar/cadstar_sch_archive_loader.h>
#include <sch_plugins/cadstar/cadstar_sch_archive_plugin.h>
#include <plugins/cadstar/cadstar_parts_lib_parser.h>
#include <sch_io/cadstar/cadstar_sch_archive_loader.h>
#include <sch_io/cadstar/cadstar_sch_archive_plugin.h>
#include <io/cadstar/cadstar_parts_lib_parser.h>
#include <lib_symbol.h>
#include <progress_reporter.h>
@ -35,7 +35,7 @@
#include <sch_screen.h>
#include <sch_sheet.h>
#include <schematic.h>
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <sch_io/kicad/sch_sexpr_plugin.h>
#include <wildcards_and_files_ext.h>
#include <wx_filename.h>
#include <wx/dir.h>
@ -51,7 +51,7 @@ const wxString CADSTAR_SCH_ARCHIVE_PLUGIN::GetName() const
bool CADSTAR_SCH_ARCHIVE_PLUGIN::CanReadLibrary( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadLibrary( aFileName ) )
if( !SCH_IO::CanReadLibrary( aFileName ) )
return false;
try
@ -127,7 +127,7 @@ SCH_SHEET* CADSTAR_SCH_ARCHIVE_PLUGIN::LoadSchematicFile( const wxString&
wxFileName libFileName( aSchematic->Prj().GetProjectPath(), libName,
KiCadSymbolLibFileExtension );
SCH_PLUGIN::SCH_PLUGIN_RELEASER sch_plugin;
SCH_IO::SCH_IO_RELEASER sch_plugin;
sch_plugin.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
if( !libTable->HasLibrary( libName ) )

View File

@ -28,7 +28,8 @@
#define CADSTAR_SCH_ARCHIVE_PLUGIN_H_
#include <map>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <reporter.h>
#include <lib_symbol.h>
#include <wildcards_and_files_ext.h>
@ -37,7 +38,7 @@
class SCH_SHEET;
class SCH_SCREEN;
class CADSTAR_SCH_ARCHIVE_PLUGIN : public SCH_PLUGIN
class CADSTAR_SCH_ARCHIVE_PLUGIN : public SCH_IO
{
public:
CADSTAR_SCH_ARCHIVE_PLUGIN() :

View File

@ -22,7 +22,8 @@
#define KICAD_SCH_DATABASE_PLUGIN_H
#include <database/database_connection.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <wildcards_and_files_ext.h>
@ -37,7 +38,7 @@ struct DATABASE_LIB_TABLE;
* plugins because the backing file is just a configuration file rather than something that
* contains symbol or footprint data.
*/
class SCH_DATABASE_PLUGIN : public SCH_PLUGIN
class SCH_DATABASE_PLUGIN : public SCH_IO
{
public:

View File

@ -22,7 +22,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sch_plugins/eagle/sch_eagle_plugin.h>
#include <sch_io/eagle/sch_eagle_plugin.h>
#include <locale_io.h>
#include <string_utf8_map.h>
@ -37,7 +37,7 @@
#include <wx/xml/xml.h>
#include <symbol_library.h>
#include <plugins/eagle/eagle_parser.h>
#include <io/eagle/eagle_parser.h>
#include <string_utils.h>
#include <gr_text.h>
#include <lib_shape.h>
@ -51,7 +51,7 @@
#include <project/net_settings.h>
#include <sch_edit_frame.h>
#include <sch_junction.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <sch_marker.h>
#include <sch_screen.h>
#include <sch_shape.h>
@ -2870,7 +2870,7 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
bool SCH_EAGLE_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadSchematicFile( aFileName ) )
if( !SCH_IO::CanReadSchematicFile( aFileName ) )
return false;
return checkHeader( aFileName );
@ -2879,7 +2879,7 @@ bool SCH_EAGLE_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
bool SCH_EAGLE_PLUGIN::CanReadLibrary( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadLibrary( aFileName ) )
if( !SCH_IO::CanReadLibrary( aFileName ) )
return false;
return checkHeader( aFileName );

View File

@ -26,8 +26,9 @@
#define _SCH_EAGLE_PLUGIN_H_
#include <sch_line.h>
#include <sch_io_mgr.h>
#include <plugins/eagle/eagle_parser.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <io/eagle/eagle_parser.h>
#include <lib_item.h>
#include <geometry/seg.h>
@ -74,11 +75,11 @@ typedef boost::ptr_map<wxString, EPART> EPART_LIST;
/**
* A #SCH_PLUGIN derivation for loading 6.x+ Eagle schematic files.
* A #SCH_IO derivation for loading 6.x+ Eagle schematic files.
*
* As with all SCH_PLUGINs there is no UI dependencies i.e. windowing calls allowed.
* As with all SCH_IO there is no UI dependencies i.e. windowing calls allowed.
*/
class SCH_EAGLE_PLUGIN : public SCH_PLUGIN
class SCH_EAGLE_PLUGIN : public SCH_IO
{
public:
const double ARC_ACCURACY = SCH_IU_PER_MM * 0.01; // 0.01mm
@ -258,7 +259,7 @@ private:
std::map<wxString, EAGLE_LIBRARY> m_eagleLibs;
std::unordered_map<wxString, bool> m_userValue; ///< deviceset/@uservalue for device.
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi; ///< PI to create KiCad symbol library.
SCH_IO::SCH_IO_RELEASER m_pi; ///< PI to create KiCad symbol library.
std::unique_ptr<STRING_UTF8_MAP> m_properties; ///< Library plugin properties.
PROGRESS_REPORTER* m_progressReporter; ///< optional; may be nullptr

View File

@ -24,7 +24,7 @@
#include "sch_easyeda_parser.h"
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <schematic.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>

View File

@ -25,10 +25,10 @@
#ifndef SCH_EASYEDA_PARSER_H_
#define SCH_EASYEDA_PARSER_H_
#include <plugins/easyeda/easyeda_parser_base.h>
#include <plugins/easyeda/easyeda_parser_structs.h>
#include <io/easyeda/easyeda_parser_base.h>
#include <io/easyeda/easyeda_parser_structs.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <pin_type.h>
#include <layer_ids.h>
#include <wx/filename.h>

View File

@ -99,7 +99,7 @@ static bool FindSchFileInStream( const wxString& aName, wxInputStream& aStream,
bool SCH_EASYEDA_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadSchematicFile( aFileName ) )
if( !SCH_IO::CanReadSchematicFile( aFileName ) )
return false;
try

View File

@ -25,7 +25,8 @@
#ifndef SCH_EASYEDA_PLUGIN_H_
#define SCH_EASYEDA_PLUGIN_H_
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <reporter.h>
#include <wx/arrstr.h>
@ -34,7 +35,7 @@ class SCH_SHEET;
class SCH_SCREEN;
class SCH_EASYEDA_PLUGIN : public SCH_PLUGIN
class SCH_EASYEDA_PLUGIN : public SCH_IO
{
public:
SCH_EASYEDA_PLUGIN()

View File

@ -23,11 +23,11 @@
*/
#include "sch_easyedapro_parser.h"
#include <plugins/easyedapro/easyedapro_import_utils.h>
#include <io/easyedapro/easyedapro_import_utils.h>
#include <core/map_helpers.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <schematic.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>

View File

@ -25,9 +25,9 @@
#ifndef SCH_EASYEDAPRO_PARSER_H_
#define SCH_EASYEDAPRO_PARSER_H_
#include <plugins/easyedapro/easyedapro_parser.h>
#include <io/easyedapro/easyedapro_parser.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <pin_type.h>
#include <layer_ids.h>
#include <wx/filename.h>

View File

@ -41,8 +41,8 @@
#include <nlohmann/json.hpp>
#include <string_utils.h>
#include <wildcards_and_files_ext.h>
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <plugins/easyedapro/easyedapro_import_utils.h>
#include <sch_io/kicad/sch_sexpr_plugin.h>
#include <io/easyedapro/easyedapro_import_utils.h>
#include <core/map_helpers.h>
#include <project_sch.h>
@ -531,7 +531,7 @@ SCH_SHEET* SCH_EASYEDAPRO_PLUGIN::LoadSchematicFile( const wxString& aFileName,
};
EASYEDAPRO::IterateZipFiles( aFileName, cbs );
SCH_PLUGIN::SCH_PLUGIN_RELEASER sch_plugin;
SCH_IO::SCH_IO_RELEASER sch_plugin;
sch_plugin.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
if( !libTable->HasLibrary( libName ) )

View File

@ -25,16 +25,17 @@
#ifndef SCH_EASYEDAPRO_PLUGIN_H_
#define SCH_EASYEDAPRO_PLUGIN_H_
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <reporter.h>
#include <plugins/common/plugin_common_choose_project.h>
#include <io/common/plugin_common_choose_project.h>
class SCH_SHEET;
class SCH_SCREEN;
class SCH_EASYEDAPRO_PLUGIN : public SCH_PLUGIN, public PROJECT_CHOOSER_PLUGIN
class SCH_EASYEDAPRO_PLUGIN : public SCH_IO, public PROJECT_CHOOSER_PLUGIN
{
public:
SCH_EASYEDAPRO_PLUGIN();

View File

@ -24,7 +24,8 @@
#include "http_lib/http_lib_settings.h"
#include <http_lib/http_lib_connection.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <wildcards_and_files_ext.h>
/**
@ -34,7 +35,7 @@
* plugins because the backing file is just a configuration file rather than something that
* contains symbol or footprint data.
*/
class SCH_HTTP_LIB_PLUGIN : public SCH_PLUGIN
class SCH_HTTP_LIB_PLUGIN : public SCH_IO
{
public:

View File

@ -22,7 +22,7 @@
#ifndef _SCH_SEXPR_LIB_PLUGIN_CACHE_
#define _SCH_SEXPR_LIB_PLUGIN_CACHE_
#include "../sch_lib_plugin_cache.h"
#include "sch_io/sch_lib_plugin_cache.h"
class FILE_LINE_READER;
class LIB_FIELD;
@ -43,7 +43,7 @@ public:
virtual ~SCH_SEXPR_PLUGIN_CACHE();
// Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any SCH_PLUGIN objects.
// error codes nor user interface calls from here, nor in any SCH_IO objects.
// Catch these exceptions higher up please.
/// Save the entire library to file m_libFileName;

View File

@ -56,7 +56,7 @@
#include <sch_no_connect.h>
#include <sch_screen.h>
#include <sch_sheet_pin.h>
#include <sch_plugins/kicad/sch_sexpr_parser.h>
#include <sch_io/kicad/sch_sexpr_parser.h>
#include <template_fieldnames.h>
#include <trigo.h>
#include <progress_reporter.h>

View File

@ -46,17 +46,17 @@
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <schematic.h>
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <sch_io/kicad/sch_sexpr_plugin.h>
#include <sch_screen.h>
#include <lib_shape.h>
#include <lib_pin.h>
#include <lib_text.h>
#include <lib_textbox.h>
#include <eeschema_id.h> // for MAX_UNIT_COUNT_PER_PACKAGE definition
#include <plugins/kicad/kicad_plugin_utils.h>
#include <io/kicad/kicad_io_utils.h>
#include <sch_file_versions.h>
#include <schematic_lexer.h>
#include <sch_plugins/kicad/sch_sexpr_parser.h>
#include <sch_io/kicad/sch_sexpr_parser.h>
#include "sch_sexpr_lib_plugin_cache.h"
#include "sch_sexpr_plugin_common.h"
#include <symbol_lib_table.h> // for PropPowerSymsOnly definition.

View File

@ -24,7 +24,8 @@
#define _SCH_SEXPR_PLUGIN_H_
#include <memory>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <sch_file_versions.h>
#include <sch_sheet_path.h>
#include <stack>
@ -56,12 +57,12 @@ class SYMBOL_LIB;
class BUS_ALIAS;
/**
* A #SCH_PLUGIN derivation for loading schematic files using the new s-expression
* A #SCH_IO derivation for loading schematic files using the new s-expression
* file format.
*
* As with all SCH_PLUGINs there is no UI dependencies i.e. windowing calls allowed.
* As with all SCH_IOs there is no UI dependencies i.e. windowing calls allowed.
*/
class SCH_SEXPR_PLUGIN : public SCH_PLUGIN
class SCH_SEXPR_PLUGIN : public SCH_IO
{
public:

View File

@ -26,7 +26,7 @@
#include <eda_shape.h> // FILL_T
#include "../sch_lib_plugin_cache.h"
#include "sch_io/sch_lib_plugin_cache.h"
class FILE_LINE_READER;
class LIB_FIELD;
@ -47,7 +47,7 @@ public:
virtual ~SCH_LEGACY_PLUGIN_CACHE() {}
// Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any SCH_PLUGIN objects.
// error codes nor user interface calls from here, nor in any SCH_IO objects.
// Catch these exceptions higher up please.
/// Save the entire library to file m_libFileName;

View File

@ -53,10 +53,10 @@
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <bus_alias.h>
#include <plugins/plugin_utils.h>
#include <sch_plugins/legacy/sch_legacy_lib_plugin_cache.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_plugins/legacy/sch_legacy_plugin_helpers.h>
#include <io/io_utils.h>
#include <sch_io/legacy/sch_legacy_lib_plugin_cache.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <sch_io/legacy/sch_legacy_plugin_helpers.h>
#include <sch_screen.h>
#include <schematic.h>
#include <symbol_library.h>
@ -2243,19 +2243,19 @@ void SCH_LEGACY_PLUGIN::SaveLibrary( const wxString& aLibraryPath, const STRING_
bool SCH_LEGACY_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadSchematicFile( aFileName ) )
if( !SCH_IO::CanReadSchematicFile( aFileName ) )
return false;
return PLUGIN_UTILS::fileStartsWithPrefix( aFileName, wxT( "EESchema" ), true );
return IO_UTILS::fileStartsWithPrefix( aFileName, wxT( "EESchema" ), true );
}
bool SCH_LEGACY_PLUGIN::CanReadLibrary( const wxString& aFileName ) const
{
if( !SCH_PLUGIN::CanReadLibrary( aFileName ) )
if( !SCH_IO::CanReadLibrary( aFileName ) )
return false;
return PLUGIN_UTILS::fileStartsWithPrefix( aFileName, wxT( "EESchema" ), true );
return IO_UTILS::fileStartsWithPrefix( aFileName, wxT( "EESchema" ), true );
}

View File

@ -24,7 +24,8 @@
#define _SCH_LEGACY_PLUGIN_H_
#include <memory>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <stack>
#include <general.h> // for EESCHEMA_VERSION definition
#include <wildcards_and_files_ext.h>
@ -52,7 +53,7 @@ class OUTPUTFORMATTER;
/**
* A #SCH_PLUGIN derivation for loading schematic files created before the new s-expression
* A #SCH_IO derivation for loading schematic files created before the new s-expression
* file format.
*
* The legacy parser and formatter attempt to be compatible with the legacy file format.
@ -60,9 +61,9 @@ class OUTPUTFORMATTER;
* So "$C", "$Co", and "$Com" could be used for "$Comp" and the old parser would allow
* this. This parser is not that forgiving and sticks to the legacy file format document.
*
* As with all SCH_PLUGINs there is no UI dependencies i.e. windowing calls allowed.
* As with all SCH_IO there is no UI dependencies i.e. windowing calls allowed.
*/
class SCH_LEGACY_PLUGIN : public SCH_PLUGIN
class SCH_LEGACY_PLUGIN : public SCH_IO
{
public:

View File

@ -24,9 +24,9 @@
* schematic file.
*/
#include <sch_plugins/ltspice/ltspice_sch_parser.h>
#include <sch_plugins/ltspice/ltspice_schematic.h>
#include <sch_io_mgr.h>
#include <sch_io/ltspice/ltspice_sch_parser.h>
#include <sch_io/ltspice/ltspice_schematic.h>
#include <sch_io/sch_io_mgr.h>
#include <schematic.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>

View File

@ -27,12 +27,12 @@
#ifndef LTSPICE_SCH_PARSER_H
#define LTSPICE_SCH_PARSER_H
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <pin_type.h>
#include <layer_ids.h>
#include <wx/filename.h>
#include <plotters/plotter.h>
#include <sch_plugins/ltspice/ltspice_schematic.h>
#include <sch_io/ltspice/ltspice_schematic.h>
class EDA_TEXT;

View File

@ -19,9 +19,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sch_plugins/ltspice/ltspice_schematic.h>
#include <sch_plugins/ltspice/ltspice_sch_plugin.h>
#include <sch_plugins/ltspice/ltspice_sch_parser.h>
#include <sch_io/ltspice/ltspice_schematic.h>
#include <sch_io/ltspice/ltspice_sch_plugin.h>
#include <sch_io/ltspice/ltspice_sch_parser.h>
#include <project_sch.h>
#include <schematic.h>

View File

@ -22,7 +22,8 @@
#ifndef SCH_LTSPICE_PLUGIN_H_
#define SCH_LTSPICE_PLUGIN_H_
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <reporter.h>
#include <wx/log.h>
@ -31,7 +32,7 @@ class SCH_SHEET;
class SCH_SCREEN;
class SCH_LTSPICE_PLUGIN : public SCH_PLUGIN
class SCH_LTSPICE_PLUGIN : public SCH_IO
{
public:
SCH_LTSPICE_PLUGIN()

View File

@ -23,8 +23,8 @@
* @brief Loads the asc file and asy files.
*/
#include <sch_plugins/ltspice/ltspice_schematic.h>
#include <sch_plugins/ltspice/ltspice_sch_parser.h>
#include <sch_io/ltspice/ltspice_schematic.h>
#include <sch_io/ltspice/ltspice_sch_parser.h>
#include <sch_screen.h>
#include <wx/log.h>
#include <wx/dir.h>

View File

@ -22,7 +22,7 @@
#ifndef LTSPICE_SCHEMATIC_LOADER_H
#define LTSPICE_SCHEMATIC_LOADER_H
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <sch_sheet_path.h>
#include <pin_type.h>
#include <layer_ids.h>

View File

@ -24,7 +24,8 @@
#include <unordered_set>
#include <ki_exception.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <wx/translation.h>
#include <wx/filename.h>
#include <wx/dir.h>
@ -36,19 +37,19 @@
wxString::FromUTF8( aCaller ).GetData() ) );
const PLUGIN_FILE_DESC SCH_PLUGIN::GetSchematicFileDesc() const
const PLUGIN_FILE_DESC SCH_IO::GetSchematicFileDesc() const
{
return PLUGIN_FILE_DESC( wxEmptyString, {} );
}
const PLUGIN_FILE_DESC SCH_PLUGIN::GetLibraryFileDesc() const
const PLUGIN_FILE_DESC SCH_IO::GetLibraryFileDesc() const
{
return PLUGIN_FILE_DESC( wxEmptyString, {} );
}
bool SCH_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
bool SCH_IO::CanReadSchematicFile( const wxString& aFileName ) const
{
const std::vector<std::string>& exts = GetSchematicFileDesc().m_FileExtensions;
@ -64,7 +65,7 @@ bool SCH_PLUGIN::CanReadSchematicFile( const wxString& aFileName ) const
}
bool SCH_PLUGIN::CanReadLibrary( const wxString& aFileName ) const
bool SCH_IO::CanReadLibrary( const wxString& aFileName ) const
{
const PLUGIN_FILE_DESC& desc = GetLibraryFileDesc();
@ -115,91 +116,91 @@ bool SCH_PLUGIN::CanReadLibrary( const wxString& aFileName ) const
}
void SCH_PLUGIN::SaveLibrary( const wxString& aFileName, const STRING_UTF8_MAP* aProperties )
void SCH_IO::SaveLibrary( const wxString& aFileName, const STRING_UTF8_MAP* aProperties )
{
NOT_IMPLEMENTED( __FUNCTION__ );
}
SCH_SHEET* SCH_PLUGIN::LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
SCH_SHEET* SCH_IO::LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
SCH_SHEET* aAppendToMe, const STRING_UTF8_MAP* aProperties )
{
NOT_IMPLEMENTED( __FUNCTION__ );
}
void SCH_PLUGIN::SaveSchematicFile( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
void SCH_IO::SaveSchematicFile( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
void SCH_PLUGIN::EnumerateSymbolLib( wxArrayString& aAliasNameList,
void SCH_IO::EnumerateSymbolLib( wxArrayString& aAliasNameList,
const wxString& aLibraryPath,
const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
void SCH_PLUGIN::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
void SCH_IO::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
const wxString& aLibraryPath,
const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
LIB_SYMBOL* SCH_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
LIB_SYMBOL* SCH_IO::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
void SCH_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
void SCH_IO::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
void SCH_PLUGIN::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
void SCH_IO::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
void SCH_PLUGIN::CreateSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
void SCH_IO::CreateSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
bool SCH_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
bool SCH_IO::DeleteSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
bool SCH_PLUGIN::IsSymbolLibWritable( const wxString& aLibraryPath )
bool SCH_IO::IsSymbolLibWritable( const wxString& aLibraryPath )
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}
void SCH_PLUGIN::SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
void SCH_IO::SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
{
// Empty for most plugins
//
@ -211,8 +212,8 @@ void SCH_PLUGIN::SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
}
const wxString& SCH_PLUGIN::GetError() const
const wxString& SCH_IO::GetError() const
{
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
NOT_IMPLEMENTED( __FUNCTION__ );
}

View File

@ -20,9 +20,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SCH_IO_MGR_H_
#define _SCH_IO_MGR_H_
#ifndef SCH_IO_H_
#define SCH_IO_H_
#include <sch_io/sch_io_mgr.h>
#include <import_export.h>
#include <map>
#include <enum_vector.h>
@ -31,99 +32,10 @@
#include <plugin_file_desc.h>
#include <wx/arrstr.h>
class SCH_SHEET;
class SCH_SCREEN;
class SCH_PLUGIN;
class SCHEMATIC;
class SYMBOL_LIB_TABLE;
class KIWAY;
class LIB_SYMBOL;
class SYMBOL_LIB;
class STRING_UTF8_MAP;
class PROGRESS_REPORTER;
/**
* A factory which returns an instance of a #SCH_PLUGIN.
*/
class SCH_IO_MGR
{
public:
/**
* A set of file types that the #SCH_IO_MGR knows about, and for which there
* has been a plugin written, in alphabetical order.
*/
// clang-format off
DEFINE_ENUM_VECTOR( SCH_FILE_T,
{
SCH_KICAD, ///< The s-expression version of the schematic.
SCH_LEGACY, ///< Legacy Eeschema file formats prior to s-expression.
SCH_ALTIUM, ///< Altium file format
SCH_CADSTAR_ARCHIVE, ///< CADSTAR Schematic Archive
SCH_DATABASE, ///< KiCad database library
SCH_EAGLE, ///< Autodesk Eagle file format
SCH_EASYEDA, ///< EasyEDA Std schematic file
SCH_EASYEDAPRO, ///< EasyEDA Pro archive
SCH_LTSPICE, ///< LtSpice Schematic format
SCH_HTTP, ///< KiCad HTTP library
// Add your schematic type here.
SCH_FILE_UNKNOWN
} )
// clang-format on
/**
* Return a #SCH_PLUGIN which the caller can use to import, export, save, or load
* design documents.
*
* The returned #SCH_PLUGIN, may be reference counted, so please call PluginRelease()
* when you are done using the returned #SCH_PLUGIN. It may or may not be code running
* from a DLL/DSO.
*
* @param aFileType is from #SCH_FILE_T and tells which plugin to find.
*
* @return the plugin corresponding to aFileType or NULL if not found.
* Caller owns the returned object, and must call PluginRelease when done using it.
*/
APIEXPORT
static SCH_PLUGIN* FindPlugin( SCH_FILE_T aFileType );
/**
* Release a #SCH_PLUGIN back to the system, and may cause it to be unloaded from memory.
*
* @param aPlugin is the one to be released, and which is no longer usable
* after calling this.
*/
static void ReleasePlugin( SCH_PLUGIN* aPlugin );
/**
* Return a brief name for a plugin, given aFileType enum.
*/
static const wxString ShowType( SCH_FILE_T aFileType );
/**
* Return the #SCH_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
*/
static SCH_FILE_T EnumFromStr( const wxString& aFileType );
/**
* Return a plugin type given a symbol library using the file extension of \a aLibPath.
*/
static SCH_FILE_T GuessPluginTypeFromLibPath( const wxString& aLibPath, int aCtl = 0 );
/**
* Return a plugin type given a schematic using the file extension of \a aSchematicPath.
*/
static SCH_FILE_T GuessPluginTypeFromSchPath( const wxString& aSchematicPath, int aCtl = 0 );
};
/**
* Base class that schematic file and library loading and saving plugins should derive from.
* Implementations can provide either LoadSchematicFile() or SaveSchematicFile() functions,
* or both. SCH_PLUGINs throw exceptions, so it is best that you wrap your calls to these
* or both. SCH_IOs throw exceptions, so it is best that you wrap your calls to these
* functions in a try catch block. Plugins throw exceptions because it is illegal
* for them to have any user interface calls in them whatsoever, i.e. no windowing
* or screen printing at all.
@ -141,14 +53,14 @@ public:
* }
* </pre>
*/
class SCH_PLUGIN
class SCH_IO
{
public:
//-----<PUBLIC SCH_PLUGIN API>-------------------------------------------------
//-----<PUBLIC SCH_IO API>-------------------------------------------------
/**
* Return a brief hard coded name for this SCH_PLUGIN.
* Return a brief hard coded name for this SCH_IO.
*/
virtual const wxString GetName() const = 0;
@ -163,23 +75,23 @@ public:
virtual void SetProgressReporter( PROGRESS_REPORTER* aReporter ) {}
/**
* Returns schematic file description for the #SCH_PLUGIN.
* Returns schematic file description for the #SCH_IO.
*/
virtual const PLUGIN_FILE_DESC GetSchematicFileDesc() const;
/**
* Returns symbol library description for the #SCH_PLUGIN.
* Returns symbol library description for the #SCH_IO.
*/
virtual const PLUGIN_FILE_DESC GetLibraryFileDesc() const;
/**
* Checks if this SCH_PLUGIN can read the specified schematic file.
* Checks if this SCH_IO can read the specified schematic file.
* If not overriden, extension check is used.
*/
virtual bool CanReadSchematicFile( const wxString& aFileName ) const;
/**
* Checks if this SCH_PLUGIN can read the specified symbol library file.
* Checks if this SCH_IO can read the specified symbol library file.
* If not overriden, extension check is used.
*/
virtual bool CanReadLibrary( const wxString& aFileName ) const;
@ -198,7 +110,7 @@ public:
virtual void SaveLibrary( const wxString& aFileName, const STRING_UTF8_MAP* aProperties = nullptr );
/**
* Load information from some input file format that this #SCH_PLUGIN implementation
* Load information from some input file format that this #SCH_IO implementation
* knows about, into either a new #SCH_SHEET or an existing one. This may be used to load an
* entire new #SCH_SHEET, or to augment an existing one if \a aAppendToMe is not NULL.
*
@ -230,7 +142,7 @@ public:
const STRING_UTF8_MAP* aProperties = nullptr );
/**
* Write \a aSchematic to a storage file in a format that this #SCH_PLUGIN implementation
* Write \a aSchematic to a storage file in a format that this #SCH_IO implementation
* knows about, or it can be used to write a portion of \a aSchematic to a special kind
* of export file.
*
@ -302,7 +214,7 @@ public:
/**
* Load a #LIB_SYMBOL object having \a aPartName from the \a aLibraryPath containing
* a library format that this #SCH_PLUGIN knows about.
* a library format that this #SCH_IO knows about.
*
* @param aLibraryPath is a locator for the "library", usually a directory, file,
* or URL containing several symbols.
@ -421,11 +333,11 @@ public:
virtual bool IsSymbolLibWritable( const wxString& aLibraryPath );
/**
* Append supported #SCH_PLUGIN options to \a aListToAppenTo along with internationalized
* descriptions. Options are typically appended so that a derived SCH_PLUGIN can call
* Append supported #SCH_IO options to \a aListToAppenTo along with internationalized
* descriptions. Options are typically appended so that a derived SCH_IO can call
* its base class function by the same name first, thus inheriting options declared there.
* (Some base class options could pertain to all Symbol*() functions in all derived
* SCH_PLUGINs.) Note that since aListToAppendTo is a PROPERTIES object, all options
* SCH_IOs.) Note that since aListToAppendTo is a PROPERTIES object, all options
* will be unique and last guy wins.
*
* @param aListToAppendTo holds a tuple of
@ -442,7 +354,7 @@ public:
* holding a wxValidator for the cells in said dialog:
* http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180.
* This would require a 3 column list, and introducing wx GUI knowledge to
* #SCH_PLUGIN, which has been avoided to date.
* #SCH_IO, which has been avoided to date.
*/
virtual void SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const;
@ -509,40 +421,40 @@ public:
*/
virtual void SetLibTable( SYMBOL_LIB_TABLE* aTable ) {}
//-----</PUBLIC SCH_PLUGIN API>------------------------------------------------
//-----</PUBLIC SCH_IO API>------------------------------------------------
/* The compiler writes the "zero argument" constructor for a SCH_PLUGIN
/* The compiler writes the "zero argument" constructor for a SCH_IO
automatically if you do not provide one. If you decide you need to
provide a zero argument constructor of your own design, that is allowed.
It must be public, and it is what the SCH_IO_MGR uses. Parameters may be
passed into a SCH_PLUGIN via the PROPERTIES variable for any of the public
passed into a SCH_IO via the PROPERTIES variable for any of the public
API functions which take one.
*/
virtual ~SCH_PLUGIN() { }
virtual ~SCH_IO() { }
/**
* Helper object to release a #SCH_PLUGIN in the context of a potential thrown exception
* Helper object to release a #SCH_IO in the context of a potential thrown exception
* through its destructor.
*/
class SCH_PLUGIN_RELEASER
class SCH_IO_RELEASER
{
SCH_PLUGIN* plugin;
SCH_IO* plugin;
// private assignment operator so it's illegal
SCH_PLUGIN_RELEASER& operator=( SCH_PLUGIN_RELEASER& aOther ) { return *this; }
SCH_IO_RELEASER& operator=( SCH_IO_RELEASER& aOther ) { return *this; }
// private copy constructor so it's illegal
SCH_PLUGIN_RELEASER( const SCH_PLUGIN_RELEASER& aOther ) {}
SCH_IO_RELEASER( const SCH_IO_RELEASER& aOther ) {}
public:
SCH_PLUGIN_RELEASER( SCH_PLUGIN* aPlugin = nullptr ) :
SCH_IO_RELEASER( SCH_IO* aPlugin = nullptr ) :
plugin( aPlugin )
{
}
~SCH_PLUGIN_RELEASER()
~SCH_IO_RELEASER()
{
if( plugin )
release();
@ -554,23 +466,24 @@ public:
plugin = nullptr;
}
void set( SCH_PLUGIN* aPlugin )
void set( SCH_IO* aPlugin )
{
if( plugin )
release();
plugin = aPlugin;
}
operator SCH_PLUGIN* () const
operator SCH_IO* () const
{
return plugin;
}
SCH_PLUGIN* operator -> () const
SCH_IO* operator -> () const
{
return plugin;
}
};
};
#endif // _SCH_IO_MGR_H_
#endif // SCH_IO_H_

View File

@ -23,18 +23,18 @@
#include <wx/filename.h>
#include <wx/uri.h>
#include <sch_io_mgr.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_plugins/eagle/sch_eagle_plugin.h>
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <sch_io/sch_io_mgr.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <sch_io/eagle/sch_eagle_plugin.h>
#include <sch_io/kicad/sch_sexpr_plugin.h>
#include <sch_plugins/altium/sch_altium_plugin.h>
#include <sch_plugins/cadstar/cadstar_sch_archive_plugin.h>
#include <sch_plugins/easyeda/sch_easyeda_plugin.h>
#include <sch_plugins/easyedapro/sch_easyedapro_plugin.h>
#include <sch_plugins/database/sch_database_plugin.h>
#include <sch_plugins/ltspice/ltspice_sch_plugin.h>
#include <sch_plugins/http_lib/sch_http_lib_plugin.h>
#include <sch_io/altium/sch_altium_plugin.h>
#include <sch_io/cadstar/cadstar_sch_archive_plugin.h>
#include <sch_io/easyeda/sch_easyeda_plugin.h>
#include <sch_io/easyedapro/sch_easyedapro_plugin.h>
#include <sch_io/database/sch_database_plugin.h>
#include <sch_io/ltspice/ltspice_sch_plugin.h>
#include <sch_io/http_lib/sch_http_lib_plugin.h>
#include <common.h> // for ExpandEnvVarSubstitutions
#include <wildcards_and_files_ext.h>
@ -57,7 +57,7 @@
// plugins coexisting.
SCH_PLUGIN* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
SCH_IO* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
{
// This implementation is subject to change, any magic is allowed here.
// The public SCH_IO_MGR API is the only pertinent public information.
@ -79,7 +79,7 @@ SCH_PLUGIN* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
}
void SCH_IO_MGR::ReleasePlugin( SCH_PLUGIN* aPlugin )
void SCH_IO_MGR::ReleasePlugin( SCH_IO* aPlugin )
{
// This function is a place holder for a future point in time where
// the plugin is a DLL/DSO. It could do reference counting, and then
@ -158,7 +158,7 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::GuessPluginTypeFromLibPath( const wxString& a
if( ( aCtl & KICTL_NONKICAD_ONLY ) && isKiCad )
continue;
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
if( !pi )
continue;
@ -184,7 +184,7 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::GuessPluginTypeFromSchPath( const wxString& a
if( ( aCtl & KICTL_NONKICAD_ONLY ) && isKiCad )
continue;
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
if( !pi )
continue;

View File

@ -0,0 +1,122 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@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 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/>.
*/
#ifndef _SCH_IO_MGR_H_
#define _SCH_IO_MGR_H_
#include <import_export.h>
#include <map>
#include <enum_vector.h>
#include <reporter.h>
#include <i18n_utility.h>
#include <plugin_file_desc.h>
#include <wx/arrstr.h>
class SCH_SHEET;
class SCH_SCREEN;
class SCH_IO;
class SCHEMATIC;
class SYMBOL_LIB_TABLE;
class KIWAY;
class LIB_SYMBOL;
class SYMBOL_LIB;
class STRING_UTF8_MAP;
class PROGRESS_REPORTER;
/**
* A factory which returns an instance of a #SCH_IO.
*/
class SCH_IO_MGR
{
public:
/**
* A set of file types that the #SCH_IO_MGR knows about, and for which there
* has been a plugin written, in alphabetical order.
*/
// clang-format off
DEFINE_ENUM_VECTOR( SCH_FILE_T,
{
SCH_KICAD, ///< The s-expression version of the schematic.
SCH_LEGACY, ///< Legacy Eeschema file formats prior to s-expression.
SCH_ALTIUM, ///< Altium file format
SCH_CADSTAR_ARCHIVE, ///< CADSTAR Schematic Archive
SCH_DATABASE, ///< KiCad database library
SCH_EAGLE, ///< Autodesk Eagle file format
SCH_EASYEDA, ///< EasyEDA Std schematic file
SCH_EASYEDAPRO, ///< EasyEDA Pro archive
SCH_LTSPICE, ///< LtSpice Schematic format
SCH_HTTP, ///< KiCad HTTP library
// Add your schematic type here.
SCH_FILE_UNKNOWN
} )
// clang-format on
/**
* Return a #SCH_IO which the caller can use to import, export, save, or load
* design documents.
*
* The returned #SCH_IO, may be reference counted, so please call PluginRelease()
* when you are done using the returned #SCH_IO. It may or may not be code running
* from a DLL/DSO.
*
* @param aFileType is from #SCH_FILE_T and tells which plugin to find.
*
* @return the plugin corresponding to aFileType or NULL if not found.
* Caller owns the returned object, and must call PluginRelease when done using it.
*/
APIEXPORT
static SCH_IO* FindPlugin( SCH_FILE_T aFileType );
/**
* Release a #SCH_IO back to the system, and may cause it to be unloaded from memory.
*
* @param aPlugin is the one to be released, and which is no longer usable
* after calling this.
*/
static void ReleasePlugin( SCH_IO* aPlugin );
/**
* Return a brief name for a plugin, given aFileType enum.
*/
static const wxString ShowType( SCH_FILE_T aFileType );
/**
* Return the #SCH_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
*/
static SCH_FILE_T EnumFromStr( const wxString& aFileType );
/**
* Return a plugin type given a symbol library using the file extension of \a aLibPath.
*/
static SCH_FILE_T GuessPluginTypeFromLibPath( const wxString& aLibPath, int aCtl = 0 );
/**
* Return a plugin type given a schematic using the file extension of \a aSchematicPath.
*/
static SCH_FILE_T GuessPluginTypeFromSchPath( const wxString& aSchematicPath, int aCtl = 0 );
};
#endif // _SCH_IO_MGR_H_

View File

@ -35,7 +35,7 @@ class OUTPUTFORMATTER;
/**
* A base cache assistant implementation for the symbol library portion of the #SCH_PLUGIN API.
* A base cache assistant implementation for the symbol library portion of the #SCH_IO API.
*/
class SCH_LIB_PLUGIN_CACHE
{
@ -56,7 +56,7 @@ public:
}
// Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any SCH_PLUGIN objects.
// error codes nor user interface calls from here, nor in any SCH_IO objects.
// Catch these exceptions higher up please.
/// Save the entire library to file m_libFileName;

View File

@ -31,7 +31,7 @@
#include <tool/tool_manager.h>
#include <project_sch.h>
#include <sch_edit_frame.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_view.h>
@ -169,7 +169,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
if( schFileType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
schFileType = SCH_IO_MGR::SCH_KICAD;
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( schFileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( schFileType ) );
std::unique_ptr< SCH_SHEET> tmpSheet = std::make_unique<SCH_SHEET>( &Schematic() );
// This will cause the sheet UUID to be set to the UUID of the aSheet argument. This is

View File

@ -38,8 +38,8 @@
#include <symbol_tree_pane.h>
#include <project/project_file.h>
#include <widgets/lib_tree.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <sch_io/kicad/sch_sexpr_plugin.h>
#include <dialogs/dialog_lib_new_symbol.h>
#include <eda_list_dialog.h>
#include <wx/clipbrd.h>

View File

@ -56,7 +56,7 @@ void SYMBOL_EDIT_FRAME::ImportSymbol()
if( fileType == SCH_IO_MGR::SCH_KICAD || fileType == SCH_IO_MGR::SCH_LEGACY )
continue; // this is "Import non-KiCad schematic"
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
if( !pi )
continue;
@ -98,7 +98,7 @@ void SYMBOL_EDIT_FRAME::ImportSymbol()
return;
}
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( piType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( piType ) );
// TODO dialog to select the symbol to be imported if there is more than one
try
@ -173,7 +173,7 @@ void SYMBOL_EDIT_FRAME::ExportSymbol()
if( pluginType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
pluginType = SCH_IO_MGR::SCH_KICAD;
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
if( fn.FileExists() )
{

View File

@ -34,7 +34,7 @@
#include <systemdirsappend.h>
#include <symbol_lib_table.h>
#include <lib_symbol.h>
#include <sch_plugins/database/sch_database_plugin.h>
#include <sch_io/database/sch_database_plugin.h>
#include <dialogs/dialog_database_lib_settings.h>
#include <wx/dir.h>
@ -111,7 +111,7 @@ void SYMBOL_LIB_TABLE_ROW::ShowSettingsDialog( wxWindow* aParent ) const
return;
DIALOG_DATABASE_LIB_SETTINGS dlg( aParent,
static_cast<SCH_DATABASE_PLUGIN*>( ( SCH_PLUGIN* )plugin ) );
static_cast<SCH_DATABASE_PLUGIN*>( ( SCH_IO* )plugin ) );
dlg.ShowModal();
}

View File

@ -26,7 +26,8 @@
#define _SYMBOL_LIB_TABLE_H_
#include <lib_table_base.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <lib_id.h>
//class LIB_SYMBOL;
@ -36,7 +37,7 @@ class DIALOG_SYMBOL_LIB_TABLE;
/**
* Hold a record identifying a symbol library accessed by the appropriate symbol library
* #SCH_PLUGIN object in the #SYMBOL_LIB_TABLE.
* #SCH_IO object in the #SYMBOL_LIB_TABLE.
*/
class SYMBOL_LIB_TABLE_ROW : public LIB_TABLE_ROW
{
@ -95,7 +96,7 @@ public:
void GetSubLibraryNames( std::vector<wxString>& aNames ) const;
/**
* @see SCH_PLUGIN::GetAvailableSymbolFields
* @see SCH_IO::GetAvailableSymbolFields
*/
void GetAvailableSymbolFields( std::vector<wxString>& aNames ) const
{
@ -104,7 +105,7 @@ public:
}
/**
* @see SCH_PLUGIN::GetDefaultSymbolFields
* @see SCH_IO::GetDefaultSymbolFields
*/
void GetDefaultSymbolFields( std::vector<wxString>& aNames ) const
{
@ -130,12 +131,12 @@ private:
return new SYMBOL_LIB_TABLE_ROW( *this );
}
void setPlugin( SCH_PLUGIN* aPlugin )
void setPlugin( SCH_IO* aPlugin )
{
plugin.set( aPlugin );
}
SCH_PLUGIN::SCH_PLUGIN_RELEASER plugin;
SCH_IO::SCH_IO_RELEASER plugin;
LIB_T type;
};
@ -166,7 +167,7 @@ public:
* Return an SYMBOL_LIB_TABLE_ROW if \a aNickName is found in this table or in any chained
* fallBack table fragment.
*
* The #SCH_PLUGIN is loaded and attached to the "plugin" fieldf the #SYMBOL_LIB_TABLE_ROW if
* The #SCH_IO is loaded and attached to the "plugin" fieldf the #SYMBOL_LIB_TABLE_ROW if
* not already loaded.
*
* @param aNickName is the name of the row to find.

View File

@ -38,7 +38,7 @@
#include <widgets/app_progress_dialog.h>
#include <symbol_library.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_io/legacy/sch_legacy_plugin.h>
#include <wx/log.h>
#include <wx/progdlg.h>

View File

@ -36,7 +36,7 @@
#include <wx/filename.h>
#include <project.h>
#include <sch_io_mgr.h>
#include <sch_io/sch_io_mgr.h>
#include <symbol_library_common.h>
@ -45,7 +45,7 @@ class LIB_ID;
class LINE_READER;
class OUTPUTFORMATTER;
class STRING_UTF8_MAP;
class SCH_PLUGIN;
class SCH_IO;
class SYMBOL_LIB;
@ -323,7 +323,7 @@ private:
int m_mod_hash; ///< incremented each time library is changed.
SCH_IO_MGR::SCH_FILE_T m_pluginType;
std::unique_ptr< SCH_PLUGIN > m_plugin;
std::unique_ptr< SCH_IO > m_plugin;
std::unique_ptr<STRING_UTF8_MAP> m_properties; ///< Library properties
};

Some files were not shown because too many files have changed in this diff Show More