Move importers from wxLog to REPORTER.
Fixes https://gitlab.com/kicad/code/kicad/issues/6389
This commit is contained in:
parent
a530c22eff
commit
2ad69fc56b
|
@ -113,20 +113,20 @@ REPORTER& NULL_REPORTER::GetInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
REPORTER& STDOUT_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
|
REPORTER& STDOUT_REPORTER::Report( const wxString& aMsg, SEVERITY aSeverity )
|
||||||
{
|
{
|
||||||
switch( aSeverity )
|
switch( aSeverity )
|
||||||
{
|
{
|
||||||
case RPT_SEVERITY_UNDEFINED: std::cout << "SEVERITY_UNDEFINED: "; break;
|
case RPT_SEVERITY_UNDEFINED: std::cout << "SEVERITY_UNDEFINED: "; break;
|
||||||
case RPT_SEVERITY_INFO: std::cout << "SEVERITY_INFO: "; break;
|
case RPT_SEVERITY_INFO: std::cout << "SEVERITY_INFO: "; break;
|
||||||
case RPT_SEVERITY_WARNING: std::cout << "SEVERITY_WARNING: "; break;
|
case RPT_SEVERITY_WARNING: std::cout << "SEVERITY_WARNING: "; break;
|
||||||
case RPT_SEVERITY_ERROR: std::cout << "SEVERITY_ERROR: "; break;
|
case RPT_SEVERITY_ERROR: std::cout << "SEVERITY_ERROR: "; break;
|
||||||
case RPT_SEVERITY_ACTION: std::cout << "SEVERITY_ACTION: "; break;
|
case RPT_SEVERITY_ACTION: std::cout << "SEVERITY_ACTION: "; break;
|
||||||
case RPT_SEVERITY_EXCLUSION:
|
case RPT_SEVERITY_EXCLUSION:
|
||||||
case RPT_SEVERITY_IGNORE: break;
|
case RPT_SEVERITY_IGNORE: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << aText << std::endl;
|
std::cout << aMsg << std::endl;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,34 @@ REPORTER& STDOUT_REPORTER::GetInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
REPORTER& WXLOG_REPORTER::Report( const wxString& aMsg, SEVERITY aSeverity )
|
||||||
|
{
|
||||||
|
switch( aSeverity )
|
||||||
|
{
|
||||||
|
case RPT_SEVERITY_ERROR: wxLogError( aMsg ); break;
|
||||||
|
case RPT_SEVERITY_WARNING: wxLogWarning( aMsg ); break;
|
||||||
|
case RPT_SEVERITY_UNDEFINED: wxLogMessage( aMsg ); break;
|
||||||
|
case RPT_SEVERITY_INFO: wxLogInfo( aMsg ); break;
|
||||||
|
case RPT_SEVERITY_ACTION: wxLogInfo( aMsg ); break;
|
||||||
|
case RPT_SEVERITY_EXCLUSION: break;
|
||||||
|
case RPT_SEVERITY_IGNORE: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
REPORTER& WXLOG_REPORTER::GetInstance()
|
||||||
|
{
|
||||||
|
static REPORTER* s_wxLogReporter = nullptr;
|
||||||
|
|
||||||
|
if( !s_wxLogReporter )
|
||||||
|
s_wxLogReporter = new WXLOG_REPORTER();
|
||||||
|
|
||||||
|
return *s_wxLogReporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
REPORTER& STATUSBAR_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
|
REPORTER& STATUSBAR_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
|
||||||
{
|
{
|
||||||
if( m_statusBar )
|
if( m_statusBar )
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include <profile.h>
|
#include <profile.h>
|
||||||
#include <project/project_file.h>
|
#include <project/project_file.h>
|
||||||
#include <project_rescue.h>
|
#include <project_rescue.h>
|
||||||
|
#include <wx_html_report_box.h>
|
||||||
|
#include <dialog_HTML_reporter_base.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
#include <richio.h>
|
#include <richio.h>
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
|
@ -930,8 +932,8 @@ bool SCH_EDIT_FRAME::doAutoSave()
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
{
|
{
|
||||||
wxFileName newfilename;
|
wxFileName newfilename;
|
||||||
SCH_SHEET_LIST sheetList = Schematic().GetSheets();
|
SCH_SHEET_LIST sheetList = Schematic().GetSheets();
|
||||||
SCH_IO_MGR::SCH_FILE_T fileType = (SCH_IO_MGR::SCH_FILE_T) aFileType;
|
SCH_IO_MGR::SCH_FILE_T fileType = (SCH_IO_MGR::SCH_FILE_T) aFileType;
|
||||||
|
|
||||||
switch( fileType )
|
switch( fileType )
|
||||||
|
@ -953,10 +955,18 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi(
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( fileType ) );
|
||||||
SCH_IO_MGR::FindPlugin( (SCH_IO_MGR::SCH_FILE_T) aFileType ) );
|
DIALOG_HTML_REPORTER* reporter = new DIALOG_HTML_REPORTER( this );
|
||||||
|
|
||||||
|
pi->SetReporter( reporter->m_Reporter );
|
||||||
Schematic().SetRoot( pi->Load( aFileName, &Schematic() ) );
|
Schematic().SetRoot( pi->Load( aFileName, &Schematic() ) );
|
||||||
|
|
||||||
|
if( reporter->m_Reporter->HasMessage() )
|
||||||
|
reporter->ShowModal();
|
||||||
|
|
||||||
|
pi->SetReporter( &WXLOG_REPORTER::GetInstance() );
|
||||||
|
delete reporter;
|
||||||
|
|
||||||
// Non-KiCad schematics do not use a drawing-sheet (or if they do, it works differently
|
// Non-KiCad schematics do not use a drawing-sheet (or if they do, it works differently
|
||||||
// to KiCad), so set it to an empty one
|
// to KiCad), so set it to an empty one
|
||||||
DS_DATA_MODEL& drawingSheet = DS_DATA_MODEL::GetTheInstance();
|
DS_DATA_MODEL& drawingSheet = DS_DATA_MODEL::GetTheInstance();
|
||||||
|
|
|
@ -56,21 +56,13 @@ SCH_PLUGIN* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
|
||||||
|
|
||||||
switch( aFileType )
|
switch( aFileType )
|
||||||
{
|
{
|
||||||
case SCH_LEGACY:
|
case SCH_LEGACY: return new SCH_LEGACY_PLUGIN();
|
||||||
return new SCH_LEGACY_PLUGIN();
|
case SCH_KICAD: return new SCH_SEXPR_PLUGIN();
|
||||||
case SCH_KICAD:
|
case SCH_ALTIUM: return new SCH_ALTIUM_PLUGIN();
|
||||||
return new SCH_SEXPR_PLUGIN();
|
case SCH_CADSTAR_ARCHIVE: return new CADSTAR_SCH_ARCHIVE_PLUGIN();
|
||||||
case SCH_ALTIUM:
|
case SCH_EAGLE: return new SCH_EAGLE_PLUGIN();
|
||||||
return new SCH_ALTIUM_PLUGIN();
|
default: return nullptr;
|
||||||
case SCH_CADSTAR_ARCHIVE:
|
|
||||||
return new CADSTAR_SCH_ARCHIVE_PLUGIN();
|
|
||||||
case SCH_EAGLE:
|
|
||||||
return new SCH_EAGLE_PLUGIN();
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,23 +84,13 @@ const wxString SCH_IO_MGR::ShowType( SCH_FILE_T aType )
|
||||||
|
|
||||||
switch( aType )
|
switch( aType )
|
||||||
{
|
{
|
||||||
default:
|
case SCH_LEGACY: return wxString( wxT( "Legacy" ) );
|
||||||
return wxString::Format( _( "Unknown SCH_FILE_T value: %d" ), aType );
|
case SCH_KICAD: return wxString( wxT( "KiCad" ) );
|
||||||
|
case SCH_ALTIUM: return wxString( wxT( "Altium" ) );
|
||||||
case SCH_LEGACY:
|
case SCH_CADSTAR_ARCHIVE: return wxString( wxT( "CADSTAR Schematic Archive" ) );
|
||||||
return wxString( wxT( "Legacy" ) );
|
case SCH_EAGLE: return wxString( wxT( "EAGLE" ) );
|
||||||
|
default: return wxString::Format( _( "Unknown SCH_FILE_T value: %d" ),
|
||||||
case SCH_KICAD:
|
aType );
|
||||||
return wxString( wxT( "KiCad" ) );
|
|
||||||
|
|
||||||
case SCH_ALTIUM:
|
|
||||||
return wxString( wxT( "Altium" ) );
|
|
||||||
|
|
||||||
case SCH_CADSTAR_ARCHIVE:
|
|
||||||
return wxString( wxT( "CADSTAR Schematic Archive" ) );
|
|
||||||
|
|
||||||
case SCH_EAGLE:
|
|
||||||
return wxString( wxT( "EAGLE" ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <import_export.h>
|
#include <import_export.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <enum_vector.h>
|
#include <enum_vector.h>
|
||||||
|
#include <reporter.h>
|
||||||
|
|
||||||
|
|
||||||
class SCH_SHEET;
|
class SCH_SHEET;
|
||||||
|
@ -158,6 +159,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual const wxString GetName() const = 0;
|
virtual const wxString GetName() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an optional reporter for warnings/errors.
|
||||||
|
*/
|
||||||
|
virtual void SetReporter( REPORTER* aReporter ) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the file extension for the #SCH_PLUGIN.
|
* Return the file extension for the #SCH_PLUGIN.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -80,6 +80,8 @@ SCH_ALTIUM_PLUGIN::SCH_ALTIUM_PLUGIN()
|
||||||
m_rootSheet = nullptr;
|
m_rootSheet = nullptr;
|
||||||
m_currentSheet = nullptr;
|
m_currentSheet = nullptr;
|
||||||
m_schematic = nullptr;
|
m_schematic = nullptr;
|
||||||
|
|
||||||
|
m_reporter = &WXLOG_REPORTER::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,7 +243,8 @@ void SCH_ALTIUM_PLUGIN::ParseAltiumSch( const wxString& aFileName )
|
||||||
|
|
||||||
if( fp == nullptr )
|
if( fp == nullptr )
|
||||||
{
|
{
|
||||||
wxLogError( wxString::Format( _( "Cannot open file '%s'" ), aFileName ) );
|
m_reporter->Report( wxString::Format( _( "Cannot open file '%s'." ), aFileName ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +437,8 @@ void SCH_ALTIUM_PLUGIN::Parse( const CFB::CompoundFileReader& aReader )
|
||||||
case ALTIUM_SCH_RECORD::RECORD_226:
|
case ALTIUM_SCH_RECORD::RECORD_226:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wxLogError( wxString::Format( "Unknown Record id: %d", recordId ) );
|
m_reporter->Report( wxString::Format( _( "Unknown Record id: %d." ), recordId ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,8 +536,9 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map<wxString, wxString>& aPropertie
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Pin has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Pin has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +577,7 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map<wxString, wxString>& aPropertie
|
||||||
pinLocation.y += elem.pinlength;
|
pinLocation.y += elem.pinlength;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wxLogWarning( "Pin has unexpected orientation" );
|
m_reporter->Report( _( "Pin has unexpected orientation." ), RPT_SEVERITY_WARNING );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,15 +615,15 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map<wxString, wxString>& aPropertie
|
||||||
case ASCH_PIN_ELECTRICAL::UNKNOWN:
|
case ASCH_PIN_ELECTRICAL::UNKNOWN:
|
||||||
default:
|
default:
|
||||||
pin->SetType( ELECTRICAL_PINTYPE::PT_UNSPECIFIED );
|
pin->SetType( ELECTRICAL_PINTYPE::PT_UNSPECIFIED );
|
||||||
wxLogWarning( "Pin has unexpected electrical type" );
|
m_reporter->Report( _( "Pin has unexpected electrical type." ), RPT_SEVERITY_WARNING );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( elem.symbolOuterEdge == ASCH_PIN_SYMBOL_OUTEREDGE::UNKNOWN )
|
if( elem.symbolOuterEdge == ASCH_PIN_SYMBOL_OUTEREDGE::UNKNOWN )
|
||||||
wxLogWarning( "Pin has unexpected outer edge type" );
|
m_reporter->Report( _( "Pin has unexpected outer edge type." ), RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
if( elem.symbolInnerEdge == ASCH_PIN_SYMBOL_INNEREDGE::UNKNOWN )
|
if( elem.symbolInnerEdge == ASCH_PIN_SYMBOL_INNEREDGE::UNKNOWN )
|
||||||
wxLogWarning( "Pin has unexpected inner edge type" );
|
m_reporter->Report( _( "Pin has unexpected inner edge type." ), RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
if( elem.symbolOuterEdge == ASCH_PIN_SYMBOL_OUTEREDGE::NEGATED )
|
if( elem.symbolOuterEdge == ASCH_PIN_SYMBOL_OUTEREDGE::NEGATED )
|
||||||
{
|
{
|
||||||
|
@ -740,8 +745,9 @@ void SCH_ALTIUM_PLUGIN::ParseLabel( const std::map<wxString, wxString>& aPropert
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Label has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Label has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,8 +781,10 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map<wxString, wxString>& aProper
|
||||||
|
|
||||||
if( elem.points.size() < 2 )
|
if( elem.points.size() < 2 )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxString::Format( "Bezier has %d control points. At least 2 are expected.",
|
m_reporter->Report( wxString::Format( _( "Bezier has %d control points. At least 2 are "
|
||||||
static_cast<int>( elem.points.size() ) ) );
|
"expected." ),
|
||||||
|
static_cast<int>( elem.points.size() ) ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,8 +839,9 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map<wxString, wxString>& aProper
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Bezier has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Bezier has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -915,8 +924,9 @@ void SCH_ALTIUM_PLUGIN::ParsePolyline( const std::map<wxString, wxString>& aProp
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Polyline has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Polyline has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,8 +986,9 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map<wxString, wxString>& aPrope
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Polygon has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Polygon has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1057,8 +1068,10 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map<wxString, wxString>&
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Rounded Rectangle has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Rounded rectangle has non-existent "
|
||||||
elem.ownerindex ) );
|
"ownerindex %d." ),
|
||||||
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1093,7 +1106,8 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
|
||||||
|
|
||||||
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
|
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
|
||||||
{
|
{
|
||||||
wxLogError( "Arc drawing is not possible for now on schematic." );
|
m_reporter->Report( _( "Arc drawing is not possible for now on schematic." ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1101,8 +1115,9 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Arc has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Arc has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,8 +1176,9 @@ void SCH_ALTIUM_PLUGIN::ParseLine( const std::map<wxString, wxString>& aProperti
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Line has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Line has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1232,8 +1248,9 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aPro
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Rectangle has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Rectangle has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1351,7 +1368,8 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE aStyle )
|
wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE aStyle,
|
||||||
|
REPORTER* aReporter )
|
||||||
{
|
{
|
||||||
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW )
|
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW )
|
||||||
{
|
{
|
||||||
|
@ -1534,7 +1552,10 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( aStyle != ASCH_POWER_PORT_STYLE::BAR )
|
if( aStyle != ASCH_POWER_PORT_STYLE::BAR )
|
||||||
wxLogWarning( "Power Port has unknown style, use bar instead. " );
|
{
|
||||||
|
aReporter->Report( _( "Power Port has unknown style, use bar instead." ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
|
}
|
||||||
|
|
||||||
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKPart );
|
||||||
aKPart->AddDrawItem( line1 );
|
aKPart->AddDrawItem( line1 );
|
||||||
|
@ -1591,7 +1612,7 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
||||||
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
||||||
pin->SetVisible( false );
|
pin->SetVisible( false );
|
||||||
|
|
||||||
wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( kpart, elem.style );
|
wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( kpart, elem.style, m_reporter );
|
||||||
|
|
||||||
kpart->GetValueField().SetPosition( valueFieldPos );
|
kpart->GetValueField().SetPosition( valueFieldPos );
|
||||||
|
|
||||||
|
@ -1641,7 +1662,7 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
||||||
valueField->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_CENTER );
|
valueField->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_CENTER );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wxLogWarning( "Pin has unexpected orientation" );
|
m_reporter->Report( _( "Pin has unexpected orientation." ), RPT_SEVERITY_WARNING );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2012,8 +2033,9 @@ void SCH_ALTIUM_PLUGIN::ParseDesignator( const std::map<wxString, wxString>& aPr
|
||||||
if( symbol == m_symbols.end() )
|
if( symbol == m_symbols.end() )
|
||||||
{
|
{
|
||||||
// TODO: e.g. can depend on Template (RECORD=39
|
// TODO: e.g. can depend on Template (RECORD=39
|
||||||
wxLogWarning( wxString::Format( "Designator has non-existent ownerindex %d",
|
m_reporter->Report( wxString::Format( _( "Designator has non-existent ownerindex %d." ),
|
||||||
elem.ownerindex ) );
|
elem.ownerindex ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@ public:
|
||||||
|
|
||||||
const wxString GetName() const override;
|
const wxString GetName() const override;
|
||||||
|
|
||||||
|
void SetReporter( REPORTER* aReporter ) override { m_reporter = aReporter; }
|
||||||
|
|
||||||
const wxString GetFileExtension() const override;
|
const wxString GetFileExtension() const override;
|
||||||
|
|
||||||
const wxString GetLibraryFileExtension() const override;
|
const wxString GetLibraryFileExtension() const override;
|
||||||
|
@ -134,6 +136,8 @@ private:
|
||||||
void ParseParameter( const std::map<wxString, wxString>& aProperties );
|
void ParseParameter( const std::map<wxString, wxString>& aProperties );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
REPORTER* m_reporter; // current reporter for warnings/errors
|
||||||
|
|
||||||
SCH_SHEET* m_rootSheet; // The root sheet of the schematic being loaded..
|
SCH_SHEET* m_rootSheet; // The root sheet of the schematic being loaded..
|
||||||
SCH_SHEET* m_currentSheet; // The current sheet of the schematic being loaded..
|
SCH_SHEET* m_currentSheet; // The current sheet of the schematic being loaded..
|
||||||
SCHEMATIC* m_schematic; // Passed to Load(), the schematic object being loaded
|
SCHEMATIC* m_schematic; // Passed to Load(), the schematic object being loaded
|
||||||
|
|
|
@ -99,24 +99,26 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
||||||
|
|
||||||
if( Schematic.VariantHierarchy.Variants.size() > 0 )
|
if( Schematic.VariantHierarchy.Variants.size() > 0 )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxString::Format(
|
m_reporter->Report( wxString::Format( _( "The CADSTAR design contains variants which has "
|
||||||
_( "The CADSTAR design contains variants which has no KiCad equivalent. Only "
|
"no KiCad equivalent. Only the master variant "
|
||||||
"the master variant ('%s') was loaded." ),
|
"('%s') was loaded." ),
|
||||||
Schematic.VariantHierarchy.Variants.at( "V0" ).Name ) );
|
Schematic.VariantHierarchy.Variants.at( "V0" ).Name ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Schematic.Groups.size() > 0 )
|
if( Schematic.Groups.size() > 0 )
|
||||||
{
|
{
|
||||||
wxLogWarning(
|
m_reporter->Report( _( "The CADSTAR design contains grouped items which has no KiCad "
|
||||||
_( "The CADSTAR design contains grouped items which has no KiCad equivalent. Any "
|
"equivalent. Any grouped items have been ungrouped." ),
|
||||||
"grouped items have been ungrouped." ) );
|
RPT_SEVERITY_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Schematic.ReuseBlocks.size() > 0 )
|
if( Schematic.ReuseBlocks.size() > 0 )
|
||||||
{
|
{
|
||||||
wxLogWarning(
|
m_reporter->Report( _( "The CADSTAR design contains re-use blocks which has no KiCad "
|
||||||
_( "The CADSTAR design contains re-use blocks which has no KiCad equivalent. The "
|
"equivalent. The re-use block information has been discarded during "
|
||||||
"re-use block information has been discarded during the import." ) );
|
"the import." ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,9 +218,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogMessage(
|
m_reporter->Report( _( "The CADSTAR design has been imported successfully.\n"
|
||||||
_( "The CADSTAR design has been imported successfully.\n"
|
"Please review the import errors and warnings (if any)." ) );
|
||||||
"Please review the import errors and warnings (if any)." ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,11 +349,14 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
|
||||||
|
|
||||||
if( symbolID.IsEmpty() )
|
if( symbolID.IsEmpty() )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxString::Format(
|
m_reporter->Report( wxString::Format( _( "Part definition '%s' references symbol "
|
||||||
_( "Part definition '%s' references symbol '%s' (alternate '%s') "
|
"'%s' (alternate '%s') which could not be "
|
||||||
"which could not be found in the symbol library. The part has not "
|
"found in the symbol library. The part has "
|
||||||
"been loaded into the KiCad library." ),
|
"not been loaded into the KiCad library." ),
|
||||||
part.Name, gate.Name, gate.Alternate ) );
|
part.Name,
|
||||||
|
gate.Name,
|
||||||
|
gate.Alternate ),
|
||||||
|
RPT_SEVERITY_WARNING);
|
||||||
|
|
||||||
ok = false;
|
ok = false;
|
||||||
break;
|
break;
|
||||||
|
@ -393,10 +397,12 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
{
|
{
|
||||||
if( m_partMap.find( sym.PartRef.RefID ) == m_partMap.end() )
|
if( m_partMap.find( sym.PartRef.RefID ) == m_partMap.end() )
|
||||||
{
|
{
|
||||||
wxLogError( wxString::Format(
|
m_reporter->Report( wxString::Format( _( "Symbol '%s' references part '%s' which "
|
||||||
_( "Symbol '%s' references part '%s' which could not be found "
|
"could not be found in the library. The "
|
||||||
"in the library. The symbol was not loaded" ),
|
"symbol was not loaded" ),
|
||||||
sym.ComponentRef.Designator, sym.PartRef.RefID ) );
|
sym.ComponentRef.Designator,
|
||||||
|
sym.PartRef.RefID ),
|
||||||
|
RPT_SEVERITY_ERROR);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -617,10 +623,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogError( wxString::Format(
|
m_reporter->Report( wxString::Format( _( "Symbol ID '%s' is of an unknown type. It is "
|
||||||
_( "Symbol ID '%s' is of an unknown type. It is neither a component or a "
|
"neither a component or a net power / symbol. "
|
||||||
"net power / symbol. The symbol was not loaded." ),
|
"The symbol was not loaded." ),
|
||||||
sym.ID ) );
|
sym.ID ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sym.ScaleRatioDenominator != 1 || sym.ScaleRatioNumerator != 1 )
|
if( sym.ScaleRatioDenominator != 1 || sym.ScaleRatioNumerator != 1 )
|
||||||
|
@ -630,11 +637,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
if( symbolName.empty() )
|
if( symbolName.empty() )
|
||||||
symbolName = wxString::Format( "ID: %s", sym.ID);
|
symbolName = wxString::Format( "ID: %s", sym.ID);
|
||||||
|
|
||||||
wxLogError( wxString::Format(
|
m_reporter->Report( wxString::Format( _( "Symbol '%s' is scaled in the original "
|
||||||
_( "Symbol '%s' is scaled in the original CADSTAR schematic but this is not"
|
"CADSTAR schematic but this is not supported "
|
||||||
" supported in KiCad. The symbol was loaded with 1:1 scale and may require "
|
"in KiCad. The symbol was loaded with 1:1 "
|
||||||
"manual fixing." ),
|
"scale and may require manual fixing." ),
|
||||||
symbolName, sym.PartRef.RefID ) );
|
symbolName,
|
||||||
|
sym.PartRef.RefID ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1057,11 +1066,12 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols()
|
||||||
|
|
||||||
if( Library.SymbolDefinitions.find( docSym.SymdefID ) == Library.SymbolDefinitions.end() )
|
if( Library.SymbolDefinitions.find( docSym.SymdefID ) == Library.SymbolDefinitions.end() )
|
||||||
{
|
{
|
||||||
wxLogError(
|
m_reporter->Report( wxString::Format( _( "Documentation Symbol '%s' refers to symbol "
|
||||||
wxString::Format( _( "Documentation Symbol '%s' refers to symbol definition "
|
"definition ID '%s' which does not exist in "
|
||||||
"ID '%s' which does not exist in the library. The symbol "
|
"the library. The symbol was not loaded." ),
|
||||||
"was not loaded." ),
|
docSym.ID,
|
||||||
docSym.ID, docSym.SymdefID ) );
|
docSym.SymdefID ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,7 +1173,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadTextVariables()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogError( _( "Text Variables could not be set as there is no project attached." ) );
|
m_reporter->Report( _( "Text Variables could not be set as there is no project attached." ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,22 +1571,26 @@ SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
|
||||||
|
|
||||||
if( NormalizeAngle180( compAngleDeciDeg ) != NormalizeAngle180( aComponentOrientationDeciDeg ) )
|
if( NormalizeAngle180( compAngleDeciDeg ) != NormalizeAngle180( aComponentOrientationDeciDeg ) )
|
||||||
{
|
{
|
||||||
wxLogError(
|
m_reporter->Report( wxString::Format( _( "Symbol '%s' is rotated by an angle of %.1f "
|
||||||
wxString::Format( _( "Symbol '%s' is rotated by an angle of %.1f degrees in the "
|
"degrees in the original CADSTAR design but "
|
||||||
"original CADSTAR design but KiCad only supports rotation "
|
"KiCad only supports rotation angles multiples "
|
||||||
"angles multiples of 90 degrees. The connecting wires will "
|
"of 90 degrees. The connecting wires will need "
|
||||||
"need manual fixing." ),
|
"manual fixing." ),
|
||||||
aCadstarSymbol.ComponentRef.Designator, compAngleDeciDeg / 10.0 ) );
|
aCadstarSymbol.ComponentRef.Designator,
|
||||||
|
compAngleDeciDeg / 10.0 ),
|
||||||
|
RPT_SEVERITY_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
component->SetOrientation( compOrientation );
|
component->SetOrientation( compOrientation );
|
||||||
|
|
||||||
if( m_sheetMap.find( aCadstarSymbol.LayerID ) == m_sheetMap.end() )
|
if( m_sheetMap.find( aCadstarSymbol.LayerID ) == m_sheetMap.end() )
|
||||||
{
|
{
|
||||||
wxLogError(
|
m_reporter->Report( wxString::Format( _( "Symbol '%s' references sheet ID '%s' which does "
|
||||||
wxString::Format( _( "Symbol '%s' references sheet ID '%s' which does not exist in "
|
"not exist in the design. The symbol was not "
|
||||||
"the design. The symbol was not loaded." ),
|
"loaded." ),
|
||||||
aCadstarSymbol.ComponentRef.Designator, aCadstarSymbol.LayerID ) );
|
aCadstarSymbol.ComponentRef.Designator,
|
||||||
|
aCadstarSymbol.LayerID ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
|
|
||||||
delete component;
|
delete component;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1656,7 +1671,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(
|
||||||
case ALIGNMENT::CENTERLEFT: fieldAlignment = ALIGNMENT::CENTERRIGHT; break;
|
case ALIGNMENT::CENTERLEFT: fieldAlignment = ALIGNMENT::CENTERRIGHT; break;
|
||||||
case ALIGNMENT::TOPLEFT: fieldAlignment = ALIGNMENT::TOPRIGHT; break;
|
case ALIGNMENT::TOPLEFT: fieldAlignment = ALIGNMENT::TOPRIGHT; break;
|
||||||
//Change right to left:
|
//Change right to left:
|
||||||
case ALIGNMENT::BOTTOMRIGHT: fieldAlignment = ALIGNMENT::BOTTOMLEFT; break;
|
case ALIGNMENT::BOTTOMRIGHT: fieldAlignment = ALIGNMENT::BOTTOMLEFT; break;
|
||||||
case ALIGNMENT::CENTERRIGHT: fieldAlignment = ALIGNMENT::CENTERLEFT; break;
|
case ALIGNMENT::CENTERRIGHT: fieldAlignment = ALIGNMENT::CENTERLEFT; break;
|
||||||
case ALIGNMENT::TOPRIGHT: fieldAlignment = ALIGNMENT::TOPLEFT; break;
|
case ALIGNMENT::TOPRIGHT: fieldAlignment = ALIGNMENT::TOPLEFT; break;
|
||||||
// Center alignment does not mirror:
|
// Center alignment does not mirror:
|
||||||
|
@ -1718,10 +1733,12 @@ CADSTAR_SCH_ARCHIVE_LOADER::POINT CADSTAR_SCH_ARCHIVE_LOADER::getLocationOfNetEl
|
||||||
auto logUnknownNetElementError =
|
auto logUnknownNetElementError =
|
||||||
[&]()
|
[&]()
|
||||||
{
|
{
|
||||||
wxLogError( wxString::Format( _(
|
m_reporter->Report( wxString::Format( _( "Net %s references unknown net element %s. "
|
||||||
"Net %s references unknown net element %s. The net was "
|
"The net was not properly loaded and may "
|
||||||
"not properly loaded and may require manual fixing." ),
|
"require manual fixing." ),
|
||||||
getNetName( aNet ), aNetElementID ) );
|
getNetName( aNet ),
|
||||||
|
aNetElementID ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
|
|
||||||
return POINT();
|
return POINT();
|
||||||
};
|
};
|
||||||
|
@ -2002,12 +2019,15 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(
|
||||||
{
|
{
|
||||||
if( block.Figures.size() > 0 )
|
if( block.Figures.size() > 0 )
|
||||||
{
|
{
|
||||||
wxLogError( wxString::Format(
|
m_reporter->Report( wxString::Format( _( "The block ID %s (Block name: '%s') "
|
||||||
_( "The block ID %s (Block name: '%s') is drawn on sheet '%s' but is "
|
"is drawn on sheet '%s' but is not "
|
||||||
"not linked to another sheet in the design. KiCad requires all "
|
"linked to another sheet in the "
|
||||||
"sheet symbols to be associated to a sheet, so the block was not "
|
"design. KiCad requires all sheet "
|
||||||
"loaded." ),
|
"symbols to be associated to a sheet, "
|
||||||
block.ID, block.Name, Sheets.SheetNames.at( aCadstarSheetID ) ) );
|
"so the block was not loaded." ),
|
||||||
|
block.ID, block.Name,
|
||||||
|
Sheets.SheetNames.at( aCadstarSheetID ) ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -2024,10 +2044,10 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
THROW_IO_ERROR( wxString::Format(
|
THROW_IO_ERROR( wxString::Format( _( "The CADSTAR schematic might be corrupt: "
|
||||||
_( "The CADSTAR schematic might be corrupt: Block %s references a "
|
"Block %s references a child sheet but has no "
|
||||||
"child sheet but has no Figure defined." ),
|
"Figure defined." ),
|
||||||
block.ID ) );
|
block.ID ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSheetAndChildSheets( block.AssocLayerID, blockExtents.first, blockExtents.second, aSheet );
|
loadSheetAndChildSheets( block.AssocLayerID, blockExtents.first, blockExtents.second, aSheet );
|
||||||
|
|
|
@ -52,7 +52,7 @@ class SCHEMATIC;
|
||||||
class CADSTAR_SCH_ARCHIVE_LOADER : public CADSTAR_SCH_ARCHIVE_PARSER
|
class CADSTAR_SCH_ARCHIVE_LOADER : public CADSTAR_SCH_ARCHIVE_PARSER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CADSTAR_SCH_ARCHIVE_LOADER( wxString aFilename )
|
explicit CADSTAR_SCH_ARCHIVE_LOADER( wxString aFilename, REPORTER* aReporter )
|
||||||
: CADSTAR_SCH_ARCHIVE_PARSER( aFilename )
|
: CADSTAR_SCH_ARCHIVE_PARSER( aFilename )
|
||||||
{
|
{
|
||||||
m_schematic = nullptr;
|
m_schematic = nullptr;
|
||||||
|
@ -60,6 +60,7 @@ public:
|
||||||
m_plugin = nullptr;
|
m_plugin = nullptr;
|
||||||
m_designCenter.x = 0;
|
m_designCenter.x = 0;
|
||||||
m_designCenter.y = 0;
|
m_designCenter.y = 0;
|
||||||
|
m_reporter = aReporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ private:
|
||||||
*/
|
*/
|
||||||
typedef std::map<TERMINAL_ID, wxString> TERMINAL_TO_PINNUM_MAP;
|
typedef std::map<TERMINAL_ID, wxString> TERMINAL_TO_PINNUM_MAP;
|
||||||
|
|
||||||
|
REPORTER* m_reporter;
|
||||||
SCHEMATIC* m_schematic;
|
SCHEMATIC* m_schematic;
|
||||||
SCH_SHEET* m_rootSheet;
|
SCH_SHEET* m_rootSheet;
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER* m_plugin;
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER* m_plugin;
|
||||||
|
|
|
@ -134,7 +134,7 @@ SCH_SHEET* CADSTAR_SCH_ARCHIVE_PLUGIN::Load( const wxString& aFileName, SCHEMATI
|
||||||
aSchematic->Prj().SchSymbolLibTable();
|
aSchematic->Prj().SchSymbolLibTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
CADSTAR_SCH_ARCHIVE_LOADER csaFile( aFileName );
|
CADSTAR_SCH_ARCHIVE_LOADER csaFile( aFileName, m_reporter );
|
||||||
csaFile.Load( aSchematic, rootSheet, &sch_plugin, libFileName );
|
csaFile.Load( aSchematic, rootSheet, &sch_plugin, libFileName );
|
||||||
|
|
||||||
sch_plugin->SaveLibrary( libFileName.GetFullPath() );
|
sch_plugin->SaveLibrary( libFileName.GetFullPath() );
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
|
|
||||||
#include <sch_io_mgr.h>
|
#include <sch_io_mgr.h>
|
||||||
|
#include <reporter.h>
|
||||||
|
|
||||||
|
|
||||||
class SCH_SHEET;
|
class SCH_SHEET;
|
||||||
class SCH_SCREEN;
|
class SCH_SCREEN;
|
||||||
|
@ -40,6 +42,8 @@ public:
|
||||||
|
|
||||||
const wxString GetName() const override;
|
const wxString GetName() const override;
|
||||||
|
|
||||||
|
void SetReporter( REPORTER* aReporter ) override { m_reporter = aReporter; }
|
||||||
|
|
||||||
const wxString GetFileExtension() const override;
|
const wxString GetFileExtension() const override;
|
||||||
|
|
||||||
const wxString GetLibraryFileExtension() const override;
|
const wxString GetLibraryFileExtension() const override;
|
||||||
|
@ -88,11 +92,14 @@ public:
|
||||||
|
|
||||||
CADSTAR_SCH_ARCHIVE_PLUGIN()
|
CADSTAR_SCH_ARCHIVE_PLUGIN()
|
||||||
{
|
{
|
||||||
|
m_reporter = &WXLOG_REPORTER::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
~CADSTAR_SCH_ARCHIVE_PLUGIN()
|
~CADSTAR_SCH_ARCHIVE_PLUGIN()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REPORTER* m_reporter; // current reporter for warnings/errors
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CADSTAR_SCH_ARCHIVE_PLUGIN_H_
|
#endif // CADSTAR_SCH_ARCHIVE_PLUGIN_H_
|
||||||
|
|
|
@ -351,10 +351,11 @@ static void eagleToKicadAlignment( EDA_TEXT* aText, int aEagleAlignment, int aRe
|
||||||
|
|
||||||
SCH_EAGLE_PLUGIN::SCH_EAGLE_PLUGIN()
|
SCH_EAGLE_PLUGIN::SCH_EAGLE_PLUGIN()
|
||||||
{
|
{
|
||||||
m_kiway = nullptr;
|
|
||||||
m_rootSheet = nullptr;
|
m_rootSheet = nullptr;
|
||||||
m_currentSheet = nullptr;
|
m_currentSheet = nullptr;
|
||||||
m_schematic = nullptr;
|
m_schematic = nullptr;
|
||||||
|
|
||||||
|
m_reporter = &WXLOG_REPORTER::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1157,9 +1158,10 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
||||||
|
|
||||||
if( part_it == m_partlist.end() )
|
if( part_it == m_partlist.end() )
|
||||||
{
|
{
|
||||||
wxLogError( _( "Error parsing Eagle file. "
|
m_reporter->Report( wxString::Format( _( "Error parsing Eagle file. Could not find '%s' "
|
||||||
"Could not find \"%s\" instance but it is referenced in the schematic." ),
|
"instance but it is referenced in the schematic." ),
|
||||||
einstance.part );
|
einstance.part ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1187,8 +1189,9 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
||||||
|
|
||||||
if( !part )
|
if( !part )
|
||||||
{
|
{
|
||||||
wxLogMessage( wxString::Format( _( "Could not find %s in the imported library" ),
|
m_reporter->Report( wxString::Format( _( "Could not find '%s' in the imported library." ),
|
||||||
kisymbolname ) );
|
kisymbolname ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,8 @@ public:
|
||||||
|
|
||||||
const wxString GetName() const override;
|
const wxString GetName() const override;
|
||||||
|
|
||||||
|
void SetReporter( REPORTER* aReporter ) override { m_reporter = aReporter; }
|
||||||
|
|
||||||
const wxString GetFileExtension() const override;
|
const wxString GetFileExtension() const override;
|
||||||
|
|
||||||
const wxString GetLibraryFileExtension() const override;
|
const wxString GetLibraryFileExtension() const override;
|
||||||
|
@ -212,32 +214,34 @@ private:
|
||||||
std::map<int, bool> units;
|
std::map<int, bool> units;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
REPORTER* m_reporter; ///< Reporter for warnings/errors
|
||||||
|
|
||||||
///< Map references to missing component units data
|
///< Map references to missing component units data
|
||||||
std::map<wxString, EAGLE_MISSING_CMP> m_missingCmps;
|
std::map<wxString, EAGLE_MISSING_CMP> m_missingCmps;
|
||||||
|
|
||||||
KIWAY* m_kiway; ///< For creating sub sheets.
|
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded
|
||||||
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..
|
SCH_SHEET* m_currentSheet; ///< The current sheet of the schematic being loaded
|
||||||
SCH_SHEET* m_currentSheet; ///< The current sheet of the schematic being loaded..
|
wxString m_version; ///< Eagle file version.
|
||||||
wxString m_version; ///< Eagle file version.
|
wxFileName m_filename;
|
||||||
wxFileName m_filename;
|
wxString m_libName; ///< Library name to save symbols
|
||||||
wxString m_libName; ///< Library name to save symbols
|
SCHEMATIC* m_schematic; ///< Passed to Load(), the schematic object being loaded
|
||||||
SCHEMATIC* m_schematic; ///< Passed to Load(), the schematic object being loaded
|
|
||||||
|
|
||||||
EPART_MAP m_partlist;
|
EPART_MAP m_partlist;
|
||||||
std::map<wxString, EAGLE_LIBRARY> m_eagleLibs;
|
std::map<wxString, EAGLE_LIBRARY> m_eagleLibs;
|
||||||
|
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi; ///< Plugin to create the KiCad symbol library.
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi; ///< Plugin to create the KiCad symbol library.
|
||||||
std::unique_ptr< PROPERTIES > m_properties; ///< Library plugin properties.
|
std::unique_ptr< PROPERTIES > m_properties; ///< Library plugin properties.
|
||||||
|
|
||||||
std::map<wxString, int> m_netCounts;
|
std::map<wxString, int> m_netCounts;
|
||||||
std::map<int, SCH_LAYER_ID> m_layerMap;
|
std::map<int, SCH_LAYER_ID> m_layerMap;
|
||||||
|
|
||||||
///< Wire intersection points, used for quick checks whether placing a net label in a particular
|
///< Wire intersection points, used for quick checks whether placing a net label in a particular
|
||||||
///< place would short two nets.
|
///< place would short two nets.
|
||||||
std::vector<VECTOR2I> m_wireIntersections;
|
std::vector<VECTOR2I> m_wireIntersections;
|
||||||
|
|
||||||
///< Wires and labels of a single connection (segment in Eagle nomenclature)
|
///< Wires and labels of a single connection (segment in Eagle nomenclature)
|
||||||
typedef struct SEG_DESC_STRUCT {
|
typedef struct SEG_DESC_STRUCT
|
||||||
|
{
|
||||||
///< Test if a particular label is attached to any of the stored segments
|
///< Test if a particular label is attached to any of the stored segments
|
||||||
const SEG* LabelAttached( const SCH_TEXT* aLabel ) const;
|
const SEG* LabelAttached( const SCH_TEXT* aLabel ) const;
|
||||||
|
|
||||||
|
|
|
@ -249,8 +249,26 @@ public:
|
||||||
|
|
||||||
static REPORTER& GetInstance();
|
static REPORTER& GetInstance();
|
||||||
|
|
||||||
REPORTER& Report( const wxString& aText,
|
REPORTER& Report( const wxString& aMsg, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
|
||||||
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
|
|
||||||
|
bool HasMessage() const override { return false; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WXLOG_REPORTER : public REPORTER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WXLOG_REPORTER()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~WXLOG_REPORTER()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static REPORTER& GetInstance();
|
||||||
|
|
||||||
|
REPORTER& Report( const wxString& aMsg, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
|
||||||
|
|
||||||
bool HasMessage() const override { return false; }
|
bool HasMessage() const override { return false; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue