Remove KIWAY dependence from SCH_PLUGINs
This commit is contained in:
parent
7c7b7f41da
commit
2499a1d640
|
@ -496,7 +496,7 @@ bool DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged( const wxString& aNewFilenam
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pi->Save( newAbsoluteFilename, m_sheet, &Kiway() );
|
pi->Save( newAbsoluteFilename, m_sheet, &m_frame->Schematic() );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
|
|
@ -134,7 +134,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName,
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pi->Save( schematicFileName.GetFullPath(), aSheet, &Kiway() );
|
pi->Save( schematicFileName.GetFullPath(), aSheet, &Schematic() );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
|
@ -332,7 +332,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Schematic().SetRoot( pi->Load( fullFileName, &Kiway(), &Schematic() ) );
|
Schematic().SetRoot( pi->Load( fullFileName, &Schematic() ) );
|
||||||
|
|
||||||
GetCurrentSheet().push_back( &Schematic().Root() );
|
GetCurrentSheet().push_back( &Schematic().Root() );
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
Schematic().Reset();
|
Schematic().Reset();
|
||||||
|
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ) );
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ) );
|
||||||
Schematic().SetRoot( pi->Load( aFileName, &Kiway(), &Schematic() ) );
|
Schematic().SetRoot( pi->Load( aFileName, &Schematic() ) );
|
||||||
|
|
||||||
// Eagle sheets do not use a worksheet frame by default, so set it to an empty one
|
// Eagle sheets do not use a worksheet frame by default, so set it to an empty one
|
||||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||||
|
|
|
@ -391,18 +391,16 @@ int SCH_EAGLE_PLUGIN::GetModifyHash() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC* aSchematic,
|
SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe,
|
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||||
const PROPERTIES* aProperties )
|
|
||||||
{
|
{
|
||||||
wxASSERT( !aFileName || aKiway != NULL );
|
wxASSERT( !aFileName || aSchematic != nullptr );
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
// Load the document
|
// Load the document
|
||||||
wxXmlDocument xmlDocument;
|
wxXmlDocument xmlDocument;
|
||||||
|
|
||||||
m_filename = aFileName;
|
m_filename = aFileName;
|
||||||
m_kiway = aKiway;
|
|
||||||
m_schematic = aSchematic;
|
m_schematic = aSchematic;
|
||||||
|
|
||||||
if( !xmlDocument.Load( m_filename.GetFullPath() ) )
|
if( !xmlDocument.Load( m_filename.GetFullPath() ) )
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
|
|
||||||
int GetModifyHash() const override;
|
int GetModifyHash() const override;
|
||||||
|
|
||||||
SCH_SHEET* Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC* aSchematic,
|
SCH_SHEET* Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe = NULL, const PROPERTIES* aProperties = NULL ) override;
|
SCH_SHEET* aAppendToMe = NULL, const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
bool CheckHeader( const wxString& aFileName ) override;
|
bool CheckHeader( const wxString& aFileName ) override;
|
||||||
|
|
|
@ -209,7 +209,7 @@ public:
|
||||||
* wrong, using line number and character offsets of the input file if
|
* wrong, using line number and character offsets of the input file if
|
||||||
* possible.
|
* possible.
|
||||||
*/
|
*/
|
||||||
virtual SCH_SHEET* Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC* aSchematic,
|
virtual SCH_SHEET* Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe = NULL, const PROPERTIES* aProperties = NULL );
|
SCH_SHEET* aAppendToMe = NULL, const PROPERTIES* aProperties = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,13 +219,13 @@ public:
|
||||||
*
|
*
|
||||||
* @param aFileName is the name of a file to save to on disk.
|
* @param aFileName is the name of a file to save to on disk.
|
||||||
*
|
*
|
||||||
* @param aSchematic is the class #SCH_SHEET in memory document tree from which to extract
|
* @param aSheet is the class #SCH_SHEET in memory document tree from which to extract
|
||||||
* information when writing to \a aFileName. The caller continues to
|
* information when writing to \a aFileName. The caller continues to
|
||||||
* own the SCHEMATIC, and the plugin should refrain from modifying the
|
* own the SCHEMATIC, and the plugin should refrain from modifying the
|
||||||
* SCHEMATIC if possible.
|
* SCHEMATIC if possible.
|
||||||
*
|
*
|
||||||
* @param aKiway is the #KIWAY object used to access the component libraries loaded
|
* @param aSchematic is the #SCHEMATIC object used to access any schematic-wide or project
|
||||||
* by the project.
|
* information needed to save the document.
|
||||||
*
|
*
|
||||||
* @param aProperties is an associative array that can be used to tell the saver how to
|
* @param aProperties is an associative array that can be used to tell the saver how to
|
||||||
* save the file, because it can take any number of additional named
|
* save the file, because it can take any number of additional named
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
*
|
*
|
||||||
* @throw IO_ERROR if there is a problem saving or exporting.
|
* @throw IO_ERROR if there is a problem saving or exporting.
|
||||||
*/
|
*/
|
||||||
virtual void Save( const wxString& aFileName, SCH_SHEET* aSchematic, KIWAY* aKiway,
|
virtual void Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
||||||
const PROPERTIES* aProperties = NULL );
|
const PROPERTIES* aProperties = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -576,22 +576,21 @@ SCH_LEGACY_PLUGIN::~SCH_LEGACY_PLUGIN()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN::init( KIWAY* aKiway, const PROPERTIES* aProperties )
|
void SCH_LEGACY_PLUGIN::init( SCHEMATIC* aSchematic, const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
m_version = 0;
|
m_version = 0;
|
||||||
m_rootSheet = nullptr;
|
m_rootSheet = nullptr;
|
||||||
m_props = aProperties;
|
m_props = aProperties;
|
||||||
m_kiway = aKiway;
|
m_schematic = aSchematic;
|
||||||
m_cache = nullptr;
|
m_cache = nullptr;
|
||||||
m_out = nullptr;
|
m_out = nullptr;
|
||||||
m_schematic = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET* SCH_LEGACY_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC* aSchematic,
|
SCH_SHEET* SCH_LEGACY_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
wxASSERT( !aFileName || aKiway != NULL );
|
wxASSERT( !aFileName || aSchematic != NULL );
|
||||||
|
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
SCH_SHEET* sheet;
|
SCH_SHEET* sheet;
|
||||||
|
@ -617,19 +616,17 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SC
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_path.IsEmpty() )
|
if( m_path.IsEmpty() )
|
||||||
m_path = aKiway->Prj().GetProjectPath();
|
m_path = aSchematic->Prj().GetProjectPath();
|
||||||
|
|
||||||
wxLogTrace( traceSchLegacyPlugin, "m_Normalized append path \"%s\".", m_path );
|
wxLogTrace( traceSchLegacyPlugin, "m_Normalized append path \"%s\".", m_path );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = aKiway->Prj().GetProjectPath();
|
m_path = aSchematic->Prj().GetProjectPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentPath.push( m_path );
|
m_currentPath.push( m_path );
|
||||||
init( aKiway, aProperties );
|
init( aSchematic, aProperties );
|
||||||
|
|
||||||
m_schematic = aSchematic;
|
|
||||||
|
|
||||||
if( aAppendToMe == NULL )
|
if( aAppendToMe == NULL )
|
||||||
{
|
{
|
||||||
|
@ -1821,7 +1818,7 @@ std::shared_ptr<BUS_ALIAS> SCH_LEGACY_PLUGIN::loadBusAlias( LINE_READER& aReader
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWAY* aKiway,
|
void SCH_LEGACY_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET object." );
|
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET object." );
|
||||||
|
@ -1829,7 +1826,7 @@ void SCH_LEGACY_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWA
|
||||||
|
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values.
|
LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values.
|
||||||
|
|
||||||
init( aKiway, aProperties );
|
init( aSchematic, aProperties );
|
||||||
|
|
||||||
wxFileName fn = aFileName;
|
wxFileName fn = aFileName;
|
||||||
|
|
||||||
|
@ -1848,7 +1845,7 @@ void SCH_LEGACY_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWA
|
||||||
void SCH_LEGACY_PLUGIN::Format( SCH_SHEET* aSheet )
|
void SCH_LEGACY_PLUGIN::Format( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET* object." );
|
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET* object." );
|
||||||
wxCHECK_RET( m_kiway != NULL, "NULL KIWAY* object." );
|
wxCHECK_RET( m_schematic != NULL, "NULL SCHEMATIC* object." );
|
||||||
|
|
||||||
SCH_SCREEN* screen = aSheet->GetScreen();
|
SCH_SCREEN* screen = aSheet->GetScreen();
|
||||||
|
|
||||||
|
|
|
@ -97,14 +97,14 @@ public:
|
||||||
|
|
||||||
int GetModifyHash() const override;
|
int GetModifyHash() const override;
|
||||||
|
|
||||||
SCH_SHEET* Load( const wxString& aFileName, KIWAY* aKiway , SCHEMATIC* aSchematic,
|
SCH_SHEET* Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe = nullptr,
|
SCH_SHEET* aAppendToMe = nullptr,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
|
|
||||||
void LoadContent( LINE_READER& aReader, SCH_SCREEN* aScreen,
|
void LoadContent( LINE_READER& aReader, SCH_SCREEN* aScreen,
|
||||||
int version = EESCHEMA_VERSION );
|
int version = EESCHEMA_VERSION );
|
||||||
|
|
||||||
void Save( const wxString& aFileName, SCH_SHEET* aScreen, KIWAY* aKiway,
|
void Save( const wxString& aFileName, SCH_SHEET* aScreen, SCHEMATIC* aSchematic,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
|
|
||||||
void Format( SCH_SHEET* aSheet );
|
void Format( SCH_SHEET* aSheet );
|
||||||
|
@ -177,14 +177,13 @@ protected:
|
||||||
wxString m_path; ///< Root project path for loading child sheets.
|
wxString m_path; ///< Root project path for loading child sheets.
|
||||||
std::stack<wxString> m_currentPath;///< Stack to maintain nested sheet paths
|
std::stack<wxString> m_currentPath;///< Stack to maintain nested sheet paths
|
||||||
const PROPERTIES* m_props; ///< Passed via Save() or Load(), no ownership, may be nullptr.
|
const PROPERTIES* m_props; ///< Passed via Save() or Load(), no ownership, may be nullptr.
|
||||||
KIWAY* m_kiway; ///< Required for path to legacy component libraries.
|
|
||||||
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..
|
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..
|
||||||
OUTPUTFORMATTER* m_out; ///< The output formatter for saving SCH_SCREEN objects.
|
OUTPUTFORMATTER* m_out; ///< The output formatter for saving SCH_SCREEN objects.
|
||||||
SCH_LEGACY_PLUGIN_CACHE* m_cache;
|
SCH_LEGACY_PLUGIN_CACHE* m_cache;
|
||||||
SCHEMATIC* m_schematic; ///< Passed to Load(), the schematic object being loaded
|
SCHEMATIC* m_schematic; ///< Passed to Load(), the schematic object being loaded
|
||||||
|
|
||||||
/// initialize PLUGIN like a constructor would.
|
/// initialize PLUGIN like a constructor would.
|
||||||
void init( KIWAY* aKiway, const PROPERTIES* aProperties = nullptr );
|
void init( SCHEMATIC* aSchematic, const PROPERTIES* aProperties = nullptr );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SCH_LEGACY_PLUGIN_H_
|
#endif // _SCH_LEGACY_PLUGIN_H_
|
||||||
|
|
|
@ -47,7 +47,7 @@ void SCH_PLUGIN::SaveLibrary( const wxString& aFileName, const PROPERTIES* aProp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET* SCH_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC* aSchematic,
|
SCH_SHEET* SCH_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
not_implemented( this, __FUNCTION__ );
|
not_implemented( this, __FUNCTION__ );
|
||||||
|
@ -55,7 +55,7 @@ SCH_SHEET* SCH_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWAY* aKiway,
|
void SCH_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* 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_PLUGIN interface.
|
||||||
|
|
|
@ -407,23 +407,22 @@ SCH_SEXPR_PLUGIN::~SCH_SEXPR_PLUGIN()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN::init( KIWAY* aKiway, const PROPERTIES* aProperties )
|
void SCH_SEXPR_PLUGIN::init( SCHEMATIC* aSchematic, const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
m_version = 0;
|
m_version = 0;
|
||||||
m_rootSheet = nullptr;
|
m_rootSheet = nullptr;
|
||||||
m_props = aProperties;
|
m_props = aProperties;
|
||||||
m_kiway = aKiway;
|
m_schematic = aSchematic;
|
||||||
m_cache = nullptr;
|
m_cache = nullptr;
|
||||||
m_out = nullptr;
|
m_out = nullptr;
|
||||||
m_fieldId = 100; // number arbitrarily > MANDATORY_FIELDS or SHEET_MANDATORY_FIELDS
|
m_fieldId = 100; // number arbitrarily > MANDATORY_FIELDS or SHEET_MANDATORY_FIELDS
|
||||||
m_schematic = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC* aSchematic,
|
SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
wxASSERT( !aFileName || aKiway != NULL );
|
wxASSERT( !aFileName || aSchematic != nullptr );
|
||||||
|
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
SCH_SHEET* sheet;
|
SCH_SHEET* sheet;
|
||||||
|
@ -449,19 +448,17 @@ SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SCH
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_path.IsEmpty() )
|
if( m_path.IsEmpty() )
|
||||||
m_path = aKiway->Prj().GetProjectPath();
|
m_path = aSchematic->Prj().GetProjectPath();
|
||||||
|
|
||||||
wxLogTrace( traceSchLegacyPlugin, "Normalized append path \"%s\".", m_path );
|
wxLogTrace( traceSchLegacyPlugin, "Normalized append path \"%s\".", m_path );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = aKiway->Prj().GetProjectPath();
|
m_path = aSchematic->Prj().GetProjectPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentPath.push( m_path );
|
m_currentPath.push( m_path );
|
||||||
init( aKiway, aProperties );
|
init( aSchematic, aProperties );
|
||||||
|
|
||||||
m_schematic = aSchematic;
|
|
||||||
|
|
||||||
if( aAppendToMe == NULL )
|
if( aAppendToMe == NULL )
|
||||||
{
|
{
|
||||||
|
@ -582,7 +579,7 @@ void SCH_SEXPR_PLUGIN::LoadContent( LINE_READER& aReader, SCH_SHEET* aSheet, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWAY* aKiway,
|
void SCH_SEXPR_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET object." );
|
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET object." );
|
||||||
|
@ -590,7 +587,7 @@ void SCH_SEXPR_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWAY
|
||||||
|
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values.
|
LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values.
|
||||||
|
|
||||||
init( aKiway, aProperties );
|
init( aSchematic, aProperties );
|
||||||
|
|
||||||
wxFileName fn = aFileName;
|
wxFileName fn = aFileName;
|
||||||
|
|
||||||
|
@ -609,7 +606,7 @@ void SCH_SEXPR_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWAY
|
||||||
void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET* object." );
|
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET* object." );
|
||||||
wxCHECK_RET( m_kiway != NULL, "NULL KIWAY* object." );
|
wxCHECK_RET( m_schematic != NULL, "NULL SCHEMATIC* object." );
|
||||||
|
|
||||||
SCH_SCREEN* screen = aSheet->GetScreen();
|
SCH_SCREEN* screen = aSheet->GetScreen();
|
||||||
|
|
||||||
|
|
|
@ -84,14 +84,14 @@ public:
|
||||||
|
|
||||||
int GetModifyHash() const override;
|
int GetModifyHash() const override;
|
||||||
|
|
||||||
SCH_SHEET* Load( const wxString& aFileName, KIWAY* aKiway, SCHEMATIC* aSchematic,
|
SCH_SHEET* Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe = nullptr,
|
SCH_SHEET* aAppendToMe = nullptr,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
|
|
||||||
void LoadContent( LINE_READER& aReader, SCH_SHEET* aSheet,
|
void LoadContent( LINE_READER& aReader, SCH_SHEET* aSheet,
|
||||||
int aVersion = SEXPR_SCHEMATIC_FILE_VERSION );
|
int aVersion = SEXPR_SCHEMATIC_FILE_VERSION );
|
||||||
|
|
||||||
void Save( const wxString& aFileName, SCH_SHEET* aSheet, KIWAY* aKiway,
|
void Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
|
|
||||||
void Format( SCH_SHEET* aSheet );
|
void Format( SCH_SHEET* aSheet );
|
||||||
|
@ -154,14 +154,13 @@ protected:
|
||||||
wxString m_path; ///< Root project path for loading child sheets.
|
wxString m_path; ///< Root project path for loading child sheets.
|
||||||
std::stack<wxString> m_currentPath;///< Stack to maintain nested sheet paths
|
std::stack<wxString> m_currentPath;///< Stack to maintain nested sheet paths
|
||||||
const PROPERTIES* m_props; ///< Passed via Save() or Load(), no ownership, may be nullptr.
|
const PROPERTIES* m_props; ///< Passed via Save() or Load(), no ownership, may be nullptr.
|
||||||
KIWAY* m_kiway; ///< Required for path to legacy component libraries.
|
|
||||||
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..
|
SCH_SHEET* m_rootSheet; ///< The root 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
|
||||||
OUTPUTFORMATTER* m_out; ///< The output formatter for saving SCH_SCREEN objects.
|
OUTPUTFORMATTER* m_out; ///< The output formatter for saving SCH_SCREEN objects.
|
||||||
SCH_SEXPR_PLUGIN_CACHE* m_cache;
|
SCH_SEXPR_PLUGIN_CACHE* m_cache;
|
||||||
|
|
||||||
/// initialize PLUGIN like a constructor would.
|
/// initialize PLUGIN like a constructor would.
|
||||||
void init( KIWAY* aKiway, const PROPERTIES* aProperties = nullptr );
|
void init( SCHEMATIC* aSchematic, const PROPERTIES* aProperties = nullptr );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SCH_SEXPR_PLUGIN_H_
|
#endif // _SCH_SEXPR_PLUGIN_H_
|
||||||
|
|
|
@ -134,12 +134,12 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
||||||
{
|
{
|
||||||
if( aSheet->GetScreen() != nullptr )
|
if( aSheet->GetScreen() != nullptr )
|
||||||
{
|
{
|
||||||
newSheet.reset( pi->Load( fullFilename, &Kiway(), &Schematic() ) );
|
newSheet.reset( pi->Load( fullFilename, &Schematic() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newSheet->SetFileName( fullFilename );
|
newSheet->SetFileName( fullFilename );
|
||||||
pi->Load( fullFilename, &Kiway(), &Schematic(), newSheet.get() );
|
pi->Load( fullFilename, &Schematic(), newSheet.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !pi->GetError().IsEmpty() )
|
if( !pi->GetError().IsEmpty() )
|
||||||
|
|
Loading…
Reference in New Issue