2023-09-16 21:02:33 -04:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2023 Mark Roszko <mark.roszko@gmail.com>
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2023-09-16 21:02:33 -04:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <jobs/job_export_sch_netlist.h>
|
2024-07-15 18:20:13 -04:00
|
|
|
#include <jobs/job_registry.h>
|
|
|
|
#include <i18n_utility.h>
|
2023-09-16 21:02:33 -04:00
|
|
|
|
|
|
|
|
2025-01-02 13:20:31 +00:00
|
|
|
std::map<JOB_EXPORT_SCH_NETLIST::FORMAT, wxString> jobNetlistNameLookup =
|
|
|
|
{
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::KICADSEXPR, wxT( "KiCad" ) },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::KICADXML, wxT( "XML" ) },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::ORCADPCB2, wxT( "OrcadPCB2" ) },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::ALLEGRO, wxT( "Allegro" ) },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::PADS, wxT( "PADS" ) },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::CADSTAR, wxT( "CadStar" ) },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::SPICE, wxT( "SPICE" ) },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::SPICEMODEL, wxT( "SPICE Model" ) }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-07-15 18:20:13 -04:00
|
|
|
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_SCH_NETLIST::FORMAT,
|
|
|
|
{
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::KICADSEXPR, "kicad" },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::KICADXML, "xml" },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::ALLEGRO, "allegro" },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::PADS, "pads" },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::CADSTAR, "cadstar" },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::ORCADPCB2, "orcadpcb2" },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::SPICE, "spice" },
|
|
|
|
{ JOB_EXPORT_SCH_NETLIST::FORMAT::SPICEMODEL, "spicemodel" },
|
|
|
|
} )
|
|
|
|
|
2024-11-04 20:51:15 -05:00
|
|
|
JOB_EXPORT_SCH_NETLIST::JOB_EXPORT_SCH_NETLIST() :
|
|
|
|
JOB( "netlist", false ),
|
2023-09-16 21:02:33 -04:00
|
|
|
m_filename(),
|
2024-07-15 18:20:13 -04:00
|
|
|
format( FORMAT::KICADSEXPR ),
|
|
|
|
m_spiceSaveAllVoltages( false ),
|
|
|
|
m_spiceSaveAllCurrents( false ),
|
|
|
|
m_spiceSaveAllDissipations( false ),
|
|
|
|
m_spiceSaveAllEvents( false )
|
|
|
|
{
|
|
|
|
m_params.emplace_back( new JOB_PARAM<FORMAT>( "format", &format, format ) );
|
|
|
|
m_params.emplace_back( new JOB_PARAM<bool>( "spice.save_all_voltages", &m_spiceSaveAllVoltages,
|
|
|
|
m_spiceSaveAllVoltages ) );
|
|
|
|
m_params.emplace_back( new JOB_PARAM<bool>( "spice.save_all_currents", &m_spiceSaveAllCurrents,
|
|
|
|
m_spiceSaveAllCurrents ) );
|
|
|
|
m_params.emplace_back( new JOB_PARAM<bool>( "spice.save_all_events", &m_spiceSaveAllEvents,
|
|
|
|
m_spiceSaveAllEvents ) );
|
|
|
|
m_params.emplace_back( new JOB_PARAM<bool>( "spice.save_all_dissipations", &m_spiceSaveAllDissipations,
|
|
|
|
m_spiceSaveAllDissipations ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-01-02 13:20:31 +00:00
|
|
|
std::map<JOB_EXPORT_SCH_NETLIST::FORMAT, wxString>& JOB_EXPORT_SCH_NETLIST::GetFormatNameMap()
|
|
|
|
{
|
|
|
|
return jobNetlistNameLookup;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-12-28 21:18:15 -05:00
|
|
|
wxString JOB_EXPORT_SCH_NETLIST::GetDefaultDescription() const
|
2023-09-16 21:02:33 -04:00
|
|
|
{
|
2025-01-02 13:20:31 +00:00
|
|
|
return wxString::Format( _( "Export %s netlist" ), GetFormatNameMap()[format] );
|
2025-01-01 16:32:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-01-04 14:02:24 +00:00
|
|
|
wxString JOB_EXPORT_SCH_NETLIST::GetSettingsDialogTitle() const
|
2025-01-01 16:32:36 +00:00
|
|
|
{
|
2025-01-04 14:02:24 +00:00
|
|
|
return wxString::Format( _( "Export Netlist Job Settings" ) );
|
2024-07-15 18:20:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
REGISTER_JOB( sch_export_netlist, _HKI( "Schematic: Export Netlist" ), KIWAY::FACE_SCH,
|
|
|
|
JOB_EXPORT_SCH_NETLIST );
|