Move separation of model name from params earlier in the process.
We need just the model name when we look for a match in the library file.
(cherry picked from commit 60aadfee40
)
This commit is contained in:
parent
31d688b34c
commit
d4a312d6cb
|
@ -1690,6 +1690,7 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
|
||||||
wxString spiceDeviceType = spiceDeviceInfo.m_Text.Trim( true ).Trim( false );
|
wxString spiceDeviceType = spiceDeviceInfo.m_Text.Trim( true ).Trim( false );
|
||||||
wxString spiceLib = spiceLibInfo.m_Text.Trim( true ).Trim( false );
|
wxString spiceLib = spiceLibInfo.m_Text.Trim( true ).Trim( false );
|
||||||
wxString spiceModel = spiceModelInfo.m_Text.Trim( true ).Trim( false );
|
wxString spiceModel = spiceModelInfo.m_Text.Trim( true ).Trim( false );
|
||||||
|
wxString modelLineParams;
|
||||||
|
|
||||||
bool libraryModel = false;
|
bool libraryModel = false;
|
||||||
bool inferredModel = false;
|
bool inferredModel = false;
|
||||||
|
@ -1702,6 +1703,10 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
|
||||||
SIM_LIB_MGR libMgr( aProject, &reporter );
|
SIM_LIB_MGR libMgr( aProject, &reporter );
|
||||||
std::vector<T_field> emptyFields;
|
std::vector<T_field> emptyFields;
|
||||||
|
|
||||||
|
// Pull out any following parameters from model name
|
||||||
|
spiceModel = spiceModel.BeforeFirst( ' ', &modelLineParams );
|
||||||
|
spiceModelInfo.m_Text = spiceModel;
|
||||||
|
|
||||||
SIM_LIBRARY::MODEL model = libMgr.CreateModel( spiceLib, spiceModel.ToStdString(),
|
SIM_LIBRARY::MODEL model = libMgr.CreateModel( spiceLib, spiceModel.ToStdString(),
|
||||||
emptyFields, sourcePins );
|
emptyFields, sourcePins );
|
||||||
|
|
||||||
|
@ -1794,18 +1799,26 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
|
||||||
T_field libraryField = spiceLibInfo.CreateField( &aSymbol, SIM_LIBRARY_FIELD );
|
T_field libraryField = spiceLibInfo.CreateField( &aSymbol, SIM_LIBRARY_FIELD );
|
||||||
aSymbol.AddField( libraryField );
|
aSymbol.AddField( libraryField );
|
||||||
|
|
||||||
// Split library model name from any following parameters
|
|
||||||
wxString modelLineParams;
|
|
||||||
spiceModelInfo.m_Text = spiceModelInfo.m_Text.BeforeFirst( ' ', &modelLineParams );
|
|
||||||
|
|
||||||
T_field nameField = spiceModelInfo.CreateField( &aSymbol, SIM_NAME_FIELD );
|
T_field nameField = spiceModelInfo.CreateField( &aSymbol, SIM_NAME_FIELD );
|
||||||
aSymbol.AddField( nameField );
|
aSymbol.AddField( nameField );
|
||||||
|
|
||||||
if( !modelLineParams.IsEmpty() )
|
if( !modelLineParams.IsEmpty() )
|
||||||
{
|
{
|
||||||
spiceParamsInfo = spiceModelInfo;
|
spiceParamsInfo = spiceModelInfo;
|
||||||
|
spiceParamsInfo.m_Pos.x += nameField.GetBoundingBox().GetWidth();
|
||||||
spiceParamsInfo.m_Text = modelLineParams;
|
spiceParamsInfo.m_Text = modelLineParams;
|
||||||
|
|
||||||
|
BOX2I nameBBox = nameField.GetBoundingBox();
|
||||||
|
int nameWidth = nameBBox.GetWidth();
|
||||||
|
|
||||||
|
// Add space between model name and additional parameters
|
||||||
|
nameWidth += KiROUND( nameBBox.GetHeight() * 1.25 );
|
||||||
|
|
||||||
|
if( nameField.GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||||
|
spiceParamsInfo.m_Pos.x -= nameWidth;
|
||||||
|
else
|
||||||
|
spiceParamsInfo.m_Pos.x += nameWidth;
|
||||||
|
|
||||||
T_field paramsField = spiceParamsInfo.CreateField( &aSymbol, SIM_PARAMS_FIELD );
|
T_field paramsField = spiceParamsInfo.CreateField( &aSymbol, SIM_PARAMS_FIELD );
|
||||||
aSymbol.AddField( paramsField );
|
aSymbol.AddField( paramsField );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue